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

Side by Side Diff: Source/bindings/modules/v8/custom/V8ServiceWorkerMessageEventCustom.cpp

Issue 1130113006: ServiceWorker: Introduce ServiceWorkerMessageEvent to replace MessageEvent (3/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make more tests pass Created 5 years, 5 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
(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
OLDNEW
« no previous file with comments | « LayoutTests/webexposed/global-interface-listing-expected.txt ('k') | Source/bindings/modules/v8/custom/custom.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698