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 22 matching lines...) Expand all Loading... |
33 #include "core/platform/mediastream/MediaStreamDescriptor.h" | 33 #include "core/platform/mediastream/MediaStreamDescriptor.h" |
34 #include "modules/mediastream/MediaStreamTrack.h" | 34 #include "modules/mediastream/MediaStreamTrack.h" |
35 #include "platform/Timer.h" | 35 #include "platform/Timer.h" |
36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class ExceptionState; | 41 class ExceptionState; |
42 | 42 |
43 class MediaStream : public RefCounted<MediaStream>, public ScriptWrappable, publ
ic URLRegistrable, public MediaStreamDescriptorClient, public EventTarget, publi
c ContextLifecycleObserver { | 43 class MediaStream : public RefCounted<MediaStream>, public ScriptWrappable, publ
ic URLRegistrable, public MediaStreamDescriptorClient, public EventTargetWithInl
ineData, public ContextLifecycleObserver { |
44 public: | 44 public: |
45 static PassRefPtr<MediaStream> create(ScriptExecutionContext*); | 45 static PassRefPtr<MediaStream> create(ScriptExecutionContext*); |
46 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, PassRefPtr<Me
diaStream>); | 46 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, PassRefPtr<Me
diaStream>); |
47 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, const MediaSt
reamTrackVector&); | 47 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, const MediaSt
reamTrackVector&); |
48 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, PassRefPtr<Me
diaStreamDescriptor>); | 48 static PassRefPtr<MediaStream> create(ScriptExecutionContext*, PassRefPtr<Me
diaStreamDescriptor>); |
49 virtual ~MediaStream(); | 49 virtual ~MediaStream(); |
50 | 50 |
51 // DEPRECATED | 51 // DEPRECATED |
52 String label() const { return m_descriptor->id(); } | 52 String label() const { return m_descriptor->id(); } |
53 | 53 |
(...skipping 25 matching lines...) Expand all Loading... |
79 | 79 |
80 using RefCounted<MediaStream>::ref; | 80 using RefCounted<MediaStream>::ref; |
81 using RefCounted<MediaStream>::deref; | 81 using RefCounted<MediaStream>::deref; |
82 | 82 |
83 // URLRegistrable | 83 // URLRegistrable |
84 virtual URLRegistry& registry() const OVERRIDE; | 84 virtual URLRegistry& registry() const OVERRIDE; |
85 | 85 |
86 protected: | 86 protected: |
87 MediaStream(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>); | 87 MediaStream(ScriptExecutionContext*, PassRefPtr<MediaStreamDescriptor>); |
88 | 88 |
89 // EventTarget | |
90 virtual EventTargetData* eventTargetData() OVERRIDE; | |
91 virtual EventTargetData* ensureEventTargetData() OVERRIDE; | |
92 | |
93 // ContextLifecycleObserver | 89 // ContextLifecycleObserver |
94 virtual void contextDestroyed(); | 90 virtual void contextDestroyed(); |
95 | 91 |
96 private: | 92 private: |
97 // EventTarget | 93 // EventTarget |
98 virtual void refEventTarget() OVERRIDE { ref(); } | 94 virtual void refEventTarget() OVERRIDE { ref(); } |
99 virtual void derefEventTarget() OVERRIDE { deref(); } | 95 virtual void derefEventTarget() OVERRIDE { deref(); } |
100 | 96 |
101 // MediaStreamDescriptorClient | 97 // MediaStreamDescriptorClient |
102 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; | 98 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; |
103 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; | 99 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; |
104 | 100 |
105 void scheduleDispatchEvent(PassRefPtr<Event>); | 101 void scheduleDispatchEvent(PassRefPtr<Event>); |
106 void scheduledEventTimerFired(Timer<MediaStream>*); | 102 void scheduledEventTimerFired(Timer<MediaStream>*); |
107 | 103 |
108 bool m_stopped; | 104 bool m_stopped; |
109 | 105 |
110 EventTargetData m_eventTargetData; | |
111 | |
112 MediaStreamTrackVector m_audioTracks; | 106 MediaStreamTrackVector m_audioTracks; |
113 MediaStreamTrackVector m_videoTracks; | 107 MediaStreamTrackVector m_videoTracks; |
114 RefPtr<MediaStreamDescriptor> m_descriptor; | 108 RefPtr<MediaStreamDescriptor> m_descriptor; |
115 | 109 |
116 Timer<MediaStream> m_scheduledEventTimer; | 110 Timer<MediaStream> m_scheduledEventTimer; |
117 Vector<RefPtr<Event> > m_scheduledEvents; | 111 Vector<RefPtr<Event> > m_scheduledEvents; |
118 }; | 112 }; |
119 | 113 |
120 typedef Vector<RefPtr<MediaStream> > MediaStreamVector; | 114 typedef Vector<RefPtr<MediaStream> > MediaStreamVector; |
121 | 115 |
122 } // namespace WebCore | 116 } // namespace WebCore |
123 | 117 |
124 #endif // MediaStream_h | 118 #endif // MediaStream_h |
OLD | NEW |