OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "ServiceWorkerGlobalScopeProxy.h" | 32 #include "ServiceWorkerGlobalScopeProxy.h" |
33 | 33 |
34 #include "WebEmbeddedWorkerImpl.h" | 34 #include "WebEmbeddedWorkerImpl.h" |
| 35 #include "WebSerializedScriptValue.h" |
35 #include "WebServiceWorkerContextClient.h" | 36 #include "WebServiceWorkerContextClient.h" |
36 #include "bindings/v8/WorkerScriptController.h" | 37 #include "bindings/v8/WorkerScriptController.h" |
37 #include "core/dom/ExecutionContext.h" | 38 #include "core/dom/ExecutionContext.h" |
| 39 #include "core/dom/MessagePort.h" |
| 40 #include "core/events/MessageEvent.h" |
38 #include "core/events/ThreadLocalEventNames.h" | 41 #include "core/events/ThreadLocalEventNames.h" |
39 #include "core/workers/WorkerGlobalScope.h" | 42 #include "core/workers/WorkerGlobalScope.h" |
40 #include "modules/serviceworkers/FetchEvent.h" | 43 #include "modules/serviceworkers/FetchEvent.h" |
41 #include "modules/serviceworkers/InstallEvent.h" | 44 #include "modules/serviceworkers/InstallEvent.h" |
42 #include "modules/serviceworkers/WaitUntilObserver.h" | 45 #include "modules/serviceworkers/WaitUntilObserver.h" |
43 #include "platform/NotImplemented.h" | 46 #include "platform/NotImplemented.h" |
44 #include "wtf/Functional.h" | 47 #include "wtf/Functional.h" |
45 #include "wtf/PassOwnPtr.h" | 48 #include "wtf/PassOwnPtr.h" |
46 | 49 |
47 using namespace WebCore; | 50 using namespace WebCore; |
(...skipping 19 matching lines...) Expand all Loading... |
67 } | 70 } |
68 | 71 |
69 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID) | 72 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID) |
70 { | 73 { |
71 ASSERT(m_workerGlobalScope); | 74 ASSERT(m_workerGlobalScope); |
72 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG
lobalScope, eventID); | 75 RefPtr<RespondWithObserver> observer = RespondWithObserver::create(m_workerG
lobalScope, eventID); |
73 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer)); | 76 m_workerGlobalScope->dispatchEvent(FetchEvent::create(observer)); |
74 observer->didDispatchEvent(); | 77 observer->didDispatchEvent(); |
75 } | 78 } |
76 | 79 |
| 80 void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag
e, const WebMessagePortChannelArray& webChannels) |
| 81 { |
| 82 ASSERT(m_workerGlobalScope); |
| 83 |
| 84 OwnPtr<MessagePortArray> ports = MessagePort::toMessagePortArray(m_workerGlo
balScope, webChannels); |
| 85 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
| 86 m_workerGlobalScope->dispatchEvent(MessageEvent::create(ports.release(), val
ue)); |
| 87 } |
| 88 |
77 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL) | 89 void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage,
int lineNumber, int columnNumber, const String& sourceURL) |
78 { | 90 { |
79 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); | 91 m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL); |
80 } | 92 } |
81 | 93 |
82 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource, MessageL
evel, const String& message, int lineNumber, const String& sourceURL) | 94 void ServiceWorkerGlobalScopeProxy::reportConsoleMessage(MessageSource, MessageL
evel, const String& message, int lineNumber, const String& sourceURL) |
83 { | 95 { |
84 notImplemented(); | 96 notImplemented(); |
85 } | 97 } |
86 | 98 |
(...skipping 27 matching lines...) Expand all Loading... |
114 | 126 |
115 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) | 127 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, ExecutionContext& executionContext, WebServiceWorkerContextC
lient& client) |
116 : m_embeddedWorker(embeddedWorker) | 128 : m_embeddedWorker(embeddedWorker) |
117 , m_executionContext(executionContext) | 129 , m_executionContext(executionContext) |
118 , m_client(client) | 130 , m_client(client) |
119 , m_workerGlobalScope(0) | 131 , m_workerGlobalScope(0) |
120 { | 132 { |
121 } | 133 } |
122 | 134 |
123 } // namespace blink | 135 } // namespace blink |
OLD | NEW |