Make the NetworkProcess be managed by the WebContext, rather than a singleton Network...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2012 21:31:14 +0000 (21:31 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Dec 2012 21:31:14 +0000 (21:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105104

Reviewed by Alexey Proskuryakov.

Move to having the WebContext own and manage the NetworkProcessProxy.

* UIProcess/Network/NetworkProcessManager.cpp: Removed.
* UIProcess/Network/NetworkProcessManager.h: Removed.
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::create):
(WebKit::NetworkProcessProxy::NetworkProcessProxy):
(WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
* UIProcess/Network/NetworkProcessProxy.h:
(WebKit):
(NetworkProcessProxy):
* UIProcess/Network/mac/NetworkProcessManagerMac.mm: Removed.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::ensureNetworkProcess):
(WebKit::WebContext::removeNetworkProcessProxy):
(WebKit::WebContext::getNetworkProcessConnection):
(WebKit::WebContext::willStartUsingPrivateBrowsing):
(WebKit::WebContext::willStopUsingPrivateBrowsing):
(WebKit::WebContext::createNewWebProcess):
* UIProcess/WebContext.h:
(WebKit):
(WebContext):
(WebKit::WebContext::networkProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::getNetworkProcessConnection):
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::applicationBecameVisible):
(WebKit::WebContext::applicationBecameOccluded):
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137808 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp [deleted file]
Source/WebKit2/UIProcess/Network/NetworkProcessManager.h [deleted file]
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm [deleted file]
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/mac/WebContextMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index 0da855a..4d33de9 100644 (file)
@@ -1,3 +1,40 @@
+2012-12-15  Sam Weinig  <sam@webkit.org>
+
+        Make the NetworkProcess be managed by the WebContext, rather than a singleton NetworkProcessMananger
+        https://bugs.webkit.org/show_bug.cgi?id=105104
+
+        Reviewed by Alexey Proskuryakov.
+
+        Move to having the WebContext own and manage the NetworkProcessProxy.
+
+        * UIProcess/Network/NetworkProcessManager.cpp: Removed.
+        * UIProcess/Network/NetworkProcessManager.h: Removed.
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::create):
+        (WebKit::NetworkProcessProxy::NetworkProcessProxy):
+        (WebKit::NetworkProcessProxy::networkProcessCrashedOrFailedToLaunch):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        (WebKit):
+        (NetworkProcessProxy):
+        * UIProcess/Network/mac/NetworkProcessManagerMac.mm: Removed.
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::ensureNetworkProcess):
+        (WebKit::WebContext::removeNetworkProcessProxy):
+        (WebKit::WebContext::getNetworkProcessConnection):
+        (WebKit::WebContext::willStartUsingPrivateBrowsing):
+        (WebKit::WebContext::willStopUsingPrivateBrowsing):
+        (WebKit::WebContext::createNewWebProcess):
+        * UIProcess/WebContext.h:
+        (WebKit):
+        (WebContext):
+        (WebKit::WebContext::networkProcess):
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::getNetworkProcessConnection):
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit::WebContext::applicationBecameVisible):
+        (WebKit::WebContext::applicationBecameOccluded):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2012-12-15  Anders Carlsson  <andersca@apple.com>
 
         DownloadProxy objects should know which DownloadProxyMap they belong to
diff --git a/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp b/Source/WebKit2/UIProcess/Network/NetworkProcessManager.cpp
deleted file mode 100644 (file)
index 4340da3..0000000
+++ /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 (file)
index f55c0d0..0000000
+++ /dev/null
@@ -1,69 +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();
-
-    NetworkProcessProxy* process() { return m_networkProcess.get(); }
-
-    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
index 6be27c6..e91d6f9 100644 (file)
@@ -27,7 +27,6 @@
 #include "NetworkProcessProxy.h"
 
 #include "NetworkProcessCreationParameters.h"
-#include "NetworkProcessManager.h"
 #include "NetworkProcessMessages.h"
 #include "WebContext.h"
 #include "WebProcessMessages.h"
@@ -39,13 +38,13 @@ 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)
 {
     connect();
@@ -94,7 +93,7 @@ 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->removeNetworkProcessProxy(this);
 }
 
 void NetworkProcessProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
index 8a2b6a4..08d0671 100644 (file)
 
 namespace WebKit {
 
-class NetworkProcessManager;
+class WebContext;
 struct NetworkProcessCreationParameters;
 
 class NetworkProcessProxy : public RefCounted<NetworkProcessProxy>, public ChildProcessProxy {
 public:
-    static PassRefPtr<NetworkProcessProxy> create(NetworkProcessManager*);
+    static PassRefPtr<NetworkProcessProxy> create(WebContext*);
     ~NetworkProcessProxy();
 
     void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>);
@@ -51,7 +51,7 @@ public:
 #endif
 
 private:
-    NetworkProcessProxy(NetworkProcessManager*);
+    NetworkProcessProxy(WebContext*);
 
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) OVERRIDE;
     void platformInitializeNetworkProcess(NetworkProcessCreationParameters&);
@@ -70,7 +70,7 @@ private:
     // ProcessLauncher::Client
     virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier);
 
-    NetworkProcessManager* m_networkProcessManager;
+    WebContext* m_webContext;
     
     unsigned m_numPendingConnectionRequests;
     Deque<RefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> > m_pendingConnectionReplies;
diff --git a/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm b/Source/WebKit2/UIProcess/Network/mac/NetworkProcessManagerMac.mm
deleted file mode 100644 (file)
index eaf9888..0000000
+++ /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)
index f674217..387ac15 100644 (file)
@@ -72,7 +72,6 @@
 #endif
 
 #if ENABLE(NETWORK_PROCESS)
-#include "NetworkProcessManager.h"
 #include "NetworkProcessMessages.h"
 #include "NetworkProcessProxy.h"
 #endif
@@ -358,30 +357,47 @@ bool WebContext::usesNetworkProcess() const
 }
 
 #if ENABLE(NETWORK_PROCESS)
-static bool anyContextUsesNetworkProcess()
+void WebContext::ensureNetworkProcess()
 {
-    const Vector<WebContext*>& contexts = WebContext::allContexts();
-    for (size_t i = 0, count = contexts.size(); i < count; ++i)
-    if (contexts[i]->usesNetworkProcess())
-        return true;
+    if (m_networkProcess)
+        return;
 
-    return false;
+    m_networkProcess = NetworkProcessProxy::create(this);
+}
+
+void WebContext::removeNetworkProcessProxy(NetworkProcessProxy* networkProcessProxy)
+{
+    ASSERT(m_networkProcess);
+    ASSERT(networkProcessProxy == m_networkProcess.get());
+    
+    m_networkProcess = nullptr;
+}
+
+void WebContext::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply)
+{
+    ASSERT(reply);
+
+    ensureNetworkProcess();
+    ASSERT(m_networkProcess);
+
+    m_networkProcess->getNetworkProcessConnection(reply);
 }
 #endif
 
+
 void WebContext::willStartUsingPrivateBrowsing()
 {
     if (m_privateBrowsingEnterCount++)
         return;
 
+    const Vector<WebContext*>& contexts = allContexts();
+    for (size_t i = 0, count = contexts.size(); i < count; ++i) {
 #if ENABLE(NETWORK_PROCESS)
-    if (anyContextUsesNetworkProcess())
-        NetworkProcessManager::shared().process()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
+        if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
+            contexts[i]->networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession(), 0);
 #endif
-
-    const Vector<WebContext*>& contexts = allContexts();
-    for (size_t i = 0, count = contexts.size(); i < count; ++i)
         contexts[i]->sendToAllProcesses(Messages::WebProcess::EnsurePrivateBrowsingSession());
+    }
 }
 
 void WebContext::willStopUsingPrivateBrowsing()
@@ -391,14 +407,15 @@ void WebContext::willStopUsingPrivateBrowsing()
     if (m_privateBrowsingEnterCount && --m_privateBrowsingEnterCount)
         return;
 
+    const Vector<WebContext*>& contexts = allContexts();
+    for (size_t i = 0, count = contexts.size(); i < count; ++i) {
 #if ENABLE(NETWORK_PROCESS)
-    if (anyContextUsesNetworkProcess())
-        NetworkProcessManager::shared().process()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
+        if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
+            contexts[i]->networkProcess()->send(Messages::NetworkProcess::DestroyPrivateBrowsingSession(), 0);
 #endif
 
-    const Vector<WebContext*>& contexts = allContexts();
-    for (size_t i = 0, count = contexts.size(); i < count; ++i)
         contexts[i]->sendToAllProcesses(Messages::WebProcess::DestroyPrivateBrowsingSession());
+    }
 }
 
 WebProcessProxy* WebContext::ensureSharedWebProcess()
@@ -413,7 +430,7 @@ WebProcessProxy* WebContext::createNewWebProcess()
 {
 #if ENABLE(NETWORK_PROCESS)
     if (m_usesNetworkProcess)
-        NetworkProcessManager::shared().ensureNetworkProcess();
+        ensureNetworkProcess();
 #endif
 
     RefPtr<WebProcessProxy> process = WebProcessProxy::create(this);
index 4ce19c3..070e467 100644 (file)
@@ -52,30 +52,32 @@ namespace WebKit {
 
 class DownloadProxy;
 class WebApplicationCacheManagerProxy;
-#if ENABLE(BATTERY_STATUS)
-class WebBatteryManagerProxy;
-#endif
 class WebCookieManagerProxy;
 class WebDatabaseManagerProxy;
 class WebGeolocationManagerProxy;
 class WebIconDatabase;
 class WebKeyValueStorageManagerProxy;
 class WebMediaCacheManagerProxy;
-#if ENABLE(NETWORK_INFO)
-class WebNetworkInfoManagerProxy;
-#endif
+class NetworkProcessProxy;
 class WebNotificationManagerProxy;
 class WebPageGroup;
 class WebPageProxy;
 class WebResourceCacheManagerProxy;
-#if USE(SOUP)
-class WebSoupRequestManagerProxy;
-#endif
 struct StatisticsData;
 struct WebProcessCreationParameters;
     
 typedef GenericCallback<WKDictionaryRef> DictionaryCallback;
 
+#if ENABLE(BATTERY_STATUS)
+class WebBatteryManagerProxy;
+#endif
+#if ENABLE(NETWORK_INFO)
+class WebNetworkInfoManagerProxy;
+#endif
+#if USE(SOUP)
+class WebSoupRequestManagerProxy;
+#endif
+
 #if PLATFORM(MAC)
 extern NSString *SchemeForCustomProtocolRegisteredNotificationName;
 extern NSString *SchemeForCustomProtocolUnregisteredNotificationName;
@@ -248,9 +250,21 @@ public:
 
     void textCheckerStateChanged();
 
+
+    // Network Process Management
+
     void setUsesNetworkProcess(bool);
     bool usesNetworkProcess() const;
 
+#if ENABLE(NETWORK_PROCESS)
+    void ensureNetworkProcess();
+    NetworkProcessProxy* networkProcess() { return m_networkProcess.get(); }
+    void removeNetworkProcessProxy(NetworkProcessProxy*);
+
+    void getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply>);
+#endif
+
+
 #if PLATFORM(MAC)
     static bool applicationIsOccluded() { return s_applicationIsOccluded; }
 #endif
@@ -424,6 +438,7 @@ private:
 
 #if ENABLE(NETWORK_PROCESS)
     bool m_usesNetworkProcess;
+    RefPtr<NetworkProcessProxy> m_networkProcess;
 #endif
     
     HashMap<uint64_t, RefPtr<DictionaryCallback> > m_dictionaryCallbacks;
index 0970e4e..9fcff4c 100644 (file)
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
-#if ENABLE(NETWORK_PROCESS)
-#include "NetworkProcessManager.h"
-#endif
-
 #if PLATFORM(MAC)
 #include "SimplePDFPlugin.h"
 #if ENABLE(PDFKIT_PLUGIN)
@@ -376,7 +372,7 @@ void WebProcessProxy::getSharedWorkerProcessConnection(const String& /* url */,
 #if ENABLE(NETWORK_PROCESS)
 void WebProcessProxy::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply)
 {
-    NetworkProcessManager::shared().getNetworkProcessConnection(reply);
+    m_context->getNetworkProcessConnection(reply);
 }
 #endif // ENABLE(NETWORK_PROCESS)
 
index 74bd0e7..304ee12 100644 (file)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "WebContext.h"
 
-#import "NetworkProcessManager.h"
+#import "NetworkProcessProxy.h"
 #import "PluginProcessManager.h"
 #import "SharedWorkerProcessManager.h"
 #import "WKBrowsingContextControllerInternal.h"
@@ -35,7 +35,7 @@
 #import "WebProcessMessages.h"
 #import <WebCore/Color.h>
 #import <WebCore/FileSystem.h>
-#include <WebCore/NotImplemented.h>
+#import <WebCore/NotImplemented.h>
 #import <WebCore/PlatformPasteboard.h>
 #import <sys/param.h>
 
@@ -273,15 +273,18 @@ void WebContext::applicationBecameVisible(uint32_t, void*, uint32_t, void*, uint
         s_applicationIsOccluded = false;
 
         const Vector<WebContext*>& contexts = WebContext::allContexts();
-        for (size_t i = 0, count = contexts.size(); i < count; ++i)
+        for (size_t i = 0, count = contexts.size(); i < count; ++i) {
+#if ENABLE(NETWORK_PROCESS)
+            if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
+                contexts[i]->networkProcess()->setApplicationIsOccluded(false);
+#endif
+
             contexts[i]->sendToAllProcesses(Messages::WebProcess::SetApplicationIsOccluded(false));
+        }
 
 #if ENABLE(PLUGIN_PROCESS)
         PluginProcessManager::shared().setApplicationIsOccluded(false);
 #endif
-#if ENABLE(NETWORK_PROCESS)
-        NetworkProcessManager::shared().setApplicationIsOccluded(false);
-#endif
 #if ENABLE(SHARED_WORKER_PROCESS)
         SharedWorkerProcessManager::shared().setApplicationIsOccluded(false);
 #endif
@@ -293,15 +296,18 @@ void WebContext::applicationBecameOccluded(uint32_t, void*, uint32_t, void*, uin
     if (!s_applicationIsOccluded) {
         s_applicationIsOccluded = true;
         const Vector<WebContext*>& contexts = WebContext::allContexts();
-        for (size_t i = 0, count = contexts.size(); i < count; ++i)
+        for (size_t i = 0, count = contexts.size(); i < count; ++i) {
+#if ENABLE(NETWORK_PROCESS)
+            if (contexts[i]->usesNetworkProcess() && contexts[i]->networkProcess())
+                contexts[i]->networkProcess()->setApplicationIsOccluded(true);
+#endif
+
             contexts[i]->sendToAllProcesses(Messages::WebProcess::SetApplicationIsOccluded(true));
+        }
 
 #if ENABLE(PLUGIN_PROCESS)
         PluginProcessManager::shared().setApplicationIsOccluded(true);
 #endif
-#if ENABLE(NETWORK_PROCESS)
-        NetworkProcessManager::shared().setApplicationIsOccluded(true);
-#endif
 #if ENABLE(SHARED_WORKER_PROCESS)
         SharedWorkerProcessManager::shared().setApplicationIsOccluded(true);
 #endif
index f9c91ce..8a90938 100644 (file)
                3F87B9C0158940D80090FF62 /* WebColorChooserProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BF158940D80090FF62 /* WebColorChooserProxy.h */; };
                4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F601430155C5A32001FBDE0 /* BlockingResponseMap.h */; };
                51021E9C12B16788005C033C /* WebContextMenuClientMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */; };
-               5105B0DD162F7E9D00E27709 /* NetworkProcessManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5105B0DB162F7E9D00E27709 /* NetworkProcessManager.cpp */; };
-               5105B0DE162F7E9D00E27709 /* NetworkProcessManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5105B0DC162F7E9D00E27709 /* NetworkProcessManager.h */; };
                510AFFB916542048001BA05E /* WebResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510AFFB716542048001BA05E /* WebResourceLoader.cpp */; };
                510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 510AFFB816542048001BA05E /* WebResourceLoader.h */; };
                510CC8491613C85C00D03ED3 /* NetworkProcess.app in CopyFiles */ = {isa = PBXBuildFile; fileRef = 510CC80E1613C79900D03ED3 /* NetworkProcess.app */; };
                93FC67C012D3CCF200A60610 /* EncoderAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FC67A012D3CC7400A60610 /* EncoderAdapter.h */; };
                9F4F59421648B40700493B7E /* SharedWorkerProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59411648B40700493B7E /* SharedWorkerProcessManagerMac.mm */; };
                9F4F59441648B67F00493B7E /* SharedWorkerProcessProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59431648B67F00493B7E /* SharedWorkerProcessProxyMac.mm */; };
-               9F4F59461648BA8E00493B7E /* NetworkProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */; };
                9F54F88F16488E87007DF81A /* ChildProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F88E16488E87007DF81A /* ChildProcessMac.mm */; };
                9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */; };
                B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B62E730F143047A60069EC35 /* WKHitTestResult.cpp */; };
                51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClientMac.mm; sourceTree = "<group>"; };
                5105B0D4162F7A7A00E27709 /* NetworkProcessConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessConnection.cpp; path = Network/NetworkProcessConnection.cpp; sourceTree = "<group>"; };
                5105B0D5162F7A7A00E27709 /* NetworkProcessConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessConnection.h; path = Network/NetworkProcessConnection.h; sourceTree = "<group>"; };
-               5105B0DB162F7E9D00E27709 /* NetworkProcessManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessManager.cpp; sourceTree = "<group>"; };
-               5105B0DC162F7E9D00E27709 /* NetworkProcessManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessManager.h; sourceTree = "<group>"; };
                5105B0F31630872E00E27709 /* NetworkProcessProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = NetworkProcessProxy.messages.in; sourceTree = "<group>"; };
                510AFFB716542048001BA05E /* WebResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebResourceLoader.cpp; path = Network/WebResourceLoader.cpp; sourceTree = "<group>"; };
                510AFFB816542048001BA05E /* WebResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebResourceLoader.h; path = Network/WebResourceLoader.h; sourceTree = "<group>"; };
                93FC67A012D3CC7400A60610 /* EncoderAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EncoderAdapter.h; sourceTree = "<group>"; };
                9F4F59411648B40700493B7E /* SharedWorkerProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedWorkerProcessManagerMac.mm; sourceTree = "<group>"; };
                9F4F59431648B67F00493B7E /* SharedWorkerProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SharedWorkerProcessProxyMac.mm; sourceTree = "<group>"; };
-               9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessManagerMac.mm; path = mac/NetworkProcessManagerMac.mm; sourceTree = "<group>"; };
                9F54F88E16488E87007DF81A /* ChildProcessMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ChildProcessMac.mm; sourceTree = "<group>"; };
                9F54F8941648AE0E007DF81A /* PluginProcessManagerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessManagerMac.mm; sourceTree = "<group>"; };
                A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedScriptValue.h; sourceTree = "<group>"; };
                        children = (
                                29AD3091164B4C100072DEA9 /* CustomProtocols */,
                                516319931628980E00E22F00 /* mac */,
-                               5105B0DB162F7E9D00E27709 /* NetworkProcessManager.cpp */,
-                               5105B0DC162F7E9D00E27709 /* NetworkProcessManager.h */,
                                510CC7EA16138E7200D03ED3 /* NetworkProcessProxy.cpp */,
                                510CC7EB16138E7200D03ED3 /* NetworkProcessProxy.h */,
                                5105B0F31630872E00E27709 /* NetworkProcessProxy.messages.in */,
                516319931628980E00E22F00 /* mac */ = {
                        isa = PBXGroup;
                        children = (
-                               9F4F59451648BA8E00493B7E /* NetworkProcessManagerMac.mm */,
                                516319911628980A00E22F00 /* NetworkProcessProxyMac.mm */,
                        );
                        name = mac;
                                1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */,
                                1A232903162C867300D82F7A /* MessageDecoder.h in Headers */,
                                5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */,
-                               5105B0DE162F7E9D00E27709 /* NetworkProcessManager.h in Headers */,
                                513A163D163088F6005D7D22 /* NetworkProcessProxyMessages.h in Headers */,
                                513A164D1630A9BF005D7D22 /* NetworkConnectionToWebProcess.h in Headers */,
                                1A13BEB41635A9C800F19C03 /* StringReference.h in Headers */,
                                1A2328FE162C866A00D82F7A /* MessageEncoder.cpp in Sources */,
                                1A232902162C867300D82F7A /* MessageDecoder.cpp in Sources */,
                                5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
-                               5105B0DD162F7E9D00E27709 /* NetworkProcessManager.cpp in Sources */,
                                513A163C163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp in Sources */,
                                513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
                                5183DDEC1630BDFC008BE5C7 /* NetworkProcessConnection.cpp in Sources */,
                                9F54F8951648AE0F007DF81A /* PluginProcessManagerMac.mm in Sources */,
                                9F4F59421648B40700493B7E /* SharedWorkerProcessManagerMac.mm in Sources */,
                                9F4F59441648B67F00493B7E /* SharedWorkerProcessProxyMac.mm in Sources */,
-                               9F4F59461648BA8E00493B7E /* NetworkProcessManagerMac.mm in Sources */,
                                1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */,
                                1AB16AED164B41E400290D62 /* RemoteGraphicsLayer.mm in Sources */,
                                51217460164C20E30037A5C1 /* ShareableResource.cpp in Sources */,