2 * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
27 #include "NetworkProcess.h"
29 #include "ArgumentCoders.h"
30 #include "Attachment.h"
31 #include "AuthenticationManager.h"
32 #include "ChildProcessMessages.h"
33 #include "CustomProtocolManager.h"
34 #include "DataReference.h"
35 #include "DownloadProxyMessages.h"
37 #include "NetworkConnectionToWebProcess.h"
38 #include "NetworkProcessCreationParameters.h"
39 #include "NetworkProcessPlatformStrategies.h"
40 #include "NetworkProcessProxyMessages.h"
41 #include "NetworkResourceLoader.h"
42 #include "NetworkSession.h"
43 #include "RemoteNetworkingContext.h"
44 #include "SessionTracker.h"
45 #include "StatisticsData.h"
46 #include "WebCookieManager.h"
47 #include "WebCoreArgumentCoders.h"
48 #include "WebPageProxyMessages.h"
49 #include "WebProcessPoolMessages.h"
50 #include "WebsiteData.h"
51 #include "WebsiteDataFetchOption.h"
52 #include "WebsiteDataType.h"
53 #include <WebCore/DNS.h>
54 #include <WebCore/DiagnosticLoggingClient.h>
55 #include <WebCore/LogInitialization.h>
56 #include <WebCore/NetworkStorageSession.h>
57 #include <WebCore/PlatformCookieJar.h>
58 #include <WebCore/ResourceRequest.h>
59 #include <WebCore/RuntimeApplicationChecks.h>
60 #include <WebCore/SecurityOriginData.h>
61 #include <WebCore/SecurityOriginHash.h>
62 #include <WebCore/SessionID.h>
63 #include <WebCore/URLParser.h>
64 #include <wtf/OptionSet.h>
65 #include <wtf/RunLoop.h>
66 #include <wtf/text/CString.h>
68 #if ENABLE(SEC_ITEM_SHIM)
69 #include "SecItemShim.h"
72 #if ENABLE(NETWORK_CACHE)
73 #include "NetworkCache.h"
74 #include "NetworkCacheCoders.h"
77 #if ENABLE(NETWORK_CAPTURE)
78 #include "NetworkCaptureManager.h"
82 #include "NetworkSessionCocoa.h"
85 using namespace WebCore;
89 NetworkProcess& NetworkProcess::singleton()
91 static NeverDestroyed<NetworkProcess> networkProcess;
92 return networkProcess;
95 NetworkProcess::NetworkProcess()
96 : m_hasSetCacheModel(false)
97 , m_cacheModel(CacheModelDocumentViewer)
98 , m_diskCacheIsDisabledForTesting(false)
99 , m_canHandleHTTPSServerTrustEvaluation(true)
101 , m_clearCacheDispatchGroup(0)
104 , m_webSQLiteDatabaseTracker(*this)
107 NetworkProcessPlatformStrategies::initialize();
109 addSupplement<AuthenticationManager>();
110 addSupplement<WebCookieManager>();
111 addSupplement<CustomProtocolManager>();
112 #if USE(NETWORK_SESSION) && PLATFORM(COCOA)
113 NetworkSessionCocoa::setCustomProtocolManager(supplement<CustomProtocolManager>());
117 NetworkProcess::~NetworkProcess()
121 AuthenticationManager& NetworkProcess::authenticationManager()
123 return *supplement<AuthenticationManager>();
126 DownloadManager& NetworkProcess::downloadManager()
128 static NeverDestroyed<DownloadManager> downloadManager(*this);
129 return downloadManager;
132 void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess* connection)
134 size_t vectorIndex = m_webProcessConnections.find(connection);
135 ASSERT(vectorIndex != notFound);
137 m_webProcessConnections.remove(vectorIndex);
140 bool NetworkProcess::shouldTerminate()
142 // Network process keeps session cookies and credentials, so it should never terminate (as long as UI process connection is alive).
146 void NetworkProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder)
148 if (messageReceiverMap().dispatchMessage(connection, decoder))
151 if (decoder.messageReceiverName() == Messages::ChildProcess::messageReceiverName()) {
152 ChildProcess::didReceiveMessage(connection, decoder);
156 didReceiveNetworkProcessMessage(connection, decoder);
159 void NetworkProcess::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
161 if (messageReceiverMap().dispatchSyncMessage(connection, decoder, replyEncoder))
164 didReceiveSyncNetworkProcessMessage(connection, decoder, replyEncoder);
167 void NetworkProcess::didClose(IPC::Connection&)
169 // The UIProcess just exited.
173 void NetworkProcess::didCreateDownload()
175 disableTermination();
178 void NetworkProcess::didDestroyDownload()
183 IPC::Connection* NetworkProcess::downloadProxyConnection()
185 return parentProcessConnection();
188 AuthenticationManager& NetworkProcess::downloadsAuthenticationManager()
190 return authenticationManager();
193 void NetworkProcess::lowMemoryHandler(Critical critical)
195 if (m_suppressMemoryPressureHandler)
198 platformLowMemoryHandler(critical);
199 WTF::releaseFastMallocFreeMemory();
202 void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&& parameters)
204 URLParser::setEnabled(parameters.urlParserEnabled);
206 platformInitializeNetworkProcess(parameters);
208 WTF::setCurrentThreadIsUserInitiated();
210 m_suppressMemoryPressureHandler = parameters.shouldSuppressMemoryPressureHandler;
211 m_loadThrottleLatency = parameters.loadThrottleLatency;
212 if (!m_suppressMemoryPressureHandler) {
213 auto& memoryPressureHandler = MemoryPressureHandler::singleton();
215 if (parameters.memoryPressureMonitorHandle.fileDescriptor() != -1)
216 memoryPressureHandler.setMemoryPressureMonitorHandle(parameters.memoryPressureMonitorHandle.releaseFileDescriptor());
218 memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous) {
219 lowMemoryHandler(critical);
221 memoryPressureHandler.install();
224 #if ENABLE(NETWORK_CAPTURE)
225 NetworkCapture::Manager::singleton().initialize(
226 parameters.recordReplayMode,
227 parameters.recordReplayCacheLocation);
230 m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession;
232 m_diskCacheSizeOverride = parameters.diskCacheSizeOverride;
233 setCacheModel(static_cast<uint32_t>(parameters.cacheModel));
235 setCanHandleHTTPSServerTrustEvaluation(parameters.canHandleHTTPSServerTrustEvaluation);
237 // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions)
238 if (parameters.privateBrowsingEnabled)
239 RemoteNetworkingContext::ensurePrivateBrowsingSession(SessionID::legacyPrivateSessionID());
241 if (parameters.shouldUseTestingNetworkSession)
242 NetworkStorageSession::switchToNewTestingSession();
244 for (auto& supplement : m_supplements.values())
245 supplement->initialize(parameters);
248 void NetworkProcess::initializeConnection(IPC::Connection* connection)
250 ChildProcess::initializeConnection(connection);
252 for (auto& supplement : m_supplements.values())
253 supplement->initializeConnection(connection);
256 void NetworkProcess::createNetworkConnectionToWebProcess()
258 #if USE(UNIX_DOMAIN_SOCKETS)
259 IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection();
261 auto connection = NetworkConnectionToWebProcess::create(socketPair.server);
262 m_webProcessConnections.append(WTFMove(connection));
264 IPC::Attachment clientSocket(socketPair.client);
265 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientSocket), 0);
267 // Create the listening port.
268 mach_port_t listeningPort;
269 mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &listeningPort);
271 // Create a listening connection.
272 auto connection = NetworkConnectionToWebProcess::create(IPC::Connection::Identifier(listeningPort));
273 m_webProcessConnections.append(WTFMove(connection));
275 IPC::Attachment clientPort(listeningPort, MACH_MSG_TYPE_MAKE_SEND);
276 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCreateNetworkConnectionToWebProcess(clientPort), 0);
282 void NetworkProcess::clearCachedCredentials()
284 NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
285 #if USE(NETWORK_SESSION)
286 NetworkSession::defaultSession().clearCredentials();
290 void NetworkProcess::ensurePrivateBrowsingSession(SessionID sessionID)
292 RemoteNetworkingContext::ensurePrivateBrowsingSession(sessionID);
295 void NetworkProcess::destroyPrivateBrowsingSession(SessionID sessionID)
297 SessionTracker::destroySession(sessionID);
300 void NetworkProcess::grantSandboxExtensionsToDatabaseProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler)
302 static uint64_t lastRequestID;
304 uint64_t requestID = ++lastRequestID;
305 m_sandboxExtensionForBlobsCompletionHandlers.set(requestID, WTFMove(completionHandler));
306 parentProcessConnection()->send(Messages::NetworkProcessProxy::GrantSandboxExtensionsToDatabaseProcessForBlobs(requestID, filenames), 0);
309 void NetworkProcess::didGrantSandboxExtensionsToDatabaseProcessForBlobs(uint64_t requestID)
311 if (auto handler = m_sandboxExtensionForBlobsCompletionHandlers.take(requestID))
315 static void fetchDiskCacheEntries(SessionID sessionID, OptionSet<WebsiteDataFetchOption> fetchOptions, Function<void (Vector<WebsiteData::Entry>)>&& completionHandler)
317 #if ENABLE(NETWORK_CACHE)
318 if (NetworkCache::singleton().isEnabled()) {
319 HashMap<SecurityOriginData, uint64_t> originsAndSizes;
320 NetworkCache::singleton().traverse([fetchOptions, completionHandler = WTFMove(completionHandler), originsAndSizes = WTFMove(originsAndSizes)](auto* traversalEntry) mutable {
321 if (!traversalEntry) {
322 Vector<WebsiteData::Entry> entries;
324 for (auto& originAndSize : originsAndSizes)
325 entries.append(WebsiteData::Entry { originAndSize.key, WebsiteDataType::DiskCache, originAndSize.value });
327 RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), entries = WTFMove(entries)] {
328 completionHandler(entries);
334 auto url = traversalEntry->entry.response().url();
335 auto result = originsAndSizes.add({url.protocol().toString(), url.host(), url.port()}, 0);
337 if (fetchOptions.contains(WebsiteDataFetchOption::ComputeSizes))
338 result.iterator->value += traversalEntry->entry.sourceStorageRecord().header.size() + traversalEntry->recordInfo.bodySize;
345 RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] {
346 completionHandler({ });
350 void NetworkProcess::fetchWebsiteData(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, OptionSet<WebsiteDataFetchOption> fetchOptions, uint64_t callbackID)
352 struct CallbackAggregator final : public RefCounted<CallbackAggregator> {
353 explicit CallbackAggregator(Function<void (WebsiteData)>&& completionHandler)
354 : m_completionHandler(WTFMove(completionHandler))
358 ~CallbackAggregator()
360 ASSERT(RunLoop::isMain());
362 RunLoop::main().dispatch([completionHandler = WTFMove(m_completionHandler), websiteData = WTFMove(m_websiteData)] {
363 completionHandler(websiteData);
367 Function<void (WebsiteData)> m_completionHandler;
368 WebsiteData m_websiteData;
371 auto callbackAggregator = adoptRef(*new CallbackAggregator([this, callbackID] (WebsiteData websiteData) {
372 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidFetchWebsiteData(callbackID, websiteData), 0);
375 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
376 if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
377 getHostnamesWithCookies(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithCookies);
380 if (websiteDataTypes.contains(WebsiteDataType::DiskCache)) {
381 fetchDiskCacheEntries(sessionID, fetchOptions, [callbackAggregator = WTFMove(callbackAggregator)](auto entries) mutable {
382 callbackAggregator->m_websiteData.entries.appendVector(entries);
387 void NetworkProcess::deleteWebsiteData(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
390 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
391 if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
392 clearHSTSCache(*networkStorageSession, modifiedSince);
396 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
397 if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
398 deleteAllCookiesModifiedSince(*networkStorageSession, modifiedSince);
401 auto completionHandler = [this, callbackID] {
402 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteData(callbackID), 0);
405 if (websiteDataTypes.contains(WebsiteDataType::DiskCache) && !sessionID.isEphemeral()) {
406 clearDiskCache(modifiedSince, WTFMove(completionHandler));
413 static void clearDiskCacheEntries(const Vector<SecurityOriginData>& origins, Function<void ()>&& completionHandler)
415 #if ENABLE(NETWORK_CACHE)
416 if (NetworkCache::singleton().isEnabled()) {
417 HashSet<RefPtr<SecurityOrigin>> originsToDelete;
418 for (auto& origin : origins)
419 originsToDelete.add(origin.securityOrigin());
421 Vector<NetworkCache::Key> cacheKeysToDelete;
422 NetworkCache::singleton().traverse([completionHandler = WTFMove(completionHandler), originsToDelete = WTFMove(originsToDelete), cacheKeysToDelete = WTFMove(cacheKeysToDelete)](auto* traversalEntry) mutable {
423 if (traversalEntry) {
424 if (originsToDelete.contains(SecurityOrigin::create(traversalEntry->entry.response().url())))
425 cacheKeysToDelete.append(traversalEntry->entry.key());
429 for (auto& key : cacheKeysToDelete)
430 NetworkCache::singleton().remove(key);
432 RunLoop::main().dispatch(WTFMove(completionHandler));
440 RunLoop::main().dispatch(WTFMove(completionHandler));
443 void NetworkProcess::deleteWebsiteDataForOrigins(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, const Vector<SecurityOriginData>& origins, const Vector<String>& cookieHostNames, uint64_t callbackID)
445 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
446 if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
447 deleteCookiesForHostnames(*networkStorageSession, cookieHostNames);
450 auto completionHandler = [this, callbackID] {
451 parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteDataForOrigins(callbackID), 0);
454 if (websiteDataTypes.contains(WebsiteDataType::DiskCache) && !sessionID.isEphemeral()) {
455 clearDiskCacheEntries(origins, WTFMove(completionHandler));
462 void NetworkProcess::downloadRequest(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedFilename)
464 downloadManager().startDownload(nullptr, sessionID, downloadID, request, suggestedFilename);
467 void NetworkProcess::resumeDownload(SessionID sessionID, DownloadID downloadID, const IPC::DataReference& resumeData, const String& path, const WebKit::SandboxExtension::Handle& sandboxExtensionHandle)
469 downloadManager().resumeDownload(sessionID, downloadID, resumeData, path, sandboxExtensionHandle);
472 void NetworkProcess::cancelDownload(DownloadID downloadID)
474 downloadManager().cancelDownload(downloadID);
477 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
478 void NetworkProcess::canAuthenticateAgainstProtectionSpace(NetworkResourceLoader& loader, const WebCore::ProtectionSpace& protectionSpace)
480 static uint64_t lastLoaderID = 0;
481 uint64_t loaderID = ++lastLoaderID;
482 m_waitingNetworkResourceLoaders.set(lastLoaderID, loader);
483 parentProcessConnection()->send(Messages::NetworkProcessProxy::CanAuthenticateAgainstProtectionSpace(loaderID, loader.pageID(), loader.frameID(), protectionSpace), 0);
486 void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)
488 m_waitingNetworkResourceLoaders.take(loaderID).value()->continueCanAuthenticateAgainstProtectionSpace(canAuthenticate);
492 #if USE(NETWORK_SESSION)
493 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
494 void NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID downloadID, bool canAuthenticate)
496 downloadManager().continueCanAuthenticateAgainstProtectionSpace(downloadID, canAuthenticate);
500 void NetworkProcess::continueWillSendRequest(DownloadID downloadID, WebCore::ResourceRequest&& request)
502 downloadManager().continueWillSendRequest(downloadID, WTFMove(request));
505 void NetworkProcess::pendingDownloadCanceled(DownloadID downloadID)
507 downloadProxyConnection()->send(Messages::DownloadProxy::DidCancel({ }), downloadID.downloadID());
510 void NetworkProcess::findPendingDownloadLocation(NetworkDataTask& networkDataTask, ResponseCompletionHandler&& completionHandler, const ResourceResponse& response)
512 uint64_t destinationID = networkDataTask.pendingDownloadID().downloadID();
513 downloadProxyConnection()->send(Messages::DownloadProxy::DidReceiveResponse(response), destinationID);
515 downloadManager().willDecidePendingDownloadDestination(networkDataTask, WTFMove(completionHandler));
516 downloadProxyConnection()->send(Messages::DownloadProxy::DecideDestinationWithSuggestedFilenameAsync(networkDataTask.pendingDownloadID(), networkDataTask.suggestedFilename()), destinationID);
520 void NetworkProcess::continueDecidePendingDownloadDestination(DownloadID downloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite)
522 if (destination.isEmpty())
523 downloadManager().cancelDownload(downloadID);
525 downloadManager().continueDecidePendingDownloadDestination(downloadID, destination, sandboxExtensionHandle, allowOverwrite);
528 void NetworkProcess::setCacheModel(uint32_t cm)
530 CacheModel cacheModel = static_cast<CacheModel>(cm);
532 if (m_hasSetCacheModel && (cacheModel == m_cacheModel))
535 m_hasSetCacheModel = true;
536 m_cacheModel = cacheModel;
538 unsigned urlCacheMemoryCapacity = 0;
539 uint64_t urlCacheDiskCapacity = 0;
540 uint64_t diskFreeSize = 0;
541 if (WebCore::getVolumeFreeSpace(m_diskCacheDirectory, diskFreeSize)) {
542 // As a fudge factor, use 1000 instead of 1024, in case the reported byte
543 // count doesn't align exactly to a megabyte boundary.
544 diskFreeSize /= KB * 1000;
545 calculateURLCacheSizes(cacheModel, diskFreeSize, urlCacheMemoryCapacity, urlCacheDiskCapacity);
548 if (m_diskCacheSizeOverride >= 0)
549 urlCacheDiskCapacity = m_diskCacheSizeOverride;
551 #if ENABLE(NETWORK_CACHE)
552 auto& networkCache = NetworkCache::singleton();
553 if (networkCache.isEnabled()) {
554 networkCache.setCapacity(urlCacheDiskCapacity);
559 platformSetURLCacheSize(urlCacheMemoryCapacity, urlCacheDiskCapacity);
562 void NetworkProcess::setCanHandleHTTPSServerTrustEvaluation(bool value)
564 m_canHandleHTTPSServerTrustEvaluation = value;
567 void NetworkProcess::getNetworkProcessStatistics(uint64_t callbackID)
571 auto& networkProcess = NetworkProcess::singleton();
572 data.statisticsNumbers.set("DownloadsActiveCount", networkProcess.downloadManager().activeDownloadCount());
573 data.statisticsNumbers.set("OutstandingAuthenticationChallengesCount", networkProcess.authenticationManager().outstandingAuthenticationChallengeCount());
575 parentProcessConnection()->send(Messages::WebProcessPool::DidGetStatistics(data, callbackID), 0);
578 void NetworkProcess::logDiagnosticMessage(uint64_t webPageID, const String& message, const String& description, ShouldSample shouldSample)
580 if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
583 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessage(webPageID, message, description, ShouldSample::No), 0);
586 void NetworkProcess::logDiagnosticMessageWithResult(uint64_t webPageID, const String& message, const String& description, DiagnosticLoggingResultType result, ShouldSample shouldSample)
588 if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
591 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithResult(webPageID, message, description, result, ShouldSample::No), 0);
594 void NetworkProcess::logDiagnosticMessageWithValue(uint64_t webPageID, const String& message, const String& description, double value, unsigned significantFigures, ShouldSample shouldSample)
596 if (!DiagnosticLoggingClient::shouldLogAfterSampling(shouldSample))
599 parentProcessConnection()->send(Messages::NetworkProcessProxy::LogDiagnosticMessageWithValue(webPageID, message, description, value, significantFigures, ShouldSample::No), 0);
602 void NetworkProcess::terminate()
604 #if ENABLE(NETWORK_CAPTURE)
605 NetworkCapture::Manager::singleton().terminate();
609 ChildProcess::terminate();
612 void NetworkProcess::processWillSuspendImminently(bool& handled)
614 lowMemoryHandler(Critical::Yes);
618 void NetworkProcess::prepareToSuspend()
620 RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::prepareToSuspend()", this);
621 lowMemoryHandler(Critical::Yes);
623 RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::prepareToSuspend() Sending ProcessReadyToSuspend IPC message", this);
624 parentProcessConnection()->send(Messages::NetworkProcessProxy::ProcessReadyToSuspend(), 0);
627 void NetworkProcess::cancelPrepareToSuspend()
629 // Although it is tempting to send a NetworkProcessProxy::DidCancelProcessSuspension message from here
630 // we do not because prepareToSuspend() already replied with a NetworkProcessProxy::ProcessReadyToSuspend
631 // message. And NetworkProcessProxy expects to receive either a NetworkProcessProxy::ProcessReadyToSuspend-
632 // or NetworkProcessProxy::DidCancelProcessSuspension- message, but not both.
633 RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::cancelPrepareToSuspend()", this);
636 void NetworkProcess::processDidResume()
638 RELEASE_LOG(ProcessSuspension, "%p - NetworkProcess::processDidResume()", this);
641 void NetworkProcess::prefetchDNS(const String& hostname)
643 WebCore::prefetchDNS(hostname);
647 void NetworkProcess::initializeProcess(const ChildProcessInitializationParameters&)
651 void NetworkProcess::initializeProcessName(const ChildProcessInitializationParameters&)
655 void NetworkProcess::initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&)
659 void NetworkProcess::platformLowMemoryHandler(Critical)
664 } // namespace WebKit