Title: [151480] trunk/Source/WebKit2
Revision
151480
Author
oli...@apple.com
Date
2013-06-11 18:12:27 -0700 (Tue, 11 Jun 2013)

Log Message

Make sure we aren't throttling plugin timers during initialisation and destruction
https://bugs.webkit.org/show_bug.cgi?id=117522

Reviewed by Darin Adler.

Add a new ActivityAssertion RAII class to handle allowing/disallowing
timer throttling.  Then make use of it during plugin initialisation
and destruction, as well as any synchronous messages (on the basis
that if another process is waiting for the plugin we shouldn't be
throttling timers).

* CMakeLists.txt:
* GNUmakefile.list.am:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::didReceiveSyncMessage):
(WebKit::WebProcessConnection::destroyPlugin):
(WebKit::WebProcessConnection::createPlugin):
* Shared/ActivityAssertion.cpp: Added.
(WebKit::ActivityAssertion::ActivityAssertion):
(WebKit::ActivityAssertion::~ActivityAssertion):
* Shared/ActivityAssertion.h: Added.
* Target.pri:
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/CMakeLists.txt (151479 => 151480)


--- trunk/Source/WebKit2/CMakeLists.txt	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/CMakeLists.txt	2013-06-12 01:12:27 UTC (rev 151480)
@@ -154,6 +154,7 @@
 
     Shared/APIClientTraits.cpp
     Shared/APIObject.cpp
+    Shared/ActivityAssertion.cpp
     Shared/CacheModel.cpp
     Shared/ChildProcess.cpp
     Shared/ChildProcessProxy.cpp

Modified: trunk/Source/WebKit2/ChangeLog (151479 => 151480)


--- trunk/Source/WebKit2/ChangeLog	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-12 01:12:27 UTC (rev 151480)
@@ -1,3 +1,29 @@
+2013-06-11  Oliver Hunt  <oli...@apple.com>
+
+        Make sure we aren't throttling plugin timers during initialisation and destruction
+        https://bugs.webkit.org/show_bug.cgi?id=117522
+
+        Reviewed by Darin Adler.
+
+        Add a new ActivityAssertion RAII class to handle allowing/disallowing
+        timer throttling.  Then make use of it during plugin initialisation
+        and destruction, as well as any synchronous messages (on the basis
+        that if another process is waiting for the plugin we shouldn't be
+        throttling timers).
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        (WebKit::WebProcessConnection::destroyPlugin):
+        (WebKit::WebProcessConnection::createPlugin):
+        * Shared/ActivityAssertion.cpp: Added.
+        (WebKit::ActivityAssertion::ActivityAssertion):
+        (WebKit::ActivityAssertion::~ActivityAssertion):
+        * Shared/ActivityAssertion.h: Added.
+        * Target.pri:
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2013-06-06  Timothy Hatcher  <timo...@apple.com>
 
         Update the framework bundle identifier for the Web Inspector.

Modified: trunk/Source/WebKit2/GNUmakefile.list.am (151479 => 151480)


--- trunk/Source/WebKit2/GNUmakefile.list.am	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/GNUmakefile.list.am	2013-06-12 01:12:27 UTC (rev 151480)
@@ -373,6 +373,8 @@
 	Source/WebKit2/Shared/API/c/WKUserContentURLPattern.h \
 	Source/WebKit2/Shared/APIObject.cpp \
 	Source/WebKit2/Shared/APIObject.h \
+	Source/WebKit2/Shared/ActivityAssertion.cpp \
+	Source/WebKit2/Shared/ActivityAssertion.h \
 	Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp \
 	Source/WebKit2/Shared/Authentication/AuthenticationManager.h \
 	Source/WebKit2/Shared/BlockingResponseMap.h \

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (151479 => 151480)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2013-06-12 01:12:27 UTC (rev 151480)
@@ -28,6 +28,7 @@
 
 #if ENABLE(PLUGIN_PROCESS)
 
+#include "ActivityAssertion.h"
 #include "ArgumentCoders.h"
 #include "ConnectionStack.h"
 #include "NPObjectMessageReceiverMessages.h"
@@ -140,6 +141,9 @@
 
 void WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)
 {
+    // Force all timers to run at full speed when processing a synchronous message
+    ActivityAssertion activityAssertion(PluginProcess::shared());
+
     ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::shared(), connection);
 
     uint64_t destinationID = decoder.destinationID();
@@ -176,6 +180,9 @@
 
 void WebProcessConnection::destroyPlugin(uint64_t pluginInstanceID, bool asynchronousCreationIncomplete)
 {
+    // Ensure we don't clamp any timers during destruction
+    ActivityAssertion activityAssertion(PluginProcess::shared());
+
     PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(pluginInstanceID);
     
     // If there is no PluginControllerProxy then this plug-in doesn't exist yet and we probably have nothing to do.
@@ -222,6 +229,9 @@
 
 void WebProcessConnection::createPlugin(const PluginCreationParameters& creationParameters, PassRefPtr<Messages::WebProcessConnection::CreatePlugin::DelayedReply> reply)
 {
+    // Ensure we don't clamp any timers during initialization
+    ActivityAssertion activityAssertion(PluginProcess::shared());
+
     PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(creationParameters.pluginInstanceID);
 
     // The controller proxy for the plug-in we're being asked to create synchronously might already exist if it was requested asynchronously before.

Added: trunk/Source/WebKit2/Shared/ActivityAssertion.cpp (0 => 151480)


--- trunk/Source/WebKit2/Shared/ActivityAssertion.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/ActivityAssertion.cpp	2013-06-12 01:12:27 UTC (rev 151480)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 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 "ActivityAssertion.h"
+
+#include "ChildProcess.h"
+
+namespace WebKit {
+
+ActivityAssertion::ActivityAssertion(ChildProcess& process)
+    : m_process(process)
+{
+    m_process.incrementActiveTaskCount();
+}
+
+ActivityAssertion::~ActivityAssertion()
+{
+    m_process.decrementActiveTaskCount();
+}
+
+}

Added: trunk/Source/WebKit2/Shared/ActivityAssertion.h (0 => 151480)


--- trunk/Source/WebKit2/Shared/ActivityAssertion.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/ActivityAssertion.h	2013-06-12 01:12:27 UTC (rev 151480)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2013 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 ActivityAssertion_h
+#define ActivityAssertion_h
+
+#include <wtf/Noncopyable.h>
+
+namespace WebKit {
+
+class ChildProcess;
+
+class ActivityAssertion {
+    WTF_MAKE_NONCOPYABLE(ActivityAssertion);
+public:
+    ActivityAssertion(ChildProcess&);
+    ~ActivityAssertion();
+
+private:
+    ChildProcess& m_process;
+};
+
+}
+
+#endif

Modified: trunk/Source/WebKit2/Target.pri (151479 => 151480)


--- trunk/Source/WebKit2/Target.pri	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/Target.pri	2013-06-12 01:12:27 UTC (rev 151480)
@@ -74,6 +74,7 @@
     Shared/Authentication/AuthenticationManager.h \
     Shared/ShareableBitmap.h \
     Shared/CacheModel.h \
+    Shared/ActivityAssertion.h \
     Shared/ChildProcess.h \
     Shared/ChildProcessProxy.h \
     Shared/ConnectionStack.h \
@@ -431,6 +432,7 @@
     Shared/API/c/qt/WKImageQt.cpp \
     Shared/APIClientTraits.cpp \
     Shared/APIObject.cpp \
+    Shared/ActivityAssertion.cpp \
     Shared/Authentication/AuthenticationManager.cpp \
     Shared/Plugins/Netscape/PluginInformation.cpp \
     Shared/Plugins/Netscape/NetscapePluginModule.cpp \

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (151479 => 151480)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-06-11 23:51:33 UTC (rev 151479)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-06-12 01:12:27 UTC (rev 151480)
@@ -626,6 +626,8 @@
 		9FB5F394169E6A80002C25BF /* WKContextPrivateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9FB5F392169E6A80002C25BF /* WKContextPrivateMac.mm */; };
 		9FB5F395169E6A80002C25BF /* WKContextPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A5EFD38C16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */; };
+		A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D792D41767CB0900881CBE /* ActivityAssertion.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B62E7310143047A60069EC35 /* WKHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B62E730F143047A60069EC35 /* WKHitTestResult.cpp */; };
 		B62E7312143047B00069EC35 /* WKHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = B62E7311143047B00069EC35 /* WKHitTestResult.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B63403F914910D57001070B5 /* APIObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B63403F814910D57001070B5 /* APIObject.cpp */; };
@@ -2113,6 +2115,8 @@
 		9FB5F393169E6A80002C25BF /* WKContextPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKContextPrivateMac.h; path = mac/WKContextPrivateMac.h; sourceTree = "<group>"; };
 		A5EFD38B16B0E88C00B2F0E8 /* WKPageVisibilityTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageVisibilityTypes.h; sourceTree = "<group>"; };
 		A72D5D7F1236CBA800A88B15 /* WebSerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSerializedScriptValue.h; sourceTree = "<group>"; };
+		A7D792D41767CB0900881CBE /* ActivityAssertion.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ActivityAssertion.h; sourceTree = "<group>"; };
+		A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActivityAssertion.cpp; sourceTree = "<group>"; };
 		B396EA5512E0ED2D00F4FEB7 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		B62E730F143047A60069EC35 /* WKHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKHitTestResult.cpp; sourceTree = "<group>"; };
 		B62E7311143047B00069EC35 /* WKHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKHitTestResult.h; sourceTree = "<group>"; };
@@ -3243,6 +3247,8 @@
 				51A8A60D1627F2AC000D90E9 /* Network */,
 				BCAF35E516CA253B00D4E9FC /* OfflineStorage */,
 				1AAE058C1279DCD400852418 /* Plugins */,
+				A7D792D41767CB0900881CBE /* ActivityAssertion.h */,
+				A7D792D51767CB6E00881CBE /* ActivityAssertion.cpp */,
 				1A3DD205125E5A2F004515E6 /* APIClient.h */,
 				5D51845313BCF9CC00C7FF4A /* APIClientTraits.cpp */,
 				5D51845413BCF9CC00C7FF4A /* APIClientTraits.h */,
@@ -5578,6 +5584,7 @@
 				BC1BE1E012D54A410004A228 /* WebGeolocationClient.h in Headers */,
 				BC0E5FE512D697160012A72A /* WebGeolocationManager.h in Headers */,
 				1AC5FFC2174BFD1B0001483D /* PluginProcessAttributes.h in Headers */,
+				A7D792D81767CCA300881CBE /* ActivityAssertion.h in Headers */,
 				BC0E606212D6BA910012A72A /* WebGeolocationManagerMessages.h in Headers */,
 				BC54CACB12D64291005C67B0 /* WebGeolocationManagerProxy.h in Headers */,
 				BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */,
@@ -6565,6 +6572,7 @@
 				5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
 				B878B616133428DC006888E9 /* CorrectionPanel.mm in Sources */,
 				2989A411167D1834004F96D2 /* CustomProtocolManagerMac.mm in Sources */,
+				A7D792D61767CB6E00881CBE /* ActivityAssertion.cpp in Sources */,
 				2984F588164BA095004BC0C6 /* CustomProtocolManagerMessageReceiver.cpp in Sources */,
 				29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */,
 				2984F57C164B915F004BC0C6 /* CustomProtocolManagerProxyMessageReceiver.cpp in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to