const ScanLocatorResults& ScanLocator::locateModel(const DisembodiedObject &object) { string name = nameObject(*scan, object); if (cache.count(name) == 0) cacheModel(object); return cache[name]; }
NetworkProcessProxy& WebProcessPool::ensureNetworkProcess() { if (m_networkProcess) return *m_networkProcess; m_networkProcess = NetworkProcessProxy::create(*this); NetworkProcessCreationParameters parameters; parameters.privateBrowsingEnabled = WebPreferences::anyPagesAreUsingPrivateBrowsing(); parameters.cacheModel = cacheModel(); parameters.diskCacheSizeOverride = m_configuration->diskCacheSizeOverride(); parameters.canHandleHTTPSServerTrustEvaluation = m_canHandleHTTPSServerTrustEvaluation; parameters.diskCacheDirectory = m_configuration->diskCacheDirectory(); if (!parameters.diskCacheDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle); #if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION) parameters.shouldEnableNetworkCacheSpeculativeRevalidation = m_configuration->diskCacheSpeculativeValidationEnabled(); #endif #if PLATFORM(IOS) String cookieStorageDirectory = this->cookieStorageDirectory(); if (!cookieStorageDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle); String containerCachesDirectory = this->networkingCachesDirectory(); if (!containerCachesDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(containerCachesDirectory, parameters.containerCachesDirectoryExtensionHandle); String parentBundleDirectory = this->parentBundleDirectory(); if (!parentBundleDirectory.isEmpty()) SandboxExtension::createHandle(parentBundleDirectory, SandboxExtension::ReadOnly, parameters.parentBundleDirectoryExtensionHandle); #endif parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession; // Add any platform specific parameters platformInitializeNetworkProcess(parameters); // Initialize the network process. m_networkProcess->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0); #if PLATFORM(COCOA) m_networkProcess->send(Messages::NetworkProcess::SetQOS(networkProcessLatencyQOS(), networkProcessThroughputQOS()), 0); #endif if (m_didNetworkProcessCrash) { m_didNetworkProcessCrash = false; for (auto& process : m_processes) process->reinstateNetworkProcessAssertionState(*m_networkProcess); } return *m_networkProcess; }
void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters) { initInspectorServer(); if (!parameters.urlSchemesRegisteredAsLocal.contains("resource")) { WebCore::SchemeRegistry::registerURLSchemeAsLocal("resource"); parameters.urlSchemesRegisteredAsLocal.append("resource"); } parameters.memoryCacheDisabled = m_memoryCacheDisabled || cacheModel() == CacheModelDocumentViewer; }
WebProcessProxy& WebProcessPool::createNewWebProcess() { ensureNetworkProcess(); Ref<WebProcessProxy> process = WebProcessProxy::create(*this); WebProcessCreationParameters parameters; parameters.injectedBundlePath = injectedBundlePath(); if (!parameters.injectedBundlePath.isEmpty()) SandboxExtension::createHandle(parameters.injectedBundlePath, SandboxExtension::ReadOnly, parameters.injectedBundlePathExtensionHandle); parameters.applicationCacheDirectory = m_configuration->applicationCacheDirectory(); parameters.applicationCacheFlatFileSubdirectoryName = m_configuration->applicationCacheFlatFileSubdirectoryName(); if (!parameters.applicationCacheDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.applicationCacheDirectory, parameters.applicationCacheDirectoryExtensionHandle); parameters.webSQLDatabaseDirectory = m_configuration->webSQLDatabaseDirectory(); if (!parameters.webSQLDatabaseDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.webSQLDatabaseDirectory, parameters.webSQLDatabaseDirectoryExtensionHandle); parameters.mediaCacheDirectory = m_configuration->mediaCacheDirectory(); if (!parameters.mediaCacheDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.mediaCacheDirectory, parameters.mediaCacheDirectoryExtensionHandle); #if PLATFORM(IOS) String cookieStorageDirectory = this->cookieStorageDirectory(); if (!cookieStorageDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle); String containerCachesDirectory = this->webContentCachesDirectory(); if (!containerCachesDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(containerCachesDirectory, parameters.containerCachesDirectoryExtensionHandle); String containerTemporaryDirectory = this->containerTemporaryDirectory(); if (!containerTemporaryDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(containerTemporaryDirectory, parameters.containerTemporaryDirectoryExtensionHandle); #endif parameters.mediaKeyStorageDirectory = m_configuration->mediaKeysStorageDirectory(); if (!parameters.mediaKeyStorageDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.mediaKeyStorageDirectory, parameters.mediaKeyStorageDirectoryExtensionHandle); parameters.shouldUseTestingNetworkSession = m_shouldUseTestingNetworkSession; parameters.cacheModel = cacheModel(); parameters.languages = userPreferredLanguages(); copyToVector(m_schemesToRegisterAsEmptyDocument, parameters.urlSchemesRegisteredAsEmptyDocument); copyToVector(m_schemesToRegisterAsSecure, parameters.urlSchemesRegisteredAsSecure); copyToVector(m_schemesToRegisterAsBypassingContentSecurityPolicy, parameters.urlSchemesRegisteredAsBypassingContentSecurityPolicy); copyToVector(m_schemesToSetDomainRelaxationForbiddenFor, parameters.urlSchemesForWhichDomainRelaxationIsForbidden); copyToVector(m_schemesToRegisterAsLocal, parameters.urlSchemesRegisteredAsLocal); copyToVector(m_schemesToRegisterAsNoAccess, parameters.urlSchemesRegisteredAsNoAccess); copyToVector(m_schemesToRegisterAsDisplayIsolated, parameters.urlSchemesRegisteredAsDisplayIsolated); copyToVector(m_schemesToRegisterAsCORSEnabled, parameters.urlSchemesRegisteredAsCORSEnabled); copyToVector(m_schemesToRegisterAsAlwaysRevalidated, parameters.urlSchemesRegisteredAsAlwaysRevalidated); #if ENABLE(CACHE_PARTITIONING) copyToVector(m_schemesToRegisterAsCachePartitioned, parameters.urlSchemesRegisteredAsCachePartitioned); #endif parameters.shouldAlwaysUseComplexTextCodePath = m_alwaysUsesComplexTextCodePath; parameters.shouldUseFontSmoothing = m_shouldUseFontSmoothing; // FIXME: This leaves UI process and WebProcess disagreeing about the state if the client hasn't set the path. // iconDatabasePath is non-empty by default, but m_iconDatabase isn't enabled in UI process unless setDatabasePath is called explicitly. parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty(); parameters.terminationTimeout = 0; parameters.textCheckerState = TextChecker::state(); parameters.fullKeyboardAccessEnabled = WebProcessProxy::fullKeyboardAccessEnabled(); parameters.defaultRequestTimeoutInterval = API::URLRequest::defaultTimeoutInterval(); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) // FIXME: There should be a generic way for supplements to add to the intialization parameters. supplement<WebNotificationManagerProxy>()->populateCopyOfNotificationPermissions(parameters.notificationPermissions); #endif parameters.plugInAutoStartOriginHashes = m_plugInAutoStartProvider.autoStartOriginHashesCopy(); copyToVector(m_plugInAutoStartProvider.autoStartOrigins(), parameters.plugInAutoStartOrigins); parameters.memoryCacheDisabled = m_memoryCacheDisabled; #if ENABLE(SERVICE_CONTROLS) auto& serviceController = ServicesController::singleton(); parameters.hasImageServices = serviceController.hasImageServices(); parameters.hasSelectionServices = serviceController.hasSelectionServices(); parameters.hasRichContentServices = serviceController.hasRichContentServices(); serviceController.refreshExistingServices(); #endif #if ENABLE(NETSCAPE_PLUGIN_API) parameters.pluginLoadClientPolicies = m_pluginLoadClientPolicies; #endif #if OS(LINUX) parameters.shouldEnableMemoryPressureReliefLogging = true; #endif parameters.resourceLoadStatisticsEnabled = resourceLoadStatisticsEnabled(); // Add any platform specific parameters platformInitializeWebProcess(parameters); RefPtr<API::Object> injectedBundleInitializationUserData = m_injectedBundleClient.getInjectedBundleInitializationUserData(this); if (!injectedBundleInitializationUserData) injectedBundleInitializationUserData = m_injectedBundleInitializationUserData; parameters.initializationUserData = UserData(process->transformObjectsToHandles(injectedBundleInitializationUserData.get())); process->send(Messages::WebProcess::InitializeWebProcess(parameters), 0); #if PLATFORM(COCOA) process->send(Messages::WebProcess::SetQOS(webProcessLatencyQOS(), webProcessThroughputQOS()), 0); #endif if (WebPreferences::anyPagesAreUsingPrivateBrowsing()) process->send(Messages::WebProcess::EnsurePrivateBrowsingSession(SessionID::legacyPrivateSessionID()), 0); if (m_automationSession) process->send(Messages::WebProcess::EnsureAutomationSessionProxy(m_automationSession->sessionIdentifier()), 0); m_processes.append(process.ptr()); ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty()); #if ENABLE(REMOTE_INSPECTOR) // Initialize remote inspector connection now that we have a sub-process that is hosting one of our web views. Inspector::RemoteInspector::singleton(); #endif return process; }