OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); }); | 772 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); }); |
773 if (it != end()) { | 773 if (it != end()) { |
774 StatsReport* report = new StatsReport((*it)->id()); | 774 StatsReport* report = new StatsReport((*it)->id()); |
775 delete *it; | 775 delete *it; |
776 *it = report; | 776 *it = report; |
777 return report; | 777 return report; |
778 } | 778 } |
779 return InsertNew(id); | 779 return InsertNew(id); |
780 } | 780 } |
781 | 781 |
782 // Looks for a report with the given |id|. If one is not found, NULL | 782 // Looks for a report with the given |id|. If one is not found, null |
783 // will be returned. | 783 // will be returned. |
784 StatsReport* StatsCollection::Find(const StatsReport::Id& id) { | 784 StatsReport* StatsCollection::Find(const StatsReport::Id& id) { |
785 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 785 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
786 Container::iterator it = std::find_if(list_.begin(), list_.end(), | 786 Container::iterator it = std::find_if(list_.begin(), list_.end(), |
787 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); }); | 787 [&id](const StatsReport* r)->bool { return r->id()->Equals(id); }); |
788 return it == list_.end() ? nullptr : *it; | 788 return it == list_.end() ? nullptr : *it; |
789 } | 789 } |
790 | 790 |
791 } // namespace webrtc | 791 } // namespace webrtc |
OLD | NEW |