diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 20:20:22 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 20:20:22 +0000 |
commit | e18e7ad1c60f6472c25bc4af2554f471e55a85a6 (patch) | |
tree | 4240f999b4a49da982a2ba91324416db381412f0 /webkit/api | |
parent | 63b397506f70501d8089eecf28f50e17417fdd48 (diff) | |
download | chromium_src-e18e7ad1c60f6472c25bc4af2554f471e55a85a6.zip chromium_src-e18e7ad1c60f6472c25bc4af2554f471e55a85a6.tar.gz chromium_src-e18e7ad1c60f6472c25bc4af2554f471e55a85a6.tar.bz2 |
Enable message ports for workers.
TEST=included ui test
Review URL: http://codereview.chromium.org/160576
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api')
-rw-r--r-- | webkit/api/public/WebWorker.h | 10 | ||||
-rw-r--r-- | webkit/api/public/WebWorkerClient.h | 4 | ||||
-rw-r--r-- | webkit/api/src/PlatformMessagePortChannel.cpp | 8 | ||||
-rw-r--r-- | webkit/api/src/PlatformMessagePortChannel.h | 4 |
4 files changed, 17 insertions, 9 deletions
diff --git a/webkit/api/public/WebWorker.h b/webkit/api/public/WebWorker.h index 908993e..480b34a 100644 --- a/webkit/api/public/WebWorker.h +++ b/webkit/api/public/WebWorker.h @@ -1,10 +1,10 @@ /* * 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 @@ -14,7 +14,7 @@ * * 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 @@ -34,6 +34,7 @@ #include "WebCommon.h" namespace WebKit { + class WebMessagePortChannel; class WebString; class WebURL; class WebWorkerClient; @@ -49,7 +50,8 @@ namespace WebKit { const WebString& userAgent, const WebString& sourceCode) = 0; virtual void terminateWorkerContext() = 0; - virtual void postMessageToWorkerContext(const WebString&) = 0; + virtual void postMessageToWorkerContext(const WebString&, + WebMessagePortChannel*) = 0; virtual void workerObjectDestroyed() = 0; }; diff --git a/webkit/api/public/WebWorkerClient.h b/webkit/api/public/WebWorkerClient.h index a5faddd..30c2afb 100644 --- a/webkit/api/public/WebWorkerClient.h +++ b/webkit/api/public/WebWorkerClient.h @@ -34,6 +34,7 @@ #include "WebCommon.h" namespace WebKit { + class WebMessagePortChannel; class WebString; class WebWorker; @@ -42,7 +43,8 @@ namespace WebKit { // the Worker object, unless noted. class WebWorkerClient { public: - virtual void postMessageToWorkerObject(const WebString&) = 0; + virtual void postMessageToWorkerObject(const WebString&, + WebMessagePortChannel*) = 0; virtual void postExceptionToWorkerObject( const WebString& errorString, int lineNumber, diff --git a/webkit/api/src/PlatformMessagePortChannel.cpp b/webkit/api/src/PlatformMessagePortChannel.cpp index 72a626a..cafbdea 100644 --- a/webkit/api/src/PlatformMessagePortChannel.cpp +++ b/webkit/api/src/PlatformMessagePortChannel.cpp @@ -122,7 +122,8 @@ PlatformMessagePortChannel::PlatformMessagePortChannel() : m_localPort(0) { m_webChannel = webKitClient()->createMessagePortChannel(); - m_webChannel->setClient(this); + if (m_webChannel) + m_webChannel->setClient(this); } PlatformMessagePortChannel::PlatformMessagePortChannel(WebMessagePortChannel* channel) @@ -174,7 +175,7 @@ void PlatformMessagePortChannel::disentangle() void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message) { - if (!m_localPort) + if (!m_localPort || !m_webChannel) return; WebString messageString = message->message(); @@ -232,7 +233,8 @@ bool PlatformMessagePortChannel::hasPendingActivity() void PlatformMessagePortChannel::setEntangledChannel(PassRefPtr<PlatformMessagePortChannel> remote) { - m_webChannel->entangle(remote->m_webChannel); + if (m_webChannel) + m_webChannel->entangle(remote->m_webChannel); MutexLocker lock(m_mutex); m_entangledChannel = remote; diff --git a/webkit/api/src/PlatformMessagePortChannel.h b/webkit/api/src/PlatformMessagePortChannel.h index 08c6a5c..e668e8b 100644 --- a/webkit/api/src/PlatformMessagePortChannel.h +++ b/webkit/api/src/PlatformMessagePortChannel.h @@ -31,7 +31,9 @@ #ifndef PlatformMessagePortChannel_h #define PlatformMessagePortChannel_h -#include "WebMessagePortChannelClient.h" +// FIXME: This relative path is a temporary hack to support using this +// header from webkit/glue. +#include "../public/WebMessagePortChannelClient.h" #include "MessagePortChannel.h" |