Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp

Issue 740453004: IDL: Basic dictionary inheritance support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionaryDerived.h ('k') | Source/core/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestDictionaryDerivedImplementedAs.h"
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/V8TestDictionary.h"
13
14 namespace blink {
15
16 void V8TestDictionaryDerivedImplementedAs::toImpl(v8::Isolate* isolate, v8::Hand le<v8::Value> v8Value, TestDictionaryDerivedImplementedAs& impl, ExceptionState& exceptionState)
17 {
18 if (isUndefinedOrNull(v8Value))
19 return;
20 if (!v8Value->IsObject()) {
21 exceptionState.throwTypeError("cannot convert to dictionary.");
22 return;
23 }
24
25 V8TestDictionary::toImpl(isolate, v8Value, impl, exceptionState);
26 if (exceptionState.hadException())
27 return;
28
29 // FIXME: Do not use Dictionary and DictionaryHelper
30 // https://crbug.com/321462
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;
35 String derivedStringMember;
36 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString Member", derivedStringMember)) {
37 impl.setDerivedStringMember(derivedStringMember);
38 } else if (block.HasCaught()) {
39 exceptionState.rethrowV8Exception(block.Exception());
40 return;
41 }
42
43 String derivedStringMemberWithDefault;
44 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "derivedString MemberWithDefault", derivedStringMemberWithDefault)) {
45 impl.setDerivedStringMemberWithDefault(derivedStringMemberWithDefault);
46 } else if (block.HasCaught()) {
47 exceptionState.rethrowV8Exception(block.Exception());
48 return;
49 }
50
51 }
52
53 v8::Handle<v8::Value> toV8(TestDictionaryDerivedImplementedAs& impl, v8::Handle< v8::Object> creationContext, v8::Isolate* isolate)
54 {
55 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate);
56 toV8TestDictionary(impl, v8Object, creationContext, isolate);
57 toV8TestDictionaryDerivedImplementedAs(impl, v8Object, creationContext, isol ate);
58 return v8Object;
59 }
60
61 void toV8TestDictionaryDerivedImplementedAs(TestDictionaryDerivedImplementedAs& impl, v8::Handle<v8::Object> dictionary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
62 {
63 if (impl.hasDerivedStringMember()) {
64 dictionary->Set(v8String(isolate, "derivedStringMember"), v8String(isola te, impl.derivedStringMember()));
65 }
66
67 if (impl.hasDerivedStringMemberWithDefault()) {
68 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, impl.derivedStringMemberWithDefault()));
69 } else {
70 dictionary->Set(v8String(isolate, "derivedStringMemberWithDefault"), v8S tring(isolate, String("default string value")));
71 }
72
73 }
74
75 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/core/V8TestDictionaryDerived.h ('k') | Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698