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/GeneratedCodeHelper.h" |
8 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
9 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 10 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
10 #include "bindings/core/v8/V8PrivateProperty.h" | 11 #include "bindings/core/v8/V8PrivateProperty.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 class V8ServiceWorkerMessageEventInternal { | 15 class V8ServiceWorkerMessageEventInternal { |
15 public: | 16 public: |
16 template <typename EventType, typename DictType> | 17 template <typename EventType, typename DictType> |
17 static void constructorCustom(const v8::FunctionCallbackInfo<v8::Value>&); | 18 static void constructorCustom(const v8::FunctionCallbackInfo<v8::Value>&); |
18 | 19 |
19 template <typename EventType> | 20 template <typename EventType> |
20 static void dataAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Val
ue>&); | 21 static void dataAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Val
ue>&); |
21 }; | 22 }; |
22 | 23 |
23 template <typename EventType, typename DictType> | 24 template <typename EventType, typename DictType> |
24 void V8ServiceWorkerMessageEventInternal::constructorCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) | 25 void V8ServiceWorkerMessageEventInternal::constructorCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) |
25 { | 26 { |
26 ExceptionState exceptionState(ExceptionState::ConstructionContext, V8TypeOf<
EventType>::Type::wrapperTypeInfo.interfaceName, info.Holder(), info.GetIsolate(
)); | 27 ExceptionState exceptionState(ExceptionState::ConstructionContext, V8TypeOf<
EventType>::Type::wrapperTypeInfo.interfaceName, info.Holder(), info.GetIsolate(
)); |
27 if (UNLIKELY(info.Length() < 1)) { | 28 if (UNLIKELY(info.Length() < 1)) { |
28 setMinimumArityTypeError(exceptionState, 1, info.Length()); | 29 throwMinimumArityError(exceptionState, 1, info.Length()); |
29 return; | 30 return; |
30 } | 31 } |
31 | 32 |
32 V8StringResource<> type = info[0]; | 33 V8StringResource<> type = info[0]; |
33 if (!type.prepare()) | 34 if (!type.prepare()) |
34 return; | 35 return; |
35 | 36 |
36 DictType eventInitDict; | 37 DictType eventInitDict; |
37 if (!isUndefinedOrNull(info[1])) { | 38 if (!isUndefinedOrNull(info[1])) { |
38 if (!info[1]->IsObject()) { | 39 if (!info[1]->IsObject()) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 88 } |
88 if (data.IsEmpty()) | 89 if (data.IsEmpty()) |
89 data = v8::Null(isolate); | 90 data = v8::Null(isolate); |
90 privateCachedData.set(scriptState->context(), info.Holder(), data); | 91 privateCachedData.set(scriptState->context(), info.Holder(), data); |
91 v8SetReturnValue(info, data); | 92 v8SetReturnValue(info, data); |
92 } | 93 } |
93 | 94 |
94 } // namespace blink | 95 } // namespace blink |
95 | 96 |
96 #endif // V8ServiceWorkerMessageEventInternal_h | 97 #endif // V8ServiceWorkerMessageEventInternal_h |
OLD | NEW |