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 17 matching lines...) Expand all Loading... |
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 #include "config.h" | 30 #include "config.h" |
31 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 31 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
32 | 32 |
33 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 33 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
34 #include "bindings/core/v8/ScriptPromise.h" | 34 #include "bindings/core/v8/ScriptPromise.h" |
35 #include "bindings/core/v8/ScriptPromiseResolver.h" | 35 #include "bindings/core/v8/ScriptPromiseResolver.h" |
36 #include "bindings/core/v8/ScriptState.h" | 36 #include "bindings/core/v8/ScriptState.h" |
37 #include "bindings/core/v8/SerializedScriptValue.h" | 37 #include "bindings/core/v8/SerializedScriptValue.h" |
| 38 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
38 #include "core/dom/DOMException.h" | 39 #include "core/dom/DOMException.h" |
39 #include "core/dom/ExceptionCode.h" | 40 #include "core/dom/ExceptionCode.h" |
40 #include "core/dom/ExecutionContext.h" | 41 #include "core/dom/ExecutionContext.h" |
41 #include "core/dom/MessagePort.h" | 42 #include "core/dom/MessagePort.h" |
42 #include "core/events/MessageEvent.h" | 43 #include "core/events/MessageEvent.h" |
43 #include "core/frame/LocalDOMWindow.h" | 44 #include "core/frame/LocalDOMWindow.h" |
44 #include "modules/serviceworkers/ServiceWorker.h" | 45 #include "modules/serviceworkers/ServiceWorker.h" |
45 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" | 46 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
46 #include "modules/serviceworkers/ServiceWorkerError.h" | 47 #include "modules/serviceworkers/ServiceWorkerError.h" |
47 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | 48 #include "modules/serviceworkers/ServiceWorkerRegistration.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 m_readyRegistration = readyRegistration; | 255 m_readyRegistration = readyRegistration; |
255 m_ready->resolve(readyRegistration); | 256 m_ready->resolve(readyRegistration); |
256 } | 257 } |
257 | 258 |
258 void ServiceWorkerContainer::dispatchMessageEvent(const WebString& message, cons
t WebMessagePortChannelArray& webChannels) | 259 void ServiceWorkerContainer::dispatchMessageEvent(const WebString& message, cons
t WebMessagePortChannelArray& webChannels) |
259 { | 260 { |
260 if (!executionContext() || !executionContext()->executingWindow()) | 261 if (!executionContext() || !executionContext()->executingWindow()) |
261 return; | 262 return; |
262 | 263 |
263 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(executionContext(), webChannels); | 264 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::toMessagePortArray
(executionContext(), webChannels); |
264 RefPtr<SerializedScriptValue> value = SerializedScriptValue::createFromWire(
message); | 265 RefPtr<SerializedScriptValue> value = SerializedScriptValueFactory::factory(
).createFromWire(message); |
265 executionContext()->executingWindow()->dispatchEvent(MessageEvent::create(po
rts.release(), value)); | 266 executionContext()->executingWindow()->dispatchEvent(MessageEvent::create(po
rts.release(), value)); |
266 } | 267 } |
267 | 268 |
268 ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContex
t) | 269 ServiceWorkerContainer::ServiceWorkerContainer(ExecutionContext* executionContex
t) |
269 : ContextLifecycleObserver(executionContext) | 270 : ContextLifecycleObserver(executionContext) |
270 , m_provider(0) | 271 , m_provider(0) |
271 { | 272 { |
272 | 273 |
273 if (!executionContext) | 274 if (!executionContext) |
274 return; | 275 return; |
275 | 276 |
276 m_ready = createReadyProperty(); | 277 m_ready = createReadyProperty(); |
277 | 278 |
278 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { | 279 if (ServiceWorkerContainerClient* client = ServiceWorkerContainerClient::fro
m(executionContext)) { |
279 m_provider = client->provider(); | 280 m_provider = client->provider(); |
280 if (m_provider) | 281 if (m_provider) |
281 m_provider->setClient(this); | 282 m_provider->setClient(this); |
282 } | 283 } |
283 } | 284 } |
284 | 285 |
285 } // namespace blink | 286 } // namespace blink |
OLD | NEW |