Chromium Code Reviews| Index: media/base/media_log.h |
| diff --git a/media/base/media_log.h b/media/base/media_log.h |
| index 3ad2c0b7b1cbc42c2ec73ad6be8b00e3a1a810af..1b1126797a927d1a3f82b10e26ad60c411eb3742 100644 |
| --- a/media/base/media_log.h |
| +++ b/media/base/media_log.h |
| @@ -5,6 +5,9 @@ |
| #ifndef MEDIA_BASE_MEDIA_LOG_H_ |
| #define MEDIA_BASE_MEDIA_LOG_H_ |
| +#include <sstream> |
| +#include <string> |
| + |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "media/base/media_export.h" |
| @@ -14,6 +17,25 @@ |
| namespace media { |
| +// Indicates an error string should be added to the error log. |
|
scherkus (not reviewing)
2012/12/07 22:29:34
s/error//g (or something that's less specific to e
|
| +// First parameter - The string to add to the error log. |
| +typedef base::Callback<void(const std::string&)> LogCB; |
| + |
| +// Helper class to make it easier to use log_cb like DVLOG(). |
| +class LogHelper { |
| + public: |
| + LogHelper(const LogCB& Log_cb); |
| + ~LogHelper(); |
| + |
| + std::ostream& stream() { return stream_; } |
| + |
| + private: |
| + LogCB log_cb_; |
| + std::stringstream stream_; |
| +}; |
| + |
| +#define MEDIA_LOG(log_cb) LogHelper(log_cb).stream() |
| + |
| class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| public: |
| // Convert various enums to strings. |
| @@ -43,6 +65,8 @@ class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| size_t width, size_t height); |
| scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( |
| size_t start, size_t current, size_t end); |
| + scoped_ptr<MediaLogEvent> CreateMediaSourceErrorEvent( |
| + const std::string& error); |
| protected: |
| friend class base::RefCountedThreadSafe<MediaLog>; |