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..e2a05bc3932c3702692104bfc1e68bc3f21cb297 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. |
| +// First parameter - The string to add to the error log. |
| +typedef base::Callback<void(const std::string&)> ErrorLogCB; |
| + |
| +// Helper class to make it easier to use error_cb like DVLOG(). |
| +class ErrorLogHelper { |
|
scherkus (not reviewing)
2012/12/07 20:40:11
WDYT about dropping "Error" from everything?
not
|
| + public: |
| + ErrorLogHelper(const ErrorLogCB& error_cb); |
| + ~ErrorLogHelper(); |
| + |
| + std::ostream& stream() { return stream_; } |
| + |
| + private: |
| + ErrorLogCB error_cb_; |
| + std::stringstream stream_; |
| +}; |
| + |
| +#define ERROR_LOG(error_cb) ErrorLogHelper(error_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>; |