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

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

Issue 937773002: IDL: Support default values for dictionary members of union types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 impl.setObjectOrNullMemberToNull(); 199 impl.setObjectOrNullMemberToNull();
200 } else { 200 } else {
201 ScriptValue objectOrNullMember = ScriptValue(ScriptState::current(isolat e), objectOrNullMemberValue); 201 ScriptValue objectOrNullMember = ScriptValue(ScriptState::current(isolat e), objectOrNullMemberValue);
202 if (!objectOrNullMember.isObject()) { 202 if (!objectOrNullMember.isObject()) {
203 exceptionState.throwTypeError("member objectOrNullMember is not an o bject."); 203 exceptionState.throwTypeError("member objectOrNullMember is not an o bject.");
204 return; 204 return;
205 } 205 }
206 impl.setObjectOrNullMember(objectOrNullMember); 206 impl.setObjectOrNullMember(objectOrNullMember);
207 } 207 }
208 208
209 v8::Local<v8::Value> otherDoubleOrStringMemberValue = v8Object->Get(v8String (isolate, "otherDoubleOrStringMember"));
210 if (block.HasCaught()) {
211 exceptionState.rethrowV8Exception(block.Exception());
212 return;
213 }
214 if (otherDoubleOrStringMemberValue.IsEmpty() || otherDoubleOrStringMemberVal ue->IsUndefined()) {
215 // Do nothing.
216 } else {
217 DoubleOrString otherDoubleOrStringMember;
218 TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8DoubleOrString::toImpl(isolat e, otherDoubleOrStringMemberValue, otherDoubleOrStringMember, exceptionState), e xceptionState);
219 impl.setOtherDoubleOrStringMember(otherDoubleOrStringMember);
220 }
221
209 v8::Local<v8::Value> restrictedDoubleMemberValue = v8Object->Get(v8String(is olate, "restrictedDoubleMember")); 222 v8::Local<v8::Value> restrictedDoubleMemberValue = v8Object->Get(v8String(is olate, "restrictedDoubleMember"));
210 if (block.HasCaught()) { 223 if (block.HasCaught()) {
211 exceptionState.rethrowV8Exception(block.Exception()); 224 exceptionState.rethrowV8Exception(block.Exception());
212 return; 225 return;
213 } 226 }
214 if (restrictedDoubleMemberValue.IsEmpty() || restrictedDoubleMemberValue->Is Undefined()) { 227 if (restrictedDoubleMemberValue.IsEmpty() || restrictedDoubleMemberValue->Is Undefined()) {
215 // Do nothing. 228 // Do nothing.
216 } else { 229 } else {
217 TONATIVE_VOID_EXCEPTIONSTATE(double, restrictedDoubleMember, toRestricte dDouble(restrictedDoubleMemberValue, exceptionState), exceptionState); 230 TONATIVE_VOID_EXCEPTIONSTATE(double, restrictedDoubleMember, toRestricte dDouble(restrictedDoubleMemberValue, exceptionState), exceptionState);
218 impl.setRestrictedDoubleMember(restrictedDoubleMember); 231 impl.setRestrictedDoubleMember(restrictedDoubleMember);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 448 }
436 449
437 if (impl.hasDoubleOrNullMember()) { 450 if (impl.hasDoubleOrNullMember()) {
438 dictionary->Set(v8String(isolate, "doubleOrNullMember"), v8::Number::New (isolate, impl.doubleOrNullMember())); 451 dictionary->Set(v8String(isolate, "doubleOrNullMember"), v8::Number::New (isolate, impl.doubleOrNullMember()));
439 } else { 452 } else {
440 dictionary->Set(v8String(isolate, "doubleOrNullMember"), v8::Null(isolat e)); 453 dictionary->Set(v8String(isolate, "doubleOrNullMember"), v8::Null(isolat e));
441 } 454 }
442 455
443 if (impl.hasDoubleOrStringMember()) { 456 if (impl.hasDoubleOrStringMember()) {
444 dictionary->Set(v8String(isolate, "doubleOrStringMember"), toV8(impl.dou bleOrStringMember(), creationContext, isolate)); 457 dictionary->Set(v8String(isolate, "doubleOrStringMember"), toV8(impl.dou bleOrStringMember(), creationContext, isolate));
458 } else {
459 dictionary->Set(v8String(isolate, "doubleOrStringMember"), toV8(DoubleOr String::fromDouble(3.14), creationContext, isolate));
445 } 460 }
446 461
447 if (impl.hasElementOrNullMember()) { 462 if (impl.hasElementOrNullMember()) {
448 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem entOrNullMember(), creationContext, isolate)); 463 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem entOrNullMember(), creationContext, isolate));
449 } 464 }
450 465
451 if (impl.hasEnumMember()) { 466 if (impl.hasEnumMember()) {
452 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl. enumMember())); 467 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl. enumMember()));
453 } else { 468 } else {
454 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin g("foo"))); 469 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin g("foo")));
(...skipping 16 matching lines...) Expand all
471 if (impl.hasObjectMember()) { 486 if (impl.hasObjectMember()) {
472 ASSERT(impl.objectMember().isObject()); 487 ASSERT(impl.objectMember().isObject());
473 dictionary->Set(v8String(isolate, "objectMember"), impl.objectMember().v 8Value()); 488 dictionary->Set(v8String(isolate, "objectMember"), impl.objectMember().v 8Value());
474 } 489 }
475 490
476 if (impl.hasObjectOrNullMember()) { 491 if (impl.hasObjectOrNullMember()) {
477 ASSERT(impl.objectOrNullMember().isObject()); 492 ASSERT(impl.objectOrNullMember().isObject());
478 dictionary->Set(v8String(isolate, "objectOrNullMember"), impl.objectOrNu llMember().v8Value()); 493 dictionary->Set(v8String(isolate, "objectOrNullMember"), impl.objectOrNu llMember().v8Value());
479 } 494 }
480 495
496 if (impl.hasOtherDoubleOrStringMember()) {
497 dictionary->Set(v8String(isolate, "otherDoubleOrStringMember"), toV8(imp l.otherDoubleOrStringMember(), creationContext, isolate));
498 } else {
499 dictionary->Set(v8String(isolate, "otherDoubleOrStringMember"), toV8(Dou bleOrString::fromString(String("default string value")), creationContext, isolat e));
500 }
501
481 if (impl.hasRestrictedDoubleMember()) { 502 if (impl.hasRestrictedDoubleMember()) {
482 dictionary->Set(v8String(isolate, "restrictedDoubleMember"), v8::Number: :New(isolate, impl.restrictedDoubleMember())); 503 dictionary->Set(v8String(isolate, "restrictedDoubleMember"), v8::Number: :New(isolate, impl.restrictedDoubleMember()));
483 } else { 504 } else {
484 dictionary->Set(v8String(isolate, "restrictedDoubleMember"), v8::Number: :New(isolate, 3.14)); 505 dictionary->Set(v8String(isolate, "restrictedDoubleMember"), v8::Number: :New(isolate, 3.14));
485 } 506 }
486 507
487 if (impl.hasStringArrayMember()) { 508 if (impl.hasStringArrayMember()) {
488 dictionary->Set(v8String(isolate, "stringArrayMember"), toV8(impl.string ArrayMember(), creationContext, isolate)); 509 dictionary->Set(v8String(isolate, "stringArrayMember"), toV8(impl.string ArrayMember(), creationContext, isolate));
489 } 510 }
490 511
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 564 }
544 565
545 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Local<v8 ::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) 566 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(const v8::Local<v8 ::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
546 { 567 {
547 TestDictionary impl; 568 TestDictionary impl;
548 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); 569 V8TestDictionary::toImpl(isolate, value, impl, exceptionState);
549 return impl; 570 return impl;
550 } 571 }
551 572
552 } // namespace blink 573 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698