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 "config.h" | 5 #include "config.h" |
6 #include "V8ServiceWorker.h" | 6 #include "V8Client.h" |
7 | 7 |
8 #include "bindings/v8/ExceptionMessages.h" | 8 #include "bindings/v8/ExceptionMessages.h" |
9 #include "bindings/v8/ExceptionState.h" | 9 #include "bindings/v8/ExceptionState.h" |
10 #include "bindings/v8/SerializedScriptValue.h" | 10 #include "bindings/v8/SerializedScriptValue.h" |
11 #include "bindings/v8/V8Binding.h" | 11 #include "bindings/v8/V8Binding.h" |
12 #include "core/dom/MessagePort.h" | 12 #include "core/dom/MessagePort.h" |
13 #include "modules/serviceworkers/ServiceWorker.h" | 13 #include "modules/serviceworkers/ServiceWorker.h" |
14 #include "wtf/ArrayBuffer.h" | 14 #include "wtf/ArrayBuffer.h" |
15 | 15 |
16 namespace WebCore { | 16 namespace WebCore { |
17 | 17 |
18 void V8ServiceWorker::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8: :Value>& info) | 18 void V8Client::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & info) |
19 { | 19 { |
20 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", "ServiceWorker", info.Holder(), info.GetIsolate()); | 20 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", "ServiceWorker", info.Holder(), info.GetIsolate()); |
21 ServiceWorker* worker = V8ServiceWorker::toNative(info.Holder()); | 21 Client* client = V8Client::toNative(info.Holder()); |
22 MessagePortArray ports; | 22 MessagePortArray ports; |
23 ArrayBufferArray arrayBuffers; | 23 ArrayBufferArray arrayBuffers; |
24 if (info.Length() > 1) { | 24 if (info.Length() > 1) { |
25 const int transferablesArgIndex = 1; | 25 const int transferablesArgIndex = 1; |
26 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn dex], transferablesArgIndex, ports, arrayBuffers, exceptionState, info.GetIsolat e())) { | 26 if (!SerializedScriptValue::extractTransferables(info[transferablesArgIn dex], transferablesArgIndex, ports, arrayBuffers, exceptionState, info.GetIsolat e())) { |
27 exceptionState.throwIfNeeded(); | 27 exceptionState.throwIfNeeded(); |
28 return; | 28 return; |
29 } | 29 } |
30 } | 30 } |
31 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0 ], &ports, &arrayBuffers, exceptionState, info.GetIsolate()); | 31 RefPtr<SerializedScriptValue> message = SerializedScriptValue::create(info[0 ], &ports, &arrayBuffers, exceptionState, info.GetIsolate()); |
32 if (exceptionState.throwIfNeeded()) | 32 if (exceptionState.throwIfNeeded()) |
33 return; | 33 return; |
34 worker->postMessage(message.release(), &ports, exceptionState); | 34 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
35 client->postMessage(context, message.release(), &ports, exceptionState); | |
jsbell
2014/05/06 22:15:24
Actually... what's this patch based on besides 263
kinuko
2014/05/07 09:12:15
Rebase failure.. added missing code.
| |
35 exceptionState.throwIfNeeded(); | 36 exceptionState.throwIfNeeded(); |
36 } | 37 } |
37 | 38 |
38 } // namespace WebCore | 39 } // namespace WebCore |
OLD | NEW |