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

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

Issue 2821443002: Revert of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Revert Created 3 years, 8 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"
11 #include "bindings/core/v8/ScriptState.h" 11 #include "bindings/core/v8/ScriptState.h"
12 #include "bindings/core/v8/SerializedScriptValue.h" 12 #include "bindings/core/v8/SerializedScriptValue.h"
13 #include "core/dom/ExecutionContext.h"
14 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
15 #include "platform/wtf/RefPtr.h" 14 #include "platform/wtf/RefPtr.h"
16 #include "public/platform/WebString.h" 15 #include "public/platform/WebString.h"
17 16
18 namespace blink { 17 namespace blink {
19 18
20 ServiceWorkerClient* ServiceWorkerClient::Take( 19 ServiceWorkerClient* ServiceWorkerClient::Take(
21 ScriptPromiseResolver*, 20 ScriptPromiseResolver*,
22 std::unique_ptr<WebServiceWorkerClientInfo> web_client) { 21 std::unique_ptr<WebServiceWorkerClientInfo> web_client) {
23 if (!web_client) 22 if (!web_client)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 61 }
63 62
64 ASSERT_NOT_REACHED(); 63 ASSERT_NOT_REACHED();
65 return String(); 64 return String();
66 } 65 }
67 66
68 void ServiceWorkerClient::postMessage(ScriptState* script_state, 67 void ServiceWorkerClient::postMessage(ScriptState* script_state,
69 PassRefPtr<SerializedScriptValue> message, 68 PassRefPtr<SerializedScriptValue> message,
70 const MessagePortArray& ports, 69 const MessagePortArray& ports,
71 ExceptionState& exception_state) { 70 ExceptionState& exception_state) {
72 ExecutionContext* context = ExecutionContext::From(script_state); 71 ExecutionContext* context = script_state->GetExecutionContext();
73 // 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.
74 MessagePortChannelArray channels = 73 MessagePortChannelArray channels =
75 MessagePort::DisentanglePorts(context, ports, exception_state); 74 MessagePort::DisentanglePorts(context, ports, exception_state);
76 if (exception_state.HadException()) 75 if (exception_state.HadException())
77 return; 76 return;
78 77
79 WebString message_string = message->ToWireString(); 78 WebString message_string = message->ToWireString();
80 WebMessagePortChannelArray web_channels = 79 WebMessagePortChannelArray web_channels =
81 MessagePort::ToWebMessagePortChannelArray(std::move(channels)); 80 MessagePort::ToWebMessagePortChannelArray(std::move(channels));
82 ServiceWorkerGlobalScopeClient::From(context)->PostMessageToClient( 81 ServiceWorkerGlobalScopeClient::From(context)->PostMessageToClient(
83 uuid_, message_string, std::move(web_channels)); 82 uuid_, message_string, std::move(web_channels));
84 } 83 }
85 84
86 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698