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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/V8ServiceWorkerMessageEventInternal.h

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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 2016 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 #ifndef V8ServiceWorkerMessageEventInternal_h 5 #ifndef V8ServiceWorkerMessageEventInternal_h
6 #define V8ServiceWorkerMessageEventInternal_h 6 #define V8ServiceWorkerMessageEventInternal_h
7 7
8 #include "bindings/core/v8/SerializedScriptValue.h" 8 #include "bindings/core/v8/SerializedScriptValue.h"
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" 9 #include "bindings/core/v8/SerializedScriptValueFactory.h"
10 #include "bindings/core/v8/V8PrivateProperty.h" 10 #include "bindings/core/v8/V8PrivateProperty.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return; 51 return;
52 } 52 }
53 53
54 EventType* impl = EventType::create(type, eventInitDict); 54 EventType* impl = EventType::create(type, eventInitDict);
55 v8::Local<v8::Object> wrapper = info.Holder(); 55 v8::Local<v8::Object> wrapper = info.Holder();
56 wrapper = impl->associateWithWrapper( 56 wrapper = impl->associateWithWrapper(
57 isolate, &V8TypeOf<EventType>::Type::wrapperTypeInfo, wrapper); 57 isolate, &V8TypeOf<EventType>::Type::wrapperTypeInfo, wrapper);
58 58
59 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store 59 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store
60 // |data| as a private value to avoid cyclic references. 60 // |data| as a private value to avoid cyclic references.
61 /* DO NOT SUBMIT - merge conflict marker.
62 * Please spell |hasData| (not |HasData|) below. */
61 if (eventInitDict.hasData()) { 63 if (eventInitDict.hasData()) {
64 /* DO NOT SUBMIT - merge conflict marker.
65 * Please spell |data| (not |Data|) below. */
62 v8::Local<v8::Value> v8Data = eventInitDict.data().v8Value(); 66 v8::Local<v8::Value> v8Data = eventInitDict.data().v8Value();
63 V8PrivateProperty::getMessageEventCachedData(isolate).set(wrapper, v8Data); 67 V8PrivateProperty::getMessageEventCachedData(isolate).set(wrapper, v8Data);
64 if (DOMWrapperWorld::current(isolate).isIsolatedWorld()) { 68 if (DOMWrapperWorld::current(isolate).isIsolatedWorld()) {
65 impl->setSerializedData( 69 impl->setSerializedData(
66 SerializedScriptValue::serializeAndSwallowExceptions(isolate, 70 SerializedScriptValue::serializeAndSwallowExceptions(isolate,
67 v8Data)); 71 v8Data));
68 } 72 }
69 } 73 }
70 v8SetReturnValue(info, wrapper); 74 v8SetReturnValue(info, wrapper);
71 } 75 }
72 76
73 template <typename EventType> 77 template <typename EventType>
74 void V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom( 78 void V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom(
75 const v8::FunctionCallbackInfo<v8::Value>& info) { 79 const v8::FunctionCallbackInfo<v8::Value>& info) {
76 EventType* event = V8TypeOf<EventType>::Type::toImpl(info.Holder()); 80 EventType* event = V8TypeOf<EventType>::Type::toImpl(info.Holder());
77 v8::Isolate* isolate = info.GetIsolate(); 81 v8::Isolate* isolate = info.GetIsolate();
78 auto privateCachedData = 82 auto privateCachedData =
79 V8PrivateProperty::getMessageEventCachedData(isolate); 83 V8PrivateProperty::getMessageEventCachedData(isolate);
80 v8::Local<v8::Value> result = privateCachedData.getOrEmpty(info.Holder()); 84 v8::Local<v8::Value> result = privateCachedData.getOrEmpty(info.Holder());
81 if (!result.IsEmpty()) { 85 if (!result.IsEmpty()) {
82 v8SetReturnValue(info, result); 86 v8SetReturnValue(info, result);
83 return; 87 return;
84 } 88 }
85 89
86 v8::Local<v8::Value> data; 90 v8::Local<v8::Value> data;
87 if (SerializedScriptValue* serializedValue = event->serializedData()) { 91 if (SerializedScriptValue* serializedValue = event->serializedData()) {
92 /* DO NOT SUBMIT - merge conflict marker.
93 * Please spell |ports| (not |Ports|) below. */
88 MessagePortArray ports = event->ports(); 94 MessagePortArray ports = event->ports();
89 SerializedScriptValue::DeserializeOptions options; 95 SerializedScriptValue::DeserializeOptions options;
90 options.messagePorts = &ports; 96 options.messagePorts = &ports;
91 data = serializedValue->deserialize(isolate, options); 97 data = serializedValue->deserialize(isolate, options);
92 } else if (DOMWrapperWorld::current(isolate).isIsolatedWorld()) { 98 } else if (DOMWrapperWorld::current(isolate).isIsolatedWorld()) {
93 v8::Local<v8::Value> mainWorldData = 99 v8::Local<v8::Value> mainWorldData =
94 privateCachedData.getFromMainWorld(event); 100 privateCachedData.getFromMainWorld(event);
95 if (!mainWorldData.IsEmpty()) { 101 if (!mainWorldData.IsEmpty()) {
96 // TODO(bashi): Enter the main world's ScriptState::Scope while 102 // TODO(bashi): Enter the main world's ScriptState::Scope while
97 // serializing the main world's value. 103 // serializing the main world's value.
98 event->setSerializedData( 104 event->setSerializedData(
99 SerializedScriptValue::serializeAndSwallowExceptions( 105 SerializedScriptValue::serializeAndSwallowExceptions(
100 info.GetIsolate(), mainWorldData)); 106 info.GetIsolate(), mainWorldData));
101 data = event->serializedData()->deserialize(isolate); 107 data = event->serializedData()->deserialize(isolate);
102 } 108 }
103 } 109 }
104 if (data.IsEmpty()) 110 if (data.IsEmpty())
105 data = v8::Null(isolate); 111 data = v8::Null(isolate);
106 privateCachedData.set(info.Holder(), data); 112 privateCachedData.set(info.Holder(), data);
107 v8SetReturnValue(info, data); 113 v8SetReturnValue(info, data);
108 } 114 }
109 115
110 } // namespace blink 116 } // namespace blink
111 117
112 #endif // V8ServiceWorkerMessageEventInternal_h 118 #endif // V8ServiceWorkerMessageEventInternal_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698