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 27 matching lines...) Expand all Loading... | |
| 38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class AudioSourceProvider; | 43 class AudioSourceProvider; |
| 44 class ExceptionState; | 44 class ExceptionState; |
| 45 class MediaStreamComponent; | 45 class MediaStreamComponent; |
| 46 class MediaStreamTrackSourcesCallback; | 46 class MediaStreamTrackSourcesCallback; |
| 47 | 47 |
| 48 class MediaStreamTrack FINAL : public RefCounted<MediaStreamTrack>, public Scrip tWrappable, public ActiveDOMObject, public EventTargetWithInlineData, public Med iaStreamSource::Observer { | 48 class MediaStreamTrack FINAL : public RefCountedWillBeRefCountedGarbageCollected <MediaStreamTrack>, public ScriptWrappable, public ActiveDOMObject, public Event TargetWithInlineData, public MediaStreamSource::Observer { |
| 49 REFCOUNTED_EVENT_TARGET(MediaStreamTrack); | 49 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<M ediaStreamTrack>); |
| 50 public: | 50 public: |
| 51 class Observer { | 51 class Observer { |
| 52 public: | 52 public: |
| 53 virtual ~Observer() { } | 53 virtual ~Observer() { } |
| 54 virtual void trackEnded() = 0; | 54 virtual void trackEnded() = 0; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 static PassRefPtr<MediaStreamTrack> create(ExecutionContext*, MediaStreamCom ponent*); | 57 static PassRefPtrWillBeRawPtr<MediaStreamTrack> create(ExecutionContext*, Me diaStreamComponent*); |
| 58 virtual ~MediaStreamTrack(); | 58 virtual ~MediaStreamTrack(); |
| 59 | 59 |
| 60 String kind() const; | 60 String kind() const; |
| 61 String id() const; | 61 String id() const; |
| 62 String label() const; | 62 String label() const; |
| 63 | 63 |
| 64 bool enabled() const; | 64 bool enabled() const; |
| 65 void setEnabled(bool); | 65 void setEnabled(bool); |
| 66 | 66 |
| 67 String readyState() const; | 67 String readyState() const; |
| 68 | 68 |
| 69 static void getSources(ExecutionContext*, PassOwnPtr<MediaStreamTrackSources Callback>, ExceptionState&); | 69 static void getSources(ExecutionContext*, PassOwnPtr<MediaStreamTrackSources Callback>, ExceptionState&); |
| 70 void stopTrack(ExceptionState&); | 70 void stopTrack(ExceptionState&); |
| 71 PassRefPtr<MediaStreamTrack> clone(ExecutionContext*); | 71 PassRefPtrWillBeRawPtr<MediaStreamTrack> clone(ExecutionContext*); |
| 72 | 72 |
| 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); |
| 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); | 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); |
| 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
| 76 | 76 |
| 77 MediaStreamComponent* component(); | 77 MediaStreamComponent* component(); |
| 78 bool ended() const; | 78 bool ended() const; |
| 79 | 79 |
| 80 void addObserver(Observer*); | 80 void addObserver(Observer*); |
| 81 void removeObserver(Observer*); | 81 void removeObserver(Observer*); |
| 82 | 82 |
| 83 // EventTarget | 83 // EventTarget |
| 84 virtual const AtomicString& interfaceName() const OVERRIDE; | 84 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 85 virtual ExecutionContext* executionContext() const OVERRIDE; | 85 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 86 | 86 |
| 87 // ActiveDOMObject | 87 // ActiveDOMObject |
| 88 virtual void stop() OVERRIDE; | 88 virtual void stop() OVERRIDE; |
| 89 | 89 |
| 90 PassOwnPtr<AudioSourceProvider> createWebAudioSource(); | 90 PassOwnPtr<AudioSourceProvider> createWebAudioSource(); |
| 91 | 91 |
| 92 void trace(Visitor*) { } | |
| 93 | |
| 92 private: | 94 private: |
| 93 MediaStreamTrack(ExecutionContext*, MediaStreamComponent*); | 95 MediaStreamTrack(ExecutionContext*, MediaStreamComponent*); |
| 94 | 96 |
| 95 MediaStreamSource::ReadyState m_readyState; | 97 MediaStreamSource::ReadyState m_readyState; |
| 96 | 98 |
| 97 // MediaStreamSourceObserver | 99 // MediaStreamSourceObserver |
| 98 virtual void sourceChangedState() OVERRIDE; | 100 virtual void sourceChangedState() OVERRIDE; |
| 99 | 101 |
| 100 void propagateTrackEnded(); | 102 void propagateTrackEnded(); |
| 101 Vector<Observer*> m_observers; | 103 Vector<Observer*> m_observers; |
|
haraken
2014/04/08 04:42:35
As I commented in MediaStream.h, this should be a
keishi
2014/04/11 20:03:06
I had trouble making MediaStreamTrack::Observer ga
haraken
2014/04/14 04:42:43
Sounds reasonable!
| |
| 102 bool m_isIteratingObservers; | 104 bool m_isIteratingObservers; |
| 103 | 105 |
| 104 bool m_stopped; | 106 bool m_stopped; |
| 105 RefPtr<MediaStreamComponent> m_component; | 107 RefPtr<MediaStreamComponent> m_component; |
| 106 }; | 108 }; |
| 107 | 109 |
| 108 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector; | 110 typedef WillBeHeapVector<RefPtrWillBeMember<MediaStreamTrack> > MediaStreamTrack Vector; |
| 109 | 111 |
| 110 } // namespace WebCore | 112 } // namespace WebCore |
| 111 | 113 |
| 112 #endif // MediaStreamTrack_h | 114 #endif // MediaStreamTrack_h |
| OLD | NEW |