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