Remove legacy bridge config conversion

Reviewed By: javache

Differential Revision: D3741859

fbshipit-source-id: b678b3a2bbed4f7ed386e10db19553c8beef7366
This commit is contained in:
Alexander Blom 2016-08-22 06:49:06 -07:00 committed by Facebook Github Bot 3
parent 38a14ffc32
commit 61b21bcdd1
2 changed files with 5 additions and 108 deletions

View File

@ -75,7 +75,7 @@ class MessageQueue {
lazyProperty(this, 'RemoteModules', () => {
const {remoteModuleConfig} = configProvider();
const modulesConfig = this._genModulesConfig(remoteModuleConfig);
const modulesConfig = remoteModuleConfig;
const modules = this._genModules(modulesConfig);
if (__DEV__) {
@ -276,52 +276,6 @@ class MessageQueue {
* Private helper methods
*/
/**
* Converts the old, object-based module structure to the new
* array-based structure. TODO (t8823865) Removed this
* function once Android has been updated.
*/
_genModulesConfig(modules /* array or object */) {
if (Array.isArray(modules)) {
return modules;
} else {
const moduleArray = [];
const moduleNames = Object.keys(modules);
for (var i = 0, l = moduleNames.length; i < l; i++) {
const moduleName = moduleNames[i];
const moduleConfig = modules[moduleName];
const module = [moduleName];
if (moduleConfig.constants) {
module.push(moduleConfig.constants);
}
const methodsConfig = moduleConfig.methods;
if (methodsConfig) {
const methods = [];
const asyncMethods = [];
const syncHooks = [];
const methodNames = Object.keys(methodsConfig);
for (var j = 0, ll = methodNames.length; j < ll; j++) {
const methodName = methodNames[j];
const methodConfig = methodsConfig[methodName];
methods[methodConfig.methodID] = methodName;
if (methodConfig.type === MethodTypes.remoteAsync) {
asyncMethods.push(methodConfig.methodID);
} else if (methodConfig.type === MethodTypes.syncHook) {
syncHooks.push(methodConfig.methodID);
}
}
if (methods.length) {
module.push(methods);
module.push(asyncMethods);
module.push(syncHooks);
}
}
moduleArray[moduleConfig.moduleID] = module;
}
return moduleArray;
}
}
_genLookupTables(modulesConfig, moduleTable, methodTable) {
modulesConfig.forEach((config, moduleID) => {
this._genLookup(config, moduleID, moduleTable, methodTable);

View File

@ -9,69 +9,12 @@
* These don't actually exist anywhere in the code.
*/
'use strict';
var remoteModulesConfig = {
'RemoteModule1': {
'moduleID':0,
'methods':{
'remoteMethod1':{
'type':'remote',
'methodID':0
},
'remoteMethod2':{
'type':'remote',
'methodID':1
}
}
},
'RemoteModule2':{
'moduleID':1,
'methods':{
'remoteMethod1':{
'type':'remote',
'methodID':0
},
'remoteMethod2':{
'type':'remote',
'methodID':1
}
}
}
};
/**
* These actually exist in the __tests__ folder.
*/
var localModulesConfig = {
'MessageQueueTestModule1': {
'moduleID':'MessageQueueTestModule1',
'methods':{
'testHook1':{
'type':'local',
'methodID':'testHook1'
},
'testHook2':{
'type':'local',
'methodID':'testHook2'
}
}
},
'MessageQueueTestModule2': {
'moduleID':'MessageQueueTestModule2',
'methods': {
'runLocalCode':{
'type':'local',
'methodID':'runLocalCode'
},
'runLocalCode2':{
'type':'local',
'methodID':'runLocalCode2'
}
}
}
};
var remoteModulesConfig = [
['RemoteModule1',['remoteMethod1','remoteMethod2'],[],[]],
['RemoteModule2',['remoteMethod1','remoteMethod2'],[],[]],
];
var MessageQueueTestConfig = {
localModuleConfig: localModulesConfig,
remoteModuleConfig: remoteModulesConfig,
};