Chromium Code Reviews| 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 static v8::Local<v8::Value> cacheState(v8::Isolate* isolate, v8::Local<v8::Objec t> event, v8::Local<v8::Value> data) | |
|
haraken
2015/06/25 04:18:48
Can we remove this helper function?
xiang
2015/06/29 02:32:24
Done.
| |
| 14 { | |
| 15 V8HiddenValue::setHiddenValue(isolate, event, V8HiddenValue::data(isolate), data); | |
| 16 return data; | |
| 17 } | |
| 18 | |
| 19 void V8ServiceWorkerMessageEvent::dataAttributeGetterCustom(const v8::PropertyCa llbackInfo<v8::Value>& info) | |
| 20 { | |
| 21 ServiceWorkerMessageEvent* event = V8ServiceWorkerMessageEvent::toImpl(info. Holder()); | |
| 22 | |
| 23 v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(info.GetIsolate( ), info.Holder(), V8HiddenValue::data(info.GetIsolate())); | |
| 24 | |
| 25 if (!result.IsEmpty()) { | |
| 26 v8SetReturnValue(info, result); | |
| 27 return; | |
| 28 } | |
| 29 | |
| 30 v8::Local<v8::Value> data; | |
| 31 if (SerializedScriptValue* serializedValue = event->serializedData()) { | |
| 32 MessagePortArray ports = event->ports(); | |
| 33 data = serializedValue->deserialize(info.GetIsolate(), &ports); | |
| 34 } else { | |
| 35 data = event->data().v8ValueFor(ScriptState::current(info.GetIsolate())) ; | |
| 36 } | |
| 37 if (data.IsEmpty()) | |
| 38 data = v8::Null(info.GetIsolate()); | |
| 39 v8SetReturnValue(info, cacheState(info.GetIsolate(), info.Holder(), data)); | |
| 40 } | |
| 41 | |
| 42 } // namespace blink | |
| OLD | NEW |