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

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamComponent.h

Issue 1363143003: [Oilpan] Move MediaStream{Source|Component|Descriptor} to Oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert changes in PS8 Created 5 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) 2011 Ericsson AB. All rights reserved. 2 * Copyright (C) 2011 Ericsson AB. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 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 15 matching lines...) Expand all
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 MediaStreamComponent_h 32 #ifndef MediaStreamComponent_h
33 #define MediaStreamComponent_h 33 #define MediaStreamComponent_h
34 34
35 #include "platform/audio/AudioSourceProvider.h" 35 #include "platform/audio/AudioSourceProvider.h"
36 #include "platform/heap/Handle.h"
36 #include "wtf/PassOwnPtr.h" 37 #include "wtf/PassOwnPtr.h"
37 #include "wtf/PassRefPtr.h" 38 #include "wtf/PassRefPtr.h"
38 #include "wtf/RefCounted.h" 39 #include "wtf/RefCounted.h"
39 #include "wtf/ThreadingPrimitives.h" 40 #include "wtf/ThreadingPrimitives.h"
40 #include "wtf/text/WTFString.h" 41 #include "wtf/text/WTFString.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 class MediaStreamSource; 45 class MediaStreamSource;
45 class WebAudioSourceProvider; 46 class WebAudioSourceProvider;
46 47
47 class PLATFORM_EXPORT MediaStreamComponent final : public RefCounted<MediaStream Component> { 48 class PLATFORM_EXPORT MediaStreamComponent final : public GarbageCollectedFinali zed<MediaStreamComponent> {
48 public: 49 public:
49 class ExtraData { 50 class ExtraData {
50 public: 51 public:
51 virtual ~ExtraData() { } 52 virtual ~ExtraData() { }
52 }; 53 };
53 54
54 static PassRefPtr<MediaStreamComponent> create(PassRefPtr<MediaStreamSource> ); 55 static MediaStreamComponent* create(MediaStreamSource*);
55 static PassRefPtr<MediaStreamComponent> create(const String& id, PassRefPtr< MediaStreamSource>); 56 static MediaStreamComponent* create(const String& id, MediaStreamSource*);
56 57
57 MediaStreamSource* source() const { return m_source.get(); } 58 MediaStreamSource* source() const { return m_source.get(); }
58 59
59 String id() const { return m_id; } 60 String id() const { return m_id; }
60 bool enabled() const { return m_enabled; } 61 bool enabled() const { return m_enabled; }
61 void setEnabled(bool enabled) { m_enabled = enabled; } 62 void setEnabled(bool enabled) { m_enabled = enabled; }
62 bool muted() const { return m_muted; } 63 bool muted() const { return m_muted; }
63 void setMuted(bool muted) { m_muted = muted; } 64 void setMuted(bool muted) { m_muted = muted; }
64 65
65 #if ENABLE(WEB_AUDIO) 66 #if ENABLE(WEB_AUDIO)
66 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; } 67 AudioSourceProvider* audioSourceProvider() { return &m_sourceProvider; }
67 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider. wrap(provider); } 68 void setSourceProvider(WebAudioSourceProvider* provider) { m_sourceProvider. wrap(provider); }
68 #endif // ENABLE(WEB_AUDIO) 69 #endif // ENABLE(WEB_AUDIO)
69 70
70 ExtraData* extraData() const { return m_extraData.get(); } 71 ExtraData* extraData() const { return m_extraData.get(); }
71 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; } 72 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; }
72 73
74 // |m_extraData| may hold pointers GC objects, and it may touch them in dest ruction.
75 // So this class is eagerly finalized to finalize |m_extraData| promptly.
76 EAGERLY_FINALIZE();
77 DECLARE_TRACE();
78
73 private: 79 private:
74 MediaStreamComponent(const String& id, PassRefPtr<MediaStreamSource>); 80 MediaStreamComponent(const String& id, MediaStreamSource*);
75 81
76 #if ENABLE(WEB_AUDIO) 82 #if ENABLE(WEB_AUDIO)
77 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput() 83 // AudioSourceProviderImpl wraps a WebAudioSourceProvider::provideInput()
78 // calls into chromium to get a rendered audio stream. 84 // calls into chromium to get a rendered audio stream.
79 85
80 class PLATFORM_EXPORT AudioSourceProviderImpl final: public AudioSourceProvi der { 86 class PLATFORM_EXPORT AudioSourceProviderImpl final: public AudioSourceProvi der {
81 public: 87 public:
82 AudioSourceProviderImpl() 88 AudioSourceProviderImpl()
83 : m_webAudioSourceProvider(0) 89 : m_webAudioSourceProvider(0)
84 { 90 {
85 } 91 }
86 92
87 ~AudioSourceProviderImpl() override {} 93 ~AudioSourceProviderImpl() override {}
88 94
89 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr ovider. 95 // Wraps the given blink::WebAudioSourceProvider to blink::AudioSourcePr ovider.
90 void wrap(WebAudioSourceProvider*); 96 void wrap(WebAudioSourceProvider*);
91 97
92 // blink::AudioSourceProvider 98 // blink::AudioSourceProvider
93 void provideInput(AudioBus*, size_t framesToProcess) override; 99 void provideInput(AudioBus*, size_t framesToProcess) override;
94 100
95 private: 101 private:
96 WebAudioSourceProvider* m_webAudioSourceProvider; 102 WebAudioSourceProvider* m_webAudioSourceProvider;
97 Mutex m_provideInputLock; 103 Mutex m_provideInputLock;
98 }; 104 };
99 105
100 AudioSourceProviderImpl m_sourceProvider; 106 AudioSourceProviderImpl m_sourceProvider;
101 #endif // ENABLE(WEB_AUDIO) 107 #endif // ENABLE(WEB_AUDIO)
102 108
103 RefPtr<MediaStreamSource> m_source; 109 Member<MediaStreamSource> m_source;
104 String m_id; 110 String m_id;
105 bool m_enabled; 111 bool m_enabled;
106 bool m_muted; 112 bool m_muted;
107 OwnPtr<ExtraData> m_extraData; 113 OwnPtr<ExtraData> m_extraData;
108 }; 114 };
109 115
110 typedef Vector<RefPtr<MediaStreamComponent>> MediaStreamComponentVector; 116 typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector;
111 117
112 } // namespace blink 118 } // namespace blink
113 119
114 #endif // MediaStreamComponent_h 120 #endif // MediaStreamComponent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698