| 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( | 20 static void dataAttributeGetterCustom( |
| 21 const v8::FunctionCallbackInfo<v8::Value>&); | 21 const v8::FunctionCallbackInfo<v8::Value>&); |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 template <typename EventType, typename DictType> | 24 template <typename EventType, typename DictType> |
| 25 void V8ServiceWorkerMessageEventInternal::constructorCustom( | 25 void V8ServiceWorkerMessageEventInternal::constructorCustom( |
| 26 const v8::FunctionCallbackInfo<v8::Value>& info) { | 26 const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 27 ExceptionState exceptionState( | 27 ExceptionState exceptionState( |
| 28 ExceptionState::ConstructionContext, | 28 info.GetIsolate(), ExceptionState::ConstructionContext, |
| 29 V8TypeOf<EventType>::Type::wrapperTypeInfo.interfaceName, info.Holder(), | 29 V8TypeOf<EventType>::Type::wrapperTypeInfo.interfaceName); |
| 30 info.GetIsolate()); | |
| 31 if (UNLIKELY(info.Length() < 1)) { | 30 if (UNLIKELY(info.Length() < 1)) { |
| 32 exceptionState.throwTypeError( | 31 exceptionState.throwTypeError( |
| 33 ExceptionMessages::notEnoughArguments(1, info.Length())); | 32 ExceptionMessages::notEnoughArguments(1, info.Length())); |
| 34 return; | 33 return; |
| 35 } | 34 } |
| 36 | 35 |
| 37 V8StringResource<> type = info[0]; | 36 V8StringResource<> type = info[0]; |
| 38 if (!type.prepare()) | 37 if (!type.prepare()) |
| 39 return; | 38 return; |
| 40 | 39 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 102 } |
| 104 if (data.IsEmpty()) | 103 if (data.IsEmpty()) |
| 105 data = v8::Null(isolate); | 104 data = v8::Null(isolate); |
| 106 privateCachedData.set(scriptState->context(), info.Holder(), data); | 105 privateCachedData.set(scriptState->context(), info.Holder(), data); |
| 107 v8SetReturnValue(info, data); | 106 v8SetReturnValue(info, data); |
| 108 } | 107 } |
| 109 | 108 |
| 110 } // namespace blink | 109 } // namespace blink |
| 111 | 110 |
| 112 #endif // V8ServiceWorkerMessageEventInternal_h | 111 #endif // V8ServiceWorkerMessageEventInternal_h |
| OLD | NEW |