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