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

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

Issue 2691333002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: 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 "bindings/core/v8/CallbackPromiseAdapter.h" 9 #include "bindings/core/v8/CallbackPromiseAdapter.h"
9 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/ScriptState.h"
10 #include "bindings/core/v8/SerializedScriptValue.h" 12 #include "bindings/core/v8/SerializedScriptValue.h"
11 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 13 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
12 #include "public/platform/WebString.h" 14 #include "public/platform/WebString.h"
13 #include "wtf/RefPtr.h" 15 #include "wtf/RefPtr.h"
14 #include <memory>
15 16
16 namespace blink { 17 namespace blink {
17 18
18 ServiceWorkerClient* ServiceWorkerClient::take( 19 ServiceWorkerClient* ServiceWorkerClient::take(
19 ScriptPromiseResolver*, 20 ScriptPromiseResolver*,
20 std::unique_ptr<WebServiceWorkerClientInfo> webClient) { 21 std::unique_ptr<WebServiceWorkerClientInfo> webClient) {
21 if (!webClient) 22 if (!webClient)
22 return nullptr; 23 return nullptr;
23 24
24 switch (webClient->clientType) { 25 switch (webClient->clientType) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 case WebURLRequest::FrameTypeNone: 57 case WebURLRequest::FrameTypeNone:
57 return "none"; 58 return "none";
58 case WebURLRequest::FrameTypeTopLevel: 59 case WebURLRequest::FrameTypeTopLevel:
59 return "top-level"; 60 return "top-level";
60 } 61 }
61 62
62 ASSERT_NOT_REACHED(); 63 ASSERT_NOT_REACHED();
63 return String(); 64 return String();
64 } 65 }
65 66
66 void ServiceWorkerClient::postMessage(ExecutionContext* context, 67 void ServiceWorkerClient::postMessage(ScriptState* scriptState,
67 PassRefPtr<SerializedScriptValue> message, 68 PassRefPtr<SerializedScriptValue> message,
68 const MessagePortArray& ports, 69 const MessagePortArray& ports,
69 ExceptionState& exceptionState) { 70 ExceptionState& exceptionState) {
71 ExecutionContext* context = scriptState->getExecutionContext();
70 // 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.
71 std::unique_ptr<MessagePortChannelArray> channels = 73 std::unique_ptr<MessagePortChannelArray> channels =
72 MessagePort::disentanglePorts(context, ports, exceptionState); 74 MessagePort::disentanglePorts(context, ports, exceptionState);
73 if (exceptionState.hadException()) 75 if (exceptionState.hadException())
74 return; 76 return;
75 77
76 WebString messageString = message->toWireString(); 78 WebString messageString = message->toWireString();
77 std::unique_ptr<WebMessagePortChannelArray> webChannels = 79 std::unique_ptr<WebMessagePortChannelArray> webChannels =
78 MessagePort::toWebMessagePortChannelArray(std::move(channels)); 80 MessagePort::toWebMessagePortChannelArray(std::move(channels));
79 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient( 81 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(
80 m_uuid, messageString, std::move(webChannels)); 82 m_uuid, messageString, std::move(webChannels));
81 } 83 }
82 84
83 } // namespace blink 85 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698