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

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

Issue 2414333003: WebMessaging: Send transferable ArrayBuffers by copy-and-neuter semantics (Closed)
Patch Set: fix tests Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
12 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 11 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
13 #include "public/platform/WebString.h" 12 #include "public/platform/WebString.h"
14 #include "wtf/RefPtr.h" 13 #include "wtf/RefPtr.h"
15 #include <memory> 14 #include <memory>
16 15
17 namespace blink { 16 namespace blink {
18 17
19 ServiceWorkerClient* ServiceWorkerClient::take( 18 ServiceWorkerClient* ServiceWorkerClient::take(
20 ScriptPromiseResolver*, 19 ScriptPromiseResolver*,
21 std::unique_ptr<WebServiceWorkerClientInfo> webClient) { 20 std::unique_ptr<WebServiceWorkerClientInfo> webClient) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void ServiceWorkerClient::postMessage(ExecutionContext* context, 66 void ServiceWorkerClient::postMessage(ExecutionContext* context,
68 PassRefPtr<SerializedScriptValue> message, 67 PassRefPtr<SerializedScriptValue> message,
69 const MessagePortArray& ports, 68 const MessagePortArray& ports,
70 ExceptionState& exceptionState) { 69 ExceptionState& exceptionState) {
71 // 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.
72 std::unique_ptr<MessagePortChannelArray> channels = 71 std::unique_ptr<MessagePortChannelArray> channels =
73 MessagePort::disentanglePorts(context, ports, exceptionState); 72 MessagePort::disentanglePorts(context, ports, exceptionState);
74 if (exceptionState.hadException()) 73 if (exceptionState.hadException())
75 return; 74 return;
76 75
77 if (message->containsTransferableArrayBuffer())
78 context->addConsoleMessage(ConsoleMessage::create(
79 JSMessageSource, WarningMessageLevel,
80 "ServiceWorkerClient cannot send an ArrayBuffer as a transferable "
81 "object yet. See http://crbug.com/511119"));
82
83 WebString messageString = message->toWireString(); 76 WebString messageString = message->toWireString();
84 std::unique_ptr<WebMessagePortChannelArray> webChannels = 77 std::unique_ptr<WebMessagePortChannelArray> webChannels =
85 MessagePort::toWebMessagePortChannelArray(std::move(channels)); 78 MessagePort::toWebMessagePortChannelArray(std::move(channels));
86 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient( 79 ServiceWorkerGlobalScopeClient::from(context)->postMessageToClient(
87 m_uuid, messageString, std::move(webChannels)); 80 m_uuid, messageString, std::move(webChannels));
88 } 81 }
89 82
90 } // namespace blink 83 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698