OLD | NEW |
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/V8HiddenValue.h" | 10 #include "bindings/core/v8/V8HiddenValue.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 if (!info[1]->IsObject()) { | 39 if (!info[1]->IsObject()) { |
40 exceptionState.throwTypeError("parameter 2 ('eventInitDict') is not
an object."); | 40 exceptionState.throwTypeError("parameter 2 ('eventInitDict') is not
an object."); |
41 exceptionState.throwIfNeeded(); | 41 exceptionState.throwIfNeeded(); |
42 return; | 42 return; |
43 } | 43 } |
44 V8TypeOf<DictType>::Type::toImpl(info.GetIsolate(), info[1], eventInitDi
ct, exceptionState); | 44 V8TypeOf<DictType>::Type::toImpl(info.GetIsolate(), info[1], eventInitDi
ct, exceptionState); |
45 if (exceptionState.throwIfNeeded()) | 45 if (exceptionState.throwIfNeeded()) |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 RefPtrWillBeRawPtr<EventType> impl = EventType::create(type, eventInitDict); | 49 RawPtr<EventType> impl = EventType::create(type, eventInitDict); |
50 v8::Local<v8::Object> wrapper = info.Holder(); | 50 v8::Local<v8::Object> wrapper = info.Holder(); |
51 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TypeOf<EventType>
::Type::wrapperTypeInfo, wrapper); | 51 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TypeOf<EventType>
::Type::wrapperTypeInfo, wrapper); |
52 | 52 |
53 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store | 53 // TODO(bashi): Workaround for http://crbug.com/529941. We need to store |
54 // |data| as a hidden value to avoid cycle references. | 54 // |data| as a hidden value to avoid cycle references. |
55 if (eventInitDict.hasData()) { | 55 if (eventInitDict.hasData()) { |
56 v8::Local<v8::Value> v8Data = eventInitDict.data().v8Value(); | 56 v8::Local<v8::Value> v8Data = eventInitDict.data().v8Value(); |
57 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), w
rapper, V8HiddenValue::data(info.GetIsolate()), v8Data); | 57 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), w
rapper, V8HiddenValue::data(info.GetIsolate()), v8Data); |
58 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) | 58 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) |
59 impl->setSerializedData(SerializedScriptValueFactory::instance().cre
ateAndSwallowExceptions(info.GetIsolate(), v8Data)); | 59 impl->setSerializedData(SerializedScriptValueFactory::instance().cre
ateAndSwallowExceptions(info.GetIsolate(), v8Data)); |
(...skipping 29 matching lines...) Expand all Loading... |
89 } | 89 } |
90 if (data.IsEmpty()) | 90 if (data.IsEmpty()) |
91 data = v8::Null(isolate); | 91 data = v8::Null(isolate); |
92 V8HiddenValue::setHiddenValue(scriptState, info.Holder(), V8HiddenValue::dat
a(isolate), data); | 92 V8HiddenValue::setHiddenValue(scriptState, info.Holder(), V8HiddenValue::dat
a(isolate), data); |
93 v8SetReturnValue(info, data); | 93 v8SetReturnValue(info, data); |
94 } | 94 } |
95 | 95 |
96 } // namespace blink | 96 } // namespace blink |
97 | 97 |
98 #endif // V8ServiceWorkerMessageEventInternal_h | 98 #endif // V8ServiceWorkerMessageEventInternal_h |
OLD | NEW |