Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: media/base/media_log.h

Issue 11471006: Log MediaSource parsing errors to the MediaLog so they can appear in chrome:media-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/base/media_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>;
« no previous file with comments | « no previous file | media/base/media_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698