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 "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/ServiceWorkerClient.h" | 6 #include "modules/serviceworkers/ServiceWorkerClient.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" |
| 11 #include "core/inspector/ConsoleMessage.h" |
11 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" | 12 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" |
12 #include "public/platform/WebString.h" | 13 #include "public/platform/WebString.h" |
13 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInf
o& info) | 18 ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInf
o& info) |
18 { | 19 { |
19 return new ServiceWorkerClient(info); | 20 return new ServiceWorkerClient(info); |
20 } | 21 } |
(...skipping 26 matching lines...) Expand all Loading... |
47 return String(); | 48 return String(); |
48 } | 49 } |
49 | 50 |
50 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri
alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep
tionState) | 51 void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<Seri
alizedScriptValue> message, const MessagePortArray* ports, ExceptionState& excep
tionState) |
51 { | 52 { |
52 // Disentangle the port in preparation for sending it to the remote context. | 53 // Disentangle the port in preparation for sending it to the remote context. |
53 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); | 54 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); |
54 if (exceptionState.hadException()) | 55 if (exceptionState.hadException()) |
55 return; | 56 return; |
56 | 57 |
| 58 if (message->containsTransferableArrayBuffer()) |
| 59 context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, Warni
ngMessageLevel, "ServiceWorkerClient cannot send an ArrayBuffer as a transferabl
e object yet. See http://crbug.com/511119")); |
| 60 |
57 WebString messageString = message->toWireString(); | 61 WebString messageString = message->toWireString(); |
58 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo
rtChannelArray(channels.release()); | 62 OwnPtr<WebMessagePortChannelArray> webChannels = MessagePort::toWebMessagePo
rtChannelArray(channels.release()); |
59 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m
essageString, webChannels.release()); | 63 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(m_uuid, m
essageString, webChannels.release()); |
60 } | 64 } |
61 | 65 |
62 } // namespace blink | 66 } // namespace blink |
OLD | NEW |