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

Side by Side Diff: Source/platform/mediastream/MediaStreamSource.h

Issue 552653005: Oilpan: Move MediaStreamSource, MediaStreamComponent and MediaStreamDescriptor to oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 16 matching lines...) Expand all
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef MediaStreamSource_h 32 #ifndef MediaStreamSource_h
33 #define MediaStreamSource_h 33 #define MediaStreamSource_h
34 34
35 #include "platform/PlatformExport.h" 35 #include "platform/PlatformExport.h"
36 #include "platform/audio/AudioDestinationConsumer.h" 36 #include "platform/audio/AudioDestinationConsumer.h"
37 #include "platform/heap/Handle.h"
37 #include "public/platform/WebMediaConstraints.h" 38 #include "public/platform/WebMediaConstraints.h"
38 #include "wtf/OwnPtr.h" 39 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h" 40 #include "wtf/PassOwnPtr.h"
40 #include "wtf/RefCounted.h"
41 #include "wtf/ThreadingPrimitives.h" 41 #include "wtf/ThreadingPrimitives.h"
42 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
43 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
44 44
45 namespace blink { 45 namespace blink {
46 46
47 class PLATFORM_EXPORT MediaStreamSource FINAL : public RefCounted<MediaStreamSou rce> { 47 class PLATFORM_EXPORT MediaStreamSource FINAL : public GarbageCollectedFinalized <MediaStreamSource> {
48 public: 48 public:
49 class Observer { 49 class Observer : public GarbageCollectedMixin {
50 public: 50 public:
51 virtual ~Observer() { } 51 virtual ~Observer() { }
52 virtual void sourceChangedState() = 0; 52 virtual void sourceChangedState() = 0;
53 virtual void trace(Visitor*) { }
53 }; 54 };
54 55
55 class ExtraData { 56 class ExtraData {
56 public: 57 public:
57 virtual ~ExtraData() { } 58 virtual ~ExtraData() { }
58 }; 59 };
59 60
60 enum Type { 61 enum Type {
61 TypeAudio, 62 TypeAudio,
62 TypeVideo 63 TypeVideo
63 }; 64 };
64 65
65 enum ReadyState { 66 enum ReadyState {
66 ReadyStateLive = 0, 67 ReadyStateLive = 0,
67 ReadyStateMuted = 1, 68 ReadyStateMuted = 1,
68 ReadyStateEnded = 2 69 ReadyStateEnded = 2
69 }; 70 };
70 71
71 static PassRefPtr<MediaStreamSource> create(const String& id, Type, const St ring& name, ReadyState = ReadyStateLive, bool requiresConsumer = false); 72 static MediaStreamSource* create(const String& id, Type, const String& name, ReadyState = ReadyStateLive, bool requiresConsumer = false);
72 73
73 const String& id() const { return m_id; } 74 const String& id() const { return m_id; }
74 Type type() const { return m_type; } 75 Type type() const { return m_type; }
75 const String& name() const { return m_name; } 76 const String& name() const { return m_name; }
76 77
77 void setReadyState(ReadyState); 78 void setReadyState(ReadyState);
78 ReadyState readyState() const { return m_readyState; } 79 ReadyState readyState() const { return m_readyState; }
79 80
80 void addObserver(Observer*); 81 void addObserver(Observer*);
81 void removeObserver(Observer*); 82 void removeObserver(Observer*);
82 83
83 ExtraData* extraData() const { return m_extraData.get(); } 84 ExtraData* extraData() const { return m_extraData.get(); }
84 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; } 85 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; }
85 86
86 void setConstraints(blink::WebMediaConstraints constraints) { m_constraints = constraints; } 87 void setConstraints(blink::WebMediaConstraints constraints) { m_constraints = constraints; }
87 blink::WebMediaConstraints constraints() { return m_constraints; } 88 blink::WebMediaConstraints constraints() { return m_constraints; }
88 89
89 void setAudioFormat(size_t numberOfChannels, float sampleRate); 90 void setAudioFormat(size_t numberOfChannels, float sampleRate);
90 void consumeAudio(AudioBus*, size_t numberOfFrames); 91 void consumeAudio(AudioBus*, size_t numberOfFrames);
91 92
92 bool requiresAudioConsumer() const { return m_requiresConsumer; } 93 bool requiresAudioConsumer() const { return m_requiresConsumer; }
93 void addAudioConsumer(AudioDestinationConsumer*); 94 void addAudioConsumer(AudioDestinationConsumer*);
94 bool removeAudioConsumer(AudioDestinationConsumer*); 95 bool removeAudioConsumer(AudioDestinationConsumer*);
95 const HeapHashSet<Member<AudioDestinationConsumer> >& audioConsumers() { ret urn m_audioConsumers; } 96 const HeapHashSet<Member<AudioDestinationConsumer> >& audioConsumers() { ret urn m_audioConsumers; }
96 97
98 void trace(Visitor*);
99 void dispose();
100
97 private: 101 private:
98 MediaStreamSource(const String& id, Type, const String& name, ReadyState, bo ol requiresConsumer); 102 MediaStreamSource(const String& id, Type, const String& name, ReadyState, bo ol requiresConsumer);
99 103
100 String m_id; 104 String m_id;
101 Type m_type; 105 Type m_type;
102 String m_name; 106 String m_name;
103 ReadyState m_readyState; 107 ReadyState m_readyState;
104 bool m_requiresConsumer; 108 bool m_requiresConsumer;
105 Vector<Observer*> m_observers; 109 HeapHashSet<WeakMember<Observer> > m_observers;
106 Mutex m_audioConsumersLock; 110 Mutex m_audioConsumersLock;
107 PersistentHeapHashSet<Member<AudioDestinationConsumer> > m_audioConsumers; 111 HeapHashSet<Member<AudioDestinationConsumer> > m_audioConsumers;
108 OwnPtr<ExtraData> m_extraData; 112 OwnPtr<ExtraData> m_extraData;
109 blink::WebMediaConstraints m_constraints; 113 blink::WebMediaConstraints m_constraints;
110 }; 114 };
111 115
112 typedef Vector<RefPtr<MediaStreamSource> > MediaStreamSourceVector; 116 typedef HeapVector<Member<MediaStreamSource> > MediaStreamSourceVector;
113 117
114 } // namespace blink 118 } // namespace blink
115 119
116 #endif // MediaStreamSource_h 120 #endif // MediaStreamSource_h
OLDNEW
« no previous file with comments | « Source/platform/mediastream/MediaStreamDescriptor.cpp ('k') | Source/platform/mediastream/MediaStreamSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698