OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef MEDIA_BASE_MEDIA_LOG_H_ | 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ |
6 #define MEDIA_BASE_MEDIA_LOG_H_ | 6 #define MEDIA_BASE_MEDIA_LOG_H_ |
7 | 7 |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
14 #include "media/base/media_log_event.h" | 14 #include "media/base/media_log_event.h" |
15 #include "media/base/pipeline.h" | 15 #include "media/base/pipeline.h" |
16 #include "media/base/pipeline_status.h" | 16 #include "media/base/pipeline_status.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 // Indicates a string should be added to the log. | 20 // Indicates a string should be added to the log. |
21 // First parameter - The string to add to the log. | 21 // First parameter - The string to add to the log. |
22 typedef base::Callback<void(const std::string&)> LogCB; | 22 typedef base::Callback<void(const std::string&)> LogCB; |
23 | 23 |
24 // Helper class to make it easier to use log_cb like DVLOG(). | 24 // Helper class to make it easier to use log_cb like DVLOG(). |
25 class LogHelper { | 25 class LogHelper { |
26 public: | 26 public: |
27 LogHelper(const LogCB& Log_cb); | 27 explicit LogHelper(const LogCB& Log_cb); |
28 ~LogHelper(); | 28 ~LogHelper(); |
29 | 29 |
30 std::ostream& stream() { return stream_; } | 30 std::ostream& stream() { return stream_; } |
31 | 31 |
32 private: | 32 private: |
33 LogCB log_cb_; | 33 LogCB log_cb_; |
34 std::stringstream stream_; | 34 std::stringstream stream_; |
35 }; | 35 }; |
36 | 36 |
37 #define MEDIA_LOG(log_cb) LogHelper(log_cb).stream() | 37 #define MEDIA_LOG(log_cb) LogHelper(log_cb).stream() |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 private: | 75 private: |
76 // A unique (to this process) id for this MediaLog. | 76 // A unique (to this process) id for this MediaLog. |
77 int32 id_; | 77 int32 id_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 79 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace media | 82 } // namespace media |
83 | 83 |
84 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 84 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |