MCPcopy Create free account
hub / github.com/Snapchat/Valdi / postInit

Method postInit

valdi/src/valdi/runtime/Runtime.cpp:195–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193 }
194}
195
196void Runtime::postInit() {
197 if (_didInit) {
198 return;
199 }
200 _didInit = true;
201
202 if (_javaScriptRuntime != nullptr) {
203 _javaScriptRuntime->setListener(this, weakRef(this));
204 _javaScriptRuntime->setANRDiagnosticsEnabled(enableANRDiagnostics());
205 }
206 _viewNodeManager.setRuntime(weakRef(this));
207 _contextManager.setListener(this);
208
209 if (_javaScriptRuntime != nullptr) {
210 _javaScriptRuntime->postInit();
211
212 if (_diskCache != nullptr) {
213 registerNativeModuleFactory(Valdi::makeShared<PersistentStoreModuleFactory>(
214 _diskCache, _workerQueue, _userSession, _keychain, *_logger, disablePersistentStoreEncryption()));
215 }
216 registerNativeModuleFactory(makeShared<FileSystemFactory>().toShared());
217 registerNativeModuleFactory(makeShared<AttributedTextNativeModuleFactory>(_colorPalette, *_logger).toShared());
218
219 registerJavaScriptModuleFactory(makeShared<ProtobufModuleFactory>(*_resourceManager, _workerQueue, *_logger));
220 registerJavaScriptModuleFactory(makeShared<UnicodeModuleFactory>());
221 registerJavaScriptModuleFactory(makeShared<Base64ModuleFactory>());
222
223 if constexpr (kTCPSocketEnabled) {
224 registerNativeModuleFactory(makeShared<TCPSocketModuleFactory>().toShared());
225 }
226 }
227
228 if (Valdi::traceInitialization) {
229 VALDI_INFO(*_logger, "Initialized Valdi Runtime");
230 }
231}

Callers 4

TESTFunction · 0.45
RuntimeManagerWrapperMethod · 0.45
Init.jsFile · 0.45

Calls 4

weakRefFunction · 0.85
setRuntimeMethod · 0.80
toSharedMethod · 0.80
setListenerMethod · 0.65

Tested by 2

TESTFunction · 0.36