OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/StashedMessagePort.h" | 6 #include "modules/serviceworkers/StashedMessagePort.h" |
7 | 7 |
8 #include "bindings/core/v8/SerializedScriptValue.h" | 8 #include "bindings/core/v8/SerializedScriptValue.h" |
9 #include "core/dom/CrossThreadTask.h" | 9 #include "core/dom/CrossThreadTask.h" |
10 #include "core/events/MessageEvent.h" | 10 #include "core/events/MessageEvent.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 { | 51 { |
52 ASSERT(executionContext()); | 52 ASSERT(executionContext()); |
53 executionContext()->postTask(FROM_HERE, createCrossThreadTask(&StashedMessag
ePort::dispatchMessages, m_weakFactory.createWeakPtr())); | 53 executionContext()->postTask(FROM_HERE, createCrossThreadTask(&StashedMessag
ePort::dispatchMessages, m_weakFactory.createWeakPtr())); |
54 } | 54 } |
55 | 55 |
56 void StashedMessagePort::dispatchMessages() | 56 void StashedMessagePort::dispatchMessages() |
57 { | 57 { |
58 if (!isEntangled()) | 58 if (!isEntangled()) |
59 return; | 59 return; |
60 ASSERT(executionContext()->isServiceWorkerGlobalScope()); | 60 ASSERT(executionContext()->isServiceWorkerGlobalScope()); |
61 RefPtr<StashedPortCollection> stashedPorts = toServiceWorkerGlobalScope(exec
utionContext())->ports(); | 61 RefPtrWillBeRawPtr<StashedPortCollection> stashedPorts = toServiceWorkerGlob
alScope(executionContext())->ports(); |
62 | 62 |
63 RefPtr<SerializedScriptValue> message; | 63 RefPtr<SerializedScriptValue> message; |
64 OwnPtr<MessagePortChannelArray> channels; | 64 OwnPtr<MessagePortChannelArray> channels; |
65 while (tryGetMessage(message, channels)) { | 65 while (tryGetMessage(message, channels)) { |
66 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(
*executionContext(), channels.release()); | 66 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(
*executionContext(), channels.release()); |
67 RefPtrWillBeRawPtr<Event> evt = MessageEvent::create(ports.release(), me
ssage.release(), String(), String(), this); | 67 RefPtrWillBeRawPtr<Event> evt = MessageEvent::create(ports.release(), me
ssage.release(), String(), String(), this); |
68 | 68 |
69 stashedPorts->dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); | 69 stashedPorts->dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 } // namespace blink | 73 } // namespace blink |
OLD | NEW |