| 193 | } |
| 194 | } |
| 195 | |
| 196 | void 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 | } |