mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
[ReactNative] Refactor BatchedBridge and MessageQueue
Summary: @public The current implementation of `MessageQueue` is huge, over-complicated and spread across `MethodQueue`, `MethodQueueMixin`, `BatchedBridge` and `BatchedBridgeFactory` Refactored in a simpler way, were it's just a `MessageQueue` class and `BatchedBridge` is only an instance of it. Test Plan: I had to make some updates to the tests, but no real update to the native side. There's also tests covering the `remoteAsync` methods, and more integration tests for UIExplorer. Verified whats being used by Android, and it should be safe, also tests Android tests have been pretty reliable. Manually testing: Create a big hierarchy, like `<ListView>` example. Use the `TimerMixin` example to generate multiple calls. Test the failure callback on the `Geolocation` example. All the calls go through this entry point, so it's hard to miss if it's broken.
This commit is contained in:
@@ -40,9 +40,6 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
|
||||
RCTBridgeFieldRequestModuleIDs = 0,
|
||||
RCTBridgeFieldMethodIDs,
|
||||
RCTBridgeFieldParamss,
|
||||
RCTBridgeFieldResponseCBIDs,
|
||||
RCTBridgeFieldResponseReturnValues,
|
||||
RCTBridgeFieldFlushDateMillis
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RCTJavaScriptFunctionKind) {
|
||||
@@ -1258,14 +1255,6 @@ RCT_INNER_BRIDGE_ONLY(_invokeAndProcessModule:(__unused NSString *)module
|
||||
return;
|
||||
}
|
||||
|
||||
NSUInteger bufferRowCount = [requestsArray count];
|
||||
NSUInteger expectedFieldsCount = RCTBridgeFieldResponseReturnValues + 1;
|
||||
|
||||
if (bufferRowCount != expectedFieldsCount) {
|
||||
RCTLogError(@"Must pass all fields to buffer - expected %zd, saw %zd", expectedFieldsCount, bufferRowCount);
|
||||
return;
|
||||
}
|
||||
|
||||
for (NSUInteger fieldIndex = RCTBridgeFieldRequestModuleIDs; fieldIndex <= RCTBridgeFieldParamss; fieldIndex++) {
|
||||
id field = [requestsArray objectAtIndex:fieldIndex];
|
||||
if (![field isKindOfClass:[NSArray class]]) {
|
||||
|
||||
Reference in New Issue
Block a user