mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-28 08:07:25 +08:00
Build new bridge with gradle
Reviewed By: bestander Differential Revision: D3324351 fbshipit-source-id: 41fa18a23c8661440a7deff244c93278f418e1d9
This commit is contained in:
committed by
Facebook Github Bot 9
parent
708530a905
commit
5e8f1716fc
43
ReactCommon/cxxreact/ModuleRegistry.h
Normal file
43
ReactCommon/cxxreact/ModuleRegistry.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <folly/dynamic.h>
|
||||
|
||||
#include "ExecutorToken.h"
|
||||
#include "NativeModule.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
class NativeModule;
|
||||
|
||||
class ModuleRegistry {
|
||||
public:
|
||||
// not implemented:
|
||||
// onBatchComplete: see https://our.intern.facebook.com/intern/tasks/?t=5279396
|
||||
// getModule: only used by views
|
||||
// getAllModules: only used for cleanup; use RAII instead
|
||||
// notifyCatalystInstanceInitialized: this is really only used by view-related code
|
||||
// notifyCatalystInstanceDestroy: use RAII instead
|
||||
|
||||
ModuleRegistry(std::vector<std::unique_ptr<NativeModule>> modules);
|
||||
std::vector<std::string> moduleNames();
|
||||
folly::dynamic getConfig(const std::string& name);
|
||||
void callNativeMethod(ExecutorToken token, unsigned int moduleId, unsigned int methodId,
|
||||
folly::dynamic&& params, int callId);
|
||||
MethodCallResult callSerializableNativeHook(ExecutorToken token, unsigned int moduleId, unsigned int methodId, folly::dynamic&& args);
|
||||
|
||||
private:
|
||||
// This is always populated
|
||||
std::vector<std::unique_ptr<NativeModule>> modules_;
|
||||
|
||||
// This is only populated if moduleNames() is called. Values are indices into modules_.
|
||||
std::unordered_map<std::string, size_t> modulesByName_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user