From 69e4217fbebe067d9dff45aefba219f866707f22 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Wed, 17 Jun 2015 07:51:48 -0700 Subject: [PATCH] [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 `` 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. --- debugger.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/debugger.html b/debugger.html index d72e40ea..0d008455 100644 --- a/debugger.html +++ b/debugger.html @@ -48,10 +48,11 @@ var messageHandlers = { loadScript(message.url, sendReply.bind(null, null)); }, 'executeJSCall': function(message, sendReply) { - var returnValue = [[], [], [], [], []]; + var returnValue = null; try { if (window && window.require) { - returnValue = window.require(message.moduleName)[message.moduleMethod].apply(null, message.arguments); + var module = window.require(message.moduleName); + returnValue = module[message.moduleMethod].apply(module, message.arguments); } } finally { sendReply(JSON.stringify(returnValue));