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

Side by Side Diff: third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp

Issue 2471803002: Remove MediaStreamTrack.getSources(). (Closed)
Patch Set: Fix platform-specific expectations file Created 4 years, 1 month 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 15 matching lines...) Expand all
26 #include "modules/mediastream/MediaStreamTrack.h" 26 #include "modules/mediastream/MediaStreamTrack.h"
27 27
28 #include "bindings/core/v8/ExceptionMessages.h" 28 #include "bindings/core/v8/ExceptionMessages.h"
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/dom/ExceptionCode.h" 30 #include "core/dom/ExceptionCode.h"
31 #include "core/dom/ExecutionContext.h" 31 #include "core/dom/ExecutionContext.h"
32 #include "core/events/Event.h" 32 #include "core/events/Event.h"
33 #include "core/frame/Deprecation.h" 33 #include "core/frame/Deprecation.h"
34 #include "modules/mediastream/MediaConstraintsImpl.h" 34 #include "modules/mediastream/MediaConstraintsImpl.h"
35 #include "modules/mediastream/MediaStream.h" 35 #include "modules/mediastream/MediaStream.h"
36 #include "modules/mediastream/MediaStreamTrackSourcesCallback.h"
37 #include "modules/mediastream/MediaStreamTrackSourcesRequestImpl.h"
38 #include "modules/mediastream/MediaTrackSettings.h" 36 #include "modules/mediastream/MediaTrackSettings.h"
39 #include "modules/mediastream/UserMediaController.h" 37 #include "modules/mediastream/UserMediaController.h"
40 #include "platform/mediastream/MediaStreamCenter.h" 38 #include "platform/mediastream/MediaStreamCenter.h"
41 #include "platform/mediastream/MediaStreamComponent.h" 39 #include "platform/mediastream/MediaStreamComponent.h"
42 #include "public/platform/WebMediaStreamTrack.h" 40 #include "public/platform/WebMediaStreamTrack.h"
43 #include "public/platform/WebSourceInfo.h"
44 #include "wtf/Assertions.h" 41 #include "wtf/Assertions.h"
45 #include <memory> 42 #include <memory>
46 43
47 namespace blink { 44 namespace blink {
48 45
49 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context, 46 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context,
50 MediaStreamComponent* component) { 47 MediaStreamComponent* component) {
51 MediaStreamTrack* track = new MediaStreamTrack(context, component); 48 MediaStreamTrack* track = new MediaStreamTrack(context, component);
52 track->suspendIfNeeded(); 49 track->suspendIfNeeded();
53 return track; 50 return track;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 case MediaStreamSource::ReadyStateMuted: 121 case MediaStreamSource::ReadyStateMuted:
125 return "muted"; 122 return "muted";
126 case MediaStreamSource::ReadyStateEnded: 123 case MediaStreamSource::ReadyStateEnded:
127 return "ended"; 124 return "ended";
128 } 125 }
129 126
130 NOTREACHED(); 127 NOTREACHED();
131 return String(); 128 return String();
132 } 129 }
133 130
134 void MediaStreamTrack::getSources(ExecutionContext* context,
135 MediaStreamTrackSourcesCallback* callback,
136 ExceptionState& exceptionState) {
137 LocalFrame* frame = toDocument(context)->frame();
138 UserMediaController* userMedia = UserMediaController::from(frame);
139 if (!userMedia) {
140 exceptionState.throwDOMException(
141 NotSupportedError,
142 "No sources controller available; is this a detached window?");
143 return;
144 }
145 Deprecation::countDeprecation(context,
146 UseCounter::MediaStreamTrackGetSources);
147 MediaStreamTrackSourcesRequest* request =
148 MediaStreamTrackSourcesRequestImpl::create(*context, callback);
149 userMedia->requestSources(request);
150 }
151
152 void MediaStreamTrack::stopTrack(ExceptionState& exceptionState) { 131 void MediaStreamTrack::stopTrack(ExceptionState& exceptionState) {
153 if (ended()) 132 if (ended())
154 return; 133 return;
155 134
156 m_readyState = MediaStreamSource::ReadyStateEnded; 135 m_readyState = MediaStreamSource::ReadyStateEnded;
157 MediaStreamCenter::instance().didStopMediaStreamTrack(component()); 136 MediaStreamCenter::instance().didStopMediaStreamTrack(component());
158 dispatchEvent(Event::create(EventTypeNames::ended)); 137 dispatchEvent(Event::create(EventTypeNames::ended));
159 propagateTrackEnded(); 138 propagateTrackEnded();
160 } 139 }
161 140
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 253 }
275 254
276 DEFINE_TRACE(MediaStreamTrack) { 255 DEFINE_TRACE(MediaStreamTrack) {
277 visitor->trace(m_registeredMediaStreams); 256 visitor->trace(m_registeredMediaStreams);
278 visitor->trace(m_component); 257 visitor->trace(m_component);
279 EventTargetWithInlineData::trace(visitor); 258 EventTargetWithInlineData::trace(visitor);
280 ActiveDOMObject::trace(visitor); 259 ActiveDOMObject::trace(visitor);
281 } 260 }
282 261
283 } // namespace blink 262 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698