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

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

Issue 2489823002: Revert "Remove MediaStreamTrack.getSources()." (Closed)
Patch Set: rebase 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"
36 #include "modules/mediastream/MediaTrackSettings.h" 38 #include "modules/mediastream/MediaTrackSettings.h"
37 #include "modules/mediastream/UserMediaController.h" 39 #include "modules/mediastream/UserMediaController.h"
38 #include "platform/mediastream/MediaStreamCenter.h" 40 #include "platform/mediastream/MediaStreamCenter.h"
39 #include "platform/mediastream/MediaStreamComponent.h" 41 #include "platform/mediastream/MediaStreamComponent.h"
40 #include "public/platform/WebMediaStreamTrack.h" 42 #include "public/platform/WebMediaStreamTrack.h"
43 #include "public/platform/WebSourceInfo.h"
41 #include "wtf/Assertions.h" 44 #include "wtf/Assertions.h"
42 #include <memory> 45 #include <memory>
43 46
44 namespace blink { 47 namespace blink {
45 48
46 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context, 49 MediaStreamTrack* MediaStreamTrack::create(ExecutionContext* context,
47 MediaStreamComponent* component) { 50 MediaStreamComponent* component) {
48 MediaStreamTrack* track = new MediaStreamTrack(context, component); 51 MediaStreamTrack* track = new MediaStreamTrack(context, component);
49 track->suspendIfNeeded(); 52 track->suspendIfNeeded();
50 return track; 53 return track;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 case MediaStreamSource::ReadyStateMuted: 124 case MediaStreamSource::ReadyStateMuted:
122 return "muted"; 125 return "muted";
123 case MediaStreamSource::ReadyStateEnded: 126 case MediaStreamSource::ReadyStateEnded:
124 return "ended"; 127 return "ended";
125 } 128 }
126 129
127 NOTREACHED(); 130 NOTREACHED();
128 return String(); 131 return String();
129 } 132 }
130 133
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
131 void MediaStreamTrack::stopTrack(ExceptionState& exceptionState) { 152 void MediaStreamTrack::stopTrack(ExceptionState& exceptionState) {
132 if (ended()) 153 if (ended())
133 return; 154 return;
134 155
135 m_readyState = MediaStreamSource::ReadyStateEnded; 156 m_readyState = MediaStreamSource::ReadyStateEnded;
136 MediaStreamCenter::instance().didStopMediaStreamTrack(component()); 157 MediaStreamCenter::instance().didStopMediaStreamTrack(component());
137 dispatchEvent(Event::create(EventTypeNames::ended)); 158 dispatchEvent(Event::create(EventTypeNames::ended));
138 propagateTrackEnded(); 159 propagateTrackEnded();
139 } 160 }
140 161
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 274 }
254 275
255 DEFINE_TRACE(MediaStreamTrack) { 276 DEFINE_TRACE(MediaStreamTrack) {
256 visitor->trace(m_registeredMediaStreams); 277 visitor->trace(m_registeredMediaStreams);
257 visitor->trace(m_component); 278 visitor->trace(m_component);
258 EventTargetWithInlineData::trace(visitor); 279 EventTargetWithInlineData::trace(visitor);
259 ActiveDOMObject::trace(visitor); 280 ActiveDOMObject::trace(visitor);
260 } 281 }
261 282
262 } // namespace blink 283 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698