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