summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandresp@chromium.org <andresp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 11:49:08 +0000
committerandresp@chromium.org <andresp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-16 11:49:08 +0000
commite9d5204914e7748edcae607676123b8487747c9a (patch)
treee21e4e84a16ddcff4a97fe737078638ac7e26f02
parent1b99b4ab5e12bd9e1e420aeb03da9b8c3d1b5310 (diff)
downloadchromium_src-e9d5204914e7748edcae607676123b8487747c9a.zip
chromium_src-e9d5204914e7748edcae607676123b8487747c9a.tar.gz
chromium_src-e9d5204914e7748edcae607676123b8487747c9a.tar.bz2
Wire up chrome field trials with webrtc.
BUG=367114 Review URL: https://codereview.chromium.org/272503004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270994 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/libjingle/overrides/init_webrtc.cc13
-rw-r--r--third_party/libjingle/overrides/init_webrtc.h3
-rw-r--r--third_party/libjingle/overrides/initialize_module.cc18
3 files changed, 34 insertions, 0 deletions
diff --git a/third_party/libjingle/overrides/init_webrtc.cc b/third_party/libjingle/overrides/init_webrtc.cc
index eda9858..5c356ab 100644
--- a/third_party/libjingle/overrides/init_webrtc.cc
+++ b/third_party/libjingle/overrides/init_webrtc.cc
@@ -8,6 +8,7 @@
#include "base/debug/trace_event.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
+#include "base/metrics/field_trial.h"
#include "base/native_library.h"
#include "base/path_service.h"
#include "talk/base/basictypes.h"
@@ -42,6 +43,17 @@ bool InitializeWebRtcModule() {
return true;
}
+// Define webrtc:field_trial::FindFullName to provide webrtc with a field trial
+// implementation. When compiled as a static library this can be done directly
+// and without pointers to functions.
+namespace webrtc {
+namespace field_trial {
+std::string FindFullName(const std::string& trial_name) {
+ return base::FieldTrialList::FindFullName(trial_name);
+}
+} // namespace field_trial
+} // namespace webrtc
+
#else // !LIBPEERCONNECTION_LIB
// When being compiled as a shared library, we need to bridge the gap between
@@ -117,6 +129,7 @@ bool InitializeWebRtcModule() {
#if !defined(OS_MACOSX) && !defined(OS_ANDROID)
&Allocate, &Dellocate,
#endif
+ &base::FieldTrialList::FindFullName,
logging::GetLogMessageHandler(),
&GetCategoryGroupEnabled, &AddTraceEvent,
&g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine,
diff --git a/third_party/libjingle/overrides/init_webrtc.h b/third_party/libjingle/overrides/init_webrtc.h
index fd78e76..175c067 100644
--- a/third_party/libjingle/overrides/init_webrtc.h
+++ b/third_party/libjingle/overrides/init_webrtc.h
@@ -23,6 +23,8 @@ namespace webrtc {
class AudioDeviceModule;
} // namespace webrtc
+typedef std::string (*FieldTrialFindFullName)(const std::string& trial_name);
+
typedef cricket::MediaEngineInterface* (*CreateWebRtcMediaEngineFunction)(
webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc,
@@ -46,6 +48,7 @@ typedef bool (*InitializeModuleFunction)(
AllocateFunction alloc,
DellocateFunction dealloc,
#endif
+ FieldTrialFindFullName field_trial_find,
logging::LogMessageHandlerFunction log_handler,
webrtc::GetCategoryEnabledPtr trace_get_category_enabled,
webrtc::AddTraceEventPtr trace_add_trace_event,
diff --git a/third_party/libjingle/overrides/initialize_module.cc b/third_party/libjingle/overrides/initialize_module.cc
index fd1af11..c7ef382 100644
--- a/third_party/libjingle/overrides/initialize_module.cc
+++ b/third_party/libjingle/overrides/initialize_module.cc
@@ -38,6 +38,21 @@ cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine);
+// Define webrtc:field_trial::FindFullName to provide webrtc with a field trial
+// implementation. The implementation is provided by the loader via the
+// InitializeModule.
+namespace {
+FieldTrialFindFullName g_field_trial_find_ = NULL;
+}
+
+namespace webrtc {
+namespace field_trial {
+std::string FindFullName(const std::string& trial_name) {
+ return g_field_trial_find_(trial_name);
+}
+} // namespace field_trial
+} // namespace webrtc
+
extern "C" {
// Initialize logging, set the forward allocator functions (not on mac), and
@@ -49,6 +64,7 @@ bool InitializeModule(const CommandLine& command_line,
AllocateFunction alloc,
DellocateFunction dealloc,
#endif
+ FieldTrialFindFullName field_trial_find,
logging::LogMessageHandlerFunction log_handler,
webrtc::GetCategoryEnabledPtr trace_get_category_enabled,
webrtc::AddTraceEventPtr trace_add_trace_event,
@@ -61,6 +77,8 @@ bool InitializeModule(const CommandLine& command_line,
g_dealloc = dealloc;
#endif
+ g_field_trial_find_ = field_trial_find;
+
*create_media_engine = &CreateWebRtcMediaEngine;
*destroy_media_engine = &DestroyWebRtcMediaEngine;
*init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction;