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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp

Issue 340443004: IDL: reuse more code between CG for methods and constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename scriptContext -> executionContext Created 6 years, 6 months 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
OLDNEW
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 "V8TestInterfaceNamedConstructor.h" 8 #include "V8TestInterfaceNamedConstructor.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (!info.IsConstructCall()) { 78 if (!info.IsConstructCall()) {
79 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audi o"), isolate); 79 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audi o"), isolate);
80 return; 80 return;
81 } 81 }
82 82
83 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject ) { 83 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject ) {
84 v8SetReturnValue(info, info.Holder()); 84 v8SetReturnValue(info, info.Holder());
85 return; 85 return;
86 } 86 }
87 87
88 Document* document = currentDOMWindow(isolate)->document(); 88 Document* documentPtr = currentDOMWindow(isolate)->document();
89 ASSERT(document); 89 ASSERT(documentPtr);
90 Document& document = *documentPtr;
90 91
91 // Make sure the document is added to the DOM Node map. Otherwise, the TestI nterfaceNamedConstructor instance 92 // Make sure the document is added to the DOM Node map. Otherwise, the TestI nterfaceNamedConstructor instance
92 // may end up being the only node in the map and get garbage-collected prema turely. 93 // may end up being the only node in the map and get garbage-collected prema turely.
93 toV8(document, info.Holder(), isolate); 94 toV8(documentPtr, info.Holder(), isolate);
94 95
95 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceNamedConstructor", info.Holder(), isolate); 96 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceNamedConstructor", info.Holder(), isolate);
96 if (UNLIKELY(info.Length() < 1)) { 97 if (UNLIKELY(info.Length() < 1)) {
97 throwMinimumArityTypeError(exceptionState, 1, info.Length()); 98 throwMinimumArityTypeError(exceptionState, 1, info.Length());
98 return; 99 return;
99 } 100 }
100 V8StringResource<> stringArg; 101 V8StringResource<> stringArg;
101 bool defaultUndefinedOptionalBooleanArg; 102 bool defaultUndefinedOptionalBooleanArg;
102 int defaultUndefinedOptionalLongArg; 103 int defaultUndefinedOptionalLongArg;
103 V8StringResource<> defaultUndefinedOptionalStringArg; 104 V8StringResource<> defaultUndefinedOptionalStringArg;
104 V8StringResource<> defaultNullStringOptionalstringArg; 105 V8StringResource<> defaultNullStringOptionalstringArg;
105 V8StringResource<> optionalStringArg; 106 V8StringResource<> optionalStringArg;
106 { 107 {
107 v8::TryCatch block; 108 v8::TryCatch block;
108 V8RethrowTryCatchScope rethrow(block); 109 V8RethrowTryCatchScope rethrow(block);
109 TOSTRING_VOID_INTERNAL(stringArg, info[0]); 110 TOSTRING_VOID_INTERNAL(stringArg, info[0]);
110 TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalBooleanArg, info[1]->Bool eanValue()); 111 TONATIVE_VOID_INTERNAL(defaultUndefinedOptionalBooleanArg, info[1]->Bool eanValue());
111 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedOptionalLongArg, t oInt32(info[2], exceptionState), exceptionState); 112 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedOptionalLongArg, t oInt32(info[2], exceptionState), exceptionState);
112 TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[3]); 113 TOSTRING_VOID_INTERNAL(defaultUndefinedOptionalStringArg, info[3]);
113 TOSTRING_VOID_INTERNAL(defaultNullStringOptionalstringArg, argumentOrNul l(info, 4)); 114 TOSTRING_VOID_INTERNAL(defaultNullStringOptionalstringArg, argumentOrNul l(info, 4));
114 if (UNLIKELY(info.Length() <= 5)) { 115 if (UNLIKELY(info.Length() <= 5)) {
115 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConst ructor::createForJSConstructor(stringArg, defaultUndefinedOptionalBooleanArg, de faultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStr ingOptionalstringArg); 116 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConst ructor::createForJSConstructor(document, stringArg, defaultUndefinedOptionalBool eanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defa ultNullStringOptionalstringArg, exceptionState);
116 v8::Handle<v8::Object> wrapper = info.Holder(); 117 v8::Handle<v8::Object> wrapper = info.Holder();
117 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstru ctor>(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeIn fo, wrapper, isolate, WrapperConfiguration::Dependent); 118 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstru ctor>(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeIn fo, wrapper, isolate, WrapperConfiguration::Dependent);
118 v8SetReturnValue(info, wrapper); 119 v8SetReturnValue(info, wrapper);
119 return; 120 return;
120 } 121 }
121 TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]); 122 TOSTRING_VOID_INTERNAL(optionalStringArg, info[5]);
122 } 123 }
123 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor:: createForJSConstructor(*document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNull StringOptionalstringArg, optionalStringArg, exceptionState); 124 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor:: createForJSConstructor(document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullS tringOptionalstringArg, optionalStringArg, exceptionState);
124 if (exceptionState.throwIfNeeded()) 125 if (exceptionState.throwIfNeeded())
125 return; 126 return;
126 127
127 v8::Handle<v8::Object> wrapper = info.Holder(); 128 v8::Handle<v8::Object> wrapper = info.Holder();
128 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor>(im pl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrap per, isolate, WrapperConfiguration::Dependent); 129 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor>(im pl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrap per, isolate, WrapperConfiguration::Dependent);
129 v8SetReturnValue(info, wrapper); 130 v8SetReturnValue(info, wrapper);
130 } 131 }
131 132
132 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructorConstructor::dom Template(v8::Isolate* isolate) 133 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructorConstructor::dom Template(v8::Isolate* isolate)
133 { 134 {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 fromInternalPointer(object)->deref(); 222 fromInternalPointer(object)->deref();
222 } 223 }
223 224
224 template<> 225 template<>
225 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 226 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
226 { 227 {
227 return toV8(impl, creationContext, isolate); 228 return toV8(impl, creationContext, isolate);
228 } 229 }
229 230
230 } // namespace WebCore 231 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698