diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 21:38:03 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 21:38:03 +0000 |
commit | c36a24cbfdc6cb945f104d65174ef2aaa59e5dd3 (patch) | |
tree | 6f77d943b793b1f6968660c2ce3fb32f432369ed /webkit | |
parent | c28a6aac0d9687b43781bb21fdef3b6849c0d398 (diff) | |
download | chromium_src-c36a24cbfdc6cb945f104d65174ef2aaa59e5dd3.zip chromium_src-c36a24cbfdc6cb945f104d65174ef2aaa59e5dd3.tar.gz chromium_src-c36a24cbfdc6cb945f104d65174ef2aaa59e5dd3.tar.bz2 |
First half of updating Worker.postMessage(), DOMWindow.postMessage(), and
MessagePort.postMessage() to accept multiple MessagePorts.
Original review: http://codereview.chromium.org/173193
TBR=atwilson
TEST=None (new functionality not yet exposed via bindings, so existing tests suffice)
BUG=19948
Review URL: http://codereview.chromium.org/174566
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24536 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/api/public/WebMessagePortChannel.h | 9 | ||||
-rw-r--r-- | webkit/api/public/WebVector.h | 2 | ||||
-rw-r--r-- | webkit/api/public/WebWorker.h | 8 | ||||
-rw-r--r-- | webkit/api/public/WebWorkerClient.h | 8 | ||||
-rw-r--r-- | webkit/api/src/PlatformMessagePortChannel.cpp | 36 | ||||
-rw-r--r-- | webkit/glue/webworker_impl.cc | 50 | ||||
-rw-r--r-- | webkit/glue/webworker_impl.h | 10 | ||||
-rw-r--r-- | webkit/glue/webworkerclient_impl.cc | 62 | ||||
-rw-r--r-- | webkit/glue/webworkerclient_impl.h | 9 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_webworker.cc | 17 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_worker/test_webworker.h | 4 |
11 files changed, 115 insertions, 100 deletions
diff --git a/webkit/api/public/WebMessagePortChannel.h b/webkit/api/public/WebMessagePortChannel.h index ef20df4..20c0a33 100644 --- a/webkit/api/public/WebMessagePortChannel.h +++ b/webkit/api/public/WebMessagePortChannel.h @@ -32,11 +32,14 @@ #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 { @@ -45,9 +48,9 @@ namespace WebKit { virtual void destroy() = 0; // WebKit versions of WebCore::MessagePortChannel. virtual void entangle(WebMessagePortChannel*) = 0; - // If sending a message port, callee receives ownership of the object. - virtual void postMessage(const WebString&, WebMessagePortChannel*) = 0; - virtual bool tryGetMessage(WebString*, WebMessagePortChannel**) = 0; + // Callee receives ownership of the passed vector. + virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0; + virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0; protected: ~WebMessagePortChannel() { } diff --git a/webkit/api/public/WebVector.h b/webkit/api/public/WebVector.h index af811d6..4919c85 100644 --- a/webkit/api/public/WebVector.h +++ b/webkit/api/public/WebVector.h @@ -31,7 +31,7 @@ #ifndef WebVector_h #define WebVector_h -#include <utility> +#include <algorithm> #include "WebCommon.h" diff --git a/webkit/api/public/WebWorker.h b/webkit/api/public/WebWorker.h index 480b34a..1424161 100644 --- a/webkit/api/public/WebWorker.h +++ b/webkit/api/public/WebWorker.h @@ -31,10 +31,9 @@ #ifndef WebWorker_h #define WebWorker_h -#include "WebCommon.h" +#include "WebMessagePortChannel.h" namespace WebKit { - class WebMessagePortChannel; class WebString; class WebURL; class WebWorkerClient; @@ -50,8 +49,9 @@ namespace WebKit { const WebString& userAgent, const WebString& sourceCode) = 0; virtual void terminateWorkerContext() = 0; - virtual void postMessageToWorkerContext(const WebString&, - WebMessagePortChannel*) = 0; + virtual void postMessageToWorkerContext( + const WebString&, + const WebMessagePortChannelArray&) = 0; virtual void workerObjectDestroyed() = 0; }; diff --git a/webkit/api/public/WebWorkerClient.h b/webkit/api/public/WebWorkerClient.h index 3e89ed7..b9d8cef 100644 --- a/webkit/api/public/WebWorkerClient.h +++ b/webkit/api/public/WebWorkerClient.h @@ -31,10 +31,9 @@ #ifndef WebWorkerClient_h #define WebWorkerClient_h -#include "WebCommon.h" +#include "WebMessagePortChannel.h" namespace WebKit { - class WebMessagePortChannel; class WebString; class WebWorker; @@ -43,8 +42,9 @@ namespace WebKit { // the Worker object, unless noted. class WebWorkerClient { public: - virtual void postMessageToWorkerObject(const WebString&, - WebMessagePortChannel*) = 0; + virtual void postMessageToWorkerObject( + const WebString&, + const WebMessagePortChannelArray&) = 0; virtual void postExceptionToWorkerObject( const WebString& errorString, int lineNumber, diff --git a/webkit/api/src/PlatformMessagePortChannel.cpp b/webkit/api/src/PlatformMessagePortChannel.cpp index cafbdea..ee67806 100644 --- a/webkit/api/src/PlatformMessagePortChannel.cpp +++ b/webkit/api/src/PlatformMessagePortChannel.cpp @@ -179,14 +179,17 @@ void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChann return; WebString messageString = message->message(); - OwnPtr<WebCore::MessagePortChannel> channel = message->channel(); - WebMessagePortChannel* webChannel = NULL; - if (channel.get()) { - WebCore::PlatformMessagePortChannel* platformChannel = channel->channel(); - webChannel = platformChannel->webChannelRelease(); - webChannel->setClient(0); + OwnPtr<WebCore::MessagePortChannelArray> channels = message->channels(); + WebMessagePortChannelArray* webChannels = NULL; + if (channels.get() && 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, webChannel); + m_webChannel->postMessage(messageString, webChannels); } bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result) @@ -195,16 +198,19 @@ bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChann return false; WebString message; - WebMessagePortChannel* webChannel = NULL; - bool rv = m_webChannel->tryGetMessage(&message, &webChannel); + WebMessagePortChannelArray webChannels; + bool rv = m_webChannel->tryGetMessage(&message, webChannels); if (rv) { - OwnPtr<MessagePortChannel> channel; - if (webChannel) { - RefPtr<PlatformMessagePortChannel> platformChannel = create(webChannel); - webChannel->setClient(platformChannel.get()); - channel = MessagePortChannel::create(platformChannel); + OwnPtr<MessagePortChannelArray> channels; + if (webChannels.size()) { + channels = 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); + } } - result = MessagePortChannel::EventData::create(message, channel.release()); + result = MessagePortChannel::EventData::create(message, channels.release()); } return rv; diff --git a/webkit/glue/webworker_impl.cc b/webkit/glue/webworker_impl.cc index 3b33614..76f4400 100644 --- a/webkit/glue/webworker_impl.cc +++ b/webkit/glue/webworker_impl.cc @@ -38,6 +38,7 @@ using WebKit::WebCursorInfo; using WebKit::WebFrame; using WebKit::WebMessagePortChannel; +using WebKit::WebMessagePortChannelArray; using WebKit::WebNavigationPolicy; using WebKit::WebRect; using WebKit::WebScreenInfo; @@ -124,17 +125,14 @@ void WebWorkerImpl::PostMessageToWorkerContextTask( WebCore::ScriptExecutionContext* context, WebWorkerImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { DCHECK(context->isWorkerContext()); WebCore::DedicatedWorkerContext* worker_context = static_cast<WebCore::DedicatedWorkerContext*>(context); - WTF::RefPtr<WebCore::MessagePort> port; - if (channel) { - port = WebCore::MessagePort::create(*context); - port->entangle(channel.release()); - } - worker_context->dispatchMessage(message, port.release()); + WTF::OwnPtr<WebCore::MessagePortArray> ports = + WebCore::MessagePort::entanglePorts(*context, channels.release()); + worker_context->dispatchMessage(message, ports.release()); this_ptr->confirmMessageFromWorkerObject( worker_context->hasPendingActivity()); @@ -197,21 +195,24 @@ void WebWorkerImpl::terminateWorkerContext() { void WebWorkerImpl::postMessageToWorkerContext( const WebString& message, - WebMessagePortChannel* webchannel) { - - OwnPtr<WebCore::MessagePortChannel> channel; - if (webchannel) { - RefPtr<WebCore::PlatformMessagePortChannel> platform_channel = - WebCore::PlatformMessagePortChannel::create(webchannel); - webchannel->setClient(platform_channel.get()); - channel = WebCore::MessagePortChannel::create(platform_channel); + const WebMessagePortChannelArray& webchannels) { + + WTF::OwnPtr<WebCore::MessagePortChannelArray> channels; + if (webchannels.size()) { + channels = new WebCore::MessagePortChannelArray(webchannels.size()); + for (size_t i = 0; i < webchannels.size(); ++i) { + RefPtr<WebCore::PlatformMessagePortChannel> platform_channel = + WebCore::PlatformMessagePortChannel::create(webchannels[i]); + webchannels[i]->setClient(platform_channel.get()); + (*channels)[i] = WebCore::MessagePortChannel::create(platform_channel); + } } worker_thread_->runLoop().postTask(WebCore::createCallbackTask( &PostMessageToWorkerContextTask, this, webkit_glue::WebStringToString(message), - channel.release())); + channels.release())); } void WebWorkerImpl::workerObjectDestroyed() { @@ -238,27 +239,28 @@ void WebWorkerImpl::InvokeTaskMethod(void* param) { void WebWorkerImpl::postMessageToWorkerObject( const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { DispatchTaskToMainThread(WebCore::createCallbackTask( &PostMessageTask, this, message, - channel)); + channels)); } void WebWorkerImpl::PostMessageTask( WebCore::ScriptExecutionContext* context, WebWorkerImpl* this_ptr, WebCore::String message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { - WebMessagePortChannel* webChannel = NULL; - if (channel.get()) { - webChannel = channel->channel()->webChannelRelease(); - webChannel->setClient(0); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { + WebMessagePortChannelArray web_channels( + channels.get() ? channels->size() : 0); + for (size_t i = 0; i < web_channels.size(); ++i) { + web_channels[i] = (*channels)[i]->channel()->webChannelRelease(); + web_channels[i]->setClient(0); } this_ptr->client_->postMessageToWorkerObject( - webkit_glue::StringToWebString(message), webChannel); + webkit_glue::StringToWebString(message), web_channels); } void WebWorkerImpl::postExceptionToWorkerObject( diff --git a/webkit/glue/webworker_impl.h b/webkit/glue/webworker_impl.h index 9495ded..321334f 100644 --- a/webkit/glue/webworker_impl.h +++ b/webkit/glue/webworker_impl.h @@ -16,8 +16,6 @@ #include <wtf/RefPtr.h> namespace WebCore { -class Strng; -class MessagePortChannel; class WorkerThread; }; @@ -37,7 +35,7 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy, // WebCore::WorkerObjectProxy methods: virtual void postMessageToWorkerObject( const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); virtual void postExceptionToWorkerObject( const WebCore::String& error_message, int line_number, @@ -68,7 +66,7 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy, virtual void terminateWorkerContext(); virtual void postMessageToWorkerContext( const WebKit::WebString& message, - WebKit::WebMessagePortChannel* channel); + const WebKit::WebMessagePortChannelArray& channel); virtual void workerObjectDestroyed(); WebKit::WebWorkerClient* client() { return client_; } @@ -85,7 +83,7 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy, WebCore::ScriptExecutionContext* context, WebWorkerImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); // Function used to invoke tasks on the main thread. static void InvokeTaskMethod(void* param); @@ -95,7 +93,7 @@ class WebWorkerImpl: public WebCore::WorkerObjectProxy, WebCore::ScriptExecutionContext* context, WebWorkerImpl* this_ptr, WebCore::String message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void PostExceptionTask( WebCore::ScriptExecutionContext* context, WebWorkerImpl* this_ptr, diff --git a/webkit/glue/webworkerclient_impl.cc b/webkit/glue/webworkerclient_impl.cc index db754aa..0139509 100644 --- a/webkit/glue/webworkerclient_impl.cc +++ b/webkit/glue/webworkerclient_impl.cc @@ -41,6 +41,7 @@ #include "webkit/glue/webworker_impl.h" using WebKit::WebMessagePortChannel; +using WebKit::WebMessagePortChannelArray; using WebKit::WebString; using WebKit::WebWorker; using WebKit::WebWorkerClient; @@ -154,7 +155,7 @@ void WebWorkerClientImpl::terminateWorkerContext() { void WebWorkerClientImpl::postMessageToWorkerContext( const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { // Worker.terminate() could be called from JS before the context is started. if (asked_to_terminate_) return; @@ -164,18 +165,21 @@ void WebWorkerClientImpl::postMessageToWorkerContext( if (!WTF::isMainThread()) { WebWorkerImpl::DispatchTaskToMainThread( WebCore::createCallbackTask( - &PostMessageToWorkerContextTask, this, message, channel)); + &PostMessageToWorkerContextTask, this, message, channels)); return; } - WebMessagePortChannel* webchannel = NULL; - if (channel.get()) { - webchannel = channel->channel()->webChannelRelease(); + WebMessagePortChannelArray webchannels(channels.get() ? channels->size() : 0); + + for (size_t i = 0; i < webchannels.size(); ++i) { + WebMessagePortChannel* webchannel = + (*channels)[i]->channel()->webChannelRelease(); webchannel->setClient(0); + webchannels[i] = webchannel; } webworker_->postMessageToWorkerContext( - webkit_glue::StringToWebString(message), webchannel); + webkit_glue::StringToWebString(message), webchannels); } bool WebWorkerClientImpl::hasPendingActivity() const { @@ -197,25 +201,28 @@ void WebWorkerClientImpl::workerObjectDestroyed() { void WebWorkerClientImpl::postMessageToWorkerObject( const WebString& message, - WebMessagePortChannel* channel) { + const WebMessagePortChannelArray& channels) { WebCore::String message2 = webkit_glue::WebStringToString(message); - OwnPtr<WebCore::MessagePortChannel> channel2; - if (channel) { - RefPtr<WebCore::PlatformMessagePortChannel> platform_channel = - WebCore::PlatformMessagePortChannel::create(channel); - channel->setClient(platform_channel.get()); - channel2 = WebCore::MessagePortChannel::create(platform_channel); + OwnPtr<WebCore::MessagePortChannelArray> channels2; + if (channels.size()) { + channels2 = new WebCore::MessagePortChannelArray(channels.size()); + for (size_t i = 0; i < channels.size(); ++i) { + RefPtr<WebCore::PlatformMessagePortChannel> platform_channel = + WebCore::PlatformMessagePortChannel::create(channels[i]); + channels[i]->setClient(platform_channel.get()); + (*channels2)[i] = WebCore::MessagePortChannel::create(platform_channel); + } } if (WTF::currentThread() != worker_thread_id_) { script_execution_context_->postTask( WebCore::createCallbackTask(&PostMessageToWorkerObjectTask, this, - message2, channel2.release())); + message2, channels2.release())); return; } PostMessageToWorkerObjectTask( - script_execution_context_.get(), this, message2, channel2.release()); + script_execution_context_.get(), this, message2, channels2.release()); } void WebWorkerClientImpl::postExceptionToWorkerObject( @@ -313,15 +320,16 @@ void WebWorkerClientImpl::PostMessageToWorkerContextTask( WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { - WebMessagePortChannel* webChannel = NULL; - if (channel.get()) { - webChannel = channel->channel()->webChannelRelease(); - webChannel->setClient(0); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { + WebMessagePortChannelArray web_channels(channels.get() ? channels->size() : 0); + + for (size_t i = 0; i < web_channels.size(); ++i) { + web_channels[i] = (*channels)[i]->channel()->webChannelRelease(); + web_channels[i]->setClient(0); } this_ptr->webworker_->postMessageToWorkerContext( - webkit_glue::StringToWebString(message), webChannel); + webkit_glue::StringToWebString(message), web_channels); } void WebWorkerClientImpl::WorkerObjectDestroyedTask( @@ -336,16 +344,12 @@ void WebWorkerClientImpl::PostMessageToWorkerObjectTask( WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel) { + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { if (this_ptr->worker_) { - WTF::RefPtr<WebCore::MessagePort> port; - if (channel) { - port = WebCore::MessagePort::create(*context); - port->entangle(channel.release()); - } - - this_ptr->worker_->dispatchMessage(message, port.release()); + WTF::OwnPtr<WebCore::MessagePortArray> ports = + WebCore::MessagePort::entanglePorts(*context, channels.release()); + this_ptr->worker_->dispatchMessage(message, ports.release()); } } diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h index 420106b..b9110ef 100644 --- a/webkit/glue/webworkerclient_impl.h +++ b/webkit/glue/webworkerclient_impl.h @@ -14,7 +14,6 @@ #include <wtf/RefPtr.h> namespace WebCore { -class MessagePortChannel; class ScriptExecutionContext; } namespace WebKit { @@ -42,7 +41,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, virtual void terminateWorkerContext(); virtual void postMessageToWorkerContext( const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); virtual bool hasPendingActivity() const; virtual void workerObjectDestroyed(); @@ -50,7 +49,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, // These are called on the main WebKit thread. virtual void postMessageToWorkerObject( const WebKit::WebString& message, - WebKit::WebMessagePortChannel* channel); + const WebKit::WebMessagePortChannelArray& channels); virtual void postExceptionToWorkerObject( const WebKit::WebString& error_message, int line_number, @@ -89,7 +88,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void WorkerObjectDestroyedTask( WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr); @@ -101,7 +100,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr, const WebCore::String& message, - WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); + WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels); static void PostExceptionToWorkerObjectTask( WebCore::ScriptExecutionContext* context, WebWorkerClientImpl* this_ptr, diff --git a/webkit/tools/test_shell/test_worker/test_webworker.cc b/webkit/tools/test_shell/test_worker/test_webworker.cc index 6fdce06..7becc88 100644 --- a/webkit/tools/test_shell/test_worker/test_webworker.cc +++ b/webkit/tools/test_shell/test_worker/test_webworker.cc @@ -40,8 +40,9 @@ void TestWebWorker::startWorkerContext(const WebURL& script_url, webworker_impl_->startWorkerContext(script_url, user_agent, source_code); + WebKit::WebMessagePortChannelArray emptyArray; for (size_t i = 0; i < queued_messages_.size(); ++i) - webworker_impl_->postMessageToWorkerContext(queued_messages_[i], NULL); + webworker_impl_->postMessageToWorkerContext(queued_messages_[i], emptyArray); queued_messages_.clear(); } @@ -50,10 +51,11 @@ void TestWebWorker::terminateWorkerContext() { webworker_impl_->terminateWorkerContext(); } -void TestWebWorker::postMessageToWorkerContext(const WebString& message, - WebKit::WebMessagePortChannel*) { +void TestWebWorker::postMessageToWorkerContext( + const WebString& message, + const WebKit::WebMessagePortChannelArray& channels) { if (webworker_impl_) - webworker_impl_->postMessageToWorkerContext(message, NULL); + webworker_impl_->postMessageToWorkerContext(message, channels); else queued_messages_.push_back(message); } @@ -66,15 +68,16 @@ void TestWebWorker::workerObjectDestroyed() { Release(); // Releases the reference held for worker object. } -void TestWebWorker::postMessageToWorkerObject(const WebString& message, - WebKit::WebMessagePortChannel*) { +void TestWebWorker::postMessageToWorkerObject( + const WebString& message, + const WebKit::WebMessagePortChannelArray& channels) { if (!webworkerclient_delegate_) return; // The string was created in the dll's memory space as a result of a postTask. // If we pass it to test shell's memory space, it'll cause problems when GC // occurs. So duplicate it from the test shell's memory space first. webworkerclient_delegate_->postMessageToWorkerObject( - webworker_helper_->DuplicateString(message), NULL); + webworker_helper_->DuplicateString(message), channels); } void TestWebWorker::postExceptionToWorkerObject(const WebString& error_message, diff --git a/webkit/tools/test_shell/test_worker/test_webworker.h b/webkit/tools/test_shell/test_worker/test_webworker.h index 22ffecd..3e987c0 100644 --- a/webkit/tools/test_shell/test_worker/test_webworker.h +++ b/webkit/tools/test_shell/test_worker/test_webworker.h @@ -31,13 +31,13 @@ class TestWebWorker : public WebKit::WebWorker, virtual void terminateWorkerContext(); virtual void postMessageToWorkerContext( const WebKit::WebString& message, - WebKit::WebMessagePortChannel* channel); + const WebKit::WebMessagePortChannelArray& channel); virtual void workerObjectDestroyed(); // WebWorkerClient methods: virtual void postMessageToWorkerObject( const WebKit::WebString& message, - WebKit::WebMessagePortChannel* channel); + const WebKit::WebMessagePortChannelArray& channel); virtual void postExceptionToWorkerObject( const WebKit::WebString& error_message, int line_number, |