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

Unified Diff: talk/app/webrtc/fakemetricsobserver.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/fakemetricsobserver.h ('k') | talk/app/webrtc/peerconnection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/fakemetricsobserver.cc
diff --git a/talk/app/webrtc/fakemetricsobserver.cc b/talk/app/webrtc/fakemetricsobserver.cc
index 9c300ccd60e2ed0913286c9257a260d2630eaafa..4a100a079e58f163466b5eed97c1c91209f10adc 100644
--- a/talk/app/webrtc/fakemetricsobserver.cc
+++ b/talk/app/webrtc/fakemetricsobserver.cc
@@ -37,10 +37,7 @@ FakeMetricsObserver::FakeMetricsObserver() {
void FakeMetricsObserver::Reset() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
counters_.clear();
- memset(int_histogram_samples_, 0, sizeof(int_histogram_samples_));
- for (std::string& type : string_histogram_samples_) {
- type.clear();
- }
+ memset(histogram_samples_, 0, sizeof(histogram_samples_));
}
void FakeMetricsObserver::IncrementEnumCounter(
@@ -52,43 +49,31 @@ void FakeMetricsObserver::IncrementEnumCounter(
counters_.resize(type + 1);
}
auto& counters = counters_[type];
- if (counters.size() < static_cast<size_t>(counter_max)) {
- counters.resize(counter_max);
- }
++counters[counter];
}
void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type,
int value) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- RTC_DCHECK_EQ(int_histogram_samples_[type], 0);
- int_histogram_samples_[type] = value;
-}
-
-void FakeMetricsObserver::AddHistogramSample(PeerConnectionMetricsName type,
- const std::string& value) {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- string_histogram_samples_[type].assign(value);
+ RTC_DCHECK_EQ(histogram_samples_[type], 0);
+ histogram_samples_[type] = value;
}
int FakeMetricsObserver::GetEnumCounter(PeerConnectionEnumCounterType type,
int counter) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- RTC_CHECK(counters_.size() > static_cast<size_t>(type) &&
- counters_[type].size() > static_cast<size_t>(counter));
- return counters_[type][counter];
-}
-
-int FakeMetricsObserver::GetIntHistogramSample(
- PeerConnectionMetricsName type) const {
- RTC_DCHECK(thread_checker_.CalledOnValidThread());
- return int_histogram_samples_[type];
+ RTC_CHECK(counters_.size() > static_cast<size_t>(type));
+ const auto& it = counters_[type].find(counter);
+ if (it == counters_[type].end()) {
+ return 0;
+ }
+ return it->second;
}
-const std::string& FakeMetricsObserver::GetStringHistogramSample(
+int FakeMetricsObserver::GetHistogramSample(
PeerConnectionMetricsName type) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
- return string_histogram_samples_[type];
+ return histogram_samples_[type];
}
} // namespace webrtc
« no previous file with comments | « talk/app/webrtc/fakemetricsobserver.h ('k') | talk/app/webrtc/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698