void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters) { platformInitializeNetworkProcess(parameters); WTF::setCurrentThreadIsUserInitiated(); auto& memoryPressureHandler = MemoryPressureHandler::singleton(); memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous) { lowMemoryHandler(critical); }); memoryPressureHandler.install(); m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession; m_diskCacheSizeOverride = parameters.diskCacheSizeOverride; setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation); #if PLATFORM(COCOA) || USE(CFNETWORK) SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier); #endif // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions) if (parameters.privateBrowsingEnabled) RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionID::legacyPrivateSessionID()); if (parameters.shouldUseTestingNetworkSession) NetworkStorageSession::switchToNewTestingSession(); NetworkProcessSupplementMap::const_iterator it = m_supplements.begin(); NetworkProcessSupplementMap::const_iterator end = m_supplements.end(); for (; it != end; ++it) it->value->initialize(parameters); }
void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters) { platformInitializeNetworkProcess(parameters); memoryPressureHandler().setLowMemoryHandler(lowMemoryHandler); memoryPressureHandler().install(); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); #if PLATFORM(MAC) || USE(CFNETWORK) SessionTracker::setIdentifierBase(parameters.uiProcessBundleIdentifier); #endif // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions) if (parameters.privateBrowsingEnabled) RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionID::legacyPrivateSessionID()); if (parameters.shouldUseTestingNetworkSession) NetworkStorageSession::switchToNewTestingSession(); NetworkProcessSupplementMap::const_iterator it = m_supplements.begin(); NetworkProcessSupplementMap::const_iterator end = m_supplements.end(); for (; it != end; ++it) it->value->initialize(parameters); }
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 }
void NetworkProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) { ASSERT(!m_connection); if (CoreIPC::Connection::identifierIsNull(connectionIdentifier)) { // FIXME: Do better cleanup here. return; } m_connection = CoreIPC::Connection::createServerConnection(connectionIdentifier, this, RunLoop::main()); #if PLATFORM(MAC) m_connection->setShouldCloseConnectionOnMachExceptions(); #endif m_connection->open(); NetworkProcessCreationParameters parameters; platformInitializeNetworkProcess(parameters); // Initialize the network host process. m_connection->send(Messages::NetworkProcess::InitializeNetworkProcess(parameters), 0); for (unsigned i = 0; i < m_numPendingConnectionRequests; ++i) m_connection->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0); m_numPendingConnectionRequests = 0; }
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 NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters) { platformInitializeNetworkProcess(parameters); setCacheModel(static_cast<uint32_t>(parameters.cacheModel)); #if PLATFORM(MAC) || USE(CFNETWORK) RemoteNetworkingContext::setPrivateBrowsingStorageSessionIdentifierBase(parameters.uiProcessBundleIdentifier); #endif if (parameters.privateBrowsingEnabled) RemoteNetworkingContext::ensurePrivateBrowsingSession(); if (parameters.shouldUseTestingNetworkSession) NetworkStorageSession::switchToNewTestingSession(); NetworkProcessSupplementMap::const_iterator it = m_supplements.begin(); NetworkProcessSupplementMap::const_iterator end = m_supplements.end(); for (; it != end; ++it) it->value->initialize(parameters); }