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

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

Issue 229373006: Support optional, non-defaulted constructor arguments. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Formatting Created 6 years, 8 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } // namespace TestInterfaceNamedConstructorV8Internal 66 } // namespace TestInterfaceNamedConstructorV8Internal
67 67
68 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNamedCons tructorAttributes[] = { 68 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNamedCons tructorAttributes[] = {
69 {"testNamedConstructorConstructorAttribute", TestInterfaceNamedConstructorV8 Internal::TestInterfaceNamedConstructorConstructorGetter, TestInterfaceNamedCons tructorV8Internal::TestInterfaceNamedConstructorReplaceableAttributeSetterCallba ck, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestNamedConstructor::wrapperTypeInfo) , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::DontEnum), 0 /* on instance */}, 69 {"testNamedConstructorConstructorAttribute", TestInterfaceNamedConstructorV8 Internal::TestInterfaceNamedConstructorConstructorGetter, TestInterfaceNamedCons tructorV8Internal::TestInterfaceNamedConstructorReplaceableAttributeSetterCallba ck, 0, 0, const_cast<WrapperTypeInfo*>(&V8TestNamedConstructor::wrapperTypeInfo) , static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute >(v8::DontEnum), 0 /* on instance */},
70 }; 70 };
71 71
72 const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInf o = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTempla te, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructo r::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEn abledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject }; 72 const WrapperTypeInfo V8TestInterfaceNamedConstructorConstructor::wrapperTypeInf o = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructorConstructor::domTempla te, V8TestInterfaceNamedConstructor::derefObject, V8TestInterfaceNamedConstructo r::toActiveDOMObject, 0, 0, V8TestInterfaceNamedConstructor::installPerContextEn abledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
73 73
74 static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio nCallbackInfo<v8::Value>& info) 74 static void V8TestInterfaceNamedConstructorConstructorCallback(const v8::Functio nCallbackInfo<v8::Value>& info)
75 { 75 {
76 v8::Isolate* isolate = info.GetIsolate();
76 if (!info.IsConstructCall()) { 77 if (!info.IsConstructCall()) {
77 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audi o"), info.GetIsolate()); 78 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audi o"), isolate);
78 return; 79 return;
79 } 80 }
80 81
81 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) { 82 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject ) {
82 v8SetReturnValue(info, info.Holder()); 83 v8SetReturnValue(info, info.Holder());
83 return; 84 return;
84 } 85 }
85 86
86 Document* document = currentDOMWindow(info.GetIsolate())->document(); 87 Document* document = currentDOMWindow(isolate)->document();
87 ASSERT(document); 88 ASSERT(document);
88 89
89 // Make sure the document is added to the DOM Node map. Otherwise, the TestI nterfaceNamedConstructor instance 90 // Make sure the document is added to the DOM Node map. Otherwise, the TestI nterfaceNamedConstructor instance
90 // may end up being the only node in the map and get garbage-collected prema turely. 91 // may end up being the only node in the map and get garbage-collected prema turely.
91 toV8(document, info.Holder(), info.GetIsolate()); 92 toV8(document, info.Holder(), isolate);
92 93
93 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceNamedConstructor", info.Holder(), info.GetIsolate()); 94 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceNamedConstructor", info.Holder(), isolate);
94 if (UNLIKELY(info.Length() < 1)) { 95 if (UNLIKELY(info.Length() < 1)) {
95 throwArityTypeError(exceptionState, 1, info.Length()); 96 throwArityTypeError(exceptionState, 1, info.Length());
96 return; 97 return;
97 } 98 }
98 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ; 99 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ;
99 V8TRYCATCH_VOID(bool, defaultUndefinedOptionalBooleanArg, info[1]->BooleanVa lue()); 100 V8TRYCATCH_VOID(bool, defaultUndefinedOptionalBooleanArg, info[1]->BooleanVa lue());
100 V8TRYCATCH_EXCEPTION_VOID(int, defaultUndefinedOptionalLongArg, toInt32(info [2], exceptionState), exceptionState); 101 V8TRYCATCH_EXCEPTION_VOID(int, defaultUndefinedOptionalLongArg, toInt32(info [2], exceptionState), exceptionState);
101 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOpt ionalStringArg, info[3]); 102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOpt ionalStringArg, info[3]);
102 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOp tionalstringArg, argumentOrNull(info, 4)); 103 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOp tionalstringArg, argumentOrNull(info, 4));
103 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor:: createForJSConstructor(*document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNull StringOptionalstringArg, exceptionState); 104 if (UNLIKELY(info.Length() <= 5)) {
105 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstruct or::createForJSConstructor(stringArg, defaultUndefinedOptionalBooleanArg, defaul tUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNullStringO ptionalstringArg);
106 v8::Handle<v8::Object> wrapper = info.Holder();
107 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor >(impl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
108 v8SetReturnValue(info, wrapper);
109 return;
110 }
111 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, optionalStringArg, info[5]);
112 RefPtr<TestInterfaceNamedConstructor> impl = TestInterfaceNamedConstructor:: createForJSConstructor(*document, stringArg, defaultUndefinedOptionalBooleanArg, defaultUndefinedOptionalLongArg, defaultUndefinedOptionalStringArg, defaultNull StringOptionalstringArg, optionalStringArg, exceptionState);
104 if (exceptionState.throwIfNeeded()) 113 if (exceptionState.throwIfNeeded())
105 return; 114 return;
106 115
107 v8::Handle<v8::Object> wrapper = info.Holder(); 116 v8::Handle<v8::Object> wrapper = info.Holder();
108 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor>(im pl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrap per, info.GetIsolate(), WrapperConfiguration::Dependent); 117 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNamedConstructor>(im pl.release(), &V8TestInterfaceNamedConstructorConstructor::wrapperTypeInfo, wrap per, isolate, WrapperConfiguration::Dependent);
109 v8SetReturnValue(info, wrapper); 118 v8SetReturnValue(info, wrapper);
110 } 119 }
111 120
112 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructorConstructor::dom Template(v8::Isolate* isolate) 121 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructorConstructor::dom Template(v8::Isolate* isolate)
113 { 122 {
114 static int domTemplateKey; // This address is used for a key to look up the dom template. 123 static int domTemplateKey; // This address is used for a key to look up the dom template.
115 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 124 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
116 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey); 125 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
117 if (!result.IsEmpty()) 126 if (!result.IsEmpty())
118 return result; 127 return result;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 fromInternalPointer(object)->deref(); 212 fromInternalPointer(object)->deref();
204 } 213 }
205 214
206 template<> 215 template<>
207 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 216 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
208 { 217 {
209 return toV8(impl, creationContext, isolate); 218 return toV8(impl, creationContext, isolate);
210 } 219 }
211 220
212 } // namespace WebCore 221 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698