OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. 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 * 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 26 matching lines...) Expand all Loading... |
37 namespace blink { | 37 namespace blink { |
38 | 38 |
39 class ExceptionState; | 39 class ExceptionState; |
40 | 40 |
41 class MODULES_EXPORT MediaStream final | 41 class MODULES_EXPORT MediaStream final |
42 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaStream> | 42 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaStream> |
43 , public URLRegistrable | 43 , public URLRegistrable |
44 , public MediaStreamDescriptorClient | 44 , public MediaStreamDescriptorClient |
45 , public ContextLifecycleObserver { | 45 , public ContextLifecycleObserver { |
46 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaStream); | 46 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaStream); |
47 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaStream); | 47 USING_GARBAGE_COLLECTED_MIXIN(MediaStream); |
48 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
49 public: | 49 public: |
50 static MediaStream* create(ExecutionContext*); | 50 static MediaStream* create(ExecutionContext*); |
51 static MediaStream* create(ExecutionContext*, MediaStream*); | 51 static MediaStream* create(ExecutionContext*, MediaStream*); |
52 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&)
; | 52 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&)
; |
53 static MediaStream* create(ExecutionContext*, PassRefPtr<MediaStreamDescript
or>); | 53 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*); |
54 ~MediaStream() override; | 54 ~MediaStream() override; |
55 | 55 |
56 String id() const { return m_descriptor->id(); } | 56 String id() const { return m_descriptor->id(); } |
57 | 57 |
58 void addTrack(MediaStreamTrack*, ExceptionState&); | 58 void addTrack(MediaStreamTrack*, ExceptionState&); |
59 void removeTrack(MediaStreamTrack*, ExceptionState&); | 59 void removeTrack(MediaStreamTrack*, ExceptionState&); |
60 MediaStreamTrack* getTrackById(String); | 60 MediaStreamTrack* getTrackById(String); |
61 MediaStream* clone(ExecutionContext*); | 61 MediaStream* clone(ExecutionContext*); |
62 | 62 |
63 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } | 63 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } |
64 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } | 64 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } |
65 MediaStreamTrackVector getTracks(); | 65 MediaStreamTrackVector getTracks(); |
66 | 66 |
67 bool active() const { return m_descriptor->active(); } | 67 bool active() const { return m_descriptor->active(); } |
68 | 68 |
69 DEFINE_ATTRIBUTE_EVENT_LISTENER(active); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(active); |
70 DEFINE_ATTRIBUTE_EVENT_LISTENER(inactive); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(inactive); |
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
72 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
73 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
74 | 74 |
75 void trackEnded(); | 75 void trackEnded(); |
76 | 76 |
77 // MediaStreamDescriptorClient | 77 // MediaStreamDescriptorClient |
78 void streamEnded() override; | 78 void streamEnded() override; |
79 | 79 |
80 MediaStreamDescriptor* descriptor() const { return m_descriptor.get(); } | 80 MediaStreamDescriptor* descriptor() const { return m_descriptor; } |
81 | 81 |
82 // EventTarget | 82 // EventTarget |
83 const AtomicString& interfaceName() const override; | 83 const AtomicString& interfaceName() const override; |
84 ExecutionContext* executionContext() const override; | 84 ExecutionContext* executionContext() const override; |
85 | 85 |
86 // URLRegistrable | 86 // URLRegistrable |
87 URLRegistry& registry() const override; | 87 URLRegistry& registry() const override; |
88 | 88 |
89 // Oilpan: need to eagerly unregister as m_descriptor client. | 89 // Oilpan: need to eagerly unregister as m_descriptor client. |
90 EAGERLY_FINALIZE(); | 90 EAGERLY_FINALIZE(); |
91 DECLARE_VIRTUAL_TRACE(); | 91 DECLARE_VIRTUAL_TRACE(); |
92 | 92 |
93 private: | 93 private: |
94 MediaStream(ExecutionContext*, PassRefPtr<MediaStreamDescriptor>); | 94 MediaStream(ExecutionContext*, MediaStreamDescriptor*); |
95 MediaStream(ExecutionContext*, const MediaStreamTrackVector& audioTracks, co
nst MediaStreamTrackVector& videoTracks); | 95 MediaStream(ExecutionContext*, const MediaStreamTrackVector& audioTracks, co
nst MediaStreamTrackVector& videoTracks); |
96 | 96 |
97 // ContextLifecycleObserver | 97 // ContextLifecycleObserver |
98 void contextDestroyed() override; | 98 void contextDestroyed() override; |
99 | 99 |
100 // MediaStreamDescriptorClient | 100 // MediaStreamDescriptorClient |
101 void addRemoteTrack(MediaStreamComponent*) override; | 101 void addRemoteTrack(MediaStreamComponent*) override; |
102 void removeRemoteTrack(MediaStreamComponent*) override; | 102 void removeRemoteTrack(MediaStreamComponent*) override; |
103 | 103 |
104 bool emptyOrOnlyEndedTracks(); | 104 bool emptyOrOnlyEndedTracks(); |
105 | 105 |
106 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 106 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
107 void scheduledEventTimerFired(Timer<MediaStream>*); | 107 void scheduledEventTimerFired(Timer<MediaStream>*); |
108 | 108 |
109 bool m_stopped; | 109 bool m_stopped; |
110 | 110 |
111 MediaStreamTrackVector m_audioTracks; | 111 MediaStreamTrackVector m_audioTracks; |
112 MediaStreamTrackVector m_videoTracks; | 112 MediaStreamTrackVector m_videoTracks; |
113 RefPtr<MediaStreamDescriptor> m_descriptor; | 113 Member<MediaStreamDescriptor> m_descriptor; |
114 | 114 |
115 Timer<MediaStream> m_scheduledEventTimer; | 115 Timer<MediaStream> m_scheduledEventTimer; |
116 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; | 116 WillBeHeapVector<RefPtrWillBeMember<Event>> m_scheduledEvents; |
117 }; | 117 }; |
118 | 118 |
119 typedef HeapVector<Member<MediaStream>> MediaStreamVector; | 119 typedef HeapVector<Member<MediaStream>> MediaStreamVector; |
120 | 120 |
121 } // namespace blink | 121 } // namespace blink |
122 | 122 |
123 #endif // MediaStream_h | 123 #endif // MediaStream_h |
OLD | NEW |