Diff
Modified: trunk/Source/WebCore/ChangeLog (142895 => 142896)
--- trunk/Source/WebCore/ChangeLog 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebCore/ChangeLog 2013-02-14 19:31:47 UTC (rev 142896)
@@ -1,3 +1,48 @@
+2013-02-14 Mark Pilgrim <[email protected]>
+
+ [Chromium] Move PlatformMessagePortChannel to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=109845
+
+ Reviewed by Adam Barth.
+
+ Part of a larger refactoring series; see tracking bug 106829.
+
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * dom/default/chromium: Added.
+ * dom/default/chromium/PlatformMessagePortChannelChromium.cpp: Added.
+ (WebCore):
+ (WebCore::MessagePortChannel::create):
+ (WebCore::MessagePortChannel::createChannel):
+ (WebCore::MessagePortChannel::MessagePortChannel):
+ (WebCore::MessagePortChannel::~MessagePortChannel):
+ (WebCore::MessagePortChannel::entangleIfOpen):
+ (WebCore::MessagePortChannel::disentangle):
+ (WebCore::MessagePortChannel::postMessageToRemote):
+ (WebCore::MessagePortChannel::tryGetMessageFromRemote):
+ (WebCore::MessagePortChannel::close):
+ (WebCore::MessagePortChannel::isConnectedTo):
+ (WebCore::MessagePortChannel::hasPendingActivity):
+ (WebCore::MessagePortChannel::locallyEntangledPort):
+ (WebCore::PlatformMessagePortChannel::create):
+ (WebCore::PlatformMessagePortChannel::PlatformMessagePortChannel):
+ (WebCore::PlatformMessagePortChannel::~PlatformMessagePortChannel):
+ (WebCore::PlatformMessagePortChannel::createChannel):
+ (WebCore::PlatformMessagePortChannel::messageAvailable):
+ (WebCore::PlatformMessagePortChannel::entangleIfOpen):
+ (WebCore::PlatformMessagePortChannel::disentangle):
+ (WebCore::PlatformMessagePortChannel::postMessageToRemote):
+ (WebCore::PlatformMessagePortChannel::tryGetMessageFromRemote):
+ (WebCore::PlatformMessagePortChannel::close):
+ (WebCore::PlatformMessagePortChannel::isConnectedTo):
+ (WebCore::PlatformMessagePortChannel::hasPendingActivity):
+ (WebCore::PlatformMessagePortChannel::setEntangledChannel):
+ (WebCore::PlatformMessagePortChannel::webChannelRelease):
+ * dom/default/chromium/PlatformMessagePortChannelChromium.h: Added.
+ (WebKit):
+ (WebCore):
+ (PlatformMessagePortChannel):
+
2013-02-14 Chris Fleizach <[email protected]>
Remove Leopard Accessibility support from WebCore (now that no port builds on Leopard)
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (142895 => 142896)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -81,6 +81,7 @@
'../css',
'../dom',
'../dom/default',
+ '../dom/default/chromium',
'../editing',
'../fileapi',
'../history',
Modified: trunk/Source/WebCore/WebCore.gypi (142895 => 142896)
--- trunk/Source/WebCore/WebCore.gypi 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebCore/WebCore.gypi 2013-02-14 19:31:47 UTC (rev 142896)
@@ -2996,6 +2996,8 @@
'dom/WindowEventContext.h',
'dom/default/PlatformMessagePortChannel.cpp',
'dom/default/PlatformMessagePortChannel.h',
+ 'dom/default/chromium/PlatformMessagePortChannelChromium.cpp',
+ 'dom/default/chromium/PlatformMessagePortChannelChromium.h',
],
'webcore_html_files': [
'html/BaseButtonInputType.cpp',
Copied: trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.cpp (from rev 142895, trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp) (0 => 142896)
--- trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.cpp (rev 0)
+++ trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -0,0 +1,255 @@
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "PlatformMessagePortChannelChromium.h"
+
+#include "MessagePort.h"
+#include "ScriptExecutionContext.h"
+#include "SerializedScriptValue.h"
+
+#include <public/Platform.h>
+#include <public/WebMessagePortChannel.h>
+#include <public/WebString.h>
+
+namespace WebCore {
+
+PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
+{
+ return adoptPtr(new MessagePortChannel(channel));
+}
+
+void MessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
+{
+ PlatformMessagePortChannel::createChannel(port1, port2);
+}
+
+MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
+ : m_channel(channel)
+{
+}
+
+MessagePortChannel::~MessagePortChannel()
+{
+ // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
+ m_channel->close();
+}
+
+bool MessagePortChannel::entangleIfOpen(MessagePort* port)
+{
+ return m_channel->entangleIfOpen(port);
+}
+
+void MessagePortChannel::disentangle()
+{
+ m_channel->disentangle();
+}
+
+void MessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
+{
+ m_channel->postMessageToRemote(message);
+}
+
+bool MessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
+{
+ return m_channel->tryGetMessageFromRemote(result);
+}
+
+void MessagePortChannel::close()
+{
+ m_channel->close();
+}
+
+bool MessagePortChannel::isConnectedTo(MessagePort* port)
+{
+ return m_channel->isConnectedTo(port);
+}
+
+bool MessagePortChannel::hasPendingActivity()
+{
+ return m_channel->hasPendingActivity();
+}
+
+MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
+{
+ // This is just an optimization, so return 0 always.
+ return 0;
+}
+
+
+PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create()
+{
+ return adoptRef(new PlatformMessagePortChannel());
+}
+
+PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(
+ WebKit::WebMessagePortChannel* channel)
+{
+ return adoptRef(new PlatformMessagePortChannel(channel));
+}
+
+
+PlatformMessagePortChannel::PlatformMessagePortChannel()
+ : m_localPort(0)
+{
+ m_webChannel = WebKit::Platform::current()->createMessagePortChannel();
+ if (m_webChannel)
+ m_webChannel->setClient(this);
+}
+
+PlatformMessagePortChannel::PlatformMessagePortChannel(WebKit::WebMessagePortChannel* channel)
+ : m_localPort(0)
+ , m_webChannel(channel)
+{
+}
+
+PlatformMessagePortChannel::~PlatformMessagePortChannel()
+{
+ if (m_webChannel)
+ m_webChannel->destroy();
+}
+
+void PlatformMessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
+{
+ // Create proxies for each endpoint.
+ RefPtr<PlatformMessagePortChannel> channel1 = PlatformMessagePortChannel::create();
+ RefPtr<PlatformMessagePortChannel> channel2 = PlatformMessagePortChannel::create();
+
+ // Entangle the two endpoints.
+ channel1->setEntangledChannel(channel2);
+ channel2->setEntangledChannel(channel1);
+
+ // Now entangle the proxies with the appropriate local ports.
+ port1->entangle(MessagePortChannel::create(channel2));
+ port2->entangle(MessagePortChannel::create(channel1));
+}
+
+void PlatformMessagePortChannel::messageAvailable()
+{
+ MutexLocker lock(m_mutex);
+ if (m_localPort)
+ m_localPort->messageAvailable();
+}
+
+bool PlatformMessagePortChannel::entangleIfOpen(MessagePort* port)
+{
+ MutexLocker lock(m_mutex);
+ m_localPort = port;
+ return true;
+}
+
+void PlatformMessagePortChannel::disentangle()
+{
+ MutexLocker lock(m_mutex);
+ m_localPort = 0;
+}
+
+void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
+{
+ if (!m_localPort || !m_webChannel)
+ return;
+
+ WebKit::WebString messageString = message->message()->toWireString();
+ OwnPtr<MessagePortChannelArray> channels = message->channels();
+ WebKit::WebMessagePortChannelArray* webChannels = 0;
+ if (channels && channels->size()) {
+ webChannels = new WebKit::WebMessagePortChannelArray(channels->size());
+ for (size_t i = 0; i < channels->size(); ++i) {
+ PlatformMessagePortChannel* platformChannel = (*channels)[i]->channel();
+ (*webChannels)[i] = platformChannel->webChannelRelease();
+ (*webChannels)[i]->setClient(0);
+ }
+ }
+ m_webChannel->postMessage(messageString, webChannels);
+}
+
+bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
+{
+ if (!m_webChannel)
+ return false;
+
+ WebKit::WebString message;
+ WebKit::WebMessagePortChannelArray webChannels;
+ bool rv = m_webChannel->tryGetMessage(&message, webChannels);
+ if (rv) {
+ OwnPtr<MessagePortChannelArray> channels;
+ if (webChannels.size()) {
+ channels = adoptPtr(new MessagePortChannelArray(webChannels.size()));
+ for (size_t i = 0; i < webChannels.size(); ++i) {
+ RefPtr<PlatformMessagePortChannel> platformChannel = create(webChannels[i]);
+ webChannels[i]->setClient(platformChannel.get());
+ (*channels)[i] = MessagePortChannel::create(platformChannel);
+ }
+ }
+ RefPtr<SerializedScriptValue> serializedMessage = SerializedScriptValue::createFromWire(message);
+ result = MessagePortChannel::EventData::create(serializedMessage.release(), channels.release());
+ }
+
+ return rv;
+}
+
+void PlatformMessagePortChannel::close()
+{
+ MutexLocker lock(m_mutex);
+ // Disentangle ourselves from the other end. We still maintain a reference to m_webChannel,
+ // since previously-existing messages should still be delivered.
+ m_localPort = 0;
+ m_entangledChannel = 0;
+}
+
+bool PlatformMessagePortChannel::isConnectedTo(MessagePort* port)
+{
+ MutexLocker lock(m_mutex);
+ return m_entangledChannel && m_entangledChannel->m_localPort == port;
+}
+
+bool PlatformMessagePortChannel::hasPendingActivity()
+{
+ MutexLocker lock(m_mutex);
+ return m_localPort;
+}
+
+void PlatformMessagePortChannel::setEntangledChannel(PassRefPtr<PlatformMessagePortChannel> remote)
+{
+ if (m_webChannel)
+ m_webChannel->entangle(remote->m_webChannel);
+
+ MutexLocker lock(m_mutex);
+ m_entangledChannel = remote;
+}
+
+WebKit::WebMessagePortChannel* PlatformMessagePortChannel::webChannelRelease()
+{
+ WebKit::WebMessagePortChannel* rv = m_webChannel;
+ m_webChannel = 0;
+ return rv;
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.h (from rev 142895, trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.h) (0 => 142896)
--- trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.h (rev 0)
+++ trunk/Source/WebCore/dom/default/chromium/PlatformMessagePortChannelChromium.h 2013-02-14 19:31:47 UTC (rev 142896)
@@ -0,0 +1,93 @@
+/*
+ * 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 PlatformMessagePortChannelChromium_h
+#define PlatformMessagePortChannelChromium_h
+
+
+#include "MessagePortChannel.h"
+#include <public/WebMessagePortChannelClient.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+namespace WebKit {
+class WebMessagePortChannel;
+}
+
+namespace WebCore {
+
+class MessagePort;
+
+// PlatformMessagePortChannel is a platform-dependent interface to the remote side of a message channel.
+class PlatformMessagePortChannel : public ThreadSafeRefCounted<PlatformMessagePortChannel>,
+ public WebKit::WebMessagePortChannelClient {
+public:
+ static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
+ static PassRefPtr<PlatformMessagePortChannel> create();
+ static PassRefPtr<PlatformMessagePortChannel> create(WebKit::WebMessagePortChannel*);
+
+ // APIs delegated from MessagePortChannel.h
+ bool entangleIfOpen(MessagePort*);
+ void disentangle();
+ void postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData>);
+ bool tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>&);
+ void close();
+ bool isConnectedTo(MessagePort*);
+ bool hasPendingActivity();
+
+ // Releases ownership of the contained web channel.
+ WebKit::WebMessagePortChannel* webChannelRelease();
+
+ virtual ~PlatformMessagePortChannel();
+
+private:
+ PlatformMessagePortChannel();
+ PlatformMessagePortChannel(WebKit::WebMessagePortChannel*);
+
+ void setEntangledChannel(PassRefPtr<PlatformMessagePortChannel>);
+
+ // WebKit::WebMessagePortChannelClient implementation
+ virtual void messageAvailable();
+
+ // Mutex used to ensure exclusive access to the object internals.
+ Mutex m_mutex;
+
+ // Pointer to our entangled pair - cleared when close() is called.
+ RefPtr<PlatformMessagePortChannel> m_entangledChannel;
+
+ // The port we are connected to - this is the port that is notified when new messages arrive.
+ MessagePort* m_localPort;
+
+ WebKit::WebMessagePortChannel* m_webChannel;
+};
+
+} // namespace WebCore
+
+#endif // PlatformMessagePortChannelChromium_h
Modified: trunk/Source/WebKit/chromium/ChangeLog (142895 => 142896)
--- trunk/Source/WebKit/chromium/ChangeLog 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/ChangeLog 2013-02-14 19:31:47 UTC (rev 142896)
@@ -1,3 +1,21 @@
+2013-02-14 Mark Pilgrim <[email protected]>
+
+ [Chromium] Move PlatformMessagePortChannel to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=109845
+
+ Reviewed by Adam Barth.
+
+ Part of a larger refactoring series; see tracking bug 106829.
+
+ * WebKit.gyp:
+ * src/PlatformMessagePortChannel.cpp: Removed.
+ * src/PlatformMessagePortChannel.h: Removed.
+ * src/SharedWorkerRepository.cpp:
+ * src/WebDOMMessageEvent.cpp:
+ * src/WebFrameImpl.cpp:
+ * src/WebSharedWorkerImpl.cpp:
+ * src/WebWorkerClientImpl.cpp:
+
2013-02-14 Min Qin <[email protected]>
Passing alpha to DeferredImageDecoder once decoding completes
Modified: trunk/Source/WebKit/chromium/WebKit.gyp (142895 => 142896)
--- trunk/Source/WebKit/chromium/WebKit.gyp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/WebKit.gyp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -398,8 +398,6 @@
'src/PageOverlayList.h',
'src/PageWidgetDelegate.cpp',
'src/PageWidgetDelegate.h',
- 'src/PlatformMessagePortChannel.cpp',
- 'src/PlatformMessagePortChannel.h',
'src/ScrollbarGroup.cpp',
'src/ScrollbarGroup.h',
'src/SharedWorkerRepository.cpp',
Deleted: trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -1,257 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "PlatformMessagePortChannel.h"
-
-#include "MessagePort.h"
-#include "ScriptExecutionContext.h"
-#include "SerializedScriptValue.h"
-
-#include <public/Platform.h>
-#include <public/WebMessagePortChannel.h>
-#include <public/WebString.h>
-
-using namespace WebKit;
-
-namespace WebCore {
-
-PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
-{
- return adoptPtr(new MessagePortChannel(channel));
-}
-
-void MessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
-{
- PlatformMessagePortChannel::createChannel(port1, port2);
-}
-
-MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
- : m_channel(channel)
-{
-}
-
-MessagePortChannel::~MessagePortChannel()
-{
- // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
- m_channel->close();
-}
-
-bool MessagePortChannel::entangleIfOpen(MessagePort* port)
-{
- return m_channel->entangleIfOpen(port);
-}
-
-void MessagePortChannel::disentangle()
-{
- m_channel->disentangle();
-}
-
-void MessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
-{
- m_channel->postMessageToRemote(message);
-}
-
-bool MessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
-{
- return m_channel->tryGetMessageFromRemote(result);
-}
-
-void MessagePortChannel::close()
-{
- m_channel->close();
-}
-
-bool MessagePortChannel::isConnectedTo(MessagePort* port)
-{
- return m_channel->isConnectedTo(port);
-}
-
-bool MessagePortChannel::hasPendingActivity()
-{
- return m_channel->hasPendingActivity();
-}
-
-MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
-{
- // This is just an optimization, so return 0 always.
- return 0;
-}
-
-
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create()
-{
- return adoptRef(new PlatformMessagePortChannel());
-}
-
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(
- WebMessagePortChannel* channel)
-{
- return adoptRef(new PlatformMessagePortChannel(channel));
-}
-
-
-PlatformMessagePortChannel::PlatformMessagePortChannel()
- : m_localPort(0)
-{
- m_webChannel = WebKit::Platform::current()->createMessagePortChannel();
- if (m_webChannel)
- m_webChannel->setClient(this);
-}
-
-PlatformMessagePortChannel::PlatformMessagePortChannel(WebMessagePortChannel* channel)
- : m_localPort(0)
- , m_webChannel(channel)
-{
-}
-
-PlatformMessagePortChannel::~PlatformMessagePortChannel()
-{
- if (m_webChannel)
- m_webChannel->destroy();
-}
-
-void PlatformMessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
-{
- // Create proxies for each endpoint.
- RefPtr<PlatformMessagePortChannel> channel1 = PlatformMessagePortChannel::create();
- RefPtr<PlatformMessagePortChannel> channel2 = PlatformMessagePortChannel::create();
-
- // Entangle the two endpoints.
- channel1->setEntangledChannel(channel2);
- channel2->setEntangledChannel(channel1);
-
- // Now entangle the proxies with the appropriate local ports.
- port1->entangle(MessagePortChannel::create(channel2));
- port2->entangle(MessagePortChannel::create(channel1));
-}
-
-void PlatformMessagePortChannel::messageAvailable()
-{
- MutexLocker lock(m_mutex);
- if (m_localPort)
- m_localPort->messageAvailable();
-}
-
-bool PlatformMessagePortChannel::entangleIfOpen(MessagePort* port)
-{
- MutexLocker lock(m_mutex);
- m_localPort = port;
- return true;
-}
-
-void PlatformMessagePortChannel::disentangle()
-{
- MutexLocker lock(m_mutex);
- m_localPort = 0;
-}
-
-void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
-{
- if (!m_localPort || !m_webChannel)
- return;
-
- WebString messageString = message->message()->toWireString();
- OwnPtr<WebCore::MessagePortChannelArray> channels = message->channels();
- WebMessagePortChannelArray* webChannels = 0;
- if (channels && channels->size()) {
- webChannels = new WebMessagePortChannelArray(channels->size());
- for (size_t i = 0; i < channels->size(); ++i) {
- WebCore::PlatformMessagePortChannel* platformChannel = (*channels)[i]->channel();
- (*webChannels)[i] = platformChannel->webChannelRelease();
- (*webChannels)[i]->setClient(0);
- }
- }
- m_webChannel->postMessage(messageString, webChannels);
-}
-
-bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
-{
- if (!m_webChannel)
- return false;
-
- WebString message;
- WebMessagePortChannelArray webChannels;
- bool rv = m_webChannel->tryGetMessage(&message, webChannels);
- if (rv) {
- OwnPtr<MessagePortChannelArray> channels;
- if (webChannels.size()) {
- channels = adoptPtr(new MessagePortChannelArray(webChannels.size()));
- for (size_t i = 0; i < webChannels.size(); ++i) {
- RefPtr<PlatformMessagePortChannel> platformChannel = create(webChannels[i]);
- webChannels[i]->setClient(platformChannel.get());
- (*channels)[i] = MessagePortChannel::create(platformChannel);
- }
- }
- RefPtr<SerializedScriptValue> serializedMessage = SerializedScriptValue::createFromWire(message);
- result = MessagePortChannel::EventData::create(serializedMessage.release(), channels.release());
- }
-
- return rv;
-}
-
-void PlatformMessagePortChannel::close()
-{
- MutexLocker lock(m_mutex);
- // Disentangle ourselves from the other end. We still maintain a reference to m_webChannel,
- // since previously-existing messages should still be delivered.
- m_localPort = 0;
- m_entangledChannel = 0;
-}
-
-bool PlatformMessagePortChannel::isConnectedTo(MessagePort* port)
-{
- MutexLocker lock(m_mutex);
- return m_entangledChannel && m_entangledChannel->m_localPort == port;
-}
-
-bool PlatformMessagePortChannel::hasPendingActivity()
-{
- MutexLocker lock(m_mutex);
- return m_localPort;
-}
-
-void PlatformMessagePortChannel::setEntangledChannel(PassRefPtr<PlatformMessagePortChannel> remote)
-{
- if (m_webChannel)
- m_webChannel->entangle(remote->m_webChannel);
-
- MutexLocker lock(m_mutex);
- m_entangledChannel = remote;
-}
-
-WebMessagePortChannel* PlatformMessagePortChannel::webChannelRelease()
-{
- WebMessagePortChannel* rv = m_webChannel;
- m_webChannel = 0;
- return rv;
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.h (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.h 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/PlatformMessagePortChannel.h 2013-02-14 19:31:47 UTC (rev 142896)
@@ -1,93 +0,0 @@
-/*
- * 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 PlatformMessagePortChannel_h
-#define PlatformMessagePortChannel_h
-
-
-#include "MessagePortChannel.h"
-#include <public/WebMessagePortChannelClient.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/Threading.h>
-
-namespace WebKit {
-class WebMessagePortChannel;
-}
-
-namespace WebCore {
-
-class MessagePort;
-
-// PlatformMessagePortChannel is a platform-dependent interface to the remote side of a message channel.
-class PlatformMessagePortChannel : public ThreadSafeRefCounted<PlatformMessagePortChannel>,
- public WebKit::WebMessagePortChannelClient {
-public:
- static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
- static PassRefPtr<PlatformMessagePortChannel> create();
- static PassRefPtr<PlatformMessagePortChannel> create(WebKit::WebMessagePortChannel*);
-
- // APIs delegated from MessagePortChannel.h
- bool entangleIfOpen(MessagePort*);
- void disentangle();
- void postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData>);
- bool tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>&);
- void close();
- bool isConnectedTo(MessagePort* port);
- bool hasPendingActivity();
-
- // Releases ownership of the contained web channel.
- WebKit::WebMessagePortChannel* webChannelRelease();
-
- virtual ~PlatformMessagePortChannel();
-
-private:
- PlatformMessagePortChannel();
- PlatformMessagePortChannel(WebKit::WebMessagePortChannel*);
-
- void setEntangledChannel(PassRefPtr<PlatformMessagePortChannel>);
-
- // WebKit::WebMessagePortChannelClient implementation
- virtual void messageAvailable();
-
- // Mutex used to ensure exclusive access to the object internals.
- Mutex m_mutex;
-
- // Pointer to our entangled pair - cleared when close() is called.
- RefPtr<PlatformMessagePortChannel> m_entangledChannel;
-
- // The port we are connected to - this is the port that is notified when new messages arrive.
- MessagePort* m_localPort;
-
- WebKit::WebMessagePortChannel* m_webChannel;
-};
-
-} // namespace WebCore
-
-#endif // PlatformMessagePortChannel_h
Modified: trunk/Source/WebKit/chromium/src/SharedWorkerRepository.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/SharedWorkerRepository.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/SharedWorkerRepository.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -40,7 +40,7 @@
#include "ExceptionCode.h"
#include "InspectorInstrumentation.h"
#include "MessagePortChannel.h"
-#include "PlatformMessagePortChannel.h"
+#include "PlatformMessagePortChannelChromium.h"
#include "ScriptExecutionContext.h"
#include "SharedWorker.h"
#include "WebContentSecurityPolicy.h"
Modified: trunk/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -35,7 +35,7 @@
#include "Document.h"
#include "MessageEvent.h"
#include "MessagePort.h"
-#include "PlatformMessagePortChannel.h"
+#include "PlatformMessagePortChannelChromium.h"
#include "SerializedScriptValue.h"
#include "WebFrame.h"
#include "WebFrameImpl.h"
Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -119,7 +119,7 @@
#include "Page.h"
#include "PageOverlay.h"
#include "Performance.h"
-#include "PlatformMessagePortChannel.h"
+#include "PlatformMessagePortChannelChromium.h"
#include "PluginDocument.h"
#include "PrintContext.h"
#include "RenderBox.h"
Modified: trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/WebSharedWorkerImpl.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -41,7 +41,7 @@
#include "MessagePortChannel.h"
#include "Page.h"
#include "PageGroup.h"
-#include "PlatformMessagePortChannel.h"
+#include "PlatformMessagePortChannelChromium.h"
#include "SecurityOrigin.h"
#include "ScriptExecutionContext.h"
#include "SharedWorkerContext.h"
Modified: trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp (142895 => 142896)
--- trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp 2013-02-14 19:22:10 UTC (rev 142895)
+++ trunk/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp 2013-02-14 19:31:47 UTC (rev 142896)
@@ -55,7 +55,7 @@
#include <wtf/Threading.h>
#include "FrameLoaderClientImpl.h"
-#include "PlatformMessagePortChannel.h"
+#include "PlatformMessagePortChannelChromium.h"
#include "WebFileSystemCallbacks.h"
#include "WebFrameClient.h"
#include "WebFrameImpl.h"