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

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

Issue 2347103003: Implement the MediaStreamTrackEvent constructor (Closed)
Patch Set: update webexposed Created 4 years, 3 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 case MediaStreamSource::TypeAudio: 333 case MediaStreamSource::TypeAudio:
334 m_audioTracks.append(track); 334 m_audioTracks.append(track);
335 break; 335 break;
336 case MediaStreamSource::TypeVideo: 336 case MediaStreamSource::TypeVideo:
337 m_videoTracks.append(track); 337 m_videoTracks.append(track);
338 break; 338 break;
339 } 339 }
340 track->registerMediaStream(this); 340 track->registerMediaStream(this);
341 m_descriptor->addComponent(component); 341 m_descriptor->addComponent(component);
342 342
343 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::addtrack , false, false, track)); 343 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::addtrack , track));
344 344
345 if (!active() && !track->ended()) { 345 if (!active() && !track->ended()) {
346 m_descriptor->setActive(true); 346 m_descriptor->setActive(true);
347 scheduleDispatchEvent(Event::create(EventTypeNames::active)); 347 scheduleDispatchEvent(Event::create(EventTypeNames::active));
348 } 348 }
349 } 349 }
350 350
351 void MediaStream::removeRemoteTrack(MediaStreamComponent* component) 351 void MediaStream::removeRemoteTrack(MediaStreamComponent* component)
352 { 352 {
353 DCHECK(component); 353 DCHECK(component);
(...skipping 18 matching lines...) Expand all
372 } 372 }
373 } 373 }
374 if (index == kNotFound) 374 if (index == kNotFound)
375 return; 375 return;
376 376
377 m_descriptor->removeComponent(component); 377 m_descriptor->removeComponent(component);
378 378
379 MediaStreamTrack* track = (*tracks)[index]; 379 MediaStreamTrack* track = (*tracks)[index];
380 track->unregisterMediaStream(this); 380 track->unregisterMediaStream(this);
381 tracks->remove(index); 381 tracks->remove(index);
382 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::removetr ack, false, false, track)); 382 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::removetr ack, track));
383 383
384 if (active() && emptyOrOnlyEndedTracks()) { 384 if (active() && emptyOrOnlyEndedTracks()) {
385 m_descriptor->setActive(false); 385 m_descriptor->setActive(false);
386 scheduleDispatchEvent(Event::create(EventTypeNames::inactive)); 386 scheduleDispatchEvent(Event::create(EventTypeNames::inactive));
387 } 387 }
388 } 388 }
389 389
390 void MediaStream::scheduleDispatchEvent(Event* event) 390 void MediaStream::scheduleDispatchEvent(Event* event)
391 { 391 {
392 m_scheduledEvents.append(event); 392 m_scheduledEvents.append(event);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 ContextLifecycleObserver::trace(visitor); 425 ContextLifecycleObserver::trace(visitor);
426 MediaStreamDescriptorClient::trace(visitor); 426 MediaStreamDescriptorClient::trace(visitor);
427 } 427 }
428 428
429 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) 429 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor)
430 { 430 {
431 return static_cast<MediaStream*>(descriptor->client()); 431 return static_cast<MediaStream*>(descriptor->client());
432 } 432 }
433 433
434 } // namespace blink 434 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698