Title: [186095] trunk/Source/WebKit2
Revision
186095
Author
ander...@apple.com
Date
2015-06-29 16:46:27 -0700 (Mon, 29 Jun 2015)

Log Message

Get rid of ConnectionStack
https://bugs.webkit.org/show_bug.cgi?id=146437

Reviewed by Andreas Kling.

Just use a TemporaryChange and a static variable instead.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
* PluginProcess/WebProcessConnection.cpp:
(WebKit::WebProcessConnection::setGlobalException):
(WebKit::WebProcessConnection::didReceiveMessage):
(WebKit::WebProcessConnection::didReceiveSyncMessage):
* Shared/ConnectionStack.cpp: Removed.
(WebKit::ConnectionStack::singleton): Deleted.
* Shared/ConnectionStack.h: Removed.
(WebKit::ConnectionStack::current): Deleted.
(WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher): Deleted.
(WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher): Deleted.
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (186094 => 186095)


--- trunk/Source/WebKit2/ChangeLog	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-29 23:46:27 UTC (rev 186095)
@@ -1,3 +1,25 @@
+2015-06-29  Anders Carlsson  <ander...@apple.com>
+
+        Get rid of ConnectionStack
+        https://bugs.webkit.org/show_bug.cgi?id=146437
+
+        Reviewed by Andreas Kling.
+
+        Just use a TemporaryChange and a static variable instead.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        * PluginProcess/WebProcessConnection.cpp:
+        (WebKit::WebProcessConnection::setGlobalException):
+        (WebKit::WebProcessConnection::didReceiveMessage):
+        (WebKit::WebProcessConnection::didReceiveSyncMessage):
+        * Shared/ConnectionStack.cpp: Removed.
+        (WebKit::ConnectionStack::singleton): Deleted.
+        * Shared/ConnectionStack.h: Removed.
+        (WebKit::ConnectionStack::current): Deleted.
+        (WebKit::ConnectionStack::CurrentConnectionPusher::CurrentConnectionPusher): Deleted.
+        (WebKit::ConnectionStack::CurrentConnectionPusher::~CurrentConnectionPusher): Deleted.
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2015-06-29  Tim Horton  <timothy_hor...@apple.com>
 
         Fix the build.

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (186094 => 186095)


--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2015-06-29 23:46:27 UTC (rev 186095)
@@ -28,7 +28,6 @@
 
 #if ENABLE(NETWORK_PROCESS)
 
-#include "ConnectionStack.h"
 #include "NetworkBlobRegistry.h"
 #include "NetworkConnectionToWebProcessMessages.h"
 #include "NetworkProcess.h"

Modified: trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp (186094 => 186095)


--- trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/PluginProcess/WebProcessConnection.cpp	2015-06-29 23:46:27 UTC (rev 186095)
@@ -30,7 +30,6 @@
 
 #include "ActivityAssertion.h"
 #include "ArgumentCoders.h"
-#include "ConnectionStack.h"
 #include "NPObjectMessageReceiverMessages.h"
 #include "NPRemoteObjectMap.h"
 #include "PluginControllerProxy.h"
@@ -41,11 +40,14 @@
 #include "WebProcessConnectionMessages.h"
 #include <unistd.h>
 #include <wtf/RunLoop.h>
+#include <wtf/TemporaryChange.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
+static IPC::Connection* currentConnection;
+
 RefPtr<WebProcessConnection> WebProcessConnection::create(IPC::Connection::Identifier connectionIdentifier)
 {
     return adoptRef(*new WebProcessConnection(connectionIdentifier));
@@ -111,16 +113,15 @@
 
 void WebProcessConnection::setGlobalException(const String& exceptionString)
 {
-    IPC::Connection* connection = ConnectionStack::singleton().current();
-    if (!connection)
+    if (!currentConnection)
         return;
 
-    connection->sendSync(Messages::PluginProcessConnection::SetException(exceptionString), Messages::PluginProcessConnection::SetException::Reply(), 0);
+    currentConnection->sendSync(Messages::PluginProcessConnection::SetException(exceptionString), Messages::PluginProcessConnection::SetException::Reply(), 0);
 }
 
 void WebProcessConnection::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
 {
-    ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::singleton(), &connection);
+    TemporaryChange<IPC::Connection*> currentConnectionChange(currentConnection, &connection);
 
     if (decoder.messageReceiverName() == Messages::WebProcessConnection::messageReceiverName()) {
         didReceiveWebProcessConnectionMessage(connection, decoder);
@@ -142,7 +143,7 @@
 
 void WebProcessConnection::didReceiveSyncMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder, std::unique_ptr<IPC::MessageEncoder>& replyEncoder)
 {
-    ConnectionStack::CurrentConnectionPusher currentConnection(ConnectionStack::singleton(), &connection);
+    TemporaryChange<IPC::Connection*> currentConnectionChange(currentConnection, &connection);
 
     uint64_t destinationID = decoder.destinationID();
 

Deleted: trunk/Source/WebKit2/Shared/ConnectionStack.cpp (186094 => 186095)


--- trunk/Source/WebKit2/Shared/ConnectionStack.cpp	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/Shared/ConnectionStack.cpp	2015-06-29 23:46:27 UTC (rev 186095)
@@ -1,39 +0,0 @@
-/*
- * 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"
-
-#include <wtf/NeverDestroyed.h>
-
-namespace WebKit {
-
-ConnectionStack& ConnectionStack::singleton()
-{
-    static NeverDestroyed<ConnectionStack> connectionStack;
-    return connectionStack;
-}
-
-} // namespace WebKit

Deleted: trunk/Source/WebKit2/Shared/ConnectionStack.h (186094 => 186095)


--- trunk/Source/WebKit2/Shared/ConnectionStack.h	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/Shared/ConnectionStack.h	2015-06-29 23:46:27 UTC (rev 186095)
@@ -1,79 +0,0 @@
-/*
- * 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 IPC {
-    class Connection;
-}
-
-namespace WebKit {
-
-class ConnectionStack {
-public:
-    static ConnectionStack& singleton();
-
-    IPC::Connection* current()
-    {
-        return m_connectionStack.last();
-    }
-
-    class CurrentConnectionPusher {
-    public:
-        CurrentConnectionPusher(ConnectionStack& connectionStack, IPC::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
-        IPC::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<IPC::Connection*, 4> m_connectionStack;
-};
-
-} // namespace WebKit
-
-#endif // ConnectionStack_h

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (186094 => 186095)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-06-29 23:14:45 UTC (rev 186094)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2015-06-29 23:46:27 UTC (rev 186095)
@@ -898,8 +898,6 @@
 		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 */; };
 		513A163C163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513A163A163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp */; };
 		513A163D163088F6005D7D22 /* NetworkProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 513A163B163088F6005D7D22 /* NetworkProcessProxyMessages.h */; };
 		513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */; };
@@ -3058,8 +3056,6 @@
 		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>"; };
 		513A163A163088F6005D7D22 /* NetworkProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkProcessProxyMessageReceiver.cpp; sourceTree = "<group>"; };
 		513A163B163088F6005D7D22 /* NetworkProcessProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessProxyMessages.h; sourceTree = "<group>"; };
 		513A16491630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkConnectionToWebProcess.cpp; path = NetworkProcess/NetworkConnectionToWebProcess.cpp; sourceTree = "<group>"; };
@@ -4675,8 +4671,6 @@
 				E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
 				290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */,
 				1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
-				5136183B163126DA00A99DDE /* ConnectionStack.cpp */,
-				5136183C163126DA00A99DDE /* ConnectionStack.h */,
 				5106D7BF18BDBE73000AB166 /* ContextMenuContextData.cpp */,
 				5106D7C018BDBE73000AB166 /* ContextMenuContextData.h */,
 				BCE81D96131AE02000241910 /* DictionaryPopupInfo.cpp */,
@@ -7603,7 +7597,6 @@
 				37BEC4E119491486008B4286 /* CompletionHandlerCallChecker.h in Headers */,
 				37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
 				BC032DAB10F437D10058C15A /* Connection.h in Headers */,
-				5136183E163126DA00A99DDE /* ConnectionStack.h in Headers */,
 				5106D7C418BDBE73000AB166 /* ContextMenuContextData.h in Headers */,
 				CDC3830C17212282008A2FC3 /* CookieStorageShimLibrary.h in Headers */,
 				CE1A0BD31A48E6C60054EF74 /* CorePDFSPI.h in Headers */,
@@ -9391,7 +9384,6 @@
 				37BEC4E019491486008B4286 /* CompletionHandlerCallChecker.mm in Sources */,
 				BC032DAA10F437D10058C15A /* Connection.cpp in Sources */,
 				1A30EAC6115D7DA30053E937 /* ConnectionMac.mm in Sources */,
-				5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
 				5106D7C218BDBE73000AB166 /* ContextMenuContextData.cpp in Sources */,
 				CDC3831017212440008A2FC3 /* CookieStorageShim.mm in Sources */,
 				B878B616133428DC006888E9 /* CorrectionPanel.mm in Sources */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to