OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "bindings/modules/v8/V8ServiceWorkerMessageEvent.h" | 6 #include "bindings/modules/v8/V8ExtendableMessageEvent.h" |
7 | 7 |
8 #include "bindings/core/v8/SerializedScriptValue.h" | 8 #include "bindings/core/v8/SerializedScriptValue.h" |
9 #include "bindings/core/v8/V8HiddenValue.h" | 9 #include "bindings/core/v8/V8HiddenValue.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 void V8ServiceWorkerMessageEvent::dataAttributeGetterCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) | 13 void V8ExtendableMessageEvent::dataAttributeGetterCustom(const v8::FunctionCallb
ackInfo<v8::Value>& info) |
14 { | 14 { |
15 ServiceWorkerMessageEvent* event = V8ServiceWorkerMessageEvent::toImpl(info.
Holder()); | 15 ExtendableMessageEvent* event = V8ExtendableMessageEvent::toImpl(info.Holder
()); |
16 v8::Isolate* isolate = info.GetIsolate(); | 16 v8::Isolate* isolate = info.GetIsolate(); |
17 v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(isolate, info.Ho
lder(), V8HiddenValue::data(isolate)); | 17 v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(isolate, info.Ho
lder(), V8HiddenValue::data(isolate)); |
18 | 18 |
19 if (!result.IsEmpty()) { | 19 if (!result.IsEmpty()) { |
20 v8SetReturnValue(info, result); | 20 v8SetReturnValue(info, result); |
21 return; | 21 return; |
22 } | 22 } |
23 | 23 |
24 v8::Local<v8::Value> data; | 24 v8::Local<v8::Value> data; |
25 if (SerializedScriptValue* serializedValue = event->serializedData()) { | 25 if (SerializedScriptValue* serializedValue = event->serializedData()) { |
26 MessagePortArray ports = event->ports(); | 26 MessagePortArray ports = event->ports(); |
27 data = serializedValue->deserialize(isolate, &ports); | 27 data = serializedValue->deserialize(isolate, &ports); |
28 } else { | 28 } else { |
29 data = event->data().v8ValueFor(ScriptState::current(isolate)); | 29 data = event->data().v8ValueFor(ScriptState::current(isolate)); |
30 } | 30 } |
31 if (data.IsEmpty()) | 31 if (data.IsEmpty()) |
32 data = v8::Null(isolate); | 32 data = v8::Null(isolate); |
33 V8HiddenValue::setHiddenValue(isolate, info.Holder(), V8HiddenValue::data(is
olate), data); | 33 V8HiddenValue::setHiddenValue(isolate, info.Holder(), V8HiddenValue::data(is
olate), data); |
34 v8SetReturnValue(info, data); | 34 v8SetReturnValue(info, data); |
35 } | 35 } |
36 | 36 |
37 } // namespace blink | 37 } // namespace blink |
OLD | NEW |