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

Side by Side Diff: Source/bindings/core/v8/DictionaryHelperForCore.cpp

Issue 650063002: Move MediaStream and MediaStreamTrack implementation from modules/mediastream to core/mediastream. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased. Created 6 years, 2 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 /* 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 16 matching lines...) Expand all
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/V8Binding.h" 32 #include "bindings/core/v8/V8Binding.h"
33 #include "bindings/core/v8/V8DOMError.h" 33 #include "bindings/core/v8/V8DOMError.h"
34 #include "bindings/core/v8/V8Element.h" 34 #include "bindings/core/v8/V8Element.h"
35 #include "bindings/core/v8/V8EventTarget.h" 35 #include "bindings/core/v8/V8EventTarget.h"
36 #include "bindings/core/v8/V8MediaKeyError.h" 36 #include "bindings/core/v8/V8MediaKeyError.h"
37 #include "bindings/core/v8/V8MediaStream.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"
40
39 #include "bindings/core/v8/V8Storage.h" 41 #include "bindings/core/v8/V8Storage.h"
40 #include "bindings/core/v8/V8TextTrack.h" 42 #include "bindings/core/v8/V8TextTrack.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" 45 #include "bindings/core/v8/custom/V8ArrayBufferViewCustom.h"
44 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h" 46 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
45 #include "core/html/track/TrackBase.h" 47 #include "core/html/track/TrackBase.h"
48 #include "core/mediastream/MediaStream.h"
46 #include "wtf/MathExtras.h" 49 #include "wtf/MathExtras.h"
47 50
48 namespace blink { 51 namespace blink {
49 52
50 template <> 53 template <>
51 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8:: Local<v8::Value>& value) 54 bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, v8:: Local<v8::Value>& value)
52 { 55 {
53 return dictionary.get(key, value); 56 return dictionary.get(key, value);
54 } 57 }
55 58
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 template <> 483 template <>
481 struct DictionaryHelperTraits<Element> { 484 struct DictionaryHelperTraits<Element> {
482 typedef V8Element type; 485 typedef V8Element type;
483 }; 486 };
484 487
485 template <> 488 template <>
486 struct DictionaryHelperTraits<Path2D> { 489 struct DictionaryHelperTraits<Path2D> {
487 typedef V8Path2D type; 490 typedef V8Path2D type;
488 }; 491 };
489 492
493 template <>
494 struct DictionaryHelperTraits<MediaStream> {
495 typedef V8MediaStream type;
496 };
497
490 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr <Uint8Array>& value); 498 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr <Uint8Array>& value);
491 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr <ArrayBufferView>& value); 499 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr <ArrayBufferView>& value);
492 template bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr WillBeMember<MediaKeyError>& value); 500 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); 501 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); 502 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); 503 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); 504 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); 505 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); 506 template bool DictionaryHelper::get(const Dictionary&, const String& key, RawPtr <Path2D>& value);
507 template bool DictionaryHelper::get(const Dictionary&, const String& key, Member <MediaStream>& value);
499 508
500 template <typename T> 509 template <typename T>
501 struct IntegralTypeTraits { 510 struct IntegralTypeTraits {
502 }; 511 };
503 512
504 template <> 513 template <>
505 struct IntegralTypeTraits<uint8_t> { 514 struct IntegralTypeTraits<uint8_t> {
506 static inline uint8_t toIntegral(v8::Handle<v8::Value> value, IntegerConvers ionConfiguration configuration, ExceptionState& exceptionState) 515 static inline uint8_t toIntegral(v8::Handle<v8::Value> value, IntegerConvers ionConfiguration configuration, ExceptionState& exceptionState)
507 { 516 {
508 return toUInt8(value, configuration, exceptionState); 517 return toUInt8(value, configuration, exceptionState);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<long long>& value); 661 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); 662 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Nullable<unsigned long long>& value);
654 663
655 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<LocalDOMWindow>& value); 664 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); 665 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); 666 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<Uint8Array>& value);
658 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<ArrayBufferView>& value); 667 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtr<ArrayBufferView>& value);
659 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<MediaKeyError>& value); 668 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); 669 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); 670 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, RefPtrWillBeMember<EventTarget>& value);
671 template bool DictionaryHelper::convert(const Dictionary&, Dictionary::Conversio nContext&, const String& key, Member<MediaStream>& value);
662 672
663 template <> 673 template <>
664 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, MessagePortArray& value) 674 bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::Convers ionContext& context, const String& key, MessagePortArray& value)
665 { 675 {
666 Dictionary::ConversionContextScope scope(context); 676 Dictionary::ConversionContextScope scope(context);
667 677
668 v8::Local<v8::Value> v8Value; 678 v8::Local<v8::Value> v8Value;
669 if (!dictionary.get(key, v8Value)) 679 if (!dictionary.get(key, v8Value))
670 return true; 680 return true;
671 681
672 ASSERT(dictionary.isolate()); 682 ASSERT(dictionary.isolate());
673 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent()); 683 ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent());
674 684
675 if (isUndefinedOrNull(v8Value)) 685 if (isUndefinedOrNull(v8Value))
676 return true; 686 return true;
677 687
678 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState()); 688 value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState());
679 689
680 if (context.exceptionState().throwIfNeeded()) 690 if (context.exceptionState().throwIfNeeded())
681 return false; 691 return false;
682 692
683 return true; 693 return true;
684 } 694 }
685 695
696
697
686 } // namespace blink 698 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/Dictionary.cpp ('k') | Source/bindings/modules/v8/DictionaryHelperForModules.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698