[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 15:17:32 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 62487c8f85a8dc92b5b19c39e7f19b940a807bb0
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 29 22:02:54 2010 +0000

    Add a MessageSender class template
    https://bugs.webkit.org/show_bug.cgi?id=48683
    
    Reviewed by Adam Roben.
    
    * Platform/CoreIPC/MessageSender.h: Added.
    (CoreIPC::MessageSender::send):
    Add send overloads for simple message sending.
    
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    Add MessageSender.h
    
    * WebProcess/WebPage/FindController.cpp:
    (WebKit::FindController::countStringMatches):
    (WebKit::FindController::findString):
    (WebKit::FindController::updateFindIndicator):
    Call send on the web page.
    
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::connection):
    Add connection(), used by the MessageSender.
    
    * WebProcess/WebPage/WebPage.h:
    (WebKit::WebPage::destinationID):
    Add destinationID(), used by the MessageSender.
    
    * win/WebKit2.vcproj:
    Add MessageSender.h
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 321e7a4..0d4310a 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,35 @@
+2010-10-29  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Add a MessageSender class template
+        https://bugs.webkit.org/show_bug.cgi?id=48683
+
+        * Platform/CoreIPC/MessageSender.h: Added.
+        (CoreIPC::MessageSender::send):
+        Add send overloads for simple message sending.
+
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add MessageSender.h
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::countStringMatches):
+        (WebKit::FindController::findString):
+        (WebKit::FindController::updateFindIndicator):
+        Call send on the web page.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::connection):
+        Add connection(), used by the MessageSender.
+        
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::destinationID):
+        Add destinationID(), used by the MessageSender.
+
+        * win/WebKit2.vcproj:
+        Add MessageSender.h
+
 2010-10-29  Adam Roben  <aroben at apple.com>
 
         Remove redundant data members from WebTouchEvent
diff --git a/WebKit2/Platform/CoreIPC/Connection.h b/WebKit2/Platform/CoreIPC/Connection.h
index 68378eb..25b8cee 100644
--- a/WebKit2/Platform/CoreIPC/Connection.h
+++ b/WebKit2/Platform/CoreIPC/Connection.h
@@ -58,7 +58,7 @@ enum SyncReplyMode {
     AutomaticReply,
     ManualReply
 };
-    
+
 class Connection : public ThreadSafeShared<Connection> {
 public:
     class MessageReceiver {
diff --git a/WebKit2/Platform/CoreIPC/MessageSender.h b/WebKit2/Platform/CoreIPC/MessageSender.h
new file mode 100644
index 0000000..0866c28
--- /dev/null
+++ b/WebKit2/Platform/CoreIPC/MessageSender.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2010 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 MessageSender_h
+#define MessageSender_h
+
+#include <wtf/Assertions.h>
+
+namespace CoreIPC {
+
+class Connection;
+    
+template<typename T> class MessageSender {
+public:
+    template<typename U> bool send(const U& message, uint64_t destinationID)
+    {
+        Connection* connection = static_cast<T*>(this)->connection();
+        ASSERT(connection);
+
+        return connection->send(message, destinationID);
+    }
+
+    template<typename U> bool send(const U& message)
+    {
+        return send(message, static_cast<T*>(this)->destinationID());
+    }
+};
+
+} // namespace CoreIPC
+
+#endif // MessageSender_h
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 77f95a7..db898ca 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -174,6 +174,7 @@ HEADERS += \
     Platform/CoreIPC/DataReference.h \
     Platform/CoreIPC/HandleMessage.h \
     Platform/CoreIPC/MessageID.h \
+    Platform/CoreIPC/MessageSender.h \
     Platform/Logging.h \
     Platform/Module.h \
     Platform/PlatformProcessIdentifier.h \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index a9b8417..752c23f 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -68,6 +68,7 @@
 		1A0F29CC120B37160053D1B9 /* VisitedLinkTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */; };
 		1A0F29E3120B44420053D1B9 /* VisitedLinkProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */; };
 		1A0F29E4120B44420053D1B9 /* VisitedLinkProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */; };
+		1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A119A94127B796200A9ECB1 /* MessageSender.h */; };
 		1A1C4EC810D06099005E67E7 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1C79A100E7FC50078DEBC /* WebCore.framework */; };
 		1A1C649B11F4174200553C19 /* WebContextMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A1C648611F415B700553C19 /* WebContextMac.mm */; };
 		1A1FA253127A0E4F0050E709 /* NPRemoteObjectMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */; };
@@ -564,6 +565,7 @@
 		1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkTable.h; sourceTree = "<group>"; };
 		1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisitedLinkProvider.cpp; sourceTree = "<group>"; };
 		1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkProvider.h; sourceTree = "<group>"; };
+		1A119A94127B796200A9ECB1 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageSender.h; sourceTree = "<group>"; };
 		1A1C648611F415B700553C19 /* WebContextMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMac.mm; sourceTree = "<group>"; };
 		1A1FA251127A0E4F0050E709 /* NPRemoteObjectMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPRemoteObjectMap.h; sourceTree = "<group>"; };
 		1A1FA252127A0E4F0050E709 /* NPRemoteObjectMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRemoteObjectMap.cpp; sourceTree = "<group>"; };
@@ -1353,6 +1355,7 @@
 				BC131BC811726C2800B69727 /* CoreIPCMessageKinds.h */,
 				C0CE72AC1247E78D00BC0EC4 /* HandleMessage.h */,
 				BC032DA410F437D10058C15A /* MessageID.h */,
+				1A119A94127B796200A9ECB1 /* MessageSender.h */,
 			);
 			path = CoreIPC;
 			sourceTree = "<group>";
@@ -2215,6 +2218,7 @@
 				935EEBA4127761D6003322B8 /* InjectedBundleBackForwardListItem.h in Headers */,
 				1A616150127798B5003ACD86 /* DownloadManager.h in Headers */,
 				1A6161D41278981C003ACD86 /* Download.h in Headers */,
+				1A119A95127B796200A9ECB1 /* MessageSender.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index bdf9ba9..9234ac6 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -53,7 +53,7 @@ void FindController::countStringMatches(const String& string, bool caseInsensiti
     unsigned matchCount = m_webPage->corePage()->markAllMatchesForText(string, caseInsensitive ? TextCaseInsensitive : TextCaseSensitive, false, maxMatchCount);
     m_webPage->corePage()->unmarkAllTextMatches();
 
-    WebProcess::shared().connection()->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount), m_webPage->pageID());
+    m_webPage->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount));
 }
 
 static Frame* frameWithSelection(Page* page)
@@ -99,7 +99,7 @@ void FindController::findString(const String& string, FindDirection findDirectio
                 matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
             }
 
-            WebProcess::shared().connection()->send(Messages::WebPageProxy::DidFindString(string, matchCount), m_webPage->pageID());
+            m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount));
         }
 
         if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) {
@@ -179,7 +179,7 @@ bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOve
         textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     }            
     
-    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle, !isShowingOverlay), m_webPage->pageID());
+    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle, !isShowingOverlay));
     m_isShowingFindIndicator = true;
 
     return true;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 5e53a93..e5d8fad 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -153,6 +153,11 @@ WebPage::~WebPage()
 #endif
 }
 
+CoreIPC::Connection* WebPage::connection() const
+{
+    return WebProcess::shared().connection();
+}
+
 void WebPage::initializeInjectedBundleEditorClient(WKBundlePageEditorClient* client)
 {
     m_editorClient.initialize(client);
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 0b8cb88..8c0c58e 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -33,6 +33,7 @@
 #include "InjectedBundlePageFormClient.h"
 #include "InjectedBundlePageLoaderClient.h"
 #include "InjectedBundlePageUIClient.h"
+#include "MessageSender.h"
 #include "Plugin.h"
 #include "WebEditCommand.h"
 #include <WebCore/FrameLoaderTypes.h>
@@ -82,14 +83,17 @@ struct WebPreferencesStore;
 class WebTouchEvent;
 #endif
 
-class WebPage : public APIObject {
+class WebPage : public APIObject, public CoreIPC::MessageSender<WebPage> {
 public:
     static const Type APIType = TypeBundlePage;
 
     static PassRefPtr<WebPage> create(uint64_t pageID, const WebPageCreationParameters&);
-
     virtual ~WebPage();
 
+    // Used by MessageSenderWithDestinationID.
+    CoreIPC::Connection* connection() const;
+    uint64_t destinationID() const { return pageID(); }
+
     void close();
 
     WebCore::Page* corePage() const { return m_page.get(); }
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index a258d3e..21c9bbd 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -2247,6 +2247,10 @@
 					RelativePath="..\Platform\CoreIPC\MessageID.h"
 					>
 				</File>
+				<File
+					RelativePath="..\Platform\CoreIPC\MessageSender.h"
+					>
+				</File>
 				<Filter
 					Name="win"
 					>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list