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

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

Issue 860353002: IDL: Add toRestricted{Float,Double}() helpers to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 11 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 "V8TestDictionary.h" 8 #include "V8TestDictionary.h"
9 9
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 v8::Local<v8::Value> doubleOrNullMemberValue = v8Object->Get(v8String(isolat e, "doubleOrNullMember")); 73 v8::Local<v8::Value> doubleOrNullMemberValue = v8Object->Get(v8String(isolat e, "doubleOrNullMember"));
74 if (block.HasCaught()) { 74 if (block.HasCaught()) {
75 exceptionState.rethrowV8Exception(block.Exception()); 75 exceptionState.rethrowV8Exception(block.Exception());
76 return; 76 return;
77 } 77 }
78 if (doubleOrNullMemberValue.IsEmpty() || doubleOrNullMemberValue->IsUndefine d()) { 78 if (doubleOrNullMemberValue.IsEmpty() || doubleOrNullMemberValue->IsUndefine d()) {
79 // Do nothing. 79 // Do nothing.
80 } else if (doubleOrNullMemberValue->IsNull()) { 80 } else if (doubleOrNullMemberValue->IsNull()) {
81 impl.setDoubleOrNullMemberToNull(); 81 impl.setDoubleOrNullMemberToNull();
82 } else { 82 } else {
83 TONATIVE_VOID_EXCEPTIONSTATE(double, doubleOrNullMember, toDouble(double OrNullMemberValue, exceptionState), exceptionState); 83 TONATIVE_VOID_EXCEPTIONSTATE(double, doubleOrNullMember, toRestrictedDou ble(doubleOrNullMemberValue, exceptionState), exceptionState);
84 impl.setDoubleOrNullMember(doubleOrNullMember); 84 impl.setDoubleOrNullMember(doubleOrNullMember);
85 } 85 }
86 86
87 v8::Local<v8::Value> doubleOrStringMemberValue = v8Object->Get(v8String(isol ate, "doubleOrStringMember")); 87 v8::Local<v8::Value> doubleOrStringMemberValue = v8Object->Get(v8String(isol ate, "doubleOrStringMember"));
88 if (block.HasCaught()) { 88 if (block.HasCaught()) {
89 exceptionState.rethrowV8Exception(block.Exception()); 89 exceptionState.rethrowV8Exception(block.Exception());
90 return; 90 return;
91 } 91 }
92 if (doubleOrStringMemberValue.IsEmpty() || doubleOrStringMemberValue->IsUnde fined()) { 92 if (doubleOrStringMemberValue.IsEmpty() || doubleOrStringMemberValue->IsUnde fined()) {
93 // Do nothing. 93 // Do nothing.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // Do nothing. 380 // Do nothing.
381 } else { 381 } else {
382 DOMUint8Array* uint8ArrayMember = uint8ArrayMemberValue->IsUint8Array() ? V8Uint8Array::toImpl(v8::Local<v8::Uint8Array>::Cast(uint8ArrayMemberValue)) : 0; 382 DOMUint8Array* uint8ArrayMember = uint8ArrayMemberValue->IsUint8Array() ? V8Uint8Array::toImpl(v8::Local<v8::Uint8Array>::Cast(uint8ArrayMemberValue)) : 0;
383 if (!uint8ArrayMember && !uint8ArrayMemberValue->IsNull()) { 383 if (!uint8ArrayMember && !uint8ArrayMemberValue->IsNull()) {
384 exceptionState.throwTypeError("member uint8ArrayMember is not of typ e Uint8Array."); 384 exceptionState.throwTypeError("member uint8ArrayMember is not of typ e Uint8Array.");
385 return; 385 return;
386 } 386 }
387 impl.setUint8ArrayMember(uint8ArrayMember); 387 impl.setUint8ArrayMember(uint8ArrayMember);
388 } 388 }
389 389
390 v8::Local<v8::Value> unrestrictedDoubleMemberValue = v8Object->Get(v8String( isolate, "unrestrictedDoubleMember"));
391 if (block.HasCaught()) {
392 exceptionState.rethrowV8Exception(block.Exception());
393 return;
394 }
395 if (unrestrictedDoubleMemberValue.IsEmpty() || unrestrictedDoubleMemberValue ->IsUndefined()) {
396 // Do nothing.
397 } else {
398 TONATIVE_VOID_EXCEPTIONSTATE(double, unrestrictedDoubleMember, toDouble( unrestrictedDoubleMemberValue, exceptionState), exceptionState);
399 impl.setUnrestrictedDoubleMember(unrestrictedDoubleMember);
400 }
401
390 } 402 }
391 403
392 v8::Local<v8::Value> toV8(const TestDictionary& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) 404 v8::Local<v8::Value> toV8(const TestDictionary& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate)
393 { 405 {
394 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); 406 v8::Local<v8::Object> v8Object = v8::Object::New(isolate);
395 toV8TestDictionary(impl, v8Object, creationContext, isolate); 407 toV8TestDictionary(impl, v8Object, creationContext, isolate);
396 return v8Object; 408 return v8Object;
397 } 409 }
398 410
399 void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio nary, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) 411 void toV8TestDictionary(const TestDictionary& impl, v8::Local<v8::Object> dictio nary, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 } 509 }
498 510
499 if (impl.hasTestInterfaceWillBeGarbageCollectedOrNullMember()) { 511 if (impl.hasTestInterfaceWillBeGarbageCollectedOrNullMember()) {
500 dictionary->Set(v8String(isolate, "testInterfaceWillBeGarbageCollectedOr NullMember"), toV8(impl.testInterfaceWillBeGarbageCollectedOrNullMember(), creat ionContext, isolate)); 512 dictionary->Set(v8String(isolate, "testInterfaceWillBeGarbageCollectedOr NullMember"), toV8(impl.testInterfaceWillBeGarbageCollectedOrNullMember(), creat ionContext, isolate));
501 } 513 }
502 514
503 if (impl.hasUint8ArrayMember()) { 515 if (impl.hasUint8ArrayMember()) {
504 dictionary->Set(v8String(isolate, "uint8ArrayMember"), toV8(impl.uint8Ar rayMember(), creationContext, isolate)); 516 dictionary->Set(v8String(isolate, "uint8ArrayMember"), toV8(impl.uint8Ar rayMember(), creationContext, isolate));
505 } 517 }
506 518
519 if (impl.hasUnrestrictedDoubleMember()) {
520 dictionary->Set(v8String(isolate, "unrestrictedDoubleMember"), v8::Numbe r::New(isolate, impl.unrestrictedDoubleMember()));
521 } else {
522 dictionary->Set(v8String(isolate, "unrestrictedDoubleMember"), v8::Numbe r::New(isolate, 3.14));
523 }
524
507 } 525 }
508 526
509 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Local<v8 ::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) 527 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Local<v8 ::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
510 { 528 {
511 TestDictionary impl; 529 TestDictionary impl;
512 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); 530 V8TestDictionary::toImpl(isolate, value, impl, exceptionState);
513 return impl; 531 return impl;
514 } 532 }
515 533
516 } // namespace blink 534 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698