Chromium Code Reviews| Index: media/audio/audio_logging.cc |
| diff --git a/media/audio/audio_logging.cc b/media/audio/audio_logging.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4361816ddb1449d87bbb145a8cbee59272060927 |
| --- /dev/null |
| +++ b/media/audio/audio_logging.cc |
| @@ -0,0 +1,24 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/logging.h" |
| +#include "media/audio/audio_logging.h" |
| + |
| +namespace media { |
| + |
| +WebRtcLoggingCallback g_webrtc_logging_callback = nullptr; |
| + |
| +// TODO: Make sure it's thread safe. |
|
o1ka
2016/04/05 15:28:42
You can use atomic flag to guard initialization.
|
| + |
| +void InitWebRtcLoggingCallback(WebRtcLoggingCallback callback) { |
| + CHECK(!g_webrtc_logging_callback); |
| + g_webrtc_logging_callback = callback; |
| +} |
| + |
| +void WebRtcLogMessage(const std::string& message) { |
| + if (g_webrtc_logging_callback) |
| + g_webrtc_logging_callback(message); |
| +} |
| + |
| +} // namespace media |