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" |
11 #include "talk/media/webrtc/webrtcmediaengine.h" | 11 #include "talk/media/webrtc/webrtcmediaengine.h" |
| 12 #include "third_party/libjingle/overrides/talk/base/logging.h" |
12 | 13 |
13 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) | 14 #if !defined(LIBPEERCONNECTION_IMPLEMENTATION) || defined(LIBPEERCONNECTION_LIB) |
14 #error "Only compile the allocator proxy with the shared_library implementation" | 15 #error "Only compile the allocator proxy with the shared_library implementation" |
15 #endif | 16 #endif |
16 | 17 |
17 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
18 #define ALLOC_EXPORT __declspec(dllexport) | 19 #define ALLOC_EXPORT __declspec(dllexport) |
19 #else | 20 #else |
20 #define ALLOC_EXPORT __attribute__((visibility("default"))) | 21 #define ALLOC_EXPORT __attribute__((visibility("default"))) |
21 #endif | 22 #endif |
(...skipping 23 matching lines...) Expand all Loading... |
45 ALLOC_EXPORT | 46 ALLOC_EXPORT |
46 bool InitializeModule(const CommandLine& command_line, | 47 bool InitializeModule(const CommandLine& command_line, |
47 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 48 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
48 AllocateFunction alloc, | 49 AllocateFunction alloc, |
49 DellocateFunction dealloc, | 50 DellocateFunction dealloc, |
50 #endif | 51 #endif |
51 logging::LogMessageHandlerFunction log_handler, | 52 logging::LogMessageHandlerFunction log_handler, |
52 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, | 53 webrtc::GetCategoryEnabledPtr trace_get_category_enabled, |
53 webrtc::AddTraceEventPtr trace_add_trace_event, | 54 webrtc::AddTraceEventPtr trace_add_trace_event, |
54 CreateWebRtcMediaEngineFunction* create_media_engine, | 55 CreateWebRtcMediaEngineFunction* create_media_engine, |
55 DestroyWebRtcMediaEngineFunction* destroy_media_engine) { | 56 DestroyWebRtcMediaEngineFunction* destroy_media_engine, |
| 57 InitDiagnosticLoggingDelegateFunctionFunction* |
| 58 init_diagnostic_logging) { |
56 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 59 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
57 g_alloc = alloc; | 60 g_alloc = alloc; |
58 g_dealloc = dealloc; | 61 g_dealloc = dealloc; |
59 #endif | 62 #endif |
60 | 63 |
61 *create_media_engine = &CreateWebRtcMediaEngine; | 64 *create_media_engine = &CreateWebRtcMediaEngine; |
62 *destroy_media_engine = &DestroyWebRtcMediaEngine; | 65 *destroy_media_engine = &DestroyWebRtcMediaEngine; |
| 66 *init_diagnostic_logging = &talk_base::InitDiagnosticLoggingDelegateFunction; |
63 | 67 |
64 if (CommandLine::Init(0, NULL)) { | 68 if (CommandLine::Init(0, NULL)) { |
65 #if !defined(OS_WIN) | 69 #if !defined(OS_WIN) |
66 // This is not needed on Windows since CommandLine::Init has already | 70 // This is not needed on Windows since CommandLine::Init has already |
67 // done the equivalent thing via the GetCommandLine() API. | 71 // done the equivalent thing via the GetCommandLine() API. |
68 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); | 72 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); |
69 #endif | 73 #endif |
70 logging::LoggingSettings settings; | 74 logging::LoggingSettings settings; |
71 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 75 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
72 logging::InitLogging(settings); | 76 logging::InitLogging(settings); |
73 | 77 |
74 // Override the log message handler to forward logs to chrome's handler. | 78 // Override the log message handler to forward logs to chrome's handler. |
75 logging::SetLogMessageHandler(log_handler); | 79 logging::SetLogMessageHandler(log_handler); |
76 webrtc::SetupEventTracer(trace_get_category_enabled, | 80 webrtc::SetupEventTracer(trace_get_category_enabled, |
77 trace_add_trace_event); | 81 trace_add_trace_event); |
78 } | 82 } |
79 | 83 |
80 return true; | 84 return true; |
81 } | 85 } |
82 } // extern "C" | 86 } // extern "C" |
OLD | NEW |