mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
tighter ContextContainer semantics
Summary: shergin mentioned that he'd like to move away from RTTI a bit and use explicit key strings for context container instances rather than relying on the `typeid`, so this does this. We also fatal with a useful error message if we get a collision, rather than failing silently. Reviewed By: shergin Differential Revision: D13384308 fbshipit-source-id: 0b06d7555b082be89e8f130c23e94be99749a7a3
This commit is contained in:
committed by
Facebook Github Bot
parent
a3b348eacb
commit
34ea65e3d9
@@ -173,7 +173,7 @@ using namespace facebook::react;
|
||||
|
||||
_scheduler = [[RCTScheduler alloc] initWithContextContainer:self.contextContainer];
|
||||
_scheduler.delegate = self;
|
||||
|
||||
|
||||
return _scheduler;
|
||||
}
|
||||
|
||||
@@ -182,14 +182,14 @@ using namespace facebook::react;
|
||||
- (SharedContextContainer)contextContainer
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_contextContainerMutex);
|
||||
|
||||
|
||||
if (_contextContainer) {
|
||||
return _contextContainer;
|
||||
}
|
||||
|
||||
_contextContainer = std::make_shared<ContextContainer>();
|
||||
|
||||
_contextContainer->registerInstance(_reactNativeConfig);
|
||||
_contextContainer->registerInstance(_reactNativeConfig, "ReactNativeConfig");
|
||||
|
||||
auto messageQueueThread = _batchedBridge.jsMessageThread;
|
||||
auto runtime = (facebook::jsi::Runtime *)((RCTCxxBridge *)_batchedBridge).runtime;
|
||||
@@ -214,7 +214,7 @@ using namespace facebook::react;
|
||||
|
||||
_contextContainer->registerInstance(runtimeExecutor, "runtime-executor");
|
||||
|
||||
_contextContainer->registerInstance(std::make_shared<ImageManager>((__bridge void *)[_bridge imageLoader]));
|
||||
_contextContainer->registerInstance(std::make_shared<ImageManager>((__bridge void *)[_bridge imageLoader]), "ImageManager");
|
||||
return _contextContainer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user