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 "modules/mediastream/MediaStreamTrack.h" | 33 #include "modules/mediastream/MediaStreamTrack.h" |
34 #include "platform/Timer.h" | 34 #include "platform/Timer.h" |
35 #include "platform/mediastream/MediaStreamDescriptor.h" | 35 #include "platform/mediastream/MediaStreamDescriptor.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 FINAL : public RefCounted<MediaStream>, public ScriptWrappable , public URLRegistrable, public MediaStreamDescriptorClient, public EventTargetW ithInlineData, public ContextLifecycleObserver, public MediaStreamTrack::Observe r { | 43 class MediaStream FINAL : public RefCountedWillBeRefCountedGarbageCollected<Medi aStream>, public ScriptWrappable, |
44 REFCOUNTED_EVENT_TARGET(MediaStream); | 44 public URLRegistrable, public MediaStreamDescriptorClient, public EventTarge tWithInlineData, public ContextLifecycleObserver { |
45 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<M ediaStream>); | |
45 public: | 46 public: |
46 static PassRefPtr<MediaStream> create(ExecutionContext*); | 47 static PassRefPtrWillBeRawPtr<MediaStream> create(ExecutionContext*); |
47 static PassRefPtr<MediaStream> create(ExecutionContext*, PassRefPtr<MediaStr eam>); | 48 static PassRefPtrWillBeRawPtr<MediaStream> create(ExecutionContext*, PassRef PtrWillBeRawPtr<MediaStream>); |
48 static PassRefPtr<MediaStream> create(ExecutionContext*, const MediaStreamTr ackVector&); | 49 static PassRefPtrWillBeRawPtr<MediaStream> create(ExecutionContext*, const M ediaStreamTrackVector&); |
49 static PassRefPtr<MediaStream> create(ExecutionContext*, PassRefPtr<MediaStr eamDescriptor>); | 50 static PassRefPtrWillBeRawPtr<MediaStream> create(ExecutionContext*, PassRef Ptr<MediaStreamDescriptor>); |
50 virtual ~MediaStream(); | 51 virtual ~MediaStream(); |
51 | 52 |
52 // DEPRECATED | 53 // DEPRECATED |
53 String label() const { return m_descriptor->id(); } | 54 String label() const { return m_descriptor->id(); } |
54 | 55 |
55 String id() const { return m_descriptor->id(); } | 56 String id() const { return m_descriptor->id(); } |
56 | 57 |
57 void addTrack(PassRefPtr<MediaStreamTrack>, ExceptionState&); | 58 void addTrack(PassRefPtrWillBeRawPtr<MediaStreamTrack>, ExceptionState&); |
58 void removeTrack(PassRefPtr<MediaStreamTrack>, ExceptionState&); | 59 void removeTrack(PassRefPtrWillBeRawPtr<MediaStreamTrack>, ExceptionState&); |
59 MediaStreamTrack* getTrackById(String); | 60 MediaStreamTrack* getTrackById(String); |
60 PassRefPtr<MediaStream> clone(ExecutionContext*); | 61 PassRefPtrWillBeRawPtr<MediaStream> clone(ExecutionContext*); |
61 | 62 |
62 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } | 63 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } |
63 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } | 64 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } |
64 | 65 |
65 bool ended() const; | 66 bool ended() const; |
66 void stop(); | 67 void stop(); |
67 | 68 |
68 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
69 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
70 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); | 71 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
71 | 72 |
72 // MediaStreamTrack::Observer | 73 void trackEnded(); |
73 virtual void trackEnded() OVERRIDE; | |
74 | 74 |
75 // MediaStreamDescriptorClient | 75 // MediaStreamDescriptorClient |
76 virtual void streamEnded() OVERRIDE; | 76 virtual void streamEnded() OVERRIDE; |
77 | 77 |
78 MediaStreamDescriptor* descriptor() const { return m_descriptor.get(); } | 78 MediaStreamDescriptor* descriptor() const { return m_descriptor.get(); } |
79 | 79 |
80 // EventTarget | 80 // EventTarget |
81 virtual const AtomicString& interfaceName() const OVERRIDE; | 81 virtual const AtomicString& interfaceName() const OVERRIDE; |
82 virtual ExecutionContext* executionContext() const OVERRIDE; | 82 virtual ExecutionContext* executionContext() const OVERRIDE; |
83 | 83 |
84 // URLRegistrable | 84 // URLRegistrable |
85 virtual URLRegistry& registry() const OVERRIDE; | 85 virtual URLRegistry& registry() const OVERRIDE; |
86 | 86 |
87 virtual void trace(Visitor*); | |
haraken
2014/05/08 05:08:39
Remove virtual.
keishi
2014/05/09 01:53:54
Done.
| |
88 | |
87 private: | 89 private: |
88 MediaStream(ExecutionContext*, PassRefPtr<MediaStreamDescriptor>); | 90 MediaStream(ExecutionContext*, PassRefPtr<MediaStreamDescriptor>); |
89 MediaStream(ExecutionContext*, const MediaStreamTrackVector& audioTracks, co nst MediaStreamTrackVector& videoTracks); | 91 MediaStream(ExecutionContext*, const MediaStreamTrackVector& audioTracks, co nst MediaStreamTrackVector& videoTracks); |
90 | 92 |
91 // ContextLifecycleObserver | 93 // ContextLifecycleObserver |
92 virtual void contextDestroyed() OVERRIDE; | 94 virtual void contextDestroyed() OVERRIDE; |
93 | 95 |
94 // MediaStreamDescriptorClient | 96 // MediaStreamDescriptorClient |
95 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; | 97 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; |
96 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; | 98 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; |
97 | 99 |
98 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); | 100 void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>); |
99 void scheduledEventTimerFired(Timer<MediaStream>*); | 101 void scheduledEventTimerFired(Timer<MediaStream>*); |
100 | 102 |
101 bool m_stopped; | 103 bool m_stopped; |
102 | 104 |
103 MediaStreamTrackVector m_audioTracks; | 105 MediaStreamTrackVector m_audioTracks; |
104 MediaStreamTrackVector m_videoTracks; | 106 MediaStreamTrackVector m_videoTracks; |
105 RefPtr<MediaStreamDescriptor> m_descriptor; | 107 RefPtr<MediaStreamDescriptor> m_descriptor; |
106 | 108 |
107 Timer<MediaStream> m_scheduledEventTimer; | 109 Timer<MediaStream> m_scheduledEventTimer; |
108 WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; | 110 WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
109 }; | 111 }; |
110 | 112 |
111 typedef Vector<RefPtr<MediaStream> > MediaStreamVector; | 113 typedef WillBeHeapVector<RefPtrWillBeMember<MediaStream> > MediaStreamVector; |
112 | 114 |
113 } // namespace WebCore | 115 } // namespace WebCore |
114 | 116 |
115 #endif // MediaStream_h | 117 #endif // MediaStream_h |
OLD | NEW |