Index: media/base/media_log.h |
diff --git a/media/base/media_log.h b/media/base/media_log.h |
index 3ad2c0b7b1cbc42c2ec73ad6be8b00e3a1a810af..e776ef6a8b80026adf09425c038ff412a271ff51 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 a string should be added to the log. |
+// First parameter - The string to add to the 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>; |