Title: [127334] trunk/Source/WebKit2
Revision
127334
Author
[email protected]
Date
2012-08-31 16:27:27 -0700 (Fri, 31 Aug 2012)

Log Message

        [WK2] WebProcesses should not wait 60 seconds to close in multi-process mode
        https://bugs.webkit.org/show_bug.cgi?id=95616

        Reviewed by Darin Adler.

        * Shared/ChildProcess.cpp: (WebKit::ChildProcess::ChildProcess):
        * Shared/ChildProcess.h: (WebKit::ChildProcess::setTerminationTimeout):
        Expose a setter for timeout instead of taking it at construction time. If a derived
        class doesn't call the setter, default to 0.

        * PluginProcess/PluginProcess.cpp:
        (WebKit::PluginProcess::PluginProcess):
        (WebKit::PluginProcess::initializePluginProcess):
        Use timeout from initialization message.

        * WebProcess/WebProcess.cpp:
        (WebKit::WebProcess::WebProcess):
        (WebKit::WebProcess::initializeWebProcess):
        Ditto.

        * Shared/Plugins/PluginProcessCreationParameters.cpp:
        (WebKit::PluginProcessCreationParameters::encode):
        (WebKit::PluginProcessCreationParameters::decode):
        * Shared/Plugins/PluginProcessCreationParameters.h:
        * Shared/WebProcessCreationParameters.cpp:
        (WebKit::WebProcessCreationParameters::encode):
        (WebKit::WebProcessCreationParameters::decode):
        * Shared/WebProcessCreationParameters.h:
        Funnel timeout across process boundary.

        * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching):
        Pass timeout as initialization message after launch.

        * UIProcess/WebContext.cpp:
        (WebKit::WebContext::createNewWebProcess): Pass timeout as initialization message
        (unlike plugin process proxy, web process proxy doesn't wait, and relies on the message
        being queued).
        (WebKit::WebContext::disconnectProcess): Skip invalidating global managers when
        one process quits. We still need to do something, but running this code would just
        result in assertion failures any time a page was closed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (127333 => 127334)


--- trunk/Source/WebKit2/ChangeLog	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-31 23:27:27 UTC (rev 127334)
@@ -1,3 +1,46 @@
+2012-08-31  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] WebProcesses should not wait 60 seconds to close in multi-process mode
+        https://bugs.webkit.org/show_bug.cgi?id=95616
+
+        Reviewed by Darin Adler.
+
+        * Shared/ChildProcess.cpp: (WebKit::ChildProcess::ChildProcess):
+        * Shared/ChildProcess.h: (WebKit::ChildProcess::setTerminationTimeout):
+        Expose a setter for timeout instead of taking it at construction time. If a derived
+        class doesn't call the setter, default to 0.
+
+        * PluginProcess/PluginProcess.cpp:
+        (WebKit::PluginProcess::PluginProcess):
+        (WebKit::PluginProcess::initializePluginProcess):
+        Use timeout from initialization message.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess):
+        (WebKit::WebProcess::initializeWebProcess):
+        Ditto.
+
+        * Shared/Plugins/PluginProcessCreationParameters.cpp:
+        (WebKit::PluginProcessCreationParameters::encode):
+        (WebKit::PluginProcessCreationParameters::decode):
+        * Shared/Plugins/PluginProcessCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        Funnel timeout across process boundary.
+
+        * UIProcess/Plugins/PluginProcessProxy.cpp: (WebKit::PluginProcessProxy::didFinishLaunching):
+        Pass timeout as initialization message after launch.
+
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::createNewWebProcess): Pass timeout as initialization message
+        (unlike plugin process proxy, web process proxy doesn't wait, and relies on the message
+        being queued).
+        (WebKit::WebContext::disconnectProcess): Skip invalidating global managers when
+        one process quits. We still need to do something, but running this code would just
+        result in assertion failures any time a page was closed.
+
 2012-08-31  Brady Eidson  <[email protected]>
 
        REGRESSION (r127252): incomplete repaint on Flash element after pinch to zoom

Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp (127333 => 127334)


--- trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -65,8 +65,6 @@
 
 namespace WebKit {
 
-static const double shutdownTimeout = 15.0;
-
 PluginProcess& PluginProcess::shared()
 {
     DEFINE_STATIC_LOCAL(PluginProcess, pluginProcess, ());
@@ -74,8 +72,7 @@
 }
 
 PluginProcess::PluginProcess()
-    : ChildProcess(shutdownTimeout)
-    , m_supportsAsynchronousPluginInitialization(false)
+    : m_supportsAsynchronousPluginInitialization(false)
 #if PLATFORM(MAC)
     , m_compositingRenderServerPort(MACH_PORT_NULL)
 #endif
@@ -162,6 +159,7 @@
 
     m_pluginPath = parameters.pluginPath;
     m_supportsAsynchronousPluginInitialization = parameters.supportsAsynchronousPluginInitialization;
+    setTerminationTimeout(parameters.terminationTimeout);
 
     platformInitialize(parameters);
 }

Modified: trunk/Source/WebKit2/Shared/ChildProcess.cpp (127333 => 127334)


--- trunk/Source/WebKit2/Shared/ChildProcess.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/ChildProcess.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -56,8 +56,8 @@
     m_terminationTimer.startOneShot(m_terminationTimeout);
 }
 
-ChildProcess::ChildProcess(double terminationTimeout)
-    : m_terminationTimeout(terminationTimeout)
+ChildProcess::ChildProcess()
+    : m_terminationTimeout(0)
     , m_terminationCounter(0)
     , m_terminationTimer(RunLoop::main(), this, &ChildProcess::terminationTimerFired)
 {

Modified: trunk/Source/WebKit2/Shared/ChildProcess.h (127333 => 127334)


--- trunk/Source/WebKit2/Shared/ChildProcess.h	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/ChildProcess.h	2012-08-31 23:27:27 UTC (rev 127334)
@@ -60,9 +60,11 @@
     static void didCloseOnConnectionWorkQueue(WorkQueue&, CoreIPC::Connection*);
 
 protected:
-    explicit ChildProcess(double terminationTimeout);
+    explicit ChildProcess();
     ~ChildProcess();
 
+    void setTerminationTimeout(double seconds) { m_terminationTimeout = seconds; }
+
 private:
     void terminationTimerFired();
 

Modified: trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp (127333 => 127334)


--- trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -41,6 +41,7 @@
 {
     encoder->encode(pluginPath);
     encoder->encode(supportsAsynchronousPluginInitialization);
+    encoder->encode(terminationTimeout);
 
 #if PLATFORM(MAC)
     encoder->encode(parentProcessName);
@@ -54,7 +55,8 @@
         return false;
     if (!decoder->decode(result.supportsAsynchronousPluginInitialization))
         return false;
-
+    if (!decoder->decode(result.terminationTimeout))
+        return false;
 #if PLATFORM(MAC)
     if (!decoder->decode(result.parentProcessName))
         return false;

Modified: trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h (127333 => 127334)


--- trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h	2012-08-31 23:27:27 UTC (rev 127334)
@@ -50,6 +50,8 @@
     String pluginPath;
     bool supportsAsynchronousPluginInitialization;
 
+    double terminationTimeout;
+
 #if PLATFORM(MAC)
     String parentProcessName;
     CoreIPC::MachPort acceleratedCompositingPort;

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (127333 => 127334)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -66,6 +66,7 @@
 #if ENABLE(PLUGIN_PROCESS)
     encoder->encode(disablePluginProcessMessageTimeout);
 #endif
+    encoder->encode(terminationTimeout);
     encoder->encode(languages);
     encoder->encode(textCheckerState);
     encoder->encode(fullKeyboardAccessEnabled);
@@ -139,7 +140,8 @@
     if (!decoder->decode(parameters.disablePluginProcessMessageTimeout))
         return false;
 #endif
-
+    if (!decoder->decode(parameters.terminationTimeout))
+        return false;
     if (!decoder->decode(parameters.languages))
         return false;
     if (!decoder->decode(parameters.textCheckerState))

Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (127333 => 127334)


--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h	2012-08-31 23:27:27 UTC (rev 127334)
@@ -77,6 +77,8 @@
     bool disablePluginProcessMessageTimeout;
 #endif
 
+    double terminationTimeout;
+
     Vector<String> languages;
 
     TextCheckerState textCheckerState;

Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp (127333 => 127334)


--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessProxy.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -47,6 +47,8 @@
 
 namespace WebKit {
 
+static const double shutdownTimeout = 15;
+
 PassRefPtr<PluginProcessProxy> PluginProcessProxy::create(PluginProcessManager* PluginProcessManager, const PluginModuleInfo& pluginInfo)
 {
     return adoptRef(new PluginProcessProxy(PluginProcessManager, pluginInfo));
@@ -211,6 +213,8 @@
 
     parameters.pluginPath = m_pluginInfo.path;
 
+    parameters.terminationTimeout = shutdownTimeout;
+
     platformInitializePluginProcess(parameters);
 
     // Initialize the plug-in host process.

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (127333 => 127334)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -86,6 +86,8 @@
 
 namespace WebKit {
 
+static const double sharedSecondaryProcessShutdownTimeout = 60;
+
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webContextCounter, ("WebContext"));
 
 PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
@@ -329,6 +331,8 @@
     
     parameters.iconDatabaseEnabled = !iconDatabasePath().isEmpty();
 
+    parameters.terminationTimeout = (m_processModel == ProcessModelSharedSecondaryProcess) ? sharedSecondaryProcessShutdownTimeout : 0;
+
     parameters.textCheckerState = TextChecker::state();
 
     parameters.fullKeyboardAccessEnabled = WebProcessProxy::fullKeyboardAccessEnabled();
@@ -427,6 +431,14 @@
 {
     ASSERT(m_processes.contains(process));
 
+    // FIXME (Multi-WebProcess): All the invalidation calls below are still necessary in multi-process mode, but they should only affect data structures pertaining to the process being disconnected.
+    // Clearing everything causes assertion failures, so it's less trouble to skip that for now.
+    if (m_processModel != ProcessModelSharedSecondaryProcess) {
+        RefPtr<WebProcessProxy> protect(process);
+        m_processes.remove(m_processes.find(process));
+        return;
+    }
+
     m_visitedLinkProvider.processDidClose();
 
     // Invalidate all outstanding downloads.

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (127333 => 127334)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-08-31 23:25:28 UTC (rev 127333)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2012-08-31 23:27:27 UTC (rev 127334)
@@ -133,11 +133,8 @@
     return process;
 }
 
-static const double shutdownTimeout = 60;
-
 WebProcess::WebProcess()
-    : ChildProcess(shutdownTimeout)
-    , m_inDidClose(false)
+    : m_inDidClose(false)
     , m_shouldTrackVisitedLinks(true)
     , m_hasSetCacheModel(false)
     , m_cacheModel(CacheModelDocumentViewer)
@@ -274,6 +271,8 @@
 #if ENABLE(PLUGIN_PROCESS)
     m_disablePluginProcessMessageTimeout = parameters.disablePluginProcessMessageTimeout;
 #endif
+
+    setTerminationTimeout(parameters.terminationTimeout);
 }
 
 void WebProcess::setShouldTrackVisitedLinks(bool shouldTrackVisitedLinks)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to