| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 ASSERT_NOT_REACHED(); | 62 ASSERT_NOT_REACHED(); |
| 63 return String(); | 63 return String(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ServiceWorkerClient::postMessage(ExecutionContext* context, | 66 void ServiceWorkerClient::postMessage(ExecutionContext* context, |
| 67 PassRefPtr<SerializedScriptValue> message, | 67 PassRefPtr<SerializedScriptValue> message, |
| 68 const MessagePortArray& ports, | 68 const MessagePortArray& ports, |
| 69 ExceptionState& exceptionState) { | 69 ExceptionState& exceptionState) { |
| 70 // Disentangle the port in preparation for sending it to the remote context. | 70 // Disentangle the port in preparation for sending it to the remote context. |
| 71 std::unique_ptr<MessagePortChannelArray> channels = | 71 MessagePortChannelArray channels = |
| 72 MessagePort::disentanglePorts(context, ports, exceptionState); | 72 MessagePort::disentanglePorts(context, ports, exceptionState); |
| 73 if (exceptionState.hadException()) | 73 if (exceptionState.hadException()) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 WebString messageString = message->toWireString(); | 76 WebString messageString = message->toWireString(); |
| 77 std::unique_ptr<WebMessagePortChannelArray> webChannels = | 77 WebMessagePortChannelArray webChannels = |
| 78 MessagePort::toWebMessagePortChannelArray(std::move(channels)); | 78 MessagePort::toWebMessagePortChannelArray(std::move(channels)); |
| 79 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient( | 79 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient( |
| 80 m_uuid, messageString, std::move(webChannels)); | 80 m_uuid, messageString, std::move(webChannels)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |