Rename connectionDidClose and related methods to be more clear.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 May 2015 04:39:51 +0000 (04:39 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 May 2015 04:39:51 +0000 (04:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145030

Reviewed by Darin Adler.

These methods were easy to confuse with "Connection::Client::didClose()", yet they
were about something much more explicit: A child process being shut down by the UI Process.

Let's call them as such.

* Shared/ChildProcessProxy.cpp:
(WebKit::ChildProcessProxy::shutDownProcess):
(WebKit::ChildProcessProxy::clearConnection): Deleted.
(WebKit::ChildProcessProxy::connectionDidClose): Deleted.
* Shared/ChildProcessProxy.h:

* UIProcess/Databases/DatabaseProcessProxy.cpp:
(WebKit::DatabaseProcessProxy::processWillShutDown):
* UIProcess/Databases/DatabaseProcessProxy.h:

* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::processWillShutDown):
* UIProcess/Network/NetworkProcessProxy.h:

* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::processWillShutDown):
* UIProcess/Plugins/PluginProcessProxy.h:

* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::webProcessWillShutDown):
(WebKit::WebFrameProxy::disconnect): Deleted.
* UIProcess/WebFrameProxy.h:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::webProcessWillShutDown):
(WebKit::WebPageProxy::connectionDidClose): Deleted.
* UIProcess/WebPageProxy.h:

* UIProcess/WebProcessLifetimeTracker.cpp:
(WebKit::WebProcessLifetimeTracker::webProcessWillShutDown):
(WebKit::WebProcessLifetimeTracker::connectionDidClose): Deleted.
* UIProcess/WebProcessLifetimeTracker.h:

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::processWillShutDown):
(WebKit::WebProcessProxy::shutDown):
(WebKit::WebProcessProxy::removeWebPage):
(WebKit::WebProcessProxy::didClose):
(WebKit::WebProcessProxy::disconnectFramesFromPage):
(WebKit::WebProcessProxy::shouldTerminate):
(WebKit::WebProcessProxy::requestTermination):
(WebKit::WebProcessProxy::connectionDidClose): Deleted.
(WebKit::WebProcessProxy::disconnect): Deleted.
* UIProcess/WebProcessProxy.h:

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

17 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/ChildProcessProxy.cpp
Source/WebKit2/Shared/ChildProcessProxy.h
Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.cpp
Source/WebKit2/UIProcess/Databases/DatabaseProcessProxy.h
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp
Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.h
Source/WebKit2/UIProcess/WebFrameProxy.cpp
Source/WebKit2/UIProcess/WebFrameProxy.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebProcessLifetimeTracker.cpp
Source/WebKit2/UIProcess/WebProcessLifetimeTracker.h
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h

index bbb7b41..e7ff0b5 100644 (file)
@@ -1,3 +1,60 @@
+2015-05-14  Brady Eidson  <beidson@apple.com>
+
+        Rename connectionDidClose and related methods to be more clear.
+        https://bugs.webkit.org/show_bug.cgi?id=145030
+
+        Reviewed by Darin Adler.
+
+        These methods were easy to confuse with "Connection::Client::didClose()", yet they
+        were about something much more explicit: A child process being shut down by the UI Process.
+
+        Let's call them as such.
+
+        * Shared/ChildProcessProxy.cpp:
+        (WebKit::ChildProcessProxy::shutDownProcess):
+        (WebKit::ChildProcessProxy::clearConnection): Deleted.
+        (WebKit::ChildProcessProxy::connectionDidClose): Deleted.
+        * Shared/ChildProcessProxy.h:
+
+        * UIProcess/Databases/DatabaseProcessProxy.cpp:
+        (WebKit::DatabaseProcessProxy::processWillShutDown):
+        * UIProcess/Databases/DatabaseProcessProxy.h:
+
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::processWillShutDown):
+        * UIProcess/Network/NetworkProcessProxy.h:
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp:
+        (WebKit::PluginProcessProxy::processWillShutDown):
+        * UIProcess/Plugins/PluginProcessProxy.h:
+
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::webProcessWillShutDown):
+        (WebKit::WebFrameProxy::disconnect): Deleted.
+        * UIProcess/WebFrameProxy.h:
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::webProcessWillShutDown):
+        (WebKit::WebPageProxy::connectionDidClose): Deleted.
+        * UIProcess/WebPageProxy.h:
+
+        * UIProcess/WebProcessLifetimeTracker.cpp:
+        (WebKit::WebProcessLifetimeTracker::webProcessWillShutDown):
+        (WebKit::WebProcessLifetimeTracker::connectionDidClose): Deleted.
+        * UIProcess/WebProcessLifetimeTracker.h:
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::processWillShutDown):
+        (WebKit::WebProcessProxy::shutDown):
+        (WebKit::WebProcessProxy::removeWebPage):
+        (WebKit::WebProcessProxy::didClose):
+        (WebKit::WebProcessProxy::disconnectFramesFromPage):
+        (WebKit::WebProcessProxy::shouldTerminate):
+        (WebKit::WebProcessProxy::requestTermination):
+        (WebKit::WebProcessProxy::connectionDidClose): Deleted.
+        (WebKit::WebProcessProxy::disconnect): Deleted.
+        * UIProcess/WebProcessProxy.h:
+
 2015-05-14  Zhuo Li  <zachli@apple.com>
 
         Some CFNetwork SPI to reset HSTS hosts added since a date should not be used on Yosemite.
index afb712c..3c28f83 100644 (file)
@@ -159,13 +159,12 @@ void ChildProcessProxy::abortProcessLaunchIfNeeded()
     m_processLauncher = nullptr;
 }
 
-void ChildProcessProxy::clearConnection()
+void ChildProcessProxy::shutDownProcess()
 {
     if (!m_connection)
         return;
 
-    // FIXME: Call this after the connection has been invalidated.
-    connectionDidClose(*m_connection);
+    processWillShutDown(*m_connection);
 
     m_connection->invalidate();
     m_connection = nullptr;
@@ -175,8 +174,4 @@ void ChildProcessProxy::connectionWillOpen(IPC::Connection&)
 {
 }
 
-void ChildProcessProxy::connectionDidClose(IPC::Connection&)
-{
-}
-
 } // namespace WebKit
index 558947b..e0572ad 100644 (file)
@@ -73,7 +73,7 @@ public:
     bool sendMessage(std::unique_ptr<IPC::MessageEncoder>, unsigned messageSendFlags);
 
 protected:
-    void clearConnection();
+    void shutDownProcess();
     void abortProcessLaunchIfNeeded();
 
     // ProcessLauncher::Client
@@ -85,7 +85,7 @@ protected:
 private:
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) = 0;
     virtual void connectionWillOpen(IPC::Connection&);
-    virtual void connectionDidClose(IPC::Connection&);
+    virtual void processWillShutDown(IPC::Connection&) = 0;
 
     Vector<std::pair<std::unique_ptr<IPC::MessageEncoder>, unsigned>> m_pendingMessages;
     RefPtr<ProcessLauncher> m_processLauncher;
index 2a2869f..a72d01f 100644 (file)
@@ -72,6 +72,11 @@ void DatabaseProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& laun
     platformGetLaunchOptions(launchOptions);
 }
 
+void DatabaseProcessProxy::processWillShutDown(IPC::Connection& connection)
+{
+    ASSERT_UNUSED(connection, this->connection() == &connection);
+}
+
 void DatabaseProcessProxy::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
 {
     if (decoder.messageReceiverName() == Messages::DatabaseProcessProxy::messageReceiverName()) {
index 8ad869e..734aa5d 100644 (file)
@@ -59,6 +59,7 @@ private:
 
     // ChildProcessProxy
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
+    virtual void processWillShutDown(IPC::Connection&) override;
 
     // IPC::Connection::Client
     virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
index 967b920..783a654 100644 (file)
@@ -95,6 +95,11 @@ void NetworkProcessProxy::connectionWillOpen(IPC::Connection& connection)
 #endif
 }
 
+void NetworkProcessProxy::processWillShutDown(IPC::Connection& connection)
+{
+    ASSERT_UNUSED(connection, this->connection() == &connection);
+}
+
 void NetworkProcessProxy::getNetworkProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetNetworkProcessConnection::DelayedReply> reply)
 {
     m_pendingConnectionReplies.append(reply);
index 044d085..2d5f587 100644 (file)
@@ -82,6 +82,7 @@ private:
     // ChildProcessProxy
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     virtual void connectionWillOpen(IPC::Connection&) override;
+    virtual void processWillShutDown(IPC::Connection&) override;
 
     void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&);
     void networkProcessCrashedOrFailedToLaunch();
index 1005926..dd0ad4d 100644 (file)
@@ -82,6 +82,11 @@ void PluginProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launch
     platformGetLaunchOptions(launchOptions, m_pluginProcessAttributes);
 }
 
+void PluginProcessProxy::processWillShutDown(IPC::Connection& connection)
+{
+    ASSERT_UNUSED(connection, this->connection() == &connection);
+}
+
 // Asks the plug-in process to create a new connection to a web process. The connection identifier will be 
 // encoded in the given argument encoder and sent back to the connection of the given web process.
 void PluginProcessProxy::getPluginProcessConnection(PassRefPtr<Messages::WebProcessProxy::GetPluginProcessConnection::DelayedReply> reply)
index 45feedd..6c16e64 100644 (file)
@@ -111,6 +111,7 @@ private:
 
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&, const PluginProcessAttributes&);
+    virtual void processWillShutDown(IPC::Connection&) override;
 
     void pluginProcessCrashedOrFailedToLaunch();
 
index 7b7dac2..867bf27 100644 (file)
@@ -55,7 +55,7 @@ WebFrameProxy::~WebFrameProxy()
     WebProcessPool::statistics().wkFrameCount--;
 }
 
-void WebFrameProxy::disconnect()
+void WebFrameProxy::webProcessWillShutDown()
 {
     m_page = 0;
 
index 451b6fa..9586285 100644 (file)
@@ -73,7 +73,7 @@ public:
     uint64_t frameID() const { return m_frameID; }
     WebPageProxy* page() const { return m_page; }
 
-    void disconnect();
+    void webProcessWillShutDown();
 
     bool isMainFrame() const;
 
index 204e1ab..c2f878f 100644 (file)
@@ -3516,11 +3516,9 @@ void WebPageProxy::connectionWillOpen(IPC::Connection& connection)
     m_webProcessLifetimeTracker.connectionWillOpen(connection);
 }
 
-void WebPageProxy::connectionDidClose(IPC::Connection& connection)
+void WebPageProxy::webProcessWillShutDown()
 {
-    ASSERT_UNUSED(connection, &connection == m_process->connection());
-
-    m_webProcessLifetimeTracker.connectionDidClose(connection);
+    m_webProcessLifetimeTracker.webProcessWillShutDown();
 }
 
 void WebPageProxy::processDidFinishLaunching()
index ff9af24..accaa7a 100644 (file)
@@ -964,7 +964,7 @@ public:
     void didCancelCheckingText(uint64_t requestID);
 
     void connectionWillOpen(IPC::Connection&);
-    void connectionDidClose(IPC::Connection&);
+    void webProcessWillShutDown();
 
     void processDidFinishLaunching();
 
index a2ebfef..b080cc8 100644 (file)
@@ -60,7 +60,7 @@ void WebProcessLifetimeTracker::connectionWillOpen(IPC::Connection&)
         observer->addWebPage(m_webPageProxy);
 }
 
-void WebProcessLifetimeTracker::connectionDidClose(IPC::Connection&)
+void WebProcessLifetimeTracker::webProcessWillShutDown()
 {
     ASSERT(processIsRunning());
 
index 7445206..7a73b73 100644 (file)
@@ -45,7 +45,7 @@ public:
     void addObserver(WebProcessLifetimeObserver&);
 
     void connectionWillOpen(IPC::Connection&);
-    void connectionDidClose(IPC::Connection&);
+    void webProcessWillShutDown();
 
     void pageWasInvalidated();
 
index 66527f9..18b6c70 100644 (file)
@@ -147,9 +147,9 @@ void WebProcessProxy::connectionWillOpen(IPC::Connection& connection)
         page->connectionWillOpen(connection);
 }
 
-void WebProcessProxy::connectionDidClose(IPC::Connection& connection)
+void WebProcessProxy::processWillShutDown(IPC::Connection& connection)
 {
-    ASSERT(this->connection() == &connection);
+    ASSERT_UNUSED(connection, this->connection() == &connection);
 
     for (const auto& callback : m_pendingFetchWebsiteDataCallbacks.values())
         callback(WebsiteData());
@@ -164,14 +164,14 @@ void WebProcessProxy::connectionDidClose(IPC::Connection& connection)
     m_pendingDeleteWebsiteDataForOriginsCallbacks.clear();
 
     for (auto& page : m_pageMap.values())
-        page->connectionDidClose(connection);
+        page->webProcessWillShutDown();
 
     releaseRemainingIconsForPageURLs();
 }
 
-void WebProcessProxy::disconnect()
+void WebProcessProxy::shutDown()
 {
-    clearConnection();
+    shutDownProcess();
 
     if (m_webConnection) {
         m_webConnection->invalidate();
@@ -185,7 +185,7 @@ void WebProcessProxy::disconnect()
     copyValuesToVector(m_frameMap, frames);
 
     for (size_t i = 0, size = frames.size(); i < size; ++i)
-        frames[i]->disconnect();
+        frames[i]->webProcessWillShutDown();
     m_frameMap.clear();
 
     if (m_downloadProxyMap)
@@ -249,13 +249,13 @@ void WebProcessProxy::removeWebPage(uint64_t pageID)
 
 #if PLATFORM(IOS)
     if (state() == State::Running) {
-        // On iOS deploy a watchdog in the UI process, since the content may be suspended.
-        // 30s should be sufficient for any outstanding activity to complete cleanly.
+        // On iOS deploy a watchdog in the UI process, since the child process may be suspended.
+        // If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
         connection()->terminateSoon(30);
     }
 #endif
 
-    disconnect();
+    shutDown();
 }
 
 void WebProcessProxy::addVisitedLinkProvider(VisitedLinkProvider& provider)
@@ -527,7 +527,7 @@ void WebProcessProxy::didClose(IPC::Connection&)
     Vector<RefPtr<WebPageProxy>> pages;
     copyValuesToVector(m_pageMap, pages);
 
-    disconnect();
+    shutDown();
 
     for (size_t i = 0, size = pages.size(); i < size; ++i)
         pages[i]->processDidCrash();
@@ -628,7 +628,7 @@ void WebProcessProxy::disconnectFramesFromPage(WebPageProxy* page)
     copyValuesToVector(m_frameMap, frames);
     for (size_t i = 0, size = frames.size(); i < size; ++i) {
         if (frames[i]->page() == page)
-            frames[i]->disconnect();
+            frames[i]->webProcessWillShutDown();
     }
 }
 
@@ -663,8 +663,8 @@ void WebProcessProxy::shouldTerminate(bool& shouldTerminate)
 {
     shouldTerminate = canTerminateChildProcess();
     if (shouldTerminate) {
-        // We know that the web process is going to terminate so disconnect it from the process pool.
-        disconnect();
+        // We know that the web process is going to terminate so start shutting it down in the UI process.
+        shutDown();
     }
 }
 
@@ -765,7 +765,7 @@ void WebProcessProxy::requestTermination()
     if (webConnection())
         webConnection()->didClose();
 
-    disconnect();
+    shutDown();
 }
 
 void WebProcessProxy::enableSuddenTermination()
index 146072f..b10e347 100644 (file)
@@ -157,11 +157,11 @@ private:
     virtual void getLaunchOptions(ProcessLauncher::LaunchOptions&) override;
     void platformGetLaunchOptions(ProcessLauncher::LaunchOptions&);
     virtual void connectionWillOpen(IPC::Connection&) override;
-    virtual void connectionDidClose(IPC::Connection&) override;
+    virtual void processWillShutDown(IPC::Connection&) override;
 
     // Called when the web process has crashed or we know that it will terminate soon.
     // Will potentially cause the WebProcessProxy object to be freed.
-    void disconnect();
+    void shutDown();
 
     // IPC message handlers.
     void addBackForwardItem(uint64_t itemID, uint64_t pageID, const PageState&);