| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // This file has been auto-generated by code_generator_v8.py. | 5 // This file has been auto-generated by code_generator_v8.py. |
| 6 // DO NOT MODIFY! | 6 // DO NOT MODIFY! |
| 7 | 7 |
| 8 // This file has been generated from the Jinja2 template in | 8 // This file has been generated from the Jinja2 template in |
| 9 // third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp.tmpl | 9 // third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp.tmpl |
| 10 | 10 |
| 11 // clang-format off | 11 // clang-format off |
| 12 #include "V8TestInterfaceEventInit.h" | 12 #include "V8TestInterfaceEventInit.h" |
| 13 | 13 |
| 14 #include "bindings/core/v8/ExceptionState.h" | 14 #include "bindings/core/v8/ExceptionState.h" |
| 15 #include "bindings/core/v8/IDLTypes.h" | 15 #include "bindings/core/v8/IDLTypes.h" |
| 16 #include "bindings/core/v8/NativeValueTraitsImpl.h" | 16 #include "bindings/core/v8/NativeValueTraitsImpl.h" |
| 17 #include "bindings/core/v8/V8EventInit.h" | 17 #include "bindings/core/v8/V8EventInit.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 static const v8::Eternal<v8::Name>* eternalV8TestInterfaceEventInitKeys(v8::Isol
ate* isolate) { |
| 22 static const char* const kKeys[] = { |
| 23 "stringMember", |
| 24 }; |
| 25 return V8PerIsolateData::from(isolate)->findOrCreateKeys( |
| 26 kKeys, kKeys, WTF_ARRAY_LENGTH(kKeys)); |
| 27 } |
| 28 |
| 21 void V8TestInterfaceEventInit::toImpl(v8::Isolate* isolate, v8::Local<v8::Value>
v8Value, TestInterfaceEventInit& impl, ExceptionState& exceptionState) { | 29 void V8TestInterfaceEventInit::toImpl(v8::Isolate* isolate, v8::Local<v8::Value>
v8Value, TestInterfaceEventInit& impl, ExceptionState& exceptionState) { |
| 22 if (isUndefinedOrNull(v8Value)) { | 30 if (isUndefinedOrNull(v8Value)) { |
| 23 return; | 31 return; |
| 24 } | 32 } |
| 25 if (!v8Value->IsObject()) { | 33 if (!v8Value->IsObject()) { |
| 26 exceptionState.throwTypeError("cannot convert to dictionary."); | 34 exceptionState.throwTypeError("cannot convert to dictionary."); |
| 27 return; | 35 return; |
| 28 } | 36 } |
| 29 v8::Local<v8::Object> v8Object = v8Value.As<v8::Object>(); | 37 v8::Local<v8::Object> v8Object = v8Value.As<v8::Object>(); |
| 30 ALLOW_UNUSED_LOCAL(v8Object); | 38 ALLOW_UNUSED_LOCAL(v8Object); |
| 31 | 39 |
| 32 V8EventInit::toImpl(isolate, v8Value, impl, exceptionState); | 40 V8EventInit::toImpl(isolate, v8Value, impl, exceptionState); |
| 33 if (exceptionState.hadException()) | 41 if (exceptionState.hadException()) |
| 34 return; | 42 return; |
| 35 | 43 |
| 44 const v8::Eternal<v8::Name>* keys = eternalV8TestInterfaceEventInitKeys(isolat
e); |
| 36 v8::TryCatch block(isolate); | 45 v8::TryCatch block(isolate); |
| 46 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 37 v8::Local<v8::Value> stringMemberValue; | 47 v8::Local<v8::Value> stringMemberValue; |
| 38 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "stri
ngMember")).ToLocal(&stringMemberValue)) { | 48 if (!v8Object->Get(context, keys[0].Get(isolate)).ToLocal(&stringMemberValue))
{ |
| 39 exceptionState.rethrowV8Exception(block.Exception()); | 49 exceptionState.rethrowV8Exception(block.Exception()); |
| 40 return; | 50 return; |
| 41 } | 51 } |
| 42 if (stringMemberValue.IsEmpty() || stringMemberValue->IsUndefined()) { | 52 if (stringMemberValue.IsEmpty() || stringMemberValue->IsUndefined()) { |
| 43 // Do nothing. | 53 // Do nothing. |
| 44 } else { | 54 } else { |
| 45 V8StringResource<> stringMember = stringMemberValue; | 55 V8StringResource<> stringMember = stringMemberValue; |
| 46 if (!stringMember.prepare(exceptionState)) | 56 if (!stringMember.prepare(exceptionState)) |
| 47 return; | 57 return; |
| 48 impl.setStringMember(stringMember); | 58 impl.setStringMember(stringMember); |
| 49 } | 59 } |
| 50 } | 60 } |
| 51 | 61 |
| 52 v8::Local<v8::Value> TestInterfaceEventInit::toV8Impl(v8::Local<v8::Object> crea
tionContext, v8::Isolate* isolate) const { | 62 v8::Local<v8::Value> TestInterfaceEventInit::toV8Impl(v8::Local<v8::Object> crea
tionContext, v8::Isolate* isolate) const { |
| 53 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); | 63 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); |
| 54 if (!toV8TestInterfaceEventInit(*this, v8Object, creationContext, isolate)) | 64 if (!toV8TestInterfaceEventInit(*this, v8Object, creationContext, isolate)) |
| 55 return v8::Undefined(isolate); | 65 return v8::Undefined(isolate); |
| 56 return v8Object; | 66 return v8Object; |
| 57 } | 67 } |
| 58 | 68 |
| 59 bool toV8TestInterfaceEventInit(const TestInterfaceEventInit& impl, v8::Local<v8
::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* isolat
e) { | 69 bool toV8TestInterfaceEventInit(const TestInterfaceEventInit& impl, v8::Local<v8
::Object> dictionary, v8::Local<v8::Object> creationContext, v8::Isolate* isolat
e) { |
| 60 if (!toV8EventInit(impl, dictionary, creationContext, isolate)) | 70 if (!toV8EventInit(impl, dictionary, creationContext, isolate)) |
| 61 return false; | 71 return false; |
| 62 | 72 |
| 73 const v8::Eternal<v8::Name>* keys = eternalV8TestInterfaceEventInitKeys(isolat
e); |
| 74 v8::Local<v8::Context> context = isolate->GetCurrentContext(); |
| 63 if (impl.hasStringMember()) { | 75 if (impl.hasStringMember()) { |
| 64 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "stringMember"), v8String(isolate, impl.stringMember
())))) | 76 if (!v8CallBoolean(dictionary->CreateDataProperty(context, keys[0].Get(isola
te), v8String(isolate, impl.stringMember())))) |
| 65 return false; | 77 return false; |
| 66 } | 78 } |
| 67 | 79 |
| 68 return true; | 80 return true; |
| 69 } | 81 } |
| 70 | 82 |
| 71 TestInterfaceEventInit NativeValueTraits<TestInterfaceEventInit>::nativeValue(v8
::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
{ | 83 TestInterfaceEventInit NativeValueTraits<TestInterfaceEventInit>::nativeValue(v8
::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
{ |
| 72 TestInterfaceEventInit impl; | 84 TestInterfaceEventInit impl; |
| 73 V8TestInterfaceEventInit::toImpl(isolate, value, impl, exceptionState); | 85 V8TestInterfaceEventInit::toImpl(isolate, value, impl, exceptionState); |
| 74 return impl; | 86 return impl; |
| 75 } | 87 } |
| 76 | 88 |
| 77 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |