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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/custom/V8ExtendableMessageEventCustom.cpp

Issue 1658073002: ServiceWorker: Implement attributes of ExtendableMessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address falken's comments Created 4 years, 10 months 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "bindings/modules/v8/V8ServiceWorkerMessageEvent.h" 5 #include "bindings/modules/v8/V8ExtendableMessageEvent.h"
6 6
7 #include "bindings/core/v8/SerializedScriptValue.h" 7 #include "bindings/core/v8/SerializedScriptValue.h"
8 #include "bindings/core/v8/V8HiddenValue.h" 8 #include "bindings/core/v8/V8HiddenValue.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 void V8ServiceWorkerMessageEvent::dataAttributeGetterCustom(const v8::FunctionCa llbackInfo<v8::Value>& info) 12 void V8ExtendableMessageEvent::dataAttributeGetterCustom(const v8::FunctionCallb ackInfo<v8::Value>& info)
13 { 13 {
14 ServiceWorkerMessageEvent* event = V8ServiceWorkerMessageEvent::toImpl(info. Holder()); 14 ExtendableMessageEvent* event = V8ExtendableMessageEvent::toImpl(info.Holder ());
15 v8::Isolate* isolate = info.GetIsolate(); 15 v8::Isolate* isolate = info.GetIsolate();
16 ScriptState* scriptState = ScriptState::current(isolate); 16 ScriptState* scriptState = ScriptState::current(isolate);
17 v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(scriptState, inf o.Holder(), V8HiddenValue::data(isolate)); 17 v8::Local<v8::Value> result = V8HiddenValue::getHiddenValue(scriptState, inf o.Holder(), 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); 29 data = event->data().v8ValueFor(scriptState);
30 } 30 }
31 if (data.IsEmpty()) 31 if (data.IsEmpty())
32 data = v8::Null(isolate); 32 data = v8::Null(isolate);
33 V8HiddenValue::setHiddenValue(scriptState, info.Holder(), V8HiddenValue::dat a(isolate), data); 33 V8HiddenValue::setHiddenValue(scriptState, info.Holder(), V8HiddenValue::dat a(isolate), data);
34 v8SetReturnValue(info, data); 34 v8SetReturnValue(info, data);
35 } 35 }
36 36
37 } // namespace blink 37 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698