void WebContext::ensureNetworkProcess() { if (m_networkProcess) return; m_networkProcess = NetworkProcessProxy::create(*this); NetworkProcessCreationParameters parameters; parameters.privateBrowsingEnabled = WebPreferences::anyPagesAreUsingPrivateBrowsing(); parameters.cacheModel = m_cacheModel; parameters.diskCacheDirectory = diskCacheDirectory(); if (!parameters.diskCacheDirectory.isEmpty()) SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle); 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 }
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; }