| 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 "content/renderer/media/webrtc_logging.h" | 5 #include "content/renderer/media/webrtc_logging.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "content/public/renderer/webrtc_log_message_delegate.h" | 8 #include "content/public/renderer/webrtc_log_message_delegate.h" |
| 9 #include "third_party/webrtc/overrides/webrtc/base/logging.h" | 9 #include "third_party/webrtc_overrides/webrtc/base/logging.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // Shall only be set once and never go back to NULL. | 13 // Shall only be set once and never go back to NULL. |
| 14 WebRtcLogMessageDelegate* g_webrtc_logging_delegate = NULL; | 14 WebRtcLogMessageDelegate* g_webrtc_logging_delegate = NULL; |
| 15 | 15 |
| 16 void InitWebRtcLoggingDelegate(WebRtcLogMessageDelegate* delegate) { | 16 void InitWebRtcLoggingDelegate(WebRtcLogMessageDelegate* delegate) { |
| 17 CHECK(!g_webrtc_logging_delegate); | 17 CHECK(!g_webrtc_logging_delegate); |
| 18 CHECK(delegate); | 18 CHECK(delegate); |
| 19 | 19 |
| 20 g_webrtc_logging_delegate = delegate; | 20 g_webrtc_logging_delegate = delegate; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void InitWebRtcLogging() { | 23 void InitWebRtcLogging() { |
| 24 // Log messages from Libjingle should not have timestamps. | 24 // Log messages from Libjingle should not have timestamps. |
| 25 rtc::InitDiagnosticLoggingDelegateFunction(&WebRtcLogMessage); | 25 rtc::InitDiagnosticLoggingDelegateFunction(&WebRtcLogMessage); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void WebRtcLogMessage(const std::string& message) { | 28 void WebRtcLogMessage(const std::string& message) { |
| 29 if (g_webrtc_logging_delegate) | 29 if (g_webrtc_logging_delegate) |
| 30 g_webrtc_logging_delegate->LogMessage(message); | 30 g_webrtc_logging_delegate->LogMessage(message); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace content | 33 } // namespace content |
| OLD | NEW |