Index: third_party/libjingle/overrides/init_webrtc.cc |
diff --git a/third_party/libjingle/overrides/init_webrtc.cc b/third_party/libjingle/overrides/init_webrtc.cc |
index ab89d5884adf1ffca2d5b5fe929eb344a212165a..041fb20b05c1caa00fbf41aff20fc6dbeb96e51c 100644 |
--- a/third_party/libjingle/overrides/init_webrtc.cc |
+++ b/third_party/libjingle/overrides/init_webrtc.cc |
@@ -9,6 +9,7 @@ |
#include "base/files/file_path.h" |
#include "base/files/file_util.h" |
#include "base/metrics/field_trial.h" |
+#include "base/metrics/histogram.h" |
#include "base/native_library.h" |
#include "base/path_service.h" |
#include "webrtc/base/basictypes.h" |
@@ -32,14 +33,40 @@ void AddTraceEvent(char phase, |
NULL, flags); |
} |
-// Define webrtc:field_trial::FindFullName to provide webrtc with a field trial |
-// implementation. |
namespace webrtc { |
+// Define webrtc::field_trial::FindFullName to provide webrtc with a field trial |
+// implementation. |
namespace field_trial { |
std::string FindFullName(const std::string& trial_name) { |
return base::FieldTrialList::FindFullName(trial_name); |
} |
} // namespace field_trial |
+ |
+// Define webrtc::metrics functions to provide webrtc with implementations. |
+namespace metrics { |
+Histogram* HistogramFactoryGetCounts( |
+ const std::string& name, int min, int max, int bucket_count) { |
+ return reinterpret_cast<Histogram*>( |
+ base::Histogram::FactoryGet(name, min, max, bucket_count, |
+ base::HistogramBase::kUmaTargetedHistogramFlag)); |
+} |
+ |
+Histogram* HistogramFactoryGetEnumeration( |
+ const std::string& name, int boundary) { |
+ return reinterpret_cast<Histogram*>( |
+ base::LinearHistogram::FactoryGet(name, 1, boundary, boundary + 1, |
+ base::HistogramBase::kUmaTargetedHistogramFlag)); |
+} |
+ |
+void HistogramAdd( |
+ Histogram* histogram_pointer, const std::string& name, int sample) { |
+ base::HistogramBase* ptr = |
+ reinterpret_cast<base::HistogramBase*>(histogram_pointer); |
+ // The name should not vary. |
+ DCHECK(ptr->histogram_name() == name); |
+ ptr->Add(sample); |
+} |
+} // namespace metrics |
} // namespace webrtc |
#if defined(LIBPEERCONNECTION_LIB) |
@@ -126,16 +153,19 @@ bool InitializeWebRtcModule() { |
InitDiagnosticLoggingDelegateFunctionFunction init_diagnostic_logging = NULL; |
bool init_ok = initialize_module(*CommandLine::ForCurrentProcess(), |
#if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
- &Allocate, |
- &Dellocate, |
+ &Allocate, |
+ &Dellocate, |
#endif |
- &webrtc::field_trial::FindFullName, |
- logging::GetLogMessageHandler(), |
- &GetCategoryGroupEnabled, |
- &AddTraceEvent, |
- &g_create_webrtc_media_engine, |
- &g_destroy_webrtc_media_engine, |
- &init_diagnostic_logging); |
+ &webrtc::field_trial::FindFullName, |
+ &webrtc::metrics::HistogramFactoryGetCounts, |
+ &webrtc::metrics::HistogramFactoryGetEnumeration, |
+ &webrtc::metrics::HistogramAdd, |
+ logging::GetLogMessageHandler(), |
+ &GetCategoryGroupEnabled, |
+ &AddTraceEvent, |
+ &g_create_webrtc_media_engine, |
+ &g_destroy_webrtc_media_engine, |
+ &init_diagnostic_logging); |
if (init_ok) |
rtc::SetExtraLoggingInit(init_diagnostic_logging); |