| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ArrayValue.h" | 28 #include "bindings/core/v8/ArrayValue.h" |
| 29 #include "bindings/core/v8/DictionaryHelperForBindings.h" | 29 #include "bindings/core/v8/DictionaryHelperForBindings.h" |
| 30 #include "bindings/core/v8/ExceptionMessages.h" | 30 #include "bindings/core/v8/ExceptionMessages.h" |
| 31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
| 32 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 32 #include "bindings/core/v8/V8Binding.h" | 33 #include "bindings/core/v8/V8Binding.h" |
| 33 #include "bindings/core/v8/V8DOMError.h" | 34 #include "bindings/core/v8/V8DOMError.h" |
| 34 #include "bindings/core/v8/V8Element.h" | 35 #include "bindings/core/v8/V8Element.h" |
| 35 #include "bindings/core/v8/V8EventTarget.h" | 36 #include "bindings/core/v8/V8EventTarget.h" |
| 36 #include "bindings/core/v8/V8MediaKeyError.h" | 37 #include "bindings/core/v8/V8MediaKeyError.h" |
| 37 #include "bindings/core/v8/V8MessagePort.h" | 38 #include "bindings/core/v8/V8MessagePort.h" |
| 38 #include "bindings/core/v8/V8Path2D.h" | 39 #include "bindings/core/v8/V8Path2D.h" |
| 39 #include "bindings/core/v8/V8Storage.h" | 40 #include "bindings/core/v8/V8Storage.h" |
| 40 #include "bindings/core/v8/V8TextTrack.h" | 41 #include "bindings/core/v8/V8TextTrack.h" |
| 42 #include "bindings/core/v8/V8Uint8Array.h" |
| 41 #include "bindings/core/v8/V8VoidCallback.h" | 43 #include "bindings/core/v8/V8VoidCallback.h" |
| 42 #include "bindings/core/v8/V8Window.h" | 44 #include "bindings/core/v8/V8Window.h" |
| 43 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h" | |
| 44 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" | |
| 45 #include "core/html/track/TrackBase.h" | 45 #include "core/html/track/TrackBase.h" |
| 46 #include "wtf/MathExtras.h" | 46 #include "wtf/MathExtras.h" |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 template <> | 50 template <> |
| 51 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8::
Local<v8::Value>& value) | 51 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8::
Local<v8::Value>& value) |
| 52 { | 52 { |
| 53 return dictionary.get(key, value); | 53 return dictionary.get(key, value); |
| 54 } | 54 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 if (!v8Value->IsArray()) { | 447 if (!v8Value->IsArray()) { |
| 448 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key))
; | 448 context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key))
; |
| 449 return false; | 449 return false; |
| 450 } | 450 } |
| 451 | 451 |
| 452 return DictionaryHelper::get(dictionary, key, value); | 452 return DictionaryHelper::get(dictionary, key, value); |
| 453 } | 453 } |
| 454 | 454 |
| 455 template <> | 455 template <> |
| 456 struct DictionaryHelperTraits<Uint8Array> { | 456 struct DictionaryHelperTraits<DOMUint8Array> { |
| 457 typedef V8Uint8Array type; | 457 typedef V8Uint8Array type; |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 template <> | 460 template <> |
| 461 struct DictionaryHelperTraits<ArrayBufferView> { | 461 struct DictionaryHelperTraits<DOMArrayBufferView> { |
| 462 typedef V8ArrayBufferView type; | 462 typedef V8ArrayBufferView type; |
| 463 }; | 463 }; |
| 464 | 464 |
| 465 template <> | 465 template <> |
| 466 struct DictionaryHelperTraits<MediaKeyError> { | 466 struct DictionaryHelperTraits<MediaKeyError> { |
| 467 typedef V8MediaKeyError type; | 467 typedef V8MediaKeyError type; |
| 468 }; | 468 }; |
| 469 | 469 |
| 470 template <> | 470 template <> |
| 471 struct DictionaryHelperTraits<DOMError> { | 471 struct DictionaryHelperTraits<DOMError> { |
| 472 typedef V8DOMError type; | 472 typedef V8DOMError type; |
| 473 }; | 473 }; |
| 474 | 474 |
| 475 template <> | 475 template <> |
| 476 struct DictionaryHelperTraits<Storage> { | 476 struct DictionaryHelperTraits<Storage> { |
| 477 typedef V8Storage type; | 477 typedef V8Storage type; |
| 478 }; | 478 }; |
| 479 | 479 |
| 480 template <> | 480 template <> |
| 481 struct DictionaryHelperTraits<Element> { | 481 struct DictionaryHelperTraits<Element> { |
| 482 typedef V8Element type; | 482 typedef V8Element type; |
| 483 }; | 483 }; |
| 484 | 484 |
| 485 template <> | 485 template <> |
| 486 struct DictionaryHelperTraits<Path2D> { | 486 struct DictionaryHelperTraits<Path2D> { |
| 487 typedef V8Path2D type; | 487 typedef V8Path2D type; |
| 488 }; | 488 }; |
| 489 | 489 |
| 490 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
<Uint8Array>& value); | 490 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
<DOMUint8Array>& value); |
| 491 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
<ArrayBufferView>& value); | 491 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
<DOMArrayBufferView>& value); |
| 492 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<MediaKeyError>& value); | 492 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<MediaKeyError>& value); |
| 493 template bool DictionaryHelper::get(const Dictionary&, const String& key, Member
<DOMError>& value); | 493 template bool DictionaryHelper::get(const Dictionary&, const String& key, Member
<DOMError>& value); |
| 494 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Storage>& value); | 494 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Storage>& value); |
| 495 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Element>& value); | 495 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Element>& value); |
| 496 template bool DictionaryHelper::get(const Dictionary&, const String& key, RawPtr
<Element>& value); | 496 template bool DictionaryHelper::get(const Dictionary&, const String& key, RawPtr
<Element>& value); |
| 497 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Path2D>& value); | 497 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr
WillBeMember<Path2D>& value); |
| 498 template bool DictionaryHelper::get(const Dictionary&, const String& key, RawPtr
<Path2D>& value); | 498 template bool DictionaryHelper::get(const Dictionary&, const String& key, RawPtr
<Path2D>& value); |
| 499 | 499 |
| 500 template <typename T> | 500 template <typename T> |
| 501 struct IntegralTypeTraits { | 501 struct IntegralTypeTraits { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<short>& value); | 647 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<short>& value); |
| 648 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned>& value); | 648 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned>& value); |
| 649 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long>& value); | 649 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long>& value); |
| 650 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<int>& value); | 650 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<int>& value); |
| 651 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long>& value); | 651 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long>& value); |
| 652 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long long>& value); | 652 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<long long>& value); |
| 653 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long long>& value); | 653 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, Nullable<unsigned long long>& value); |
| 654 | 654 |
| 655 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); | 655 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); |
| 656 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<Storage>& value); | 656 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<Storage>& value); |
| 657 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<Uint8Array>& value); | 657 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<DOMUint8Array>& value); |
| 658 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<ArrayBufferView>& value); | 658 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtr<DOMArrayBufferView>& value); |
| 659 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); | 659 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); |
| 660 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<TrackBase>& value); | 660 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<TrackBase>& value); |
| 661 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); | 661 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio
nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value); |
| 662 | 662 |
| 663 template <> | 663 template <> |
| 664 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers
ionContext& context, const String& key, MessagePortArray& value) | 664 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers
ionContext& context, const String& key, MessagePortArray& value) |
| 665 { | 665 { |
| 666 Dictionary::ConversionContextScope scope(context); | 666 Dictionary::ConversionContextScope scope(context); |
| 667 | 667 |
| 668 v8::Local<v8::Value> v8Value; | 668 v8::Local<v8::Value> v8Value; |
| 669 if (!dictionary.get(key, v8Value)) | 669 if (!dictionary.get(key, v8Value)) |
| 670 return true; | 670 return true; |
| 671 | 671 |
| 672 ASSERT(dictionary.isolate()); | 672 ASSERT(dictionary.isolate()); |
| 673 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); | 673 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); |
| 674 | 674 |
| 675 if (isUndefinedOrNull(v8Value)) | 675 if (isUndefinedOrNull(v8Value)) |
| 676 return true; | 676 return true; |
| 677 | 677 |
| 678 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value,
key, dictionary.isolate(), context.exceptionState()); | 678 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value,
key, dictionary.isolate(), context.exceptionState()); |
| 679 | 679 |
| 680 if (context.exceptionState().throwIfNeeded()) | 680 if (context.exceptionState().throwIfNeeded()) |
| 681 return false; | 681 return false; |
| 682 | 682 |
| 683 return true; | 683 return true; |
| 684 } | 684 } |
| 685 | 685 |
| 686 } // namespace blink | 686 } // namespace blink |
| OLD | NEW |