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

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

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest Created 3 years, 8 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 exceptionState.throwDOMException( 230 exceptionState.throwDOMException(
231 TypeMismatchError, "The MediaStreamTrack provided is invalid."); 231 TypeMismatchError, "The MediaStreamTrack provided is invalid.");
232 return; 232 return;
233 } 233 }
234 234
235 size_t pos = kNotFound; 235 size_t pos = kNotFound;
236 switch (track->component()->source()->type()) { 236 switch (track->component()->source()->type()) {
237 case MediaStreamSource::TypeAudio: 237 case MediaStreamSource::TypeAudio:
238 pos = m_audioTracks.find(track); 238 pos = m_audioTracks.find(track);
239 if (pos != kNotFound) 239 if (pos != kNotFound)
240 m_audioTracks.remove(pos); 240 m_audioTracks.erase(pos);
241 break; 241 break;
242 case MediaStreamSource::TypeVideo: 242 case MediaStreamSource::TypeVideo:
243 pos = m_videoTracks.find(track); 243 pos = m_videoTracks.find(track);
244 if (pos != kNotFound) 244 if (pos != kNotFound)
245 m_videoTracks.remove(pos); 245 m_videoTracks.erase(pos);
246 break; 246 break;
247 } 247 }
248 248
249 if (pos == kNotFound) 249 if (pos == kNotFound)
250 return; 250 return;
251 track->unregisterMediaStream(this); 251 track->unregisterMediaStream(this);
252 m_descriptor->removeComponent(track->component()); 252 m_descriptor->removeComponent(track->component());
253 253
254 if (active() && emptyOrOnlyEndedTracks()) { 254 if (active() && emptyOrOnlyEndedTracks()) {
255 m_descriptor->setActive(false); 255 m_descriptor->setActive(false);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 break; 380 break;
381 } 381 }
382 } 382 }
383 if (index == kNotFound) 383 if (index == kNotFound)
384 return; 384 return;
385 385
386 m_descriptor->removeComponent(component); 386 m_descriptor->removeComponent(component);
387 387
388 MediaStreamTrack* track = (*tracks)[index]; 388 MediaStreamTrack* track = (*tracks)[index];
389 track->unregisterMediaStream(this); 389 track->unregisterMediaStream(this);
390 tracks->remove(index); 390 tracks->erase(index);
391 scheduleDispatchEvent( 391 scheduleDispatchEvent(
392 MediaStreamTrackEvent::create(EventTypeNames::removetrack, track)); 392 MediaStreamTrackEvent::create(EventTypeNames::removetrack, track));
393 393
394 if (active() && emptyOrOnlyEndedTracks()) { 394 if (active() && emptyOrOnlyEndedTracks()) {
395 m_descriptor->setActive(false); 395 m_descriptor->setActive(false);
396 scheduleDispatchEvent(Event::create(EventTypeNames::inactive)); 396 scheduleDispatchEvent(Event::create(EventTypeNames::inactive));
397 } 397 }
398 } 398 }
399 399
400 void MediaStream::scheduleDispatchEvent(Event* event) { 400 void MediaStream::scheduleDispatchEvent(Event* event) {
(...skipping 29 matching lines...) Expand all
430 EventTargetWithInlineData::trace(visitor); 430 EventTargetWithInlineData::trace(visitor);
431 ContextClient::trace(visitor); 431 ContextClient::trace(visitor);
432 MediaStreamDescriptorClient::trace(visitor); 432 MediaStreamDescriptorClient::trace(visitor);
433 } 433 }
434 434
435 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) { 435 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) {
436 return static_cast<MediaStream*>(descriptor->client()); 436 return static_cast<MediaStream*>(descriptor->client());
437 } 437 }
438 438
439 } // namespace blink 439 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698