| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "allocator_shim/allocator_stub.h" | 5 #include "allocator_shim/allocator_stub.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "init_webrtc.h" | 9 #include "init_webrtc.h" |
| 10 #include "talk/base/basictypes.h" | 10 #include "talk/base/basictypes.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 cricket::WebRtcVideoDecoderFactory* decoder_factory); | 37 cricket::WebRtcVideoDecoderFactory* decoder_factory); |
| 38 | 38 |
| 39 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine); | 39 void DestroyWebRtcMediaEngine(cricket::MediaEngineInterface* media_engine); |
| 40 | 40 |
| 41 extern "C" { | 41 extern "C" { |
| 42 | 42 |
| 43 // Initialize logging, set the forward allocator functions (not on mac), and | 43 // Initialize logging, set the forward allocator functions (not on mac), and |
| 44 // return pointers to libjingle's WebRTC factory methods. | 44 // return pointers to libjingle's WebRTC factory methods. |
| 45 // Called from init_webrtc.cc. | 45 // Called from init_webrtc.cc. |
| 46 ALLOC_EXPORT | 46 ALLOC_EXPORT |
| 47 bool InitializeModule(const CommandLine& command_line, | 47 bool InitializeModule( |
| 48 const CommandLine& command_line, |
| 48 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 49 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 49 AllocateFunction alloc, | 50 AllocateFunction alloc, |
| 50 DellocateFunction dealloc, | 51 DellocateFunction dealloc, |
| 51 #endif | 52 #endif |
| 52 logging::LogMessageHandlerFunction log_handler, | 53 logging::LogMessageHandlerFunction log_handler, |
| 53 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, | 54 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, |
| 54 webrtc::AddTraceEventPtr trace_add_trace_event, | 55 webrtc::AddTraceEventPtr trace_add_trace_event, |
| 55 CreateWebRtcMediaEngineFunction* create_media_engine, | 56 webrtc::field_trial::FindFullNameMethod field_trial_find, |
| 56 DestroyWebRtcMediaEngineFunction* destroy_media_engine, | 57 CreateWebRtcMediaEngineFunction* create_media_engine, |
| 57 InitDiagnosticLoggingDelegateFunctionFunction* | 58 DestroyWebRtcMediaEngineFunction* destroy_media_engine, |
| 58 init_diagnostic_logging) { | 59 InitDiagnosticLoggingDelegateFunctionFunction* init_diagnostic_logging) { |
| 59 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 60 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 60 g_alloc = alloc; | 61 g_alloc = alloc; |
| 61 g_dealloc = dealloc; | 62 g_dealloc = dealloc; |
| 62 #endif | 63 #endif |
| 63 | 64 |
| 64 *create_media_engine = &CreateWebRtcMediaEngine; | 65 *create_media_engine = &CreateWebRtcMediaEngine; |
| 65 *destroy_media_engine = &DestroyWebRtcMediaEngine; | 66 *destroy_media_engine = &DestroyWebRtcMediaEngine; |
| 66 *init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction; | 67 *init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction; |
| 67 | 68 |
| 68 if (CommandLine::Init(0, NULL)) { | 69 if (CommandLine::Init(0, NULL)) { |
| 69 #if !defined(OS_WIN) | 70 #if !defined(OS_WIN) |
| 70 // This is not needed on Windows since CommandLine::Init has already | 71 // This is not needed on Windows since CommandLine::Init has already |
| 71 // done the equivalent thing via the GetCommandLine() API. | 72 // done the equivalent thing via the GetCommandLine() API. |
| 72 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); | 73 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); |
| 73 #endif | 74 #endif |
| 74 logging::LoggingSettings settings; | 75 logging::LoggingSettings settings; |
| 75 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 76 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 76 logging::InitLogging(settings); | 77 logging::InitLogging(settings); |
| 77 | 78 |
| 78 // Override the log message handler to forward logs to chrome's handler. | 79 // Override the log message handler to forward logs to chrome's handler. |
| 79 logging::SetLogMessageHandler(log_handler); | 80 logging::SetLogMessageHandler(log_handler); |
| 80 webrtc::SetupEventTracer(trace_get_category_enabled, | 81 webrtc::SetupEventTracer(trace_get_category_enabled, |
| 81 trace_add_trace_event); | 82 trace_add_trace_event); |
| 83 webrtc::field_trial::Init(field_trial_find); |
| 82 } | 84 } |
| 83 | 85 |
| 84 return true; | 86 return true; |
| 85 } | 87 } |
| 86 } // extern "C" | 88 } // extern "C" |
| OLD | NEW |