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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Initialize logging, set the forward allocator functions (not on mac), and | 42 // Initialize logging, set the forward allocator functions (not on mac), and |
43 // return pointers to libjingle's WebRTC factory methods. | 43 // return pointers to libjingle's WebRTC factory methods. |
44 // Called from init_webrtc.cc. | 44 // Called from init_webrtc.cc. |
45 ALLOC_EXPORT | 45 ALLOC_EXPORT |
46 bool InitializeModule(const CommandLine& command_line, | 46 bool InitializeModule(const CommandLine& command_line, |
47 #if !defined(OS_MACOSX) | 47 #if !defined(OS_MACOSX) |
48 AllocateFunction alloc, | 48 AllocateFunction alloc, |
49 DellocateFunction dealloc, | 49 DellocateFunction dealloc, |
50 #endif | 50 #endif |
| 51 logging::LogMessageHandlerFunction log_handler, |
51 CreateWebRtcMediaEngineFunction* create_media_engine, | 52 CreateWebRtcMediaEngineFunction* create_media_engine, |
52 DestroyWebRtcMediaEngineFunction* destroy_media_engine) { | 53 DestroyWebRtcMediaEngineFunction* destroy_media_engine) { |
53 #if !defined(OS_MACOSX) | 54 #if !defined(OS_MACOSX) |
54 g_alloc = alloc; | 55 g_alloc = alloc; |
55 g_dealloc = dealloc; | 56 g_dealloc = dealloc; |
56 #endif | 57 #endif |
57 | 58 |
58 *create_media_engine = &CreateWebRtcMediaEngine; | 59 *create_media_engine = &CreateWebRtcMediaEngine; |
59 *destroy_media_engine = &DestroyWebRtcMediaEngine; | 60 *destroy_media_engine = &DestroyWebRtcMediaEngine; |
60 | 61 |
61 if (CommandLine::Init(0, NULL)) { | 62 if (CommandLine::Init(0, NULL)) { |
62 #if !defined(OS_WIN) | 63 #if !defined(OS_WIN) |
63 // This is not needed on Windows since CommandLine::Init has already | 64 // This is not needed on Windows since CommandLine::Init has already |
64 // done the equivalent thing via the GetCommandLine() API. | 65 // done the equivalent thing via the GetCommandLine() API. |
65 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); | 66 CommandLine::ForCurrentProcess()->AppendArguments(command_line, true); |
66 #endif | 67 #endif |
| 68 logging::InitLogging( |
| 69 NULL, |
| 70 logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, |
| 71 logging::LOCK_LOG_FILE, |
| 72 logging::DELETE_OLD_LOG_FILE, |
| 73 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
67 | 74 |
68 // TODO(tommi): Use SetLogMessageHandler. | 75 // Override the log message handler to forward logs to chrome's handler. |
69 logging::InitLogging( | 76 logging::SetLogMessageHandler(log_handler); |
70 FILE_PATH_LITERAL("libpeerconnection.log"), | |
71 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | |
72 logging::LOCK_LOG_FILE, | |
73 logging::APPEND_TO_OLD_LOG_FILE, | |
74 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | |
75 } | 77 } |
76 | 78 |
77 return true; | 79 return true; |
78 } | 80 } |
79 } // extern "C" | 81 } // extern "C" |
OLD | NEW |