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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaStream.h

Issue 2549353005: Remove ContextLifecycleObserver from MediaStream (Closed)
Patch Set: temp Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/MediaStream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef MediaStream_h 26 #ifndef MediaStream_h
27 #define MediaStream_h 27 #define MediaStream_h
28 28
29 #include "core/dom/ContextLifecycleObserver.h" 29 #include "core/dom/ExecutionContext.h"
30 #include "core/html/URLRegistry.h" 30 #include "core/html/URLRegistry.h"
31 #include "modules/EventTargetModules.h" 31 #include "modules/EventTargetModules.h"
32 #include "modules/ModulesExport.h" 32 #include "modules/ModulesExport.h"
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 36
37 namespace blink { 37 namespace blink {
38 38
39 class ExceptionState; 39 class ExceptionState;
40 40
41 class MODULES_EXPORT MediaStream final : public EventTargetWithInlineData, 41 class MODULES_EXPORT MediaStream final : public EventTargetWithInlineData,
42 public URLRegistrable, 42 public URLRegistrable,
43 public MediaStreamDescriptorClient, 43 public MediaStreamDescriptorClient {
44 public ContextLifecycleObserver {
45 USING_GARBAGE_COLLECTED_MIXIN(MediaStream); 44 USING_GARBAGE_COLLECTED_MIXIN(MediaStream);
46 DEFINE_WRAPPERTYPEINFO(); 45 DEFINE_WRAPPERTYPEINFO();
47 46
48 public: 47 public:
49 static MediaStream* create(ExecutionContext*); 48 static MediaStream* create(ExecutionContext*);
50 static MediaStream* create(ExecutionContext*, MediaStream*); 49 static MediaStream* create(ExecutionContext*, MediaStream*);
51 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&); 50 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&);
52 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*); 51 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*);
53 ~MediaStream() override; 52 ~MediaStream() override;
54 53
(...skipping 17 matching lines...) Expand all
72 71
73 void trackEnded(); 72 void trackEnded();
74 73
75 // MediaStreamDescriptorClient 74 // MediaStreamDescriptorClient
76 void streamEnded() override; 75 void streamEnded() override;
77 76
78 MediaStreamDescriptor* descriptor() const { return m_descriptor; } 77 MediaStreamDescriptor* descriptor() const { return m_descriptor; }
79 78
80 // EventTarget 79 // EventTarget
81 const AtomicString& interfaceName() const override; 80 const AtomicString& interfaceName() const override;
82 ExecutionContext* getExecutionContext() const override; 81 ExecutionContext* getExecutionContext() const override {
82 return m_executionContext;
83 }
83 84
84 // URLRegistrable 85 // URLRegistrable
85 URLRegistry& registry() const override; 86 URLRegistry& registry() const override;
86 87
87 DECLARE_VIRTUAL_TRACE(); 88 DECLARE_VIRTUAL_TRACE();
88 89
89 protected: 90 protected:
90 bool addEventListenerInternal( 91 bool addEventListenerInternal(
91 const AtomicString& eventType, 92 const AtomicString& eventType,
92 EventListener*, 93 EventListener*,
93 const AddEventListenerOptionsResolved&) override; 94 const AddEventListenerOptionsResolved&) override;
94 95
95 private: 96 private:
96 MediaStream(ExecutionContext*, MediaStreamDescriptor*); 97 MediaStream(ExecutionContext*, MediaStreamDescriptor*);
97 MediaStream(ExecutionContext*, 98 MediaStream(ExecutionContext*,
98 const MediaStreamTrackVector& audioTracks, 99 const MediaStreamTrackVector& audioTracks,
99 const MediaStreamTrackVector& videoTracks); 100 const MediaStreamTrackVector& videoTracks);
100 101
101 // ContextLifecycleObserver
102 void contextDestroyed() override;
103
104 // MediaStreamDescriptorClient 102 // MediaStreamDescriptorClient
105 void addRemoteTrack(MediaStreamComponent*) override; 103 void addRemoteTrack(MediaStreamComponent*) override;
106 void removeRemoteTrack(MediaStreamComponent*) override; 104 void removeRemoteTrack(MediaStreamComponent*) override;
107 105
108 bool emptyOrOnlyEndedTracks(); 106 bool emptyOrOnlyEndedTracks();
109 107
110 void scheduleDispatchEvent(Event*); 108 void scheduleDispatchEvent(Event*);
111 void scheduledEventTimerFired(TimerBase*); 109 void scheduledEventTimerFired(TimerBase*);
112 110
113 bool m_stopped;
114
115 MediaStreamTrackVector m_audioTracks; 111 MediaStreamTrackVector m_audioTracks;
116 MediaStreamTrackVector m_videoTracks; 112 MediaStreamTrackVector m_videoTracks;
117 Member<MediaStreamDescriptor> m_descriptor; 113 Member<MediaStreamDescriptor> m_descriptor;
118 114
119 Timer<MediaStream> m_scheduledEventTimer; 115 Timer<MediaStream> m_scheduledEventTimer;
120 HeapVector<Member<Event>> m_scheduledEvents; 116 HeapVector<Member<Event>> m_scheduledEvents;
117 Member<ExecutionContext> m_executionContext;
haraken 2016/12/07 06:35:01 Before this CL, this was a weak member. However, I
sof 2016/12/07 07:34:16 the worry/difference would be that downstream user
haraken 2016/12/07 08:05:52 Yeah, good point. Currently EventTarget::getExecu
121 }; 118 };
122 119
123 typedef HeapVector<Member<MediaStream>> MediaStreamVector; 120 typedef HeapVector<Member<MediaStream>> MediaStreamVector;
124 121
125 MediaStream* toMediaStream(MediaStreamDescriptor*); 122 MediaStream* toMediaStream(MediaStreamDescriptor*);
126 123
127 } // namespace blink 124 } // namespace blink
128 125
129 #endif // MediaStream_h 126 #endif // MediaStream_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/mediastream/MediaStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698