Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "bindings/core/v8/UnionTypesCore.h" | 8 #include "bindings/core/v8/UnionTypesCore.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/Dictionary.h" | 10 #include "bindings/core/v8/Dictionary.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 m_type = SpecificTypeDictionary; | 89 m_type = SpecificTypeDictionary; |
| 90 } | 90 } |
| 91 | 91 |
| 92 ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionar y::fromDictionary(Dictionary value) | 92 ArrayBufferOrArrayBufferViewOrDictionary ArrayBufferOrArrayBufferViewOrDictionar y::fromDictionary(Dictionary value) |
| 93 { | 93 { |
| 94 ArrayBufferOrArrayBufferViewOrDictionary container; | 94 ArrayBufferOrArrayBufferViewOrDictionary container; |
| 95 container.setDictionary(value); | 95 container.setDictionary(value); |
| 96 return container; | 96 return container; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8 ::Local<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, Exce ptionState& exceptionState) | 99 bool V8ArrayBufferOrArrayBufferViewOrDictionary::toImpl(v8::Isolate* isolate, v8 ::Local<v8::Value> v8Value, ArrayBufferOrArrayBufferViewOrDictionary& impl, Exce ptionState& exceptionState) |
| 100 { | 100 { |
| 101 if (v8Value.IsEmpty()) | 101 if (v8Value.IsEmpty()) |
| 102 return; | 102 return true; |
| 103 | 103 |
| 104 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { | 104 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { |
| 105 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O bject>::Cast(v8Value)); | 105 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O bject>::Cast(v8Value)); |
| 106 impl.setArrayBuffer(cppValue); | 106 impl.setArrayBuffer(cppValue); |
| 107 return; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { | 110 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { |
| 111 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc al<v8::Object>::Cast(v8Value)); | 111 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc al<v8::Object>::Cast(v8Value)); |
| 112 impl.setArrayBufferView(cppValue); | 112 impl.setArrayBufferView(cppValue); |
| 113 return; | 113 return true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { | 116 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
| 117 TONATIVE_VOID_EXCEPTIONSTATE(Dictionary, cppValue, Dictionary(v8Value, i solate, exceptionState), exceptionState); | 117 Dictionary cppValue = Dictionary(v8Value, isolate, exceptionState); |
| 118 if (exceptionState.hadException()) | |
| 119 return false; | |
| 118 impl.setDictionary(cppValue); | 120 impl.setDictionary(cppValue); |
| 119 return; | 121 return true; |
| 120 } | 122 } |
| 121 | 123 |
| 122 exceptionState.throwTypeError("The provided value is not of type '(ArrayBuff er or ArrayBufferView or Dictionary)'"); | 124 exceptionState.throwTypeError("The provided value is not of type '(ArrayBuff er or ArrayBufferView or Dictionary)'"); |
| 125 return false; | |
| 123 } | 126 } |
| 124 | 127 |
| 125 v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) | 128 v8::Local<v8::Value> toV8(const ArrayBufferOrArrayBufferViewOrDictionary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 126 { | 129 { |
| 127 switch (impl.m_type) { | 130 switch (impl.m_type) { |
| 128 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeNone: | 131 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeNone: |
| 129 return v8::Null(isolate); | 132 return v8::Null(isolate); |
| 130 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBuffer: | 133 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBuffer: |
| 131 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); | 134 return toV8(impl.getAsArrayBuffer(), creationContext, isolate); |
| 132 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBufferView: | 135 case ArrayBufferOrArrayBufferViewOrDictionary::SpecificTypeArrayBufferView: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 m_type = SpecificTypeUnrestrictedDouble; | 207 m_type = SpecificTypeUnrestrictedDouble; |
| 205 } | 208 } |
| 206 | 209 |
| 207 BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromUnr estrictedDouble(double value) | 210 BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromUnr estrictedDouble(double value) |
| 208 { | 211 { |
| 209 BooleanOrStringOrUnrestrictedDouble container; | 212 BooleanOrStringOrUnrestrictedDouble container; |
| 210 container.setUnrestrictedDouble(value); | 213 container.setUnrestrictedDouble(value); |
| 211 return container; | 214 return container; |
| 212 } | 215 } |
| 213 | 216 |
| 214 void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Loc al<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionState & exceptionState) | 217 bool V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Loc al<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionState & exceptionState) |
| 215 { | 218 { |
| 216 if (v8Value.IsEmpty()) | 219 if (v8Value.IsEmpty()) |
| 217 return; | 220 return true; |
| 218 | 221 |
| 219 if (v8Value->IsBoolean()) { | 222 if (v8Value->IsBoolean()) { |
| 220 impl.setBoolean(v8Value->ToBoolean()->Value()); | 223 impl.setBoolean(v8Value->ToBoolean()->Value()); |
| 221 return; | 224 return true; |
| 222 } | 225 } |
| 223 | 226 |
| 224 if (v8Value->IsNumber()) { | 227 if (v8Value->IsNumber()) { |
| 225 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti onState), exceptionState); | 228 double cppValue = toDouble(v8Value, exceptionState); |
| 229 if (exceptionState.hadException()) | |
| 230 return false; | |
| 226 impl.setUnrestrictedDouble(cppValue); | 231 impl.setUnrestrictedDouble(cppValue); |
| 227 return; | 232 return true; |
| 228 } | 233 } |
| 229 | 234 |
| 230 { | 235 { |
| 231 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 236 V8StringResource<> cppValue = v8Value; |
| 237 if (!cppValue.prepare(exceptionState)) | |
| 238 return false; | |
| 232 impl.setString(cppValue); | 239 impl.setString(cppValue); |
| 233 return; | 240 return true; |
| 234 } | 241 } |
| 235 | 242 |
| 236 } | 243 } |
| 237 | 244 |
| 238 v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble& impl, v8::L ocal<v8::Object> creationContext, v8::Isolate* isolate) | 245 v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble& impl, v8::L ocal<v8::Object> creationContext, v8::Isolate* isolate) |
| 239 { | 246 { |
| 240 switch (impl.m_type) { | 247 switch (impl.m_type) { |
| 241 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone: | 248 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone: |
| 242 return v8::Null(isolate); | 249 return v8::Null(isolate); |
| 243 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean: | 250 case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 m_type = SpecificTypeString; | 304 m_type = SpecificTypeString; |
| 298 } | 305 } |
| 299 | 306 |
| 300 DoubleOrString DoubleOrString::fromString(String value) | 307 DoubleOrString DoubleOrString::fromString(String value) |
| 301 { | 308 { |
| 302 DoubleOrString container; | 309 DoubleOrString container; |
| 303 container.setString(value); | 310 container.setString(value); |
| 304 return container; | 311 return container; |
| 305 } | 312 } |
| 306 | 313 |
| 307 void V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , DoubleOrString& impl, ExceptionState& exceptionState) | 314 bool V8DoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , DoubleOrString& impl, ExceptionState& exceptionState) |
| 308 { | 315 { |
| 309 if (v8Value.IsEmpty()) | 316 if (v8Value.IsEmpty()) |
| 310 return; | 317 return true; |
| 311 | 318 |
| 312 if (v8Value->IsNumber()) { | 319 if (v8Value->IsNumber()) { |
| 313 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Valu e, exceptionState), exceptionState); | 320 double cppValue = toRestrictedDouble(v8Value, exceptionState); |
| 321 if (exceptionState.hadException()) | |
| 322 return false; | |
| 314 impl.setDouble(cppValue); | 323 impl.setDouble(cppValue); |
| 315 return; | 324 return true; |
| 316 } | 325 } |
| 317 | 326 |
| 318 { | 327 { |
| 319 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 328 V8StringResource<> cppValue = v8Value; |
| 329 if (!cppValue.prepare(exceptionState)) | |
| 330 return false; | |
| 320 impl.setString(cppValue); | 331 impl.setString(cppValue); |
| 321 return; | 332 return true; |
| 322 } | 333 } |
| 323 | 334 |
| 324 } | 335 } |
| 325 | 336 |
| 326 v8::Local<v8::Value> toV8(const DoubleOrString& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) | 337 v8::Local<v8::Value> toV8(const DoubleOrString& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) |
| 327 { | 338 { |
| 328 switch (impl.m_type) { | 339 switch (impl.m_type) { |
| 329 case DoubleOrString::SpecificTypeNone: | 340 case DoubleOrString::SpecificTypeNone: |
| 330 return v8::Null(isolate); | 341 return v8::Null(isolate); |
| 331 case DoubleOrString::SpecificTypeDouble: | 342 case DoubleOrString::SpecificTypeDouble: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 container.setNodeList(value); | 400 container.setNodeList(value); |
| 390 return container; | 401 return container; |
| 391 } | 402 } |
| 392 | 403 |
| 393 void NodeOrNodeList::trace(Visitor* visitor) | 404 void NodeOrNodeList::trace(Visitor* visitor) |
| 394 { | 405 { |
| 395 visitor->trace(m_node); | 406 visitor->trace(m_node); |
| 396 visitor->trace(m_nodeList); | 407 visitor->trace(m_nodeList); |
| 397 } | 408 } |
| 398 | 409 |
| 399 void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , NodeOrNodeList& impl, ExceptionState& exceptionState) | 410 bool V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , NodeOrNodeList& impl, ExceptionState& exceptionState) |
| 400 { | 411 { |
| 401 if (v8Value.IsEmpty()) | 412 if (v8Value.IsEmpty()) |
| 402 return; | 413 return true; |
| 403 | 414 |
| 404 if (V8Node::hasInstance(v8Value, isolate)) { | 415 if (V8Node::hasInstance(v8Value, isolate)) { |
| 405 RefPtrWillBeRawPtr<Node> cppValue = V8Node::toImpl(v8::Local<v8::Object> ::Cast(v8Value)); | 416 RefPtrWillBeRawPtr<Node> cppValue = V8Node::toImpl(v8::Local<v8::Object> ::Cast(v8Value)); |
| 406 impl.setNode(cppValue); | 417 impl.setNode(cppValue); |
| 407 return; | 418 return true; |
| 408 } | 419 } |
| 409 | 420 |
| 410 if (V8NodeList::hasInstance(v8Value, isolate)) { | 421 if (V8NodeList::hasInstance(v8Value, isolate)) { |
| 411 RefPtrWillBeRawPtr<NodeList> cppValue = V8NodeList::toImpl(v8::Local<v8: :Object>::Cast(v8Value)); | 422 RefPtrWillBeRawPtr<NodeList> cppValue = V8NodeList::toImpl(v8::Local<v8: :Object>::Cast(v8Value)); |
| 412 impl.setNodeList(cppValue); | 423 impl.setNodeList(cppValue); |
| 413 return; | 424 return true; |
| 414 } | 425 } |
| 415 | 426 |
| 416 exceptionState.throwTypeError("The provided value is not of type '(Node or N odeList)'"); | 427 exceptionState.throwTypeError("The provided value is not of type '(Node or N odeList)'"); |
| 428 return false; | |
| 417 } | 429 } |
| 418 | 430 |
| 419 v8::Local<v8::Value> toV8(const NodeOrNodeList& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) | 431 v8::Local<v8::Value> toV8(const NodeOrNodeList& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) |
| 420 { | 432 { |
| 421 switch (impl.m_type) { | 433 switch (impl.m_type) { |
| 422 case NodeOrNodeList::SpecificTypeNone: | 434 case NodeOrNodeList::SpecificTypeNone: |
| 423 return v8::Null(isolate); | 435 return v8::Null(isolate); |
| 424 case NodeOrNodeList::SpecificTypeNode: | 436 case NodeOrNodeList::SpecificTypeNode: |
| 425 return toV8(impl.getAsNode(), creationContext, isolate); | 437 return toV8(impl.getAsNode(), creationContext, isolate); |
| 426 case NodeOrNodeList::SpecificTypeNodeList: | 438 case NodeOrNodeList::SpecificTypeNodeList: |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 m_type = SpecificTypeArrayBufferView; | 508 m_type = SpecificTypeArrayBufferView; |
| 497 } | 509 } |
| 498 | 510 |
| 499 StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromA rrayBufferView(PassRefPtr<TestArrayBufferView> value) | 511 StringOrArrayBufferOrArrayBufferView StringOrArrayBufferOrArrayBufferView::fromA rrayBufferView(PassRefPtr<TestArrayBufferView> value) |
| 500 { | 512 { |
| 501 StringOrArrayBufferOrArrayBufferView container; | 513 StringOrArrayBufferOrArrayBufferView container; |
| 502 container.setArrayBufferView(value); | 514 container.setArrayBufferView(value); |
| 503 return container; | 515 return container; |
| 504 } | 516 } |
| 505 | 517 |
| 506 void V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Lo cal<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, ExceptionSta te& exceptionState) | 518 bool V8StringOrArrayBufferOrArrayBufferView::toImpl(v8::Isolate* isolate, v8::Lo cal<v8::Value> v8Value, StringOrArrayBufferOrArrayBufferView& impl, ExceptionSta te& exceptionState) |
| 507 { | 519 { |
| 508 if (v8Value.IsEmpty()) | 520 if (v8Value.IsEmpty()) |
| 509 return; | 521 return true; |
| 510 | 522 |
| 511 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { | 523 if (V8ArrayBuffer::hasInstance(v8Value, isolate)) { |
| 512 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O bject>::Cast(v8Value)); | 524 RefPtr<TestArrayBuffer> cppValue = V8ArrayBuffer::toImpl(v8::Local<v8::O bject>::Cast(v8Value)); |
| 513 impl.setArrayBuffer(cppValue); | 525 impl.setArrayBuffer(cppValue); |
| 514 return; | 526 return true; |
| 515 } | 527 } |
| 516 | 528 |
| 517 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { | 529 if (V8ArrayBufferView::hasInstance(v8Value, isolate)) { |
| 518 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc al<v8::Object>::Cast(v8Value)); | 530 RefPtr<TestArrayBufferView> cppValue = V8ArrayBufferView::toImpl(v8::Loc al<v8::Object>::Cast(v8Value)); |
| 519 impl.setArrayBufferView(cppValue); | 531 impl.setArrayBufferView(cppValue); |
| 520 return; | 532 return true; |
| 521 } | 533 } |
| 522 | 534 |
| 523 { | 535 { |
| 524 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 536 V8StringResource<> cppValue = v8Value; |
| 537 if (!cppValue.prepare(exceptionState)) | |
| 538 return false; | |
| 525 impl.setString(cppValue); | 539 impl.setString(cppValue); |
| 526 return; | 540 return true; |
| 527 } | 541 } |
| 528 | 542 |
| 529 } | 543 } |
| 530 | 544 |
| 531 v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& impl, v8:: Local<v8::Object> creationContext, v8::Isolate* isolate) | 545 v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView& impl, v8:: Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 532 { | 546 { |
| 533 switch (impl.m_type) { | 547 switch (impl.m_type) { |
| 534 case StringOrArrayBufferOrArrayBufferView::SpecificTypeNone: | 548 case StringOrArrayBufferOrArrayBufferView::SpecificTypeNone: |
| 535 return v8::Null(isolate); | 549 return v8::Null(isolate); |
| 536 case StringOrArrayBufferOrArrayBufferView::SpecificTypeString: | 550 case StringOrArrayBufferOrArrayBufferView::SpecificTypeString: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 m_type = SpecificTypeDouble; | 604 m_type = SpecificTypeDouble; |
| 591 } | 605 } |
| 592 | 606 |
| 593 StringOrDouble StringOrDouble::fromDouble(double value) | 607 StringOrDouble StringOrDouble::fromDouble(double value) |
| 594 { | 608 { |
| 595 StringOrDouble container; | 609 StringOrDouble container; |
| 596 container.setDouble(value); | 610 container.setDouble(value); |
| 597 return container; | 611 return container; |
| 598 } | 612 } |
| 599 | 613 |
| 600 void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , StringOrDouble& impl, ExceptionState& exceptionState) | 614 bool V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value , StringOrDouble& impl, ExceptionState& exceptionState) |
| 601 { | 615 { |
| 602 if (v8Value.IsEmpty()) | 616 if (v8Value.IsEmpty()) |
| 603 return; | 617 return true; |
| 604 | 618 |
| 605 if (v8Value->IsNumber()) { | 619 if (v8Value->IsNumber()) { |
| 606 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Valu e, exceptionState), exceptionState); | 620 double cppValue = toRestrictedDouble(v8Value, exceptionState); |
| 621 if (exceptionState.hadException()) | |
| 622 return false; | |
| 607 impl.setDouble(cppValue); | 623 impl.setDouble(cppValue); |
| 608 return; | 624 return true; |
| 609 } | 625 } |
| 610 | 626 |
| 611 { | 627 { |
| 612 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 628 V8StringResource<> cppValue = v8Value; |
| 629 if (!cppValue.prepare(exceptionState)) | |
| 630 return false; | |
| 613 impl.setString(cppValue); | 631 impl.setString(cppValue); |
| 614 return; | 632 return true; |
| 615 } | 633 } |
| 616 | 634 |
| 617 } | 635 } |
| 618 | 636 |
| 619 v8::Local<v8::Value> toV8(const StringOrDouble& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) | 637 v8::Local<v8::Value> toV8(const StringOrDouble& impl, v8::Local<v8::Object> crea tionContext, v8::Isolate* isolate) |
| 620 { | 638 { |
| 621 switch (impl.m_type) { | 639 switch (impl.m_type) { |
| 622 case StringOrDouble::SpecificTypeNone: | 640 case StringOrDouble::SpecificTypeNone: |
| 623 return v8::Null(isolate); | 641 return v8::Null(isolate); |
| 624 case StringOrDouble::SpecificTypeString: | 642 case StringOrDouble::SpecificTypeString: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 m_type = SpecificTypeStringSequence; | 694 m_type = SpecificTypeStringSequence; |
| 677 } | 695 } |
| 678 | 696 |
| 679 StringOrStringSequence StringOrStringSequence::fromStringSequence(const Vector<S tring>& value) | 697 StringOrStringSequence StringOrStringSequence::fromStringSequence(const Vector<S tring>& value) |
| 680 { | 698 { |
| 681 StringOrStringSequence container; | 699 StringOrStringSequence container; |
| 682 container.setStringSequence(value); | 700 container.setStringSequence(value); |
| 683 return container; | 701 return container; |
| 684 } | 702 } |
| 685 | 703 |
| 686 void V8StringOrStringSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrStringSequence& impl, ExceptionState& exceptionState) | 704 bool V8StringOrStringSequence::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrStringSequence& impl, ExceptionState& exceptionState) |
| 687 { | 705 { |
| 688 if (v8Value.IsEmpty()) | 706 if (v8Value.IsEmpty()) |
| 689 return; | 707 return true; |
| 690 | 708 |
| 691 if (v8Value->IsArray()) { | 709 if (v8Value->IsArray()) { |
| 692 TONATIVE_VOID_EXCEPTIONSTATE(Vector<String>, cppValue, toImplArray<Strin g>(v8Value, 0, isolate, exceptionState), exceptionState); | 710 Vector<String> cppValue = toImplArray<String>(v8Value, 0, isolate, excep tionState); |
| 711 if (exceptionState.hadException()) | |
| 712 return false; | |
| 693 impl.setStringSequence(cppValue); | 713 impl.setStringSequence(cppValue); |
| 694 return; | 714 return true; |
| 695 } | 715 } |
| 696 | 716 |
| 697 { | 717 { |
| 698 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 718 V8StringResource<> cppValue = v8Value; |
| 719 if (!cppValue.prepare(exceptionState)) | |
| 720 return false; | |
| 699 impl.setString(cppValue); | 721 impl.setString(cppValue); |
| 700 return; | 722 return true; |
| 701 } | 723 } |
| 702 | 724 |
| 703 } | 725 } |
| 704 | 726 |
| 705 v8::Local<v8::Value> toV8(const StringOrStringSequence& impl, v8::Local<v8::Obje ct> creationContext, v8::Isolate* isolate) | 727 v8::Local<v8::Value> toV8(const StringOrStringSequence& impl, v8::Local<v8::Obje ct> creationContext, v8::Isolate* isolate) |
| 706 { | 728 { |
| 707 switch (impl.m_type) { | 729 switch (impl.m_type) { |
| 708 case StringOrStringSequence::SpecificTypeNone: | 730 case StringOrStringSequence::SpecificTypeNone: |
| 709 return v8::Null(isolate); | 731 return v8::Null(isolate); |
| 710 case StringOrStringSequence::SpecificTypeString: | 732 case StringOrStringSequence::SpecificTypeString: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 767 m_type = SpecificTypeDouble; | 789 m_type = SpecificTypeDouble; |
| 768 } | 790 } |
| 769 | 791 |
| 770 TestEnumOrDouble TestEnumOrDouble::fromDouble(double value) | 792 TestEnumOrDouble TestEnumOrDouble::fromDouble(double value) |
| 771 { | 793 { |
| 772 TestEnumOrDouble container; | 794 TestEnumOrDouble container; |
| 773 container.setDouble(value); | 795 container.setDouble(value); |
| 774 return container; | 796 return container; |
| 775 } | 797 } |
| 776 | 798 |
| 777 void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Val ue, TestEnumOrDouble& impl, ExceptionState& exceptionState) | 799 bool V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Val ue, TestEnumOrDouble& impl, ExceptionState& exceptionState) |
| 778 { | 800 { |
| 779 if (v8Value.IsEmpty()) | 801 if (v8Value.IsEmpty()) |
| 780 return; | 802 return true; |
| 781 | 803 |
| 782 if (v8Value->IsNumber()) { | 804 if (v8Value->IsNumber()) { |
| 783 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Valu e, exceptionState), exceptionState); | 805 double cppValue = toRestrictedDouble(v8Value, exceptionState); |
| 806 if (exceptionState.hadException()) | |
| 807 return false; | |
| 784 impl.setDouble(cppValue); | 808 impl.setDouble(cppValue); |
| 785 return; | 809 return true; |
| 786 } | 810 } |
| 787 | 811 |
| 788 { | 812 { |
| 789 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 813 V8StringResource<> cppValue = v8Value; |
| 814 if (!cppValue.prepare(exceptionState)) | |
|
haraken
2015/02/24 12:44:57
Would it be possible to write this like:
V8Stri
Jens Widell
2015/02/24 13:36:07
It would. But do you mean only this form of prepar
| |
| 815 return false; | |
| 790 String string = cppValue; | 816 String string = cppValue; |
| 791 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" | | string == "EnumValue3")) { | 817 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" | | string == "EnumValue3")) { |
| 792 exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); | 818 exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); |
| 793 return; | 819 return false; |
| 794 } | 820 } |
| 795 impl.setTestEnum(cppValue); | 821 impl.setTestEnum(cppValue); |
| 796 return; | 822 return true; |
| 797 } | 823 } |
| 798 | 824 |
| 799 } | 825 } |
| 800 | 826 |
| 801 v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> cr eationContext, v8::Isolate* isolate) | 827 v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> cr eationContext, v8::Isolate* isolate) |
| 802 { | 828 { |
| 803 switch (impl.m_type) { | 829 switch (impl.m_type) { |
| 804 case TestEnumOrDouble::SpecificTypeNone: | 830 case TestEnumOrDouble::SpecificTypeNone: |
| 805 return v8::Null(isolate); | 831 return v8::Null(isolate); |
| 806 case TestEnumOrDouble::SpecificTypeTestEnum: | 832 case TestEnumOrDouble::SpecificTypeTestEnum: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 m_type = SpecificTypeUint8Array; | 884 m_type = SpecificTypeUint8Array; |
| 859 } | 885 } |
| 860 | 886 |
| 861 TestInterface2OrUint8Array TestInterface2OrUint8Array::fromUint8Array(PassRefPtr <DOMUint8Array> value) | 887 TestInterface2OrUint8Array TestInterface2OrUint8Array::fromUint8Array(PassRefPtr <DOMUint8Array> value) |
| 862 { | 888 { |
| 863 TestInterface2OrUint8Array container; | 889 TestInterface2OrUint8Array container; |
| 864 container.setUint8Array(value); | 890 container.setUint8Array(value); |
| 865 return container; | 891 return container; |
| 866 } | 892 } |
| 867 | 893 |
| 868 void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Va lue> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState) | 894 bool V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Va lue> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState) |
| 869 { | 895 { |
| 870 if (v8Value.IsEmpty()) | 896 if (v8Value.IsEmpty()) |
| 871 return; | 897 return true; |
| 872 | 898 |
| 873 if (V8TestInterface2::hasInstance(v8Value, isolate)) { | 899 if (V8TestInterface2::hasInstance(v8Value, isolate)) { |
| 874 RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Local<v8: :Object>::Cast(v8Value)); | 900 RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Local<v8: :Object>::Cast(v8Value)); |
| 875 impl.setTestInterface2(cppValue); | 901 impl.setTestInterface2(cppValue); |
| 876 return; | 902 return true; |
| 877 } | 903 } |
| 878 | 904 |
| 879 if (V8Uint8Array::hasInstance(v8Value, isolate)) { | 905 if (V8Uint8Array::hasInstance(v8Value, isolate)) { |
| 880 RefPtr<DOMUint8Array> cppValue = V8Uint8Array::toImpl(v8::Local<v8::Obje ct>::Cast(v8Value)); | 906 RefPtr<DOMUint8Array> cppValue = V8Uint8Array::toImpl(v8::Local<v8::Obje ct>::Cast(v8Value)); |
| 881 impl.setUint8Array(cppValue); | 907 impl.setUint8Array(cppValue); |
| 882 return; | 908 return true; |
| 883 } | 909 } |
| 884 | 910 |
| 885 exceptionState.throwTypeError("The provided value is not of type '(TestInter face2 or Uint8Array)'"); | 911 exceptionState.throwTypeError("The provided value is not of type '(TestInter face2 or Uint8Array)'"); |
| 912 return false; | |
| 886 } | 913 } |
| 887 | 914 |
| 888 v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Local<v8:: Object> creationContext, v8::Isolate* isolate) | 915 v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Local<v8:: Object> creationContext, v8::Isolate* isolate) |
| 889 { | 916 { |
| 890 switch (impl.m_type) { | 917 switch (impl.m_type) { |
| 891 case TestInterface2OrUint8Array::SpecificTypeNone: | 918 case TestInterface2OrUint8Array::SpecificTypeNone: |
| 892 return v8::Null(isolate); | 919 return v8::Null(isolate); |
| 893 case TestInterface2OrUint8Array::SpecificTypeTestInterface2: | 920 case TestInterface2OrUint8Array::SpecificTypeTestInterface2: |
| 894 return toV8(impl.getAsTestInterface2(), creationContext, isolate); | 921 return toV8(impl.getAsTestInterface2(), creationContext, isolate); |
| 895 case TestInterface2OrUint8Array::SpecificTypeUint8Array: | 922 case TestInterface2OrUint8Array::SpecificTypeUint8Array: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 TestInterfaceGarbageCollectedOrString container; | 977 TestInterfaceGarbageCollectedOrString container; |
| 951 container.setString(value); | 978 container.setString(value); |
| 952 return container; | 979 return container; |
| 953 } | 980 } |
| 954 | 981 |
| 955 void TestInterfaceGarbageCollectedOrString::trace(Visitor* visitor) | 982 void TestInterfaceGarbageCollectedOrString::trace(Visitor* visitor) |
| 956 { | 983 { |
| 957 visitor->trace(m_testInterfaceGarbageCollected); | 984 visitor->trace(m_testInterfaceGarbageCollected); |
| 958 } | 985 } |
| 959 | 986 |
| 960 void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::L ocal<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, ExceptionS tate& exceptionState) | 987 bool V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::L ocal<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, ExceptionS tate& exceptionState) |
| 961 { | 988 { |
| 962 if (v8Value.IsEmpty()) | 989 if (v8Value.IsEmpty()) |
| 963 return; | 990 return true; |
| 964 | 991 |
| 965 if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) { | 992 if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) { |
| 966 RawPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageC ollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); | 993 RawPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageC ollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); |
| 967 impl.setTestInterfaceGarbageCollected(cppValue); | 994 impl.setTestInterfaceGarbageCollected(cppValue); |
| 968 return; | 995 return true; |
| 969 } | 996 } |
| 970 | 997 |
| 971 { | 998 { |
| 972 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 999 V8StringResource<> cppValue = v8Value; |
| 1000 if (!cppValue.prepare(exceptionState)) | |
| 1001 return false; | |
| 973 impl.setString(cppValue); | 1002 impl.setString(cppValue); |
| 974 return; | 1003 return true; |
| 975 } | 1004 } |
| 976 | 1005 |
| 977 } | 1006 } |
| 978 | 1007 |
| 979 v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString& impl, v8: :Local<v8::Object> creationContext, v8::Isolate* isolate) | 1008 v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrString& impl, v8: :Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 980 { | 1009 { |
| 981 switch (impl.m_type) { | 1010 switch (impl.m_type) { |
| 982 case TestInterfaceGarbageCollectedOrString::SpecificTypeNone: | 1011 case TestInterfaceGarbageCollectedOrString::SpecificTypeNone: |
| 983 return v8::Null(isolate); | 1012 return v8::Null(isolate); |
| 984 case TestInterfaceGarbageCollectedOrString::SpecificTypeTestInterfaceGarbage Collected: | 1013 case TestInterfaceGarbageCollectedOrString::SpecificTypeTestInterfaceGarbage Collected: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1036 m_type = SpecificTypeLong; | 1065 m_type = SpecificTypeLong; |
| 1037 } | 1066 } |
| 1038 | 1067 |
| 1039 TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value) | 1068 TestInterfaceOrLong TestInterfaceOrLong::fromLong(int value) |
| 1040 { | 1069 { |
| 1041 TestInterfaceOrLong container; | 1070 TestInterfaceOrLong container; |
| 1042 container.setLong(value); | 1071 container.setLong(value); |
| 1043 return container; | 1072 return container; |
| 1044 } | 1073 } |
| 1045 | 1074 |
| 1046 void V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8 Value, TestInterfaceOrLong& impl, ExceptionState& exceptionState) | 1075 bool V8TestInterfaceOrLong::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8 Value, TestInterfaceOrLong& impl, ExceptionState& exceptionState) |
| 1047 { | 1076 { |
| 1048 if (v8Value.IsEmpty()) | 1077 if (v8Value.IsEmpty()) |
| 1049 return; | 1078 return true; |
| 1050 | 1079 |
| 1051 if (V8TestInterface::hasInstance(v8Value, isolate)) { | 1080 if (V8TestInterface::hasInstance(v8Value, isolate)) { |
| 1052 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v 8::Local<v8::Object>::Cast(v8Value)); | 1081 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v 8::Local<v8::Object>::Cast(v8Value)); |
| 1053 impl.setTestInterface(cppValue); | 1082 impl.setTestInterface(cppValue); |
| 1054 return; | 1083 return true; |
| 1055 } | 1084 } |
| 1056 | 1085 |
| 1057 if (v8Value->IsNumber()) { | 1086 if (v8Value->IsNumber()) { |
| 1058 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt ate), exceptionState); | 1087 int cppValue = toInt32(v8Value, exceptionState); |
| 1088 if (exceptionState.hadException()) | |
| 1089 return false; | |
| 1059 impl.setLong(cppValue); | 1090 impl.setLong(cppValue); |
| 1060 return; | 1091 return true; |
| 1061 } | 1092 } |
| 1062 | 1093 |
| 1063 { | 1094 { |
| 1064 TONATIVE_VOID_EXCEPTIONSTATE(int, cppValue, toInt32(v8Value, exceptionSt ate), exceptionState); | 1095 int cppValue = toInt32(v8Value, exceptionState); |
| 1096 if (exceptionState.hadException()) | |
| 1097 return false; | |
| 1065 impl.setLong(cppValue); | 1098 impl.setLong(cppValue); |
| 1066 return; | 1099 return true; |
| 1067 } | 1100 } |
| 1068 | 1101 |
| 1069 } | 1102 } |
| 1070 | 1103 |
| 1071 v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) | 1104 v8::Local<v8::Value> toV8(const TestInterfaceOrLong& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 1072 { | 1105 { |
| 1073 switch (impl.m_type) { | 1106 switch (impl.m_type) { |
| 1074 case TestInterfaceOrLong::SpecificTypeNone: | 1107 case TestInterfaceOrLong::SpecificTypeNone: |
| 1075 return v8::Null(isolate); | 1108 return v8::Null(isolate); |
| 1076 case TestInterfaceOrLong::SpecificTypeTestInterface: | 1109 case TestInterfaceOrLong::SpecificTypeTestInterface: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1128 m_type = SpecificTypeTestInterfaceEmpty; | 1161 m_type = SpecificTypeTestInterfaceEmpty; |
| 1129 } | 1162 } |
| 1130 | 1163 |
| 1131 TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInt erfaceEmpty(PassRefPtr<TestInterfaceEmpty> value) | 1164 TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInt erfaceEmpty(PassRefPtr<TestInterfaceEmpty> value) |
| 1132 { | 1165 { |
| 1133 TestInterfaceOrTestInterfaceEmpty container; | 1166 TestInterfaceOrTestInterfaceEmpty container; |
| 1134 container.setTestInterfaceEmpty(value); | 1167 container.setTestInterfaceEmpty(value); |
| 1135 return container; | 1168 return container; |
| 1136 } | 1169 } |
| 1137 | 1170 |
| 1138 void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local <v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& ex ceptionState) | 1171 bool V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local <v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& ex ceptionState) |
| 1139 { | 1172 { |
| 1140 if (v8Value.IsEmpty()) | 1173 if (v8Value.IsEmpty()) |
| 1141 return; | 1174 return true; |
| 1142 | 1175 |
| 1143 if (V8TestInterface::hasInstance(v8Value, isolate)) { | 1176 if (V8TestInterface::hasInstance(v8Value, isolate)) { |
| 1144 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v 8::Local<v8::Object>::Cast(v8Value)); | 1177 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v 8::Local<v8::Object>::Cast(v8Value)); |
| 1145 impl.setTestInterface(cppValue); | 1178 impl.setTestInterface(cppValue); |
| 1146 return; | 1179 return true; |
| 1147 } | 1180 } |
| 1148 | 1181 |
| 1149 if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { | 1182 if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { |
| 1150 RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImpl(v8::L ocal<v8::Object>::Cast(v8Value)); | 1183 RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImpl(v8::L ocal<v8::Object>::Cast(v8Value)); |
| 1151 impl.setTestInterfaceEmpty(cppValue); | 1184 impl.setTestInterfaceEmpty(cppValue); |
| 1152 return; | 1185 return true; |
| 1153 } | 1186 } |
| 1154 | 1187 |
| 1155 exceptionState.throwTypeError("The provided value is not of type '(TestInter face or TestInterfaceEmpty)'"); | 1188 exceptionState.throwTypeError("The provided value is not of type '(TestInter face or TestInterfaceEmpty)'"); |
| 1189 return false; | |
| 1156 } | 1190 } |
| 1157 | 1191 |
| 1158 v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Loc al<v8::Object> creationContext, v8::Isolate* isolate) | 1192 v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Loc al<v8::Object> creationContext, v8::Isolate* isolate) |
| 1159 { | 1193 { |
| 1160 switch (impl.m_type) { | 1194 switch (impl.m_type) { |
| 1161 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone: | 1195 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone: |
| 1162 return v8::Null(isolate); | 1196 return v8::Null(isolate); |
| 1163 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface: | 1197 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface: |
| 1164 return toV8(impl.getAsTestInterface(), creationContext, isolate); | 1198 return toV8(impl.getAsTestInterface(), creationContext, isolate); |
| 1165 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty: | 1199 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1221 container.setTestDictionary(value); | 1255 container.setTestDictionary(value); |
| 1222 return container; | 1256 return container; |
| 1223 } | 1257 } |
| 1224 | 1258 |
| 1225 void TestInterfaceWillBeGarbageCollectedOrTestDictionary::trace(Visitor* visitor ) | 1259 void TestInterfaceWillBeGarbageCollectedOrTestDictionary::trace(Visitor* visitor ) |
| 1226 { | 1260 { |
| 1227 visitor->trace(m_testInterfaceWillBeGarbageCollected); | 1261 visitor->trace(m_testInterfaceWillBeGarbageCollected); |
| 1228 visitor->trace(m_testDictionary); | 1262 visitor->trace(m_testDictionary); |
| 1229 } | 1263 } |
| 1230 | 1264 |
| 1231 void V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTest Dictionary& impl, ExceptionState& exceptionState) | 1265 bool V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTest Dictionary& impl, ExceptionState& exceptionState) |
| 1232 { | 1266 { |
| 1233 if (v8Value.IsEmpty()) | 1267 if (v8Value.IsEmpty()) |
| 1234 return; | 1268 return true; |
| 1235 | 1269 |
| 1236 if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) { | 1270 if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) { |
| 1237 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8Tes tInterfaceWillBeGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); | 1271 RefPtrWillBeRawPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8Tes tInterfaceWillBeGarbageCollected::toImpl(v8::Local<v8::Object>::Cast(v8Value)); |
| 1238 impl.setTestInterfaceWillBeGarbageCollected(cppValue); | 1272 impl.setTestInterfaceWillBeGarbageCollected(cppValue); |
| 1239 return; | 1273 return true; |
| 1240 } | 1274 } |
| 1241 | 1275 |
| 1242 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { | 1276 if (isUndefinedOrNull(v8Value) || v8Value->IsObject()) { |
| 1243 TestDictionary cppValue; | 1277 TestDictionary cppValue; |
| 1244 TONATIVE_VOID_EXCEPTIONSTATE_ARGINTERNAL(V8TestDictionary::toImpl(isolat e, v8Value, cppValue, exceptionState), exceptionState); | 1278 TestDictionary cppValue; |
| 1279 if (!V8TestDictionary::toImpl(isolate, v8Value, cppValue, exceptionState )) | |
| 1280 return false; | |
| 1245 impl.setTestDictionary(cppValue); | 1281 impl.setTestDictionary(cppValue); |
| 1246 return; | 1282 return true; |
| 1247 } | 1283 } |
| 1248 | 1284 |
| 1249 exceptionState.throwTypeError("The provided value is not of type '(TestInter faceWillBeGarbageCollected or TestDictionary)'"); | 1285 exceptionState.throwTypeError("The provided value is not of type '(TestInter faceWillBeGarbageCollected or TestDictionary)'"); |
| 1286 return false; | |
| 1250 } | 1287 } |
| 1251 | 1288 |
| 1252 v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDiction ary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) | 1289 v8::Local<v8::Value> toV8(const TestInterfaceWillBeGarbageCollectedOrTestDiction ary& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
| 1253 { | 1290 { |
| 1254 switch (impl.m_type) { | 1291 switch (impl.m_type) { |
| 1255 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeNone: | 1292 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeNone: |
| 1256 return v8::Null(isolate); | 1293 return v8::Null(isolate); |
| 1257 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestIn terfaceWillBeGarbageCollected: | 1294 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestIn terfaceWillBeGarbageCollected: |
| 1258 return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationCon text, isolate); | 1295 return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationCon text, isolate); |
| 1259 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestDi ctionary: | 1296 case TestInterfaceWillBeGarbageCollectedOrTestDictionary::SpecificTypeTestDi ctionary: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1309 m_type = SpecificTypeString; | 1346 m_type = SpecificTypeString; |
| 1310 } | 1347 } |
| 1311 | 1348 |
| 1312 UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value) | 1349 UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value) |
| 1313 { | 1350 { |
| 1314 UnrestrictedDoubleOrString container; | 1351 UnrestrictedDoubleOrString container; |
| 1315 container.setString(value); | 1352 container.setString(value); |
| 1316 return container; | 1353 return container; |
| 1317 } | 1354 } |
| 1318 | 1355 |
| 1319 void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Va lue> v8Value, UnrestrictedDoubleOrString& impl, ExceptionState& exceptionState) | 1356 bool V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Va lue> v8Value, UnrestrictedDoubleOrString& impl, ExceptionState& exceptionState) |
| 1320 { | 1357 { |
| 1321 if (v8Value.IsEmpty()) | 1358 if (v8Value.IsEmpty()) |
| 1322 return; | 1359 return true; |
| 1323 | 1360 |
| 1324 if (v8Value->IsNumber()) { | 1361 if (v8Value->IsNumber()) { |
| 1325 TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, excepti onState), exceptionState); | 1362 double cppValue = toDouble(v8Value, exceptionState); |
| 1363 if (exceptionState.hadException()) | |
| 1364 return false; | |
| 1326 impl.setUnrestrictedDouble(cppValue); | 1365 impl.setUnrestrictedDouble(cppValue); |
| 1327 return; | 1366 return true; |
| 1328 } | 1367 } |
| 1329 | 1368 |
| 1330 { | 1369 { |
| 1331 TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exce ptionState); | 1370 V8StringResource<> cppValue = v8Value; |
| 1371 if (!cppValue.prepare(exceptionState)) | |
| 1372 return false; | |
| 1332 impl.setString(cppValue); | 1373 impl.setString(cppValue); |
| 1333 return; | 1374 return true; |
| 1334 } | 1375 } |
| 1335 | 1376 |
| 1336 } | 1377 } |
| 1337 | 1378 |
| 1338 v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8:: Object> creationContext, v8::Isolate* isolate) | 1379 v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8:: Object> creationContext, v8::Isolate* isolate) |
| 1339 { | 1380 { |
| 1340 switch (impl.m_type) { | 1381 switch (impl.m_type) { |
| 1341 case UnrestrictedDoubleOrString::SpecificTypeNone: | 1382 case UnrestrictedDoubleOrString::SpecificTypeNone: |
| 1342 return v8::Null(isolate); | 1383 return v8::Null(isolate); |
| 1343 case UnrestrictedDoubleOrString::SpecificTypeUnrestrictedDouble: | 1384 case UnrestrictedDoubleOrString::SpecificTypeUnrestrictedDouble: |
| 1344 return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); | 1385 return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); |
| 1345 case UnrestrictedDoubleOrString::SpecificTypeString: | 1386 case UnrestrictedDoubleOrString::SpecificTypeString: |
| 1346 return v8String(isolate, impl.getAsString()); | 1387 return v8String(isolate, impl.getAsString()); |
| 1347 default: | 1388 default: |
| 1348 ASSERT_NOT_REACHED(); | 1389 ASSERT_NOT_REACHED(); |
| 1349 } | 1390 } |
| 1350 return v8::Local<v8::Value>(); | 1391 return v8::Local<v8::Value>(); |
| 1351 } | 1392 } |
| 1352 | 1393 |
| 1353 UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::native Value(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& e xceptionState) | 1394 UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::native Value(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& e xceptionState) |
| 1354 { | 1395 { |
| 1355 UnrestrictedDoubleOrString impl; | 1396 UnrestrictedDoubleOrString impl; |
| 1356 V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState); | 1397 V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState); |
| 1357 return impl; | 1398 return impl; |
| 1358 } | 1399 } |
| 1359 | 1400 |
| 1360 } // namespace blink | 1401 } // namespace blink |
| OLD | NEW |