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 { | 43 class MediaStream FINAL : public RefCountedWillBeRefCountedGarbageCollected<Medi aStream>, public ScriptWrappable, public URLRegistrable, public MediaStreamDescr iptorClient, public EventTargetWithInlineData, public ContextLifecycleObserver { |
|
haraken
2014/02/26 13:58:37
Ditto. Please just check that 'RefPtr<MediaStream>
| |
| 44 REFCOUNTED_EVENT_TARGET(MediaStream); | 44 DECLARE_GC_INFO; |
| 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 | 61 |
| 61 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } | 62 MediaStreamTrackVector getAudioTracks() const { return m_audioTracks; } |
| 62 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } | 63 MediaStreamTrackVector getVideoTracks() const { return m_videoTracks; } |
| 63 | 64 |
| 64 bool ended() const; | 65 bool ended() const; |
| 65 void stop(); | 66 void stop(); |
| 66 | 67 |
| 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
| 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
| 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
| 70 | 71 |
| 71 // MediaStreamDescriptorClient | 72 // MediaStreamDescriptorClient |
| 72 virtual void trackEnded() OVERRIDE; | 73 virtual void trackEnded() OVERRIDE; |
| 73 virtual void streamEnded() OVERRIDE; | 74 virtual void streamEnded() OVERRIDE; |
| 74 | 75 |
| 75 MediaStreamDescriptor* descriptor() const { return m_descriptor.get(); } | 76 MediaStreamDescriptor* descriptor() const { return m_descriptor.get(); } |
| 76 | 77 |
| 77 // EventTarget | 78 // EventTarget |
| 78 virtual const AtomicString& interfaceName() const OVERRIDE; | 79 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 79 virtual ExecutionContext* executionContext() const OVERRIDE; | 80 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 80 | 81 |
| 81 // URLRegistrable | 82 // URLRegistrable |
| 82 virtual URLRegistry& registry() const OVERRIDE; | 83 virtual URLRegistry& registry() const OVERRIDE; |
| 83 | 84 |
| 85 void trace(Visitor*) { } | |
| 86 | |
| 84 protected: | 87 protected: |
| 85 MediaStream(ExecutionContext*, PassRefPtr<MediaStreamDescriptor>); | 88 MediaStream(ExecutionContext*, PassRefPtr<MediaStreamDescriptor>); |
| 86 | 89 |
| 87 // ContextLifecycleObserver | 90 // ContextLifecycleObserver |
| 88 virtual void contextDestroyed() OVERRIDE; | 91 virtual void contextDestroyed() OVERRIDE; |
| 89 | 92 |
| 90 private: | 93 private: |
| 91 // MediaStreamDescriptorClient | 94 // MediaStreamDescriptorClient |
| 92 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; | 95 virtual void addRemoteTrack(MediaStreamComponent*) OVERRIDE; |
| 93 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; | 96 virtual void removeRemoteTrack(MediaStreamComponent*) OVERRIDE; |
| 94 | 97 |
| 95 void scheduleDispatchEvent(PassRefPtr<Event>); | 98 void scheduleDispatchEvent(PassRefPtr<Event>); |
| 96 void scheduledEventTimerFired(Timer<MediaStream>*); | 99 void scheduledEventTimerFired(Timer<MediaStream>*); |
| 97 | 100 |
| 98 bool m_stopped; | 101 bool m_stopped; |
| 99 | 102 |
| 100 MediaStreamTrackVector m_audioTracks; | 103 MediaStreamTrackVector m_audioTracks; |
| 101 MediaStreamTrackVector m_videoTracks; | 104 MediaStreamTrackVector m_videoTracks; |
| 102 RefPtr<MediaStreamDescriptor> m_descriptor; | 105 RefPtr<MediaStreamDescriptor> m_descriptor; |
| 103 | 106 |
| 104 Timer<MediaStream> m_scheduledEventTimer; | 107 Timer<MediaStream> m_scheduledEventTimer; |
| 105 Vector<RefPtr<Event> > m_scheduledEvents; | 108 Vector<RefPtr<Event> > m_scheduledEvents; |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 typedef Vector<RefPtr<MediaStream> > MediaStreamVector; | 111 typedef WillBeHeapVector<RefPtrWillBeMember<MediaStream> > MediaStreamVector; |
| 109 | 112 |
| 110 } // namespace WebCore | 113 } // namespace WebCore |
| 111 | 114 |
| 112 #endif // MediaStream_h | 115 #endif // MediaStream_h |
| OLD | NEW |