Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: Source/WebCore/Modules/mediastream/MediaStreamTrack.h

Issue 13776002: MediaStream should fire ended event when all tracks are ended (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 #include "EventTarget.h" 32 #include "EventTarget.h"
33 #include "MediaStreamDescriptor.h" 33 #include "MediaStreamDescriptor.h"
34 #include "MediaStreamSource.h" 34 #include "MediaStreamSource.h"
35 #include <wtf/RefCounted.h> 35 #include <wtf/RefCounted.h>
36 #include <wtf/RefPtr.h> 36 #include <wtf/RefPtr.h>
37 #include <wtf/Vector.h> 37 #include <wtf/Vector.h>
38 #include <wtf/text/WTFString.h> 38 #include <wtf/text/WTFString.h>
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 class MediaStream;
42 class MediaStreamComponent; 43 class MediaStreamComponent;
43 44
44 class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMOb ject, public EventTarget, public MediaStreamSource::Observer { 45 class MediaStreamTrack : public RefCounted<MediaStreamTrack>, public ActiveDOMOb ject, public EventTarget, public MediaStreamSource::Observer {
45 public: 46 public:
46 static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, MediaStr eamComponent*); 47 static PassRefPtr<MediaStreamTrack> create(ScriptExecutionContext*, MediaStr eamComponent*, MediaStream*);
47 virtual ~MediaStreamTrack(); 48 virtual ~MediaStreamTrack();
48 49
49 String kind() const; 50 String kind() const;
50 String id() const; 51 String id() const;
51 String label() const; 52 String label() const;
52 53
53 bool enabled() const; 54 bool enabled() const;
54 void setEnabled(bool); 55 void setEnabled(bool);
55 56
56 String readyState() const; 57 String readyState() const;
57 58
58 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute); 59 DEFINE_ATTRIBUTE_EVENT_LISTENER(mute);
59 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute); 60 DEFINE_ATTRIBUTE_EVENT_LISTENER(unmute);
60 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(ended);
61 62
62 MediaStreamComponent* component(); 63 MediaStreamComponent* component();
63 bool ended() const; 64 bool ended() const;
64 65
65 // EventTarget 66 // EventTarget
66 virtual const AtomicString& interfaceName() const OVERRIDE; 67 virtual const AtomicString& interfaceName() const OVERRIDE;
67 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; 68 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
68 69
69 // ActiveDOMObject 70 // ActiveDOMObject
70 virtual void stop() OVERRIDE; 71 virtual void stop() OVERRIDE;
71 72
72 using RefCounted<MediaStreamTrack>::ref; 73 using RefCounted<MediaStreamTrack>::ref;
73 using RefCounted<MediaStreamTrack>::deref; 74 using RefCounted<MediaStreamTrack>::deref;
74 75
75 private: 76 private:
76 MediaStreamTrack(ScriptExecutionContext*, MediaStreamComponent*); 77 MediaStreamTrack(ScriptExecutionContext*, MediaStreamComponent*, MediaStream *);
77 78
78 // EventTarget 79 // EventTarget
79 virtual EventTargetData* eventTargetData() OVERRIDE; 80 virtual EventTargetData* eventTargetData() OVERRIDE;
80 virtual EventTargetData* ensureEventTargetData() OVERRIDE; 81 virtual EventTargetData* ensureEventTargetData() OVERRIDE;
81 virtual void refEventTarget() OVERRIDE { ref(); } 82 virtual void refEventTarget() OVERRIDE { ref(); }
82 virtual void derefEventTarget() OVERRIDE { deref(); } 83 virtual void derefEventTarget() OVERRIDE { deref(); }
83 EventTargetData m_eventTargetData; 84 EventTargetData m_eventTargetData;
84 85
85 // MediaStreamSourceObserver 86 // MediaStreamSourceObserver
86 virtual void sourceChangedState() OVERRIDE; 87 virtual void sourceChangedState() OVERRIDE;
87 88
88 bool m_stopped; 89 bool m_stopped;
89 RefPtr<MediaStreamComponent> m_component; 90 RefPtr<MediaStreamComponent> m_component;
91 MediaStream* m_stream;
abarth-chromium 2013/04/08 06:24:21 What's the ownership relationship between MediaStr
90 }; 92 };
91 93
92 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector; 94 typedef Vector<RefPtr<MediaStreamTrack> > MediaStreamTrackVector;
93 95
94 } // namespace WebCore 96 } // namespace WebCore
95 97
96 #endif // ENABLE(MEDIA_STREAM) 98 #endif // ENABLE(MEDIA_STREAM)
97 99
98 #endif // MediaStreamTrack_h 100 #endif // MediaStreamTrack_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698