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. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 #include "V8TestDictionaryDerivedImplementedAs.h" | 8 #include "V8TestDictionaryDerivedImplementedAs.h" |
9 | 9 |
10 #include "bindings/core/v8/Dictionary.h" | |
11 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
12 #include "bindings/core/v8/V8TestDictionary.h" | 11 #include "bindings/core/v8/V8TestDictionary.h" |
13 | 12 |
14 namespace blink { | 13 namespace blink { |
15 | 14 |
16 void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Hand
le<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState&
exceptionState) | 15 void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Hand
le<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState&
exceptionState) |
17 { | 16 { |
18 if (isUndefinedOrNull(v8Value)) | 17 if (isUndefinedOrNull(v8Value)) |
19 return; | 18 return; |
20 if (!v8Value->IsObject()) { | 19 if (!v8Value->IsObject()) { |
21 exceptionState.throwTypeError("cannot convert to dictionary."); | 20 exceptionState.throwTypeError("cannot convert to dictionary."); |
22 return; | 21 return; |
23 } | 22 } |
24 | 23 |
25 V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState); | 24 V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState); |
26 if (exceptionState.hadException()) | 25 if (exceptionState.hadException()) |
27 return; | 26 return; |
28 | 27 |
29 // FIXME: Do not use Dictionary and DictionaryHelper | 28 |
30 // https://crbug.com/321462 | 29 v8::Local<v8::Object> v8Object = v8Value->ToObject(isolate); |
31 Dictionary dictionary(v8Value, isolate); | |
32 // FIXME: Remove this v8::TryCatch once the code is switched from | |
33 // Dictionary/DictionaryHelper to something that uses ExceptionState. | |
34 v8::TryCatch block; | 30 v8::TryCatch block; |
35 String derivedStringMember; | 31 v8::Local<v8::Value> derivedStringMemberValue = v8Object->Get(v8String(isola
te, "derivedStringMember")); |
36 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString
Member", derivedStringMember)) { | 32 if (!derivedStringMemberValue.IsEmpty() && !isUndefinedOrNull(derivedStringM
emberValue)) { |
| 33 TOSTRING_VOID(V8StringResource<>, derivedStringMember, derivedStringMemb
erValue); |
37 impl.setDerivedStringMember(derivedStringMember); | 34 impl.setDerivedStringMember(derivedStringMember); |
38 } else if (block.HasCaught()) { | 35 } else if (block.HasCaught()) { |
39 exceptionState.rethrowV8Exception(block.Exception()); | 36 exceptionState.rethrowV8Exception(block.Exception()); |
40 return; | |
41 } | 37 } |
42 | 38 |
43 String derivedStringMemberWithDefault; | 39 v8::Local<v8::Value> derivedStringMemberWithDefaultValue = v8Object->Get(v8S
tring(isolate, "derivedStringMemberWithDefault")); |
44 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString
MemberWithDefault", derivedStringMemberWithDefault)) { | 40 if (!derivedStringMemberWithDefaultValue.IsEmpty() && !isUndefinedOrNull(der
ivedStringMemberWithDefaultValue)) { |
| 41 TOSTRING_VOID(V8StringResource<>, derivedStringMemberWithDefault, derive
dStringMemberWithDefaultValue); |
45 impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault); | 42 impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault); |
46 } else if (block.HasCaught()) { | 43 } else if (block.HasCaught()) { |
47 exceptionState.rethrowV8Exception(block.Exception()); | 44 exceptionState.rethrowV8Exception(block.Exception()); |
48 return; | |
49 } | 45 } |
50 | 46 |
51 } | 47 } |
52 | 48 |
53 v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) | 49 v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle<
v8::Object> creationContext, v8::Isolate* isolate) |
54 { | 50 { |
55 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); | 51 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); |
56 toV8TestDictionary(impl, v8Object, creationContext, isolate); | 52 toV8TestDictionary(impl, v8Object, creationContext, isolate); |
57 toV8TestDictionaryDerivedImplementedAs(impl, v8Object, creationContext, isol
ate); | 53 toV8TestDictionaryDerivedImplementedAs(impl, v8Object, creationContext, isol
ate); |
58 return v8Object; | 54 return v8Object; |
59 } | 55 } |
60 | 56 |
61 void toV8TestDictionaryDerivedImplementedAs(TestDictionaryDerivedImplementedAs&
impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 57 void toV8TestDictionaryDerivedImplementedAs(TestDictionaryDerivedImplementedAs&
impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
62 { | 58 { |
63 if (impl.hasDerivedStringMember()) { | 59 if (impl.hasDerivedStringMember()) { |
64 dictionary->Set(v8String(isolate, "derivedStringMember"), v8String(isola
te, impl.derivedStringMember())); | 60 dictionary->Set(v8String(isolate, "derivedStringMember"), v8String(isola
te, impl.derivedStringMember())); |
65 } | 61 } |
66 | 62 |
67 if (impl.hasDerivedStringMemberWithDefault()) { | 63 if (impl.hasDerivedStringMemberWithDefault()) { |
68 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S
tring(isolate, impl.derivedStringMemberWithDefault())); | 64 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S
tring(isolate, impl.derivedStringMemberWithDefault())); |
69 } else { | 65 } else { |
70 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S
tring(isolate, String("default string value"))); | 66 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S
tring(isolate, String("default string value"))); |
71 } | 67 } |
72 | 68 |
73 } | 69 } |
74 | 70 |
75 } // namespace blink | 71 } // namespace blink |
OLD | NEW |