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

Side by Side Diff: Source/bindings/tests/results/modules/V8TestInterface5.cpp

Issue 567503002: Add toDouble() helper, and use toFloat()/toDouble() for conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface5.h" 9 #include "V8TestInterface5.h"
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 83 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
84 TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info) ; 84 TestInterface5ImplementationV8Internal::doubleAttributeAttributeGetter(info) ;
85 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 85 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
86 } 86 }
87 87
88 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v 8::PropertyCallbackInfo<void>& info) 88 static void doubleAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v 8::PropertyCallbackInfo<void>& info)
89 { 89 {
90 v8::Handle<v8::Object> holder = info.Holder(); 90 v8::Handle<v8::Object> holder = info.Holder();
91 ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribut e", "TestInterface5", holder, info.GetIsolate()); 91 ExceptionState exceptionState(ExceptionState::SetterContext, "doubleAttribut e", "TestInterface5", holder, info.GetIsolate());
92 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); 92 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
93 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ; 93 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionSt ate), exceptionState);
94 if (!std::isfinite(cppValue)) { 94 if (!std::isfinite(cppValue)) {
95 exceptionState.throwTypeError("The provided double value is non-finite." ); 95 exceptionState.throwTypeError("The provided double value is non-finite." );
96 exceptionState.throwIfNeeded(); 96 exceptionState.throwIfNeeded();
97 return; 97 return;
98 } 98 }
99 impl->setDoubleAttribute(cppValue); 99 impl->setDoubleAttribute(cppValue);
100 } 100 }
101 101
102 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 102 static void doubleAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
103 { 103 {
(...skipping 14 matching lines...) Expand all
118 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 118 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
119 TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info); 119 TestInterface5ImplementationV8Internal::floatAttributeAttributeGetter(info);
120 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 120 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
121 } 121 }
122 122
123 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8 ::PropertyCallbackInfo<void>& info) 123 static void floatAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8 ::PropertyCallbackInfo<void>& info)
124 { 124 {
125 v8::Handle<v8::Object> holder = info.Holder(); 125 v8::Handle<v8::Object> holder = info.Holder();
126 ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute ", "TestInterface5", holder, info.GetIsolate()); 126 ExceptionState exceptionState(ExceptionState::SetterContext, "floatAttribute ", "TestInterface5", holder, info.GetIsolate());
127 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); 127 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
128 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue())); 128 TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionStat e), exceptionState);
129 if (!std::isfinite(cppValue)) { 129 if (!std::isfinite(cppValue)) {
130 exceptionState.throwTypeError("The provided float value is non-finite.") ; 130 exceptionState.throwTypeError("The provided float value is non-finite.") ;
131 exceptionState.throwIfNeeded(); 131 exceptionState.throwIfNeeded();
132 return; 132 return;
133 } 133 }
134 impl->setFloatAttribute(cppValue); 134 impl->setFloatAttribute(cppValue);
135 } 135 }
136 136
137 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 137 static void floatAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
138 { 138 {
(...skipping 12 matching lines...) Expand all
151 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info) 151 static void unrestrictedDoubleAttributeAttributeGetterCallback(v8::Local<v8::Str ing>, const v8::PropertyCallbackInfo<v8::Value>& info)
152 { 152 {
153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 153 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
154 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Getter(info); 154 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Getter(info);
155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 155 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
156 } 156 }
157 157
158 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info) 158 static void unrestrictedDoubleAttributeAttributeSetter(v8::Local<v8::Value> v8Va lue, const v8::PropertyCallbackInfo<void>& info)
159 { 159 {
160 v8::Handle<v8::Object> holder = info.Holder(); 160 v8::Handle<v8::Object> holder = info.Holder();
161 ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedDo ubleAttribute", "TestInterface5", holder, info.GetIsolate());
161 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); 162 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
162 TONATIVE_VOID(double, cppValue, static_cast<double>(v8Value->NumberValue())) ; 163 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionSt ate), exceptionState);
163 impl->setUnrestrictedDoubleAttribute(cppValue); 164 impl->setUnrestrictedDoubleAttribute(cppValue);
164 } 165 }
165 166
166 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 167 static void unrestrictedDoubleAttributeAttributeSetterCallback(v8::Local<v8::Str ing>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
167 { 168 {
168 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); 169 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
169 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Setter(v8Value, info); 170 TestInterface5ImplementationV8Internal::unrestrictedDoubleAttributeAttribute Setter(v8Value, info);
170 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 171 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
171 } 172 }
172 173
173 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info) 174 static void unrestrictedFloatAttributeAttributeGetter(const v8::PropertyCallback Info<v8::Value>& info)
174 { 175 {
175 v8::Handle<v8::Object> holder = info.Holder(); 176 v8::Handle<v8::Object> holder = info.Holder();
176 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); 177 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
177 v8SetReturnValue(info, impl->unrestrictedFloatAttribute()); 178 v8SetReturnValue(info, impl->unrestrictedFloatAttribute());
178 } 179 }
179 180
180 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info) 181 static void unrestrictedFloatAttributeAttributeGetterCallback(v8::Local<v8::Stri ng>, const v8::PropertyCallbackInfo<v8::Value>& info)
181 { 182 {
182 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); 183 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
183 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeG etter(info); 184 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeG etter(info);
184 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 185 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
185 } 186 }
186 187
187 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info) 188 static void unrestrictedFloatAttributeAttributeSetter(v8::Local<v8::Value> v8Val ue, const v8::PropertyCallbackInfo<void>& info)
188 { 189 {
189 v8::Handle<v8::Object> holder = info.Holder(); 190 v8::Handle<v8::Object> holder = info.Holder();
191 ExceptionState exceptionState(ExceptionState::SetterContext, "unrestrictedFl oatAttribute", "TestInterface5", holder, info.GetIsolate());
190 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder); 192 TestInterface5Implementation* impl = V8TestInterface5::toImpl(holder);
191 TONATIVE_VOID(float, cppValue, static_cast<float>(v8Value->NumberValue())); 193 TONATIVE_VOID_EXCEPTIONSTATE(float, cppValue, toFloat(v8Value, exceptionStat e), exceptionState);
192 impl->setUnrestrictedFloatAttribute(cppValue); 194 impl->setUnrestrictedFloatAttribute(cppValue);
193 } 195 }
194 196
195 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 197 static void unrestrictedFloatAttributeAttributeSetterCallback(v8::Local<v8::Stri ng>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
196 { 198 {
197 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); 199 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
198 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeS etter(v8Value, info); 200 TestInterface5ImplementationV8Internal::unrestrictedFloatAttributeAttributeS etter(v8Value, info);
199 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 201 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
200 } 202 }
201 203
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 359
358 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 360 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
359 { 361 {
360 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 362 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
361 TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMetho d(info); 363 TestInterface5ImplementationV8Internal::voidMethodTestInterfaceEmptyArgMetho d(info);
362 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 364 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
363 } 365 }
364 366
365 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 367 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
366 { 368 {
369 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodD oubleArgFloatArg", "TestInterface5", info.Holder(), info.GetIsolate());
367 if (UNLIKELY(info.Length() < 2)) { 370 if (UNLIKELY(info.Length() < 2)) {
368 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodDoubleArgFloatArg", "TestInterface5", 2, info.Length(), info.GetIsolate ()), info.GetIsolate()); 371 setMinimumArityTypeError(exceptionState, 2, info.Length());
372 exceptionState.throwIfNeeded();
369 return; 373 return;
370 } 374 }
371 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; 375 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ;
372 double doubleArg; 376 double doubleArg;
373 float floatArg; 377 float floatArg;
374 { 378 {
375 v8::TryCatch block; 379 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(doubleArg, toDouble(info[0], excep tionState), exceptionState);
376 V8RethrowTryCatchScope rethrow(block);
377 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
378 if (!std::isfinite(doubleArg)) { 380 if (!std::isfinite(doubleArg)) {
379 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface5", "double parameter 1 is non-fini te."), info.GetIsolate()); 381 exceptionState.throwTypeError("double parameter 1 is non-finite.");
382 exceptionState.throwIfNeeded();
380 return; 383 return;
381 } 384 }
382 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue ())); 385 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(floatArg, toFloat(info[1], excepti onState), exceptionState);
383 if (!std::isfinite(floatArg)) { 386 if (!std::isfinite(floatArg)) {
384 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodDoubleArgFloatArg", "TestInterface5", "float parameter 2 is non-finit e."), info.GetIsolate()); 387 exceptionState.throwTypeError("float parameter 2 is non-finite.");
388 exceptionState.throwIfNeeded();
385 return; 389 return;
386 } 390 }
387 } 391 }
388 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); 392 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
389 } 393 }
390 394
391 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 395 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
392 { 396 {
393 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 397 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
394 TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(in fo); 398 TestInterface5ImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(in fo);
395 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 399 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
396 } 400 }
397 401
398 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info) 402 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info)
399 { 403 {
404 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodU nrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface5", info.Holder(), info .GetIsolate());
400 if (UNLIKELY(info.Length() < 2)) { 405 if (UNLIKELY(info.Length() < 2)) {
401 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface5", 2, info.L ength(), info.GetIsolate()), info.GetIsolate()); 406 setMinimumArityTypeError(exceptionState, 2, info.Length());
407 exceptionState.throwIfNeeded();
402 return; 408 return;
403 } 409 }
404 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ; 410 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()) ;
405 double unrestrictedDoubleArg; 411 double unrestrictedDoubleArg;
406 float unrestrictedFloatArg; 412 float unrestrictedFloatArg;
407 { 413 {
408 v8::TryCatch block; 414 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedDoubleArg, toDouble(in fo[0], exceptionState), exceptionState);
409 V8RethrowTryCatchScope rethrow(block); 415 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(unrestrictedFloatArg, toFloat(info [1], exceptionState), exceptionState);
410 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue()));
411 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue()));
412 } 416 }
413 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg); 417 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg);
414 } 418 }
415 419
416 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info) 420 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info)
417 { 421 {
418 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 422 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
419 TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnres trictedFloatArgMethod(info); 423 TestInterface5ImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnres trictedFloatArgMethod(info);
420 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 424 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
421 } 425 }
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 } 878 }
875 879
876 template<> 880 template<>
877 v8::Handle<v8::Value> toV8NoInline(TestInterface5Implementation* impl, v8::Handl e<v8::Object> creationContext, v8::Isolate* isolate) 881 v8::Handle<v8::Value> toV8NoInline(TestInterface5Implementation* impl, v8::Handl e<v8::Object> creationContext, v8::Isolate* isolate)
878 { 882 {
879 return toV8(impl, creationContext, isolate); 883 return toV8(impl, creationContext, isolate);
880 } 884 }
881 885
882 } // namespace blink 886 } // namespace blink
883 #endif // ENABLE(CONDITION) 887 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698