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

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: Rebasing the fixes... Created 3 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 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return; 50 return;
51 } 51 }
52 52
53 EventType* impl = EventType::create(type, eventInitDict); 53 EventType* impl = EventType::create(type, eventInitDict);
54 v8::Local<v8::Object> wrapper = info.Holder(); 54 v8::Local<v8::Object> wrapper = info.Holder();
55 wrapper = impl->associateWithWrapper( 55 wrapper = impl->associateWithWrapper(
56 info.GetIsolate(), &V8TypeOf<EventType>::Type::wrapperTypeInfo, wrapper); 56 info.GetIsolate(), &V8TypeOf<EventType>::Type::wrapperTypeInfo, wrapper);
57 57
58 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store 58 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store
59 // |data| as a private value to avoid cyclic references. 59 // |data| as a private value to avoid cyclic references.
60 if (eventInitDict.hasData()) { 60 /* DO NOT SUBMIT - merge conflict marker.
61 v8::Local<v8::Value> v8Data = eventInitDict.data().v8Value(); 61 * Please spell |hasData| (not |HasData|) below. */
62 V8PrivateProperty::getMessageEventCachedData(info.GetIsolate()) 62 if (event_init_dict.hasData()) {
63 .set(info.GetIsolate()->GetCurrentContext(), wrapper, v8Data); 63 /* DO NOT SUBMIT - merge conflict marker.
64 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) 64 * Please spell |data| (not |Data|) below. */
65 impl->setSerializedData( 65 v8::Local<v8::Value> v8_data = event_init_dict.data().V8Value();
66 SerializedScriptValue::serializeAndSwallowExceptions( 66 V8PrivateProperty::GetMessageEventCachedData(info.GetIsolate())
67 info.GetIsolate(), v8Data)); 67 .Set(info.GetIsolate()->GetCurrentContext(), wrapper, v8_data);
68 if (DOMWrapperWorld::Current(info.GetIsolate()).IsIsolatedWorld())
69 impl->SetSerializedData(
70 SerializedScriptValue::SerializeAndSwallowExceptions(
71 info.GetIsolate(), v8_data));
68 } 72 }
69 v8SetReturnValue(info, wrapper); 73 v8SetReturnValue(info, wrapper);
70 } 74 }
71 75
72 template <typename EventType> 76 template <typename EventType>
73 void V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom( 77 void V8ServiceWorkerMessageEventInternal::dataAttributeGetterCustom(
74 const v8::FunctionCallbackInfo<v8::Value>& info) { 78 const v8::FunctionCallbackInfo<v8::Value>& info) {
75 EventType* event = V8TypeOf<EventType>::Type::toImpl(info.Holder()); 79 EventType* event = V8TypeOf<EventType>::Type::toImpl(info.Holder());
76 v8::Isolate* isolate = info.GetIsolate(); 80 v8::Isolate* isolate = info.GetIsolate();
77 ScriptState* scriptState = ScriptState::current(isolate); 81 ScriptState* scriptState = ScriptState::current(isolate);
78 auto privateCachedData = 82 auto privateCachedData =
79 V8PrivateProperty::getMessageEventCachedData(isolate); 83 V8PrivateProperty::getMessageEventCachedData(isolate);
80 v8::Local<v8::Value> result = 84 v8::Local<v8::Value> result =
81 privateCachedData.get(scriptState->context(), info.Holder()); 85 privateCachedData.get(scriptState->context(), info.Holder());
82 if (!result.IsEmpty()) { 86 if (!result.IsEmpty()) {
83 v8SetReturnValue(info, result); 87 v8SetReturnValue(info, result);
84 return; 88 return;
85 } 89 }
86 90
87 v8::Local<v8::Value> data; 91 v8::Local<v8::Value> data;
88 if (SerializedScriptValue* serializedValue = event->serializedData()) { 92 if (SerializedScriptValue* serialized_value = event->SerializedData()) {
93 /* DO NOT SUBMIT - merge conflict marker.
94 * Please spell |ports| (not |Ports|) in the 2 places below. */
89 MessagePortArray ports = event->ports(); 95 MessagePortArray ports = event->ports();
90 data = serializedValue->deserialize(isolate, &ports); 96 data = serialized_value->Deserialize(isolate, &ports);
91 } else if (DOMWrapperWorld::current(isolate).isIsolatedWorld()) { 97 } else if (DOMWrapperWorld::Current(isolate).IsIsolatedWorld()) {
92 v8::Local<v8::Value> mainWorldData = 98 v8::Local<v8::Value> main_world_data =
93 privateCachedData.getFromMainWorld(scriptState, event); 99 private_cached_data.GetFromMainWorld(script_state, event);
94 if (!mainWorldData.IsEmpty()) { 100 if (!main_world_data.IsEmpty()) {
95 // TODO(bashi): Enter the main world's ScriptState::Scope while 101 // TODO(bashi): Enter the main world's ScriptState::Scope while
96 // serializing the main world's value. 102 // serializing the main world's value.
97 event->setSerializedData( 103 event->setSerializedData(
98 SerializedScriptValue::serializeAndSwallowExceptions( 104 SerializedScriptValue::serializeAndSwallowExceptions(
99 info.GetIsolate(), mainWorldData)); 105 info.GetIsolate(), mainWorldData));
100 data = event->serializedData()->deserialize(); 106 data = event->serializedData()->deserialize();
101 } 107 }
102 } 108 }
103 if (data.IsEmpty()) 109 if (data.IsEmpty())
104 data = v8::Null(isolate); 110 data = v8::Null(isolate);
105 privateCachedData.set(scriptState->context(), info.Holder(), data); 111 privateCachedData.set(scriptState->context(), info.Holder(), data);
106 v8SetReturnValue(info, data); 112 v8SetReturnValue(info, data);
107 } 113 }
108 114
109 } // namespace blink 115 } // namespace blink
110 116
111 #endif // V8ServiceWorkerMessageEventInternal_h 117 #endif // V8ServiceWorkerMessageEventInternal_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698