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 3 // found in the LICENSE file. 4 5 #include "content/renderer/media/webrtc_logging.h" 6 7 #include "content/public/renderer/webrtc_log_message_delegate.h" 8 #include "third_party/libjingle/overrides/talk/base/logging.h" 9 10 namespace content { 11 12 // Shall only be set once and never go back to NULL. 13 WebRtcLogMessageDelegate* g_webrtc_logging_delegate = NULL; 14 15 void InitWebRtcLoggingDelegate(WebRtcLogMessageDelegate* delegate) { 16 CHECK(!g_webrtc_logging_delegate); 17 CHECK(delegate); 18 19 g_webrtc_logging_delegate = delegate; 20 } 21 22 void InitWebRtcLogging() { 23 talk_base::InitDiagnosticLoggingDelegateFunction(WebRtcLogMessage); 24 } 25 26 void WebRtcLogMessage(const std::string& message) { 27 if (g_webrtc_logging_delegate) 28 g_webrtc_logging_delegate->LogMessage(message); 29 } 30 31 } // namespace content 32