[Chromium] Move createMessagePortChannel to Platform.h
authorpilgrim@chromium.org <pilgrim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 May 2012 02:30:09 +0000 (02:30 +0000)
committerpilgrim@chromium.org <pilgrim@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 May 2012 02:30:09 +0000 (02:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85764

Reviewed by Adam Barth.

Part of a refactoring series. See tracking bug 82948.

Source/Platform:

* Platform.gypi:
* chromium/public/Platform.h:
(WebKit):
(Platform):
(WebKit::Platform::createMessagePortChannel):
* chromium/public/WebMessagePortChannel.h: Added.
(WebKit):
(WebMessagePortChannel):
(WebKit::WebMessagePortChannel::~WebMessagePortChannel):
* chromium/public/WebMessagePortChannelClient.h: Added.
(WebKit):
(WebMessagePortChannelClient):
(WebKit::WebMessagePortChannelClient::~WebMessagePortChannelClient):

Source/WebKit/chromium:

* WebKit.gyp:
* public/WebMessagePortChannel.h:
* public/platform/WebKitPlatformSupport.h:
(WebKit):
(WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
* src/PlatformMessagePortChannel.cpp:
(WebCore::PlatformMessagePortChannel::PlatformMessagePortChannel):
* src/PlatformMessagePortChannel.h:
* src/SharedWorkerRepository.cpp:
* src/WebSharedWorkerImpl.cpp:
* src/WebWorkerClientImpl.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117204 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/Platform/ChangeLog
Source/Platform/Platform.gypi
Source/Platform/chromium/public/Platform.h
Source/Platform/chromium/public/WebMessagePortChannel.h [new file with mode: 0644]
Source/Platform/chromium/public/WebMessagePortChannelClient.h [new file with mode: 0644]
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/public/WebMessagePortChannel.h
Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h
Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp
Source/WebKit/chromium/src/PlatformMessagePortChannel.h
Source/WebKit/chromium/src/SharedWorkerRepository.cpp
Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp
Source/WebKit/chromium/src/WebWorkerClientImpl.cpp

index 570b93c..0d282b0 100644 (file)
@@ -1,5 +1,28 @@
 2012-05-15  Mark Pilgrim  <pilgrim@chromium.org>
 
+        [Chromium] Move createMessagePortChannel to Platform.h
+        https://bugs.webkit.org/show_bug.cgi?id=85764
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * Platform.gypi:
+        * chromium/public/Platform.h:
+        (WebKit):
+        (Platform):
+        (WebKit::Platform::createMessagePortChannel):
+        * chromium/public/WebMessagePortChannel.h: Added.
+        (WebKit):
+        (WebMessagePortChannel):
+        (WebKit::WebMessagePortChannel::~WebMessagePortChannel):
+        * chromium/public/WebMessagePortChannelClient.h: Added.
+        (WebKit):
+        (WebMessagePortChannelClient):
+        (WebKit::WebMessagePortChannelClient::~WebMessagePortChannelClient):
+
+2012-05-15  Mark Pilgrim  <pilgrim@chromium.org>
+
         [Chromium] Move blobRegistry to Platform.h
         https://bugs.webkit.org/show_bug.cgi?id=85765
 
index 59cafb5..4bf280c 100644 (file)
@@ -72,6 +72,8 @@
             'chromium/public/WebMediaStreamDescriptor.h',
             'chromium/public/WebMediaStreamSource.h',
             'chromium/public/WebMediaStreamSourcesRequest.h',
+            'chromium/public/WebMessagePortChannel.h',
+            'chromium/public/WebMessagePortChannelClient.h',
             'chromium/public/WebMimeRegistry.h',
             'chromium/public/WebNonCopyable.h',
             'chromium/public/WebPeerConnection00Handler.h',
index 7bc8523..b574a79 100644 (file)
@@ -46,6 +46,7 @@ class WebClipboard;
 class WebFileSystem;
 class WebMediaStreamCenter;
 class WebMediaStreamCenterClient;
+class WebMessagePortChannel;
 class WebMimeRegistry;
 class WebPeerConnection00Handler;
 class WebPeerConnection00HandlerClient;
@@ -134,6 +135,13 @@ public:
     virtual size_t highUsageDeltaMB() { return 128; }
 
 
+    // Message Ports -------------------------------------------------------
+
+    // Creates a Message Port Channel. This can be called on any thread.
+    // The returned object should only be used on the thread it was created on.
+    virtual WebMessagePortChannel* createMessagePortChannel() { return 0; }
+
+
     // Network -------------------------------------------------------------
 
     // Returns a new WebURLLoader instance.
diff --git a/Source/Platform/chromium/public/WebMessagePortChannel.h b/Source/Platform/chromium/public/WebMessagePortChannel.h
new file mode 100644 (file)
index 0000000..88c1809
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 WebMessagePortChannel_h
+#define WebMessagePortChannel_h
+
+#include "WebCommon.h"
+#include "WebVector.h"
+
+namespace WebKit {
+
+class WebMessagePortChannelClient;
+class WebString;
+
+typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray;
+
+// Provides an interface to a Message Port Channel implementation. The object owns itself and
+// is signalled that its not needed anymore with the destroy() call.
+class WebMessagePortChannel {
+public:
+    virtual void setClient(WebMessagePortChannelClient*) = 0;
+    virtual void destroy() = 0;
+    // WebKit versions of WebCore::MessagePortChannel.
+    virtual void entangle(WebMessagePortChannel*) = 0;
+    // Callee receives ownership of the passed vector.
+    virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0;
+    virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0;
+
+protected:
+    ~WebMessagePortChannel() { }
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/Source/Platform/chromium/public/WebMessagePortChannelClient.h b/Source/Platform/chromium/public/WebMessagePortChannelClient.h
new file mode 100644 (file)
index 0000000..07ef9c9
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 Google 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 WebMessagePortChannelClient_h
+#define WebMessagePortChannelClient_h
+
+namespace WebKit {
+
+// Provides an interface for users of WebMessagePortChannel to be notified
+// when messages are available.
+class WebMessagePortChannelClient {
+public:
+    // Alerts that new messages have arrived, which are retrieved by calling
+    // WebMessagePortChannel::tryGetMessage. Note that this may be called
+    // on any thread.
+    virtual void messageAvailable() = 0;
+
+protected:
+    ~WebMessagePortChannelClient() { }
+};
+
+} // namespace WebKit
+
+#endif
index ecc327e..63dd6d2 100644 (file)
@@ -1,3 +1,24 @@
+2012-05-15  Mark Pilgrim  <pilgrim@chromium.org>
+
+        [Chromium] Move createMessagePortChannel to Platform.h
+        https://bugs.webkit.org/show_bug.cgi?id=85764
+
+        Reviewed by Adam Barth.
+
+        Part of a refactoring series. See tracking bug 82948.
+
+        * WebKit.gyp:
+        * public/WebMessagePortChannel.h:
+        * public/platform/WebKitPlatformSupport.h:
+        (WebKit):
+        (WebKit::WebKitPlatformSupport::injectIDBKeyIntoSerializedValue):
+        * src/PlatformMessagePortChannel.cpp:
+        (WebCore::PlatformMessagePortChannel::PlatformMessagePortChannel):
+        * src/PlatformMessagePortChannel.h:
+        * src/SharedWorkerRepository.cpp:
+        * src/WebSharedWorkerImpl.cpp:
+        * src/WebWorkerClientImpl.cpp:
+
 2012-05-15  Fady Samuel  <fsamuel@chromium.org>
 
         [Chromium] Reset ScriptInstance in HTMLPlugInElement on WebPluginContainerImpl::setPlugin
index 1bb3b57..3436028 100644 (file)
                 'public/WebMediaPlayerClient.h',
                 'public/WebMediaStreamRegistry.h',
                 'public/WebMenuItemInfo.h',
-                'public/WebMessagePortChannel.h',
-                'public/WebMessagePortChannelClient.h',
                 'public/WebNavigationType.h',
                 'public/WebNetworkStateNotifier.h',
                 'public/WebNode.h',
index cd7cfd4..d1a7168 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebMessagePortChannel_h
-#define WebMessagePortChannel_h
-
-#include "platform/WebCommon.h"
-#include "platform/WebVector.h"
-
-namespace WebKit {
-
-class WebMessagePortChannelClient;
-class WebString;
-
-typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray;
-
-// Provides an interface to a Message Port Channel implementation.  The object owns itself and
-// is signalled that its not needed anymore with the destroy() call.
-class WebMessagePortChannel {
-public:
-    virtual void setClient(WebMessagePortChannelClient*) = 0;
-    virtual void destroy() = 0;
-    // WebKit versions of WebCore::MessagePortChannel.
-    virtual void entangle(WebMessagePortChannel*) = 0;
-    // Callee receives ownership of the passed vector.
-    virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0;
-    virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0;
-
-protected:
-    ~WebMessagePortChannel() { }
-};
-
-} // namespace WebKit
-
-#endif
+#include "../../Platform/chromium/public/WebMessagePortChannel.h"
index 874cb95..eb9f803 100644 (file)
@@ -54,7 +54,6 @@ class WebCookieJar;
 class WebFileUtilities;
 class WebIDBFactory; // FIXME: Does this belong in platform?
 class WebIDBKey; // FIXME: Does this belong in platform?
-class WebMessagePortChannel; // FIXME: Does this belong in platform?
 class WebPluginListBuilder; // FIXME: Does this belong in platform?
 class WebSandboxSupport;
 class WebSharedWorkerRepository; // FIXME: Does this belong in platform?
@@ -126,13 +125,6 @@ public:
     virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& keyPath) { return WebSerializedScriptValue(); }
 
 
-    // Message Ports -------------------------------------------------------
-
-    // Creates a Message Port Channel. This can be called on any thread.
-    // The returned object should only be used on the thread it was created on.
-    virtual WebMessagePortChannel* createMessagePortChannel() { return 0; }
-
-
     // Plugins -------------------------------------------------------------
 
     // If refresh is true, then cached information should not be used to
index 3c7e711..7e5db2e 100644 (file)
 #include "SerializedScriptValue.h"
 
 #include "WebKit.h"
-#include "platform/WebKitPlatformSupport.h"
-#include "WebMessagePortChannel.h"
 #include "platform/WebString.h"
 
+#include <public/Platform.h>
+#include <public/WebMessagePortChannel.h>
+
 using namespace WebKit;
 
 namespace WebCore {
@@ -122,7 +123,7 @@ PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(
 PlatformMessagePortChannel::PlatformMessagePortChannel()
     : m_localPort(0)
 {
-    m_webChannel = webKitPlatformSupport()->createMessagePortChannel();
+    m_webChannel = WebKit::Platform::current()->createMessagePortChannel();
     if (m_webChannel)
         m_webChannel->setClient(this);
 }
index f674ce6..b1498d4 100644 (file)
@@ -31,9 +31,9 @@
 #ifndef PlatformMessagePortChannel_h
 #define PlatformMessagePortChannel_h
 
-#include "WebMessagePortChannelClient.h"
 
 #include "MessagePortChannel.h"
+#include <public/WebMessagePortChannelClient.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Threading.h>
 
index 70b800b..4e7c7b0 100644 (file)
@@ -47,7 +47,6 @@
 #include "WebFrameClient.h"
 #include "WebFrameImpl.h"
 #include "WebKit.h"
-#include "WebMessagePortChannel.h"
 #include "WebSharedWorker.h"
 #include "WebSharedWorkerRepository.h"
 #include "platform/WebKitPlatformSupport.h"
@@ -55,6 +54,7 @@
 #include "platform/WebURL.h"
 #include "WorkerScriptLoader.h"
 #include "WorkerScriptLoaderClient.h"
+#include <public/WebMessagePortChannel.h>
 
 namespace WebCore {
 
index 301c75e..4af6eec 100644 (file)
@@ -46,7 +46,6 @@
 #include "WebFileError.h"
 #include "WebFrameClient.h"
 #include "WebFrameImpl.h"
-#include "WebMessagePortChannel.h"
 #include "WebRuntimeFeatures.h"
 #include "WebSettings.h"
 #include "WebSharedWorkerClient.h"
@@ -58,6 +57,7 @@
 #include "WorkerThread.h"
 #include "platform/WebString.h"
 #include "platform/WebURL.h"
+#include <public/WebMessagePortChannel.h>
 #include <wtf/MainThread.h>
 
 using namespace WebCore;
index aee7b1d..7ea85fd 100644 (file)
 #include "WebFrameImpl.h"
 #include "WebKit.h"
 #include "platform/WebKitPlatformSupport.h"
-#include "WebMessagePortChannel.h"
 #include "WebPermissionClient.h"
 #include "platform/WebString.h"
 #include "platform/WebURL.h"
 #include "WebViewImpl.h"
 
+#include <public/WebMessagePortChannel.h>
+
 using namespace WebCore;
 
 namespace WebKit {