Title: [131861] trunk/Source/WebKit2
Revision
131861
Author
[email protected]
Date
2012-10-18 23:34:07 -0700 (Thu, 18 Oct 2012)

Log Message

Move ConnectionStack out of WebProcessConnection into its own files.
https://bugs.webkit.org/show_bug.cgi?id=99813

Reviewed by Andreas Kling.

ConnectionStack will need to be used in a few upcoming areas, so it needs to be in its own header and implementation files.

Project file stuff:
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebKit2.xcodeproj/project.pbxproj:

Move it from here:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::setGlobalException):
(WebKit::WebProcessConnection::didReceiveMessage):
(WebKit::WebProcessConnection::didReceiveSyncMessage):

Into here:
* Shared/ConnectionStack.cpp: Added.
(WebKit):
(WebKit::ConnectionStack::shared):
* Shared/ConnectionStack.h: Added.
(CoreIPC):
(WebKit):
(ConnectionStack):
(WebKit::ConnectionStack::current):
(CurrentConnectionPusher):
(WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher):
(WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/CMakeLists.txt (131860 => 131861)


--- trunk/Source/WebKit2/CMakeLists.txt	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/CMakeLists.txt	2012-10-19 06:34:07 UTC (rev 131861)
@@ -136,6 +136,7 @@
     Shared/APIClientTraits.cpp
     Shared/APIObject.cpp
     Shared/ChildProcess.cpp
+    Shared/ConnectionStack.cpp
     Shared/DictionaryPopupInfo.cpp
     Shared/EditorState.cpp
     Shared/FontInfo.cpp

Modified: trunk/Source/WebKit2/ChangeLog (131860 => 131861)


--- trunk/Source/WebKit2/ChangeLog	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-19 06:34:07 UTC (rev 131861)
@@ -1,3 +1,37 @@
+2012-10-18  Brady Eidson  <[email protected]>
+
+        Move ConnectionStack out of WebProcessConnection into its own files.
+        https://bugs.webkit.org/show_bug.cgi?id=99813
+
+        Reviewed by Andreas Kling.
+
+        ConnectionStack will need to be used in a few upcoming areas, so it needs to be in its own header and implementation files.
+
+        Project file stuff:
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebKit2.xcodeproj/project.pbxproj:
+
+        Move it from here:
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::setGlobalException):
+        (WebKit::WebProcessConnection::didReceiveMessage):
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+
+        Into here:
+        * Shared/ConnectionStack.cpp: Added.
+        (WebKit):
+        (WebKit::ConnectionStack::shared):
+        * Shared/ConnectionStack.h: Added.
+        (CoreIPC):
+        (WebKit):
+        (ConnectionStack):
+        (WebKit::ConnectionStack::current):
+        (CurrentConnectionPusher):
+        (WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher):
+        (WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher):
+
 2012-10-18  Eunmi Lee  <[email protected]>
 
         [EFL][WK2] Move ewk_{init,shutdown}() to the main() function of EFL API test.

Modified: trunk/Source/WebKit2/GNUmakefile.list.am (131860 => 131861)


--- trunk/Source/WebKit2/GNUmakefile.list.am	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/GNUmakefile.list.am	2012-10-19 06:34:07 UTC (rev 131861)
@@ -368,6 +368,8 @@
 	Source/WebKit2/Shared/ChildProcess.cpp \
 	Source/WebKit2/Shared/ChildProcess.h \
 	Source/WebKit2/Shared/CommandLine.h \
+	Source/WebKit2/Shared/ConnectionStack.cpp \
+	Source/WebKit2/Shared/ConnectionStack.h \
 	Source/WebKit2/Shared/CoreIPCSupport/WebConnectionMessageKinds.h \
 	Source/WebKit2/Shared/CoreIPCSupport/WebContextMessageKinds.h \
 	Source/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h \
@@ -1259,6 +1261,8 @@
 	Source/WebKit2/PluginProcess/unix/PluginProcessUnix.cpp \
 	Source/WebKit2/Shared/ChildProcess.cpp \
 	Source/WebKit2/Shared/ChildProcess.h \
+	Source/WebKit2/Shared/ConnectionStack.cpp \
+	Source/WebKit2/Shared/ConnectionStack.h \
 	Source/WebKit2/Shared/ProcessExecutablePath.h \
 	Source/WebKit2/Shared/Plugins/NPIdentifierData.cpp \
 	Source/WebKit2/Shared/Plugins/NPIdentifierData.h \

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (131860 => 131861)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2012-10-19 06:34:07 UTC (rev 131861)
@@ -29,6 +29,7 @@
 #if ENABLE(PLUGIN_PROCESS)
 
 #include "ArgumentCoders.h"
+#include "ConnectionStack.h"
 #include "NPRemoteObjectMap.h"
 #include "PluginControllerProxy.h"
 #include "PluginCreationParameters.h"
@@ -42,51 +43,6 @@
 
 namespace WebKit {
 
-class ConnectionStack {
-public:
-    CoreIPC::Connection* current()
-    {
-        return m_connectionStack.last();
-    }
-
-    class CurrentConnectionPusher {
-    public:
-        CurrentConnectionPusher(ConnectionStack& connectionStack, CoreIPC::Connection* connection)
-            : m_connectionStack(connectionStack)
-#if !ASSERT_DISABLED
-            , m_connection(connection)
-#endif
-        {
-            m_connectionStack.m_connectionStack.append(connection);
-        }
-
-        ~CurrentConnectionPusher()
-        {
-            ASSERT(m_connectionStack.current() == m_connection);
-            m_connectionStack.m_connectionStack.removeLast();
-        }
-
-    private:
-        ConnectionStack& m_connectionStack;
-#if !ASSERT_DISABLED
-        CoreIPC::Connection* m_connection;
-#endif
-    };
-
-private:
-    // It's OK for these to be weak pointers because we only push object on the stack
-    // from within didReceiveMessage and didReceiveSyncMessage and the Connection objects are
-    // already ref'd for the duration of those functions.
-    Vector<CoreIPC::Connection*, 4> m_connectionStack;
-};
-
-static ConnectionStack& connectionStack()
-{
-    DEFINE_STATIC_LOCAL(ConnectionStack, connectionStack, ());
-
-    return connectionStack;
-}
-
 PassRefPtr<WebProcessConnection> WebProcessConnection::create(CoreIPC::Connection::Identifier connectionIdentifier)
 {
     return adoptRef(new WebProcessConnection(connectionIdentifier));
@@ -151,7 +107,7 @@
 
 void WebProcessConnection::setGlobalException(const String& exceptionString)
 {
-    CoreIPC::Connection* connection = connectionStack().current();
+    CoreIPC::Connection* connection = ConnectionStack::shared().current();
     if (!connection)
         return;
 
@@ -160,7 +116,7 @@
 
 void WebProcessConnection::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
 {
-    ConnectionStack::CurrentConnectionPusher currentConnection(connectionStack(), connection);
+    ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::shared(), connection);
 
     if (messageID.is<CoreIPC::MessageClassWebProcessConnection>()) {
         didReceiveWebProcessConnectionMessage(connection, messageID, decoder);
@@ -182,7 +138,7 @@
 
 void WebProcessConnection::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)
 {
-    ConnectionStack::CurrentConnectionPusher currentConnection(connectionStack(), connection);
+    ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::shared(), connection);
 
     uint64_t destinationID = decoder.destinationID();
 

Added: trunk/Source/WebKit2/Shared/ConnectionStack.cpp (0 => 131861)


--- trunk/Source/WebKit2/Shared/ConnectionStack.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/ConnectionStack.cpp	2012-10-19 06:34:07 UTC (rev 131861)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 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 "ConnectionStack.h"
+
+namespace WebKit {
+
+ConnectionStack& ConnectionStack::shared()
+{
+    DEFINE_STATIC_LOCAL(ConnectionStack, connectionStack, ());
+
+    return connectionStack;
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit2/Shared/ConnectionStack.h (0 => 131861)


--- trunk/Source/WebKit2/Shared/ConnectionStack.h	                        (rev 0)
+++ trunk/Source/WebKit2/Shared/ConnectionStack.h	2012-10-19 06:34:07 UTC (rev 131861)
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 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 ConnectionStack_h
+#define ConnectionStack_h
+
+#include <wtf/Vector.h>
+
+namespace CoreIPC {
+    class Connection;
+}
+
+namespace WebKit {
+
+class ConnectionStack {
+public:
+    static ConnectionStack& shared();
+
+    CoreIPC::Connection* current()
+    {
+        return m_connectionStack.last();
+    }
+
+    class CurrentConnectionPusher {
+    public:
+        CurrentConnectionPusher(ConnectionStack& connectionStack, CoreIPC::Connection* connection)
+            : m_connectionStack(connectionStack)
+#if !ASSERT_DISABLED
+            , m_connection(connection)
+#endif
+        {
+            m_connectionStack.m_connectionStack.append(connection);
+        }
+
+        ~CurrentConnectionPusher()
+        {
+            ASSERT(m_connectionStack.current() == m_connection);
+            m_connectionStack.m_connectionStack.removeLast();
+        }
+
+    private:
+        ConnectionStack& m_connectionStack;
+#if !ASSERT_DISABLED
+        CoreIPC::Connection* m_connection;
+#endif
+    };
+
+private:
+    // It's OK for these to be weak pointers because we only push object on the stack
+    // from within didReceiveMessage and didReceiveSyncMessage and the Connection objects are
+    // already ref'd for the duration of those functions.
+    Vector<CoreIPC::Connection*, 4> m_connectionStack;
+};
+
+} // namespace WebKit
+
+#endif // ConnectionStack_h

Modified: trunk/Source/WebKit2/Target.pri (131860 => 131861)


--- trunk/Source/WebKit2/Target.pri	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/Target.pri	2012-10-19 06:34:07 UTC (rev 131861)
@@ -73,6 +73,7 @@
     Shared/ShareableSurface.h \
     Shared/CacheModel.h \
     Shared/ChildProcess.h \
+    Shared/ConnectionStack.h \
     Shared/DictionaryPopupInfo.h \
     Shared/EditorState.h \
     Shared/FontInfo.h \
@@ -441,6 +442,7 @@
     Shared/Plugins/PluginModuleInfo.cpp \
     Shared/Plugins/PluginProcessCreationParameters.cpp \
     Shared/ChildProcess.cpp \
+    Shared/ConnectionStack.cpp \
     Shared/DictionaryPopupInfo.cpp \
     Shared/EditorState.cpp \
     Shared/FontInfo.cpp \

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (131860 => 131861)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-10-19 06:23:09 UTC (rev 131860)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2012-10-19 06:34:07 UTC (rev 131861)
@@ -406,6 +406,8 @@
 		512F58FA12A88A5400629530 /* WKCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F212A88A5400629530 /* WKCredential.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		512F58FB12A88A5400629530 /* WKProtectionSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 512F58F312A88A5400629530 /* WKProtectionSpace.cpp */; };
 		512F58FC12A88A5400629530 /* WKProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 512F58F412A88A5400629530 /* WKProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5136183B163126DA00A99DDE /* ConnectionStack.cpp */; };
+		5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 5136183C163126DA00A99DDE /* ConnectionStack.h */; };
 		5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */; };
 		5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */; };
 		51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
@@ -1569,6 +1571,8 @@
 		512F58F212A88A5400629530 /* WKCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKCredential.h; sourceTree = "<group>"; };
 		512F58F312A88A5400629530 /* WKProtectionSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKProtectionSpace.cpp; sourceTree = "<group>"; };
 		512F58F412A88A5400629530 /* WKProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProtectionSpace.h; sourceTree = "<group>"; };
+		5136183B163126DA00A99DDE /* ConnectionStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectionStack.cpp; sourceTree = "<group>"; };
+		5136183C163126DA00A99DDE /* ConnectionStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectionStack.h; sourceTree = "<group>"; };
 		5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageContextMenuClient.cpp; sourceTree = "<group>"; };
 		5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageContextMenuClient.h; sourceTree = "<group>"; };
 		51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
@@ -2611,6 +2615,8 @@
 				1A2D956E12848564001EB962 /* ChildProcess.cpp */,
 				1A2D956D12848564001EB962 /* ChildProcess.h */,
 				1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
+				5136183B163126DA00A99DDE /* ConnectionStack.cpp */,
+				5136183C163126DA00A99DDE /* ConnectionStack.h */,
 				BCE81D96131AE02000241910 /* DictionaryPopupInfo.cpp */,
 				BCE81D97131AE02100241910 /* DictionaryPopupInfo.h */,
 				C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
@@ -4691,6 +4697,7 @@
 				29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */,
 				1A2328FF162C866A00D82F7A /* MessageEncoder.h in Headers */,
 				1A232903162C867300D82F7A /* MessageDecoder.h in Headers */,
+				5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -5636,6 +5643,7 @@
 				E1EDFE151628DD7A0039ECDA /* SharedWorkerProcessProxy.cpp in Sources */,
 				1A2328FE162C866A00D82F7A /* MessageEncoder.cpp in Sources */,
 				1A232902162C867300D82F7A /* MessageDecoder.cpp in Sources */,
+				5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to