| Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| index 80307f05cd84d2b0a73d0826f7182c8fe0e5f898..15c31d0cc9f2717b8ed287e7eed6705cb4b73af3 100644
|
| --- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| +++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| @@ -32,9 +32,12 @@
|
| #include "ServiceWorkerGlobalScopeProxy.h"
|
|
|
| #include "WebEmbeddedWorkerImpl.h"
|
| +#include "WebSerializedScriptValue.h"
|
| #include "WebServiceWorkerContextClient.h"
|
| #include "bindings/v8/WorkerScriptController.h"
|
| #include "core/dom/ExecutionContext.h"
|
| +#include "core/dom/MessagePort.h"
|
| +#include "core/events/MessageEvent.h"
|
| #include "core/events/ThreadLocalEventNames.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| #include "modules/serviceworkers/FetchEvent.h"
|
| @@ -74,6 +77,22 @@ void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID)
|
| observer->didDispatchEvent();
|
| }
|
|
|
| +void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& message, const WebMessagePortChannelArray& webChannels)
|
| +{
|
| + ASSERT(m_workerGlobalScope);
|
| +
|
| + OwnPtr<MessagePortArray> ports;
|
| + if (!webChannels.isEmpty()) {
|
| + OwnPtr<MessagePortChannelArray> channels = adoptPtr(new MessagePortChannelArray(webChannels.size()));
|
| + for (size_t i = 0; i < webChannels.size(); ++i)
|
| + (*channels)[i] = adoptPtr(webChannels[i]);
|
| + ports = MessagePort::entanglePorts(*m_workerGlobalScope, channels.release());
|
| + }
|
| +
|
| + WebSerializedScriptValue value = WebSerializedScriptValue::fromString(message);
|
| + m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), value));
|
| +}
|
| +
|
| void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
|
| {
|
| m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);
|
|
|