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

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

Issue 2140133005: Remove MediaStream ended event from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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, 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2011, 2012 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) { 280 for (MediaStreamTrackVector::iterator iter = m_videoTracks.begin(); iter != m_videoTracks.end(); ++iter) {
281 if (!(*iter)->ended()) 281 if (!(*iter)->ended())
282 return; 282 return;
283 } 283 }
284 284
285 streamEnded(); 285 streamEnded();
286 } 286 }
287 287
288 void MediaStream::streamEnded() 288 void MediaStream::streamEnded()
289 { 289 {
290 if (m_stopped || m_descriptor->ended()) 290 if (m_stopped)
291 return; 291 return;
292 292
293 if (active()) { 293 if (active()) {
294 m_descriptor->setActive(false); 294 m_descriptor->setActive(false);
295 scheduleDispatchEvent(Event::create(EventTypeNames::inactive)); 295 scheduleDispatchEvent(Event::create(EventTypeNames::inactive));
296 } 296 }
297
298 // TODO(guidou): remove firing of this event. See crbug.com/586924
299 if (!m_descriptor->ended()) {
300 m_descriptor->setEnded();
301 scheduleDispatchEvent(Event::create(EventTypeNames::ended));
302 }
303 } 297 }
304 298
305 bool MediaStream::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const AddEventListenerOptions& options) 299 bool MediaStream::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const AddEventListenerOptions& options)
306 { 300 {
307 if (eventType == EventTypeNames::ended) 301 if (eventType == EventTypeNames::active)
308 Deprecation::countDeprecation(getExecutionContext(), UseCounter::MediaSt reamOnEnded);
309 else if (eventType == EventTypeNames::active)
310 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnActive ); 302 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnActive );
311 else if (eventType == EventTypeNames::inactive) 303 else if (eventType == EventTypeNames::inactive)
312 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnInacti ve); 304 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnInacti ve);
313 305
314 return EventTargetWithInlineData::addEventListenerInternal(eventType, listen er, options); 306 return EventTargetWithInlineData::addEventListenerInternal(eventType, listen er, options);
315 } 307 }
316 308
317 void MediaStream::contextDestroyed() 309 void MediaStream::contextDestroyed()
318 { 310 {
319 ContextLifecycleObserver::contextDestroyed(); 311 ContextLifecycleObserver::contextDestroyed();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 ContextLifecycleObserver::trace(visitor); 425 ContextLifecycleObserver::trace(visitor);
434 MediaStreamDescriptorClient::trace(visitor); 426 MediaStreamDescriptorClient::trace(visitor);
435 } 427 }
436 428
437 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) 429 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor)
438 { 430 {
439 return static_cast<MediaStream*>(descriptor->client()); 431 return static_cast<MediaStream*>(descriptor->client());
440 } 432 }
441 433
442 } // namespace blink 434 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698