| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 27 matching lines...) Expand all Loading... |
| 38 void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type, | 38 void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type, |
| 39 int value) { | 39 int value) { |
| 40 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 40 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 41 RTC_DCHECK_EQ(histogram_samples_[type], 0); | 41 RTC_DCHECK_EQ(histogram_samples_[type], 0); |
| 42 histogram_samples_[type] = value; | 42 histogram_samples_[type] = value; |
| 43 } | 43 } |
| 44 | 44 |
| 45 int FakeMetricsObserver::GetEnumCounter(PeerConnectionEnumCounterType type, | 45 int FakeMetricsObserver::GetEnumCounter(PeerConnectionEnumCounterType type, |
| 46 int counter) const { | 46 int counter) const { |
| 47 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 47 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 48 RTC_CHECK(counters_.size() > static_cast<size_t>(type)); | 48 if (counters_.size() <= static_cast<size_t>(type)) { |
| 49 return 0; |
| 50 } |
| 49 const auto& it = counters_[type].find(counter); | 51 const auto& it = counters_[type].find(counter); |
| 50 if (it == counters_[type].end()) { | 52 if (it == counters_[type].end()) { |
| 51 return 0; | 53 return 0; |
| 52 } | 54 } |
| 53 return it->second; | 55 return it->second; |
| 54 } | 56 } |
| 55 | 57 |
| 56 int FakeMetricsObserver::GetHistogramSample( | 58 int FakeMetricsObserver::GetHistogramSample( |
| 57 PeerConnectionMetricsName type) const { | 59 PeerConnectionMetricsName type) const { |
| 58 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 60 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 59 return histogram_samples_[type]; | 61 return histogram_samples_[type]; |
| 60 } | 62 } |
| 61 | 63 |
| 62 } // namespace webrtc | 64 } // namespace webrtc |
| OLD | NEW |