Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 8 #include <memory>
9 #include "bindings/core/v8/CallbackPromiseAdapter.h" 9 #include "bindings/core/v8/CallbackPromiseAdapter.h"
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 ASSERT_NOT_REACHED(); 63 ASSERT_NOT_REACHED();
64 return String(); 64 return String();
65 } 65 }
66 66
67 void ServiceWorkerClient::postMessage(ScriptState* scriptState, 67 void ServiceWorkerClient::postMessage(ScriptState* scriptState,
68 PassRefPtr<SerializedScriptValue> message, 68 PassRefPtr<SerializedScriptValue> message,
69 const MessagePortArray& ports, 69 const MessagePortArray& ports,
70 ExceptionState& exceptionState) { 70 ExceptionState& exceptionState) {
71 ExecutionContext* context = scriptState->getExecutionContext(); 71 ExecutionContext* context = scriptState->getExecutionContext();
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 std::unique_ptr<MessagePortChannelArray> channels = 73 MessagePortChannelArray channels =
74 MessagePort::disentanglePorts(context, ports, exceptionState); 74 MessagePort::disentanglePorts(context, ports, exceptionState);
75 if (exceptionState.hadException()) 75 if (exceptionState.hadException())
76 return; 76 return;
77 77
78 WebString messageString = message->toWireString(); 78 WebString messageString = message->toWireString();
79 std::unique_ptr<WebMessagePortChannelArray> webChannels = 79 WebMessagePortChannelArray webChannels =
80 MessagePort::toWebMessagePortChannelArray(std::move(channels)); 80 MessagePort::toWebMessagePortChannelArray(std::move(channels));
81 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient( 81 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(
82 m_uuid, messageString, std::move(webChannels)); 82 m_uuid, messageString, std::move(webChannels));
83 } 83 }
84 84
85 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698