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

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

Issue 337343002: IDL: make optional arguments (without default) explicit sometimes Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-default-arguments-next
Patch Set: Created 6 years, 4 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 "V8TestInterfaceConstructor.h" 8 #include "V8TestInterfaceConstructor.h"
9 9
10 #include "bindings/core/v8/Dictionary.h" 10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h" 11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/Optional.h"
12 #include "bindings/core/v8/V8DOMConfiguration.h" 13 #include "bindings/core/v8/V8DOMConfiguration.h"
13 #include "bindings/core/v8/V8HiddenValue.h" 14 #include "bindings/core/v8/V8HiddenValue.h"
14 #include "bindings/core/v8/V8ObjectConstructor.h" 15 #include "bindings/core/v8/V8ObjectConstructor.h"
15 #include "bindings/tests/v8/V8TestInterfaceEmpty.h" 16 #include "bindings/tests/v8/V8TestInterfaceEmpty.h"
16 #include "core/dom/ContextFeatures.h" 17 #include "core/dom/ContextFeatures.h"
17 #include "core/dom/Document.h" 18 #include "core/dom/Document.h"
18 #include "core/frame/LocalDOMWindow.h" 19 #include "core/frame/LocalDOMWindow.h"
19 #include "core/frame/UseCounter.h" 20 #include "core/frame/UseCounter.h"
20 #include "platform/RuntimeEnabledFeatures.h" 21 #include "platform/RuntimeEnabledFeatures.h"
21 #include "platform/TraceEvent.h" 22 #include "platform/TraceEvent.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) 65 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
65 { 66 {
66 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate()); 67 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
67 double doubleArg; 68 double doubleArg;
68 V8StringResource<> stringArg; 69 V8StringResource<> stringArg;
69 TestInterfaceEmpty* testInterfaceEmptyArg; 70 TestInterfaceEmpty* testInterfaceEmptyArg;
70 Dictionary dictionaryArg; 71 Dictionary dictionaryArg;
71 Vector<String> sequenceStringArg; 72 Vector<String> sequenceStringArg;
72 Vector<Dictionary> sequenceDictionaryArg; 73 Vector<Dictionary> sequenceDictionaryArg;
73 Dictionary optionalDictionaryArg; 74 Dictionary optionalDictionaryArg;
74 TestInterfaceEmpty* optionalTestInterfaceEmptyArg; 75 bool optionalDictionaryArgMissing = false;
76 TestInterfaceEmpty* optionalTestInterfaceEmptyArg = nullptr;
77 bool optionalTestInterfaceEmptyArgMissing = false;
75 { 78 {
76 v8::TryCatch block; 79 v8::TryCatch block;
77 V8RethrowTryCatchScope rethrow(block); 80 V8RethrowTryCatchScope rethrow(block);
78 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue())); 81 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
79 TOSTRING_VOID_INTERNAL(stringArg, info[1]); 82 TOSTRING_VOID_INTERNAL(stringArg, info[1]);
80 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[2])); 83 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[2]));
81 TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[3], info.GetIsolat e())); 84 TONATIVE_VOID_INTERNAL(dictionaryArg, Dictionary(info[3], info.GetIsolat e()));
82 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) { 85 if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
83 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object."); 86 exceptionState.throwTypeError("parameter 4 ('dictionaryArg') is not an object.");
84 exceptionState.throwIfNeeded(); 87 exceptionState.throwIfNeeded();
85 return; 88 return;
86 } 89 }
87 TONATIVE_VOID_INTERNAL(sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate())); 90 TONATIVE_VOID_INTERNAL(sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate()));
88 TONATIVE_VOID_INTERNAL(sequenceDictionaryArg, toNativeArray<Dictionary>( info[5], 6, info.GetIsolate())); 91 TONATIVE_VOID_INTERNAL(sequenceDictionaryArg, toNativeArray<Dictionary>( info[5], 6, info.GetIsolate()));
89 TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[6], info.G etIsolate())); 92 if (!info[6]->IsUndefined()) {
90 if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg .isObject()) { 93 TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[6], in fo.GetIsolate()));
91 exceptionState.throwTypeError("parameter 7 ('optionalDictionaryArg') is not an object."); 94 if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionar yArg.isObject()) {
92 exceptionState.throwIfNeeded(); 95 exceptionState.throwTypeError("parameter 7 ('optionalDictionaryA rg') is not an object.");
93 return; 96 exceptionState.throwIfNeeded();
97 return;
98 }
99 } else {
100 optionalDictionaryArgMissing = true;
94 } 101 }
95 TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmp ty::toNativeWithTypeCheck(info.GetIsolate(), info[7])); 102 if (!info[7]->IsUndefined()) {
103 TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfac eEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[7]));
104 } else {
105 optionalTestInterfaceEmptyArgMissing = true;
106 }
96 } 107 }
97 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 108 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
98 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ; 109 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
99 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionary Arg, sequenceStringArg, sequenceDictionaryArg, optionalDictionaryArg, optionalTe stInterfaceEmptyArg, exceptionState); 110 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionary Arg, sequenceStringArg, sequenceDictionaryArg, Optional<Dictionary>(optionalDict ionaryArg, optionalDictionaryArgMissing), Optional<RefPtr<TestInterfaceEmpty> >( optionalTestInterfaceEmptyArg, optionalTestInterfaceEmptyArgMissing), exceptionS tate);
100 if (exceptionState.hadException()) { 111 if (exceptionState.hadException()) {
101 exceptionState.throwIfNeeded(); 112 exceptionState.throwIfNeeded();
102 return; 113 return;
103 } 114 }
104 v8::Handle<v8::Object> wrapper = info.Holder(); 115 v8::Handle<v8::Object> wrapper = info.Holder();
105 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate( ), WrapperConfiguration::Independent); 116 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate( ), WrapperConfiguration::Independent);
106 v8SetReturnValue(info, wrapper); 117 v8SetReturnValue(info, wrapper);
107 } 118 }
108 119
109 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info) 120 static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
110 { 121 {
111 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate()); 122 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
112 V8StringResource<> arg; 123 V8StringResource<> arg;
113 V8StringResource<> optArg; 124 V8StringResource<> optArg;
125 bool optArgMissing = false;
114 { 126 {
115 TOSTRING_VOID_INTERNAL(arg, info[0]); 127 TOSTRING_VOID_INTERNAL(arg, info[0]);
116 if (UNLIKELY(info.Length() <= 1)) { 128 if (!info[1]->IsUndefined()) {
117 ExecutionContext* executionContext = currentExecutionContext(info.Ge tIsolate()); 129 TOSTRING_VOID_INTERNAL(optArg, info[1]);
118 Document& document = *toDocument(currentExecutionContext(info.GetIso late())); 130 } else {
119 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::cr eate(executionContext, document, arg, exceptionState); 131 optArgMissing = true;
120 if (exceptionState.hadException()) {
121 exceptionState.throwIfNeeded();
122 return;
123 }
124 v8::Handle<v8::Object> wrapper = info.Holder();
125 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor> (impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.Get Isolate(), WrapperConfiguration::Independent);
126 v8SetReturnValue(info, wrapper);
127 return;
128 } 132 }
129 TOSTRING_VOID_INTERNAL(optArg, info[1]);
130 } 133 }
131 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 134 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
132 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ; 135 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
133 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, arg, optArg, exceptionState); 136 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(exe cutionContext, document, arg, Optional<V8StringResource<> >(optArg, optArgMissin g), exceptionState);
134 if (exceptionState.hadException()) { 137 if (exceptionState.hadException()) {
135 exceptionState.throwIfNeeded(); 138 exceptionState.throwIfNeeded();
136 return; 139 return;
137 } 140 }
138 v8::Handle<v8::Object> wrapper = info.Holder(); 141 v8::Handle<v8::Object> wrapper = info.Holder();
139 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate( ), WrapperConfiguration::Independent); 142 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate( ), WrapperConfiguration::Independent);
140 v8SetReturnValue(info, wrapper); 143 v8SetReturnValue(info, wrapper);
141 } 144 }
142 145
143 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info) 146 static void constructor4(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return; 241 return;
239 } 242 }
240 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate()); 243 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor", info.Holder(), info.GetIsolate());
241 if (UNLIKELY(info.Length() < 1)) { 244 if (UNLIKELY(info.Length() < 1)) {
242 setMinimumArityTypeError(exceptionState, 1, info.Length()); 245 setMinimumArityTypeError(exceptionState, 1, info.Length());
243 exceptionState.throwIfNeeded(); 246 exceptionState.throwIfNeeded();
244 return; 247 return;
245 } 248 }
246 V8StringResource<> arg; 249 V8StringResource<> arg;
247 V8StringResource<> optArg; 250 V8StringResource<> optArg;
251 bool optArgMissing = false;
248 { 252 {
249 TOSTRING_VOID_INTERNAL(arg, info[0]); 253 TOSTRING_VOID_INTERNAL(arg, info[0]);
250 if (UNLIKELY(info.Length() <= 1)) { 254 if (!info[1]->IsUndefined()) {
251 ExecutionContext* executionContext = currentExecutionContext(info.Ge tIsolate()); 255 TOSTRING_VOID_INTERNAL(optArg, info[1]);
252 Document& document = *toDocument(currentExecutionContext(info.GetIso late())); 256 } else {
253 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::cr eateForJSConstructor(executionContext, document, arg, exceptionState); 257 optArgMissing = true;
254 if (exceptionState.hadException()) {
255 exceptionState.throwIfNeeded();
256 return;
257 }
258 v8::Handle<v8::Object> wrapper = info.Holder();
259 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor> (impl.release(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrappe r, info.GetIsolate(), WrapperConfiguration::Independent);
260 v8SetReturnValue(info, wrapper);
261 return;
262 } 258 }
263 TOSTRING_VOID_INTERNAL(optArg, info[1]);
264 } 259 }
265 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 260 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
266 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ; 261 Document& document = *toDocument(currentExecutionContext(info.GetIsolate())) ;
267 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJ SConstructor(executionContext, document, arg, optArg, exceptionState); 262 RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::createForJ SConstructor(executionContext, document, arg, Optional<V8StringResource<> >(optA rg, optArgMissing), exceptionState);
268 if (exceptionState.hadException()) { 263 if (exceptionState.hadException()) {
269 exceptionState.throwIfNeeded(); 264 exceptionState.throwIfNeeded();
270 return; 265 return;
271 } 266 }
272 v8::Handle<v8::Object> wrapper = info.Holder(); 267 v8::Handle<v8::Object> wrapper = info.Holder();
273 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper, info. GetIsolate(), WrapperConfiguration::Independent); 268 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.re lease(), &V8TestInterfaceConstructorConstructor::wrapperTypeInfo, wrapper, info. GetIsolate(), WrapperConfiguration::Independent);
274 v8SetReturnValue(info, wrapper); 269 v8SetReturnValue(info, wrapper);
275 } 270 }
276 271
277 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempl ate(v8::Isolate* isolate) 272 v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempl ate(v8::Isolate* isolate)
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 fromInternalPointer(internalPointer)->deref(); 375 fromInternalPointer(internalPointer)->deref();
381 } 376 }
382 377
383 template<> 378 template<>
384 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 379 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
385 { 380 {
386 return toV8(impl, creationContext, isolate); 381 return toV8(impl, creationContext, isolate);
387 } 382 }
388 383
389 } // namespace blink 384 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/tests/idls/TestObject.idl ('k') | Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698