OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/serviceworkers/ServiceWorkerClient.h" | 5 #include "modules/serviceworkers/ServiceWorkerClient.h" |
6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | 6 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
7 | 7 |
8 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 8 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/core/v8/SerializedScriptValue.h" | 10 #include "bindings/core/v8/SerializedScriptValue.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 case WebURLRequest::FrameTypeNone: | 60 case WebURLRequest::FrameTypeNone: |
61 return "none"; | 61 return "none"; |
62 case WebURLRequest::FrameTypeTopLevel: | 62 case WebURLRequest::FrameTypeTopLevel: |
63 return "top-level"; | 63 return "top-level"; |
64 } | 64 } |
65 | 65 |
66 ASSERT_NOT_REACHED(); | 66 ASSERT_NOT_REACHED(); |
67 return String(); | 67 return String(); |
68 } | 68 } |
69 | 69 |
70 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri
alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep
tionState) | 70 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri
alizedScriptValue> message, const MessagePortArray& ports, ExceptionState& excep
tionState) |
71 { | 71 { |
72 // Disentangle the port in preparation for sending it to the remote context. | 72 // Disentangle the port in preparation for sending it to the remote context. |
73 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); | 73 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); |
74 if (exceptionState.hadException()) | 74 if (exceptionState.hadException()) |
75 return; | 75 return; |
76 | 76 |
77 if (message->containsTransferableArrayBuffer()) | 77 if (message->containsTransferableArrayBuffer()) |
78 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferabl
e object yet. See http://crbug.com/511119")); | 78 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferabl
e object yet. See http://crbug.com/511119")); |
79 | 79 |
80 WebString messageString = message->toWireString(); | 80 WebString messageString = message->toWireString(); |
81 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo
rtChannelArray(channels.release()); | 81 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo
rtChannelArray(channels.release()); |
82 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m
essageString, webChannels.release()); | 82 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m
essageString, webChannels.release()); |
83 } | 83 } |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
OLD | NEW |