Commit e9d52049 authored by andresp@chromium.org's avatar andresp@chromium.org

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
parent 1b99b4ab
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/debug/trace_event.h" #include "base/debug/trace_event.h"
#include "base/file_util.h" #include "base/file_util.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/metrics/field_trial.h"
#include "base/native_library.h" #include "base/native_library.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "talk/base/basictypes.h" #include "talk/base/basictypes.h"
...@@ -42,6 +43,17 @@ bool InitializeWebRtcModule() { ...@@ -42,6 +43,17 @@ bool InitializeWebRtcModule() {
return true; 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 #else // !LIBPEERCONNECTION_LIB
// When being compiled as a shared library, we need to bridge the gap between // When being compiled as a shared library, we need to bridge the gap between
...@@ -117,6 +129,7 @@ bool InitializeWebRtcModule() { ...@@ -117,6 +129,7 @@ bool InitializeWebRtcModule() {
#if !defined(OS_MACOSX) && !defined(OS_ANDROID) #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
&Allocate, &Dellocate, &Allocate, &Dellocate,
#endif #endif
&base::FieldTrialList::FindFullName,
logging::GetLogMessageHandler(), logging::GetLogMessageHandler(),
&GetCategoryGroupEnabled, &AddTraceEvent, &GetCategoryGroupEnabled, &AddTraceEvent,
&g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine, &g_create_webrtc_media_engine, &g_destroy_webrtc_media_engine,
......
...@@ -23,6 +23,8 @@ namespace webrtc { ...@@ -23,6 +23,8 @@ namespace webrtc {
class AudioDeviceModule; class AudioDeviceModule;
} // namespace webrtc } // namespace webrtc
typedef std::string (*FieldTrialFindFullName)(const std::string& trial_name);
typedef cricket::MediaEngineInterface* (*CreateWebRtcMediaEngineFunction)( typedef cricket::MediaEngineInterface* (*CreateWebRtcMediaEngineFunction)(
webrtc::AudioDeviceModule* adm, webrtc::AudioDeviceModule* adm,
webrtc::AudioDeviceModule* adm_sc, webrtc::AudioDeviceModule* adm_sc,
...@@ -46,6 +48,7 @@ typedef bool (*InitializeModuleFunction)( ...@@ -46,6 +48,7 @@ typedef bool (*InitializeModuleFunction)(
AllocateFunction alloc, AllocateFunction alloc,
DellocateFunction dealloc, DellocateFunction dealloc,
#endif #endif
FieldTrialFindFullName field_trial_find,
logging::LogMessageHandlerFunction log_handler, logging::LogMessageHandlerFunction log_handler,
webrtc::GetCategoryEnabledPtr trace_get_category_enabled, webrtc::GetCategoryEnabledPtr trace_get_category_enabled,
webrtc::AddTraceEventPtr trace_add_trace_event, webrtc::AddTraceEventPtr trace_add_trace_event,
......
...@@ -38,6 +38,21 @@ cricket::MediaEngineInterface* CreateWebRtcMediaEngine( ...@@ -38,6 +38,21 @@ cricket::MediaEngineInterface* CreateWebRtcMediaEngine(
void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine); 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" { extern "C" {
// Initialize logging, set the forward allocator functions (not on mac), and // Initialize logging, set the forward allocator functions (not on mac), and
...@@ -49,6 +64,7 @@ bool InitializeModule(const CommandLine& command_line, ...@@ -49,6 +64,7 @@ bool InitializeModule(const CommandLine& command_line,
AllocateFunction alloc, AllocateFunction alloc,
DellocateFunction dealloc, DellocateFunction dealloc,
#endif #endif
FieldTrialFindFullName field_trial_find,
logging::LogMessageHandlerFunction log_handler, logging::LogMessageHandlerFunction log_handler,
webrtc::GetCategoryEnabledPtr trace_get_category_enabled, webrtc::GetCategoryEnabledPtr trace_get_category_enabled,
webrtc::AddTraceEventPtr trace_add_trace_event, webrtc::AddTraceEventPtr trace_add_trace_event,
...@@ -61,6 +77,8 @@ bool InitializeModule(const CommandLine& command_line, ...@@ -61,6 +77,8 @@ bool InitializeModule(const CommandLine& command_line,
g_dealloc = dealloc; g_dealloc = dealloc;
#endif #endif
g_field_trial_find_ = field_trial_find;
*create_media_engine = &CreateWebRtcMediaEngine; *create_media_engine = &CreateWebRtcMediaEngine;
*destroy_media_engine = &DestroyWebRtcMediaEngine; *destroy_media_engine = &DestroyWebRtcMediaEngine;
*init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction; *init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment