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

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamSource.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: 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) 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 26 matching lines...) Expand all
37 #include "public/platform/WebMediaConstraints.h" 37 #include "public/platform/WebMediaConstraints.h"
38 #include "wtf/OwnPtr.h" 38 #include "wtf/OwnPtr.h"
39 #include "wtf/PassOwnPtr.h" 39 #include "wtf/PassOwnPtr.h"
40 #include "wtf/RefCounted.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 PLATFORM_EXPORT Observer { 49 class PLATFORM_EXPORT Observer {
sof 2015/09/30 06:26:35 If the Observers are on the heap, shouldn't this b
peria 2015/09/30 07:50:05 Done.
50 public: 50 public:
51 virtual ~Observer() { } 51 virtual ~Observer() { }
52 virtual void sourceChangedState() = 0; 52 virtual void sourceChangedState() = 0;
53 }; 53 };
54 54
55 class ExtraData { 55 class ExtraData {
56 public: 56 public:
57 virtual ~ExtraData() { } 57 virtual ~ExtraData() { }
58 }; 58 };
59 59
60 enum Type { 60 enum Type {
61 TypeAudio, 61 TypeAudio,
62 TypeVideo 62 TypeVideo
63 }; 63 };
64 64
65 enum ReadyState { 65 enum ReadyState {
66 ReadyStateLive = 0, 66 ReadyStateLive = 0,
67 ReadyStateMuted = 1, 67 ReadyStateMuted = 1,
68 ReadyStateEnded = 2 68 ReadyStateEnded = 2
69 }; 69 };
70 70
71 static PassRefPtr<MediaStreamSource> create(const String& id, Type, const St ring& name, bool remote, bool readonly, ReadyState = ReadyStateLive, bool requir esConsumer = false); 71 static MediaStreamSource* create(const String& id, Type, const String& name, bool remote, bool readonly, ReadyState = ReadyStateLive, bool requiresConsumer = false);
72 72
73 const String& id() const { return m_id; } 73 const String& id() const { return m_id; }
74 Type type() const { return m_type; } 74 Type type() const { return m_type; }
75 const String& name() const { return m_name; } 75 const String& name() const { return m_name; }
76 bool remote() const { return m_remote; } 76 bool remote() const { return m_remote; }
77 bool readonly() const { return m_readonly; } 77 bool readonly() const { return m_readonly; }
78 78
79 void setReadyState(ReadyState); 79 void setReadyState(ReadyState);
80 ReadyState readyState() const { return m_readyState; } 80 ReadyState readyState() const { return m_readyState; }
81 81
82 void addObserver(Observer*); 82 void addObserver(Observer*);
83 void removeObserver(Observer*); 83 void removeObserver(Observer*);
84 84
85 ExtraData* extraData() const { return m_extraData.get(); } 85 ExtraData* extraData() const { return m_extraData.get(); }
86 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; } 86 void setExtraData(PassOwnPtr<ExtraData> extraData) { m_extraData = extraData ; }
87 87
88 void setConstraints(WebMediaConstraints constraints) { m_constraints = const raints; } 88 void setConstraints(WebMediaConstraints constraints) { m_constraints = const raints; }
89 WebMediaConstraints constraints() { return m_constraints; } 89 WebMediaConstraints constraints() { return m_constraints; }
90 90
91 void setAudioFormat(size_t numberOfChannels, float sampleRate); 91 void setAudioFormat(size_t numberOfChannels, float sampleRate);
92 void consumeAudio(AudioBus*, size_t numberOfFrames); 92 void consumeAudio(AudioBus*, size_t numberOfFrames);
93 93
94 bool requiresAudioConsumer() const { return m_requiresConsumer; } 94 bool requiresAudioConsumer() const { return m_requiresConsumer; }
95 void addAudioConsumer(AudioDestinationConsumer*); 95 void addAudioConsumer(AudioDestinationConsumer*);
96 bool removeAudioConsumer(AudioDestinationConsumer*); 96 bool removeAudioConsumer(AudioDestinationConsumer*);
97 const HeapHashSet<Member<AudioDestinationConsumer>>& audioConsumers() { retu rn m_audioConsumers; } 97 const HeapHashSet<Member<AudioDestinationConsumer>>& audioConsumers() { retu rn m_audioConsumers; }
98 98
99 DECLARE_TRACE();
100
99 private: 101 private:
100 MediaStreamSource(const String& id, Type, const String& name, bool remote, b ool readonly, ReadyState, bool requiresConsumer); 102 MediaStreamSource(const String& id, Type, const String& name, bool remote, b ool readonly, ReadyState, bool requiresConsumer);
101 103
102 String m_id; 104 String m_id;
103 Type m_type; 105 Type m_type;
104 String m_name; 106 String m_name;
105 bool m_remote; 107 bool m_remote;
106 bool m_readonly; 108 bool m_readonly;
107 ReadyState m_readyState; 109 ReadyState m_readyState;
108 bool m_requiresConsumer; 110 bool m_requiresConsumer;
109 Vector<Observer*> m_observers; 111 Vector<Observer*> m_observers;
sof 2015/09/30 06:26:35 Are these bare pointers referring to heap objects?
haraken 2015/09/30 07:18:20 The GC plugin should be able to catch this error.
Yuta Kitamura 2015/09/30 07:25:09 In the current code, Observer isn't a heap-managed
haraken 2015/09/30 07:35:32 Would it be possible to catch the following case?
peria 2015/09/30 07:50:05 Done. Just a note to work for this Vector<>.
110 Mutex m_audioConsumersLock; 112 Mutex m_audioConsumersLock;
111 PersistentHeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers; 113 HeapHashSet<Member<AudioDestinationConsumer>> m_audioConsumers;
112 OwnPtr<ExtraData> m_extraData; 114 OwnPtr<ExtraData> m_extraData;
113 WebMediaConstraints m_constraints; 115 WebMediaConstraints m_constraints;
114 }; 116 };
115 117
116 typedef Vector<RefPtr<MediaStreamSource>> MediaStreamSourceVector; 118 typedef HeapVector<Member<MediaStreamSource>> MediaStreamSourceVector;
117 119
118 } // namespace blink 120 } // namespace blink
119 121
120 #endif // MediaStreamSource_h 122 #endif // MediaStreamSource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698