Skip to content

Commit 92d9853

Browse files
committed
[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.
1 parent 6573d25 commit 92d9853

File tree

8 files changed

+363
-662
lines changed

8 files changed

+363
-662
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* Copyright (c) 2015-present, Facebook, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*
9+
* @providesModule BatchedBridge
10+
*/
11+
'use strict';
12+
13+
let MessageQueue = require('MessageQueue');
14+
15+
let BatchedBridge = new MessageQueue(
16+
__fbBatchedBridgeConfig.remoteModuleConfig,
17+
__fbBatchedBridgeConfig.localModulesConfig,
18+
);
19+
20+
module.exports = BatchedBridge;

Libraries/BatchedBridge/BatchingImplementation/BatchedBridge.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

Libraries/BatchedBridge/BatchingImplementation/BatchedBridgeFactory.js

Lines changed: 0 additions & 116 deletions
This file was deleted.

Libraries/Utilities/BridgeProfiling.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
var GLOBAL = GLOBAL || this;
1515

1616
var BridgeProfiling = {
17-
profile(profileName?: string, args?: any) {
17+
profile(profileName?: any, args?: any) {
1818
if (GLOBAL.__BridgeProfilingIsProfiling) {
1919
if (args) {
2020
try {
@@ -23,6 +23,8 @@ var BridgeProfiling = {
2323
args = err.message;
2424
}
2525
}
26+
profileName = typeof profileName === 'function' ?
27+
profileName() : profileName;
2628
console.profile(profileName, args);
2729
}
2830
},

0 commit comments

Comments
 (0)