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

Side by Side Diff: webrtc/pc/statscollector.cc

Issue 2945723002: Fixing incorrect use of erase/remove idiom. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 StatsReport* report = reports_.Find(id); 428 StatsReport* report = reports_.Find(id);
429 if (!report) { 429 if (!report) {
430 report = reports_.InsertNew(id); 430 report = reports_.InsertNew(id);
431 report->AddString(StatsReport::kStatsValueNameTrackId, audio_track->id()); 431 report->AddString(StatsReport::kStatsValueNameTrackId, audio_track->id());
432 } 432 }
433 } 433 }
434 434
435 void StatsCollector::RemoveLocalAudioTrack(AudioTrackInterface* audio_track, 435 void StatsCollector::RemoveLocalAudioTrack(AudioTrackInterface* audio_track,
436 uint32_t ssrc) { 436 uint32_t ssrc) {
437 RTC_DCHECK(audio_track != NULL); 437 RTC_DCHECK(audio_track != NULL);
438 local_audio_tracks_.erase(std::remove_if(local_audio_tracks_.begin(), 438 local_audio_tracks_.erase(
439 local_audio_tracks_.end(), 439 std::remove_if(
440 [audio_track, ssrc](const LocalAudioTrackVector::value_type& track) { 440 local_audio_tracks_.begin(), local_audio_tracks_.end(),
441 return track.first == audio_track && track.second == ssrc; 441 [audio_track, ssrc](const LocalAudioTrackVector::value_type& track) {
442 })); 442 return track.first == audio_track && track.second == ssrc;
443 }),
444 local_audio_tracks_.end());
443 } 445 }
444 446
445 void StatsCollector::GetStats(MediaStreamTrackInterface* track, 447 void StatsCollector::GetStats(MediaStreamTrackInterface* track,
446 StatsReports* reports) { 448 StatsReports* reports) {
447 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); 449 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
448 RTC_DCHECK(reports != NULL); 450 RTC_DCHECK(reports != NULL);
449 RTC_DCHECK(reports->empty()); 451 RTC_DCHECK(reports->empty());
450 452
451 rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls; 453 rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
452 454
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 StatsReport* report = entry.second; 1004 StatsReport* report = entry.second;
1003 report->set_timestamp(stats_gathering_started_); 1005 report->set_timestamp(stats_gathering_started_);
1004 } 1006 }
1005 } 1007 }
1006 1008
1007 void StatsCollector::ClearUpdateStatsCacheForTest() { 1009 void StatsCollector::ClearUpdateStatsCacheForTest() {
1008 stats_gathering_started_ = 0; 1010 stats_gathering_started_ = 0;
1009 } 1011 }
1010 1012
1011 } // namespace webrtc 1013 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698