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 static PassRefPtrWillBeRawPtr<MediaStreamTrack> create(ExecutionContext*, Me diaStreamComponent*); |
| 52 public: | |
| 53 virtual ~Observer() { } | |
| 54 virtual void trackEnded() = 0; | |
| 55 }; | |
| 56 | |
| 57 static PassRefPtr<MediaStreamTrack> create(ExecutionContext*, MediaStreamCom ponent*); | |
| 58 virtual ~MediaStreamTrack(); | 52 virtual ~MediaStreamTrack(); |
| 59 | 53 |
| 60 String kind() const; | 54 String kind() const; |
| 61 String id() const; | 55 String id() const; |
| 62 String label() const; | 56 String label() const; |
| 63 | 57 |
| 64 bool enabled() const; | 58 bool enabled() const; |
| 65 void setEnabled(bool); | 59 void setEnabled(bool); |
| 66 | 60 |
| 67 String readyState() const; | 61 String readyState() const; |
| 68 | 62 |
| 69 static void getSources(ExecutionContext*, PassOwnPtr<MediaStreamTrackSources Callback>, ExceptionState&); | 63 static void getSources(ExecutionContext*, PassOwnPtr<MediaStreamTrackSources Callback>, ExceptionState&); |
| 70 void stopTrack(ExceptionState&); | 64 void stopTrack(ExceptionState&); |
| 71 PassRefPtr<MediaStreamTrack> clone(ExecutionContext*); | 65 PassRefPtrWillBeRawPtr<MediaStreamTrack> clone(ExecutionContext*); |
| 72 | 66 |
| 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); | 67 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); |
| 74 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); |
| 75 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); |
| 76 | 70 |
| 77 MediaStreamComponent* component(); | 71 MediaStreamComponent* component(); |
| 78 bool ended() const; | 72 bool ended() const; |
| 79 | 73 |
| 80 void addObserver(Observer*); | 74 void registerMediaStream(MediaStream*); |
| 81 void removeObserver(Observer*); | 75 void unregisterMediaStream(MediaStream*); |
| 82 | 76 |
| 83 // EventTarget | 77 // EventTarget |
| 84 virtual const AtomicString& interfaceName() const OVERRIDE; | 78 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 85 virtual ExecutionContext* executionContext() const OVERRIDE; | 79 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 86 | 80 |
| 87 // ActiveDOMObject | 81 // ActiveDOMObject |
| 88 virtual void stop() OVERRIDE; | 82 virtual void stop() OVERRIDE; |
| 89 | 83 |
| 90 PassOwnPtr<AudioSourceProvider> createWebAudioSource(); | 84 PassOwnPtr<AudioSourceProvider> createWebAudioSource(); |
| 91 | 85 |
| 86 void trace(Visitor*); | |
| 87 | |
| 92 private: | 88 private: |
| 93 MediaStreamTrack(ExecutionContext*, MediaStreamComponent*); | 89 MediaStreamTrack(ExecutionContext*, MediaStreamComponent*); |
| 94 | 90 |
| 95 MediaStreamSource::ReadyState m_readyState; | 91 MediaStreamSource::ReadyState m_readyState; |
| 96 | 92 |
| 97 // MediaStreamSourceObserver | 93 // MediaStreamSourceObserver |
| 98 virtual void sourceChangedState() OVERRIDE; | 94 virtual void sourceChangedState() OVERRIDE; |
| 99 | 95 |
| 100 void propagateTrackEnded(); | 96 void propagateTrackEnded(); |
| 101 Vector<Observer*> m_observers; | 97 WillBeHeapHashSet<RawPtrWillBeWeakMember<MediaStream> > m_registeredMediaStr eams; |
|
haraken
2014/05/08 05:08:39
I'm sorry I mentioned that this should be a hash s
keishi
2014/05/09 01:53:54
Done.
| |
| 102 bool m_isIteratingObservers; | 98 bool m_isIteratingRegisteredMediaStreams; |
| 103 | 99 |
| 104 bool m_stopped; | 100 bool m_stopped; |
| 105 RefPtr<MediaStreamComponent> m_component; | 101 RefPtr<MediaStreamComponent> m_component; |
| 106 }; | 102 }; |
| 107 | 103 |
| 108 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector; | 104 typedef WillBeHeapVector<RefPtrWillBeMember<MediaStreamTrack> > MediaStreamTrack Vector; |
| 109 | 105 |
| 110 } // namespace WebCore | 106 } // namespace WebCore |
| 111 | 107 |
| 112 #endif // MediaStreamTrack_h | 108 #endif // MediaStreamTrack_h |
| OLD | NEW |