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

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

Issue 2622533002: Prefer ContextClient mixin over manual ExecutionContext handling. (Closed)
Patch Set: Created 3 years, 11 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 "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 ContextClient,
42 public URLRegistrable, 43 public URLRegistrable,
43 public MediaStreamDescriptorClient { 44 public MediaStreamDescriptorClient {
44 USING_GARBAGE_COLLECTED_MIXIN(MediaStream); 45 USING_GARBAGE_COLLECTED_MIXIN(MediaStream);
45 DEFINE_WRAPPERTYPEINFO(); 46 DEFINE_WRAPPERTYPEINFO();
46 47
47 public: 48 public:
48 static MediaStream* create(ExecutionContext*); 49 static MediaStream* create(ExecutionContext*);
49 static MediaStream* create(ExecutionContext*, MediaStream*); 50 static MediaStream* create(ExecutionContext*, MediaStream*);
50 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&); 51 static MediaStream* create(ExecutionContext*, const MediaStreamTrackVector&);
51 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*); 52 static MediaStream* create(ExecutionContext*, MediaStreamDescriptor*);
(...skipping 20 matching lines...) Expand all
72 void trackEnded(); 73 void trackEnded();
73 74
74 // MediaStreamDescriptorClient 75 // MediaStreamDescriptorClient
75 void streamEnded() override; 76 void streamEnded() override;
76 77
77 MediaStreamDescriptor* descriptor() const { return m_descriptor; } 78 MediaStreamDescriptor* descriptor() const { return m_descriptor; }
78 79
79 // EventTarget 80 // EventTarget
80 const AtomicString& interfaceName() const override; 81 const AtomicString& interfaceName() const override;
81 ExecutionContext* getExecutionContext() const override { 82 ExecutionContext* getExecutionContext() const override {
82 return m_executionContext; 83 return ContextClient::getExecutionContext();
83 } 84 }
84 85
85 // URLRegistrable 86 // URLRegistrable
86 URLRegistry& registry() const override; 87 URLRegistry& registry() const override;
87 88
88 DECLARE_VIRTUAL_TRACE(); 89 DECLARE_VIRTUAL_TRACE();
89 90
90 protected: 91 protected:
91 bool addEventListenerInternal( 92 bool addEventListenerInternal(
92 const AtomicString& eventType, 93 const AtomicString& eventType,
(...skipping 14 matching lines...) Expand all
107 108
108 void scheduleDispatchEvent(Event*); 109 void scheduleDispatchEvent(Event*);
109 void scheduledEventTimerFired(TimerBase*); 110 void scheduledEventTimerFired(TimerBase*);
110 111
111 MediaStreamTrackVector m_audioTracks; 112 MediaStreamTrackVector m_audioTracks;
112 MediaStreamTrackVector m_videoTracks; 113 MediaStreamTrackVector m_videoTracks;
113 Member<MediaStreamDescriptor> m_descriptor; 114 Member<MediaStreamDescriptor> m_descriptor;
114 115
115 Timer<MediaStream> m_scheduledEventTimer; 116 Timer<MediaStream> m_scheduledEventTimer;
116 HeapVector<Member<Event>> m_scheduledEvents; 117 HeapVector<Member<Event>> m_scheduledEvents;
117 Member<ExecutionContext> m_executionContext;
118 }; 118 };
119 119
120 typedef HeapVector<Member<MediaStream>> MediaStreamVector; 120 using MediaStreamVector = HeapVector<Member<MediaStream>>;
121 121
122 MediaStream* toMediaStream(MediaStreamDescriptor*); 122 MediaStream* toMediaStream(MediaStreamDescriptor*);
123 123
124 } // namespace blink 124 } // namespace blink
125 125
126 #endif // MediaStream_h 126 #endif // MediaStream_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698