diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WebKit2/UIProcess/Network | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WebKit2/UIProcess/Network')
9 files changed, 160 insertions, 289 deletions
diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h b/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h index aba9577f2..214552570 100644 --- a/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h +++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/CustomProtocolManagerProxy.h @@ -28,7 +28,7 @@ #if ENABLE(CUSTOM_PROTOCOLS) -#include "MessageID.h" +#include "MessageReceiver.h" #if PLATFORM(MAC) #include <wtf/HashMap.h> @@ -36,34 +36,29 @@ OBJC_CLASS WKCustomProtocolLoader; #endif -namespace CoreIPC { -class Connection; -class MessageDecoder; -} // namespace CoreIPC - namespace WebCore { class ResourceRequest; } // namespace WebCore namespace WebKit { -class WebProcessProxy; +class ChildProcessProxy; -class CustomProtocolManagerProxy { +class CustomProtocolManagerProxy : public CoreIPC::MessageReceiver { public: - explicit CustomProtocolManagerProxy(WebProcessProxy*); + explicit CustomProtocolManagerProxy(ChildProcessProxy*); - void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); void startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest&); void stopLoading(uint64_t customProtocolID); private: - void didReceiveCustomProtocolManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); + // CoreIPC::MessageReceiver + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE; - WebProcessProxy* m_webProcessProxy; + ChildProcessProxy* m_childProcessProxy; #if PLATFORM(MAC) - typedef HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader> > LoaderMap; + typedef HashMap<uint64_t, RetainPtr<WKCustomProtocolLoader>> LoaderMap; LoaderMap m_loaderMap; #endif }; diff --git a/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm b/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm index 5c4aa03f3..0582d4802 100644 --- a/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm +++ b/Source/WebKit2/UIProcess/Network/CustomProtocols/mac/CustomProtocolManagerProxyMac.mm @@ -28,11 +28,14 @@ #if ENABLE(CUSTOM_PROTOCOLS) +#import "ChildProcessProxy.h" #import "Connection.h" #import "CustomProtocolManagerMessages.h" +#import "CustomProtocolManagerProxyMessages.h" #import "DataReference.h" -#import "WebProcessProxy.h" +#import "WebCoreArgumentCoders.h" #import <WebCore/ResourceError.h> +#import <WebCore/ResourceRequest.h> #import <WebCore/ResourceResponse.h> using namespace CoreIPC; @@ -119,24 +122,20 @@ using namespace WebKit; namespace WebKit { -CustomProtocolManagerProxy::CustomProtocolManagerProxy(WebProcessProxy* webProcessProxy) - : m_webProcessProxy(webProcessProxy) +CustomProtocolManagerProxy::CustomProtocolManagerProxy(ChildProcessProxy* childProcessProxy) + : m_childProcessProxy(childProcessProxy) { - ASSERT(m_webProcessProxy); -} - -void CustomProtocolManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) -{ - didReceiveCustomProtocolManagerProxyMessage(connection, messageID, decoder); + ASSERT(m_childProcessProxy); + m_childProcessProxy->addMessageReceiver(Messages::CustomProtocolManagerProxy::messageReceiverName(), this); } void CustomProtocolManagerProxy::startLoading(uint64_t customProtocolID, const ResourceRequest& coreRequest) { - NSURLRequest *request = coreRequest.nsURLRequest(); + NSURLRequest *request = coreRequest.nsURLRequest(DoNotUpdateHTTPBody); if (!request) return; - WKCustomProtocolLoader *loader = [[WKCustomProtocolLoader alloc] initWithCustomProtocolManagerProxy:this customProtocolID:customProtocolID request:request connection:m_webProcessProxy->connection()]; + WKCustomProtocolLoader *loader = [[WKCustomProtocolLoader alloc] initWithCustomProtocolManagerProxy:this customProtocolID:customProtocolID request:request connection:m_childProcessProxy->connection()]; ASSERT(loader); ASSERT(!m_loaderMap.contains(customProtocolID)); m_loaderMap.add(customProtocolID, loader); diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp deleted file mode 100644 index 4340da394..000000000 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "NetworkProcessManager.h" - -#include "NetworkProcessProxy.h" - -#if ENABLE(NETWORK_PROCESS) - -namespace WebKit { - -NetworkProcessManager& NetworkProcessManager::shared() -{ - DEFINE_STATIC_LOCAL(NetworkProcessManager, networkProcessManager, ()); - return networkProcessManager; -} - -NetworkProcessManager::NetworkProcessManager() -{ -} - -void NetworkProcessManager::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply) -{ - ASSERT(reply); - - ensureNetworkProcess(); - ASSERT(m_networkProcess); - - m_networkProcess->getNetworkProcessConnection(reply); -} - -void NetworkProcessManager::ensureNetworkProcess() -{ - if (m_networkProcess) - return; - - m_networkProcess = NetworkProcessProxy::create(this); -} - -void NetworkProcessManager::removeNetworkProcessProxy(NetworkProcessProxy* networkProcessProxy) -{ - ASSERT(m_networkProcess); - ASSERT(networkProcessProxy == m_networkProcess.get()); - - m_networkProcess = 0; -} - - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h deleted file mode 100644 index 957e45f3e..000000000 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef NetworkProcessManager_h -#define NetworkProcessManager_h - -#if ENABLE(NETWORK_PROCESS) - -#include "Connection.h" -#include "WebProcessProxyMessages.h" -#include <wtf/RefCounted.h> -#include <wtf/text/WTFString.h> - -namespace WebKit { - -class NetworkProcessConnection; -class NetworkProcessProxy; -class WebProcessProxy; - -class NetworkProcessManager { - WTF_MAKE_NONCOPYABLE(NetworkProcessManager); -public: - static NetworkProcessManager& shared(); - - void ensureNetworkProcess(); - - void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>); - - void removeNetworkProcessProxy(NetworkProcessProxy*); - -#if PLATFORM(MAC) - void setApplicationIsOccluded(bool); -#endif - -private: - NetworkProcessManager(); - - RefPtr<NetworkProcessProxy> m_networkProcess; -}; - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) - -#endif // NetworkProcessManager_h diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp index 1f9ce89ed..f15bdb442 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp @@ -26,57 +26,81 @@ #include "config.h" #include "NetworkProcessProxy.h" +#if ENABLE(NETWORK_PROCESS) + +#include "AuthenticationChallengeProxy.h" +#include "CustomProtocolManagerProxyMessages.h" +#include "DownloadProxyMessages.h" #include "NetworkProcessCreationParameters.h" -#include "NetworkProcessManager.h" #include "NetworkProcessMessages.h" #include "WebContext.h" #include "WebProcessMessages.h" #include <WebCore/RunLoop.h> -#if ENABLE(NETWORK_PROCESS) +#if USE(SECURITY_FRAMEWORK) +#include "SecItemShimProxy.h" +#endif + +#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, connection()) using namespace WebCore; namespace WebKit { -PassRefPtr<NetworkProcessProxy> NetworkProcessProxy::create(NetworkProcessManager* manager) +PassRefPtr<NetworkProcessProxy> NetworkProcessProxy::create(WebContext* webContext) { - return adoptRef(new NetworkProcessProxy(manager)); + return adoptRef(new NetworkProcessProxy(webContext)); } -NetworkProcessProxy::NetworkProcessProxy(NetworkProcessManager* manager) - : m_networkProcessManager(manager) +NetworkProcessProxy::NetworkProcessProxy(WebContext* webContext) + : m_webContext(webContext) , m_numPendingConnectionRequests(0) +#if ENABLE(CUSTOM_PROTOCOLS) + , m_customProtocolManagerProxy(this) +#endif { - ProcessLauncher::LaunchOptions launchOptions; - launchOptions.processType = ProcessLauncher::NetworkProcess; + connect(); +} -#if PLATFORM(MAC) - launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture; - launchOptions.executableHeap = false; -#if HAVE(XPC) - launchOptions.useXPC = false; -#endif -#endif +NetworkProcessProxy::~NetworkProcessProxy() +{ +} - m_processLauncher = ProcessLauncher::create(this, launchOptions); +void NetworkProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) +{ + launchOptions.processType = ProcessLauncher::NetworkProcess; + platformGetLaunchOptions(launchOptions); } -NetworkProcessProxy::~NetworkProcessProxy() +void NetworkProcessProxy::connectionWillOpen(CoreIPC::Connection* connection) { +#if USE(SECURITY_FRAMEWORK) + SecItemShimProxy::shared().initializeConnection(connection); +#endif +} +void NetworkProcessProxy::connectionWillClose(CoreIPC::Connection*) +{ } void NetworkProcessProxy::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply) { m_pendingConnectionReplies.append(reply); - if (m_processLauncher->isLaunching()) { + if (isLaunching()) { m_numPendingConnectionRequests++; return; } - m_connection->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply); + connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0, CoreIPC::DispatchMessageEvenWhenWaitingForSyncReply); +} + +DownloadProxy* NetworkProcessProxy::createDownloadProxy() +{ + if (!m_downloadProxyMap) + m_downloadProxyMap = adoptPtr(new DownloadProxyMap(this)); + + return m_downloadProxyMap->createDownloadProxy(m_webContext); } void NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch() @@ -93,33 +117,39 @@ void NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch() } // Tell the network process manager to forget about this network process proxy. This may cause us to be deleted. - m_networkProcessManager->removeNetworkProcessProxy(this); + m_webContext->networkProcessCrashed(this); } -void NetworkProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void NetworkProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder) { - didReceiveNetworkProcessProxyMessage(connection, messageID, decoder); + if (dispatchMessage(connection, decoder)) + return; + + if (m_webContext->dispatchMessage(connection, decoder)) + return; + + didReceiveNetworkProcessProxyMessage(connection, decoder); } -void NetworkProcessProxy::didClose(CoreIPC::Connection*) +void NetworkProcessProxy::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder) { - // Notify all WebProcesses that the NetworkProcess crashed. - const Vector<WebContext*>& contexts = WebContext::allContexts(); - for (size_t i = 0; i < contexts.size(); ++i) - contexts[i]->sendToAllProcesses(Messages::WebProcess::NetworkProcessCrashed()); + if (dispatchSyncMessage(connection, decoder, replyEncoder)) + return; - // This may cause us to be deleted. - networkProcessCrashedOrFailedToLaunch(); + ASSERT_NOT_REACHED(); } -void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) +void NetworkProcessProxy::didClose(CoreIPC::Connection*) { + if (m_downloadProxyMap) + m_downloadProxyMap->processDidClose(); + // This may cause us to be deleted. + networkProcessCrashedOrFailedToLaunch(); } -void NetworkProcessProxy::syncMessageSendTimedOut(CoreIPC::Connection*) +void NetworkProcessProxy::didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference, CoreIPC::StringReference) { - } void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const CoreIPC::Attachment& connectionIdentifier) @@ -136,36 +166,32 @@ void NetworkProcessProxy::didCreateNetworkConnectionToWebProcess(const CoreIPC:: #endif } -void NetworkProcessProxy::didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier connectionIdentifier) +void NetworkProcessProxy::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID) +{ + WebPageProxy* page = WebProcessProxy::webPage(pageID); + MESSAGE_CHECK(page); + + RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, connection()); + page->didReceiveAuthenticationChallengeProxy(frameID, authenticationChallenge.release()); +} + +void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, CoreIPC::Connection::Identifier connectionIdentifier) { - ASSERT(!m_connection); + ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier); 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); + connection()->send(Messages::NetworkProcess::CreateNetworkConnectionToWebProcess(), 0); m_numPendingConnectionRequests = 0; #if PLATFORM(MAC) - if (WebContext::applicationIsOccluded()) - m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(true), 0); + if (m_webContext->canEnableProcessSuppressionForNetworkProcess()) + setProcessSuppressionEnabled(true); #endif } diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h index 13fdfd89a..2cc9e8840 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h @@ -28,59 +28,74 @@ #if ENABLE(NETWORK_PROCESS) -#include "Connection.h" +#include "ChildProcessProxy.h" #include "ProcessLauncher.h" #include "WebProcessProxyMessages.h" #include <wtf/Deque.h> +#if ENABLE(CUSTOM_PROTOCOLS) +#include "CustomProtocolManagerProxy.h" +#endif + +namespace WebCore { +class AuthenticationChallenge; +} + namespace WebKit { -class NetworkProcessManager; +class DownloadProxy; +class DownloadProxyMap; +class WebContext; struct NetworkProcessCreationParameters; -class NetworkProcessProxy : public RefCounted<NetworkProcessProxy>, CoreIPC::Connection::Client, ProcessLauncher::Client { +class NetworkProcessProxy : public ChildProcessProxy { public: - static PassRefPtr<NetworkProcessProxy> create(NetworkProcessManager*); + static PassRefPtr<NetworkProcessProxy> create(WebContext*); ~NetworkProcessProxy(); void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>); - bool isValid() const { return m_connection; } + DownloadProxy* createDownloadProxy(); #if PLATFORM(MAC) - void setApplicationIsOccluded(bool); + void setProcessSuppressionEnabled(bool); #endif private: - NetworkProcessProxy(NetworkProcessManager*); + NetworkProcessProxy(WebContext*); - void platformInitializeNetworkProcess(NetworkProcessCreationParameters&); + // ChildProcessProxy + virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) OVERRIDE; + virtual void connectionWillOpen(CoreIPC::Connection*) OVERRIDE; + virtual void connectionWillClose(CoreIPC::Connection*) OVERRIDE; + void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&); void networkProcessCrashedOrFailedToLaunch(); // CoreIPC::Connection::Client - virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); - virtual void didClose(CoreIPC::Connection*); - virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName); - virtual void syncMessageSendTimedOut(CoreIPC::Connection*); + virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE; + virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE; + virtual void didClose(CoreIPC::Connection*) OVERRIDE; + virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE; // Message handlers - void didReceiveNetworkProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); + void didReceiveNetworkProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); void didCreateNetworkConnectionToWebProcess(const CoreIPC::Attachment&); - + void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID); + // ProcessLauncher::Client virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier); - // The connection to the network process. - RefPtr<CoreIPC::Connection> m_connection; - - // The process launcher for the network process. - RefPtr<ProcessLauncher> m_processLauncher; - - NetworkProcessManager* m_networkProcessManager; + WebContext* m_webContext; unsigned m_numPendingConnectionRequests; - Deque<RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> > m_pendingConnectionReplies; + Deque<RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>> m_pendingConnectionReplies; + + OwnPtr<DownloadProxyMap> m_downloadProxyMap; + +#if ENABLE(CUSTOM_PROTOCOLS) + CustomProtocolManagerProxy m_customProtocolManagerProxy; +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in index 379b10864..7e91c384e 100644 --- a/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in +++ b/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in @@ -22,8 +22,10 @@ #if ENABLE(NETWORK_PROCESS) -messages -> NetworkProcessProxy { +messages -> NetworkProcessProxy LegacyReceiver { DidCreateNetworkConnectionToWebProcess(CoreIPC::Attachment connectionIdentifier) + + DidReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID) } #endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm deleted file mode 100644 index eaf9888a5..000000000 --- a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "config.h" -#import "NetworkProcessManager.h" - -#if ENABLE(NETWORK_PROCESS) - -#import "NetworkProcessProxy.h" - -namespace WebKit { - -void NetworkProcessManager::setApplicationIsOccluded(bool applicationIsOccluded) -{ - if (m_networkProcess) - return m_networkProcess->setApplicationIsOccluded(applicationIsOccluded); -} - -} // namespace WebKit - -#endif // ENABLE(NETWORK_PROCESS) diff --git a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm index 02534e9b9..1d1ff1ccf 100644 --- a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm +++ b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessProxyMac.mm @@ -26,7 +26,6 @@ #import "config.h" #import "NetworkProcessProxy.h" -#import "NetworkProcessCreationParameters.h" #import "NetworkProcessMessages.h" #if ENABLE(NETWORK_PROCESS) @@ -35,17 +34,36 @@ using namespace WebCore; namespace WebKit { -void NetworkProcessProxy::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters) -{ - parameters.parentProcessName = [[NSProcessInfo processInfo] processName]; -} - -void NetworkProcessProxy::setApplicationIsOccluded(bool applicationIsOccluded) +void NetworkProcessProxy::setProcessSuppressionEnabled(bool processSuppressionEnabled) { if (!isValid()) return; - m_connection->send(Messages::NetworkProcess::SetApplicationIsOccluded(applicationIsOccluded), 0); + connection()->send(Messages::NetworkProcess::SetProcessSuppressionEnabled(processSuppressionEnabled), 0); +} + +#if HAVE(XPC) +static bool shouldUseXPC() +{ + if (id value = [[NSUserDefaults standardUserDefaults] objectForKey:@"WebKit2UseXPCServiceForWebProcess"]) + return [value boolValue]; + +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + return true; +#else + return false; +#endif +} +#endif + +void NetworkProcessProxy::platformGetLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions) +{ + launchOptions.architecture = ProcessLauncher::LaunchOptions::MatchCurrentArchitecture; + launchOptions.executableHeap = false; + +#if HAVE(XPC) + launchOptions.useXPC = shouldUseXPC(); +#endif } } // namespace WebKit |