Index: media/base/media_log.h |
diff --git a/media/base/media_log.h b/media/base/media_log.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fcf3f93bdbcff5ad439690a1cdfcca1fa7507710 |
--- /dev/null |
+++ b/media/base/media_log.h |
@@ -0,0 +1,65 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_MEDIA_LOG_H_ |
+#define MEDIA_BASE_MEDIA_LOG_H_ |
+#pragma once |
+ |
+#include "base/memory/ref_counted.h" |
+#include "base/process.h" |
+#include "base/time.h" |
+#include "base/values.h" |
+ |
+namespace media { |
+ |
+class MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
+public: |
+ enum EventType { |
+#define EVENT(type) type, |
+#include "media_event_types.h" |
+#undef EVENT |
+ }; |
+ |
+ struct Event { |
+ base::ProcessId renderer; |
jam
2011/07/29 16:08:55
media module shouldn't know about different chrome
Scott Franklin
2011/07/29 22:30:25
Or, since the messages are now being handled by Re
|
+ int32 id; |
+ EventType type; |
+ DictionaryValue params; |
+ base::Time time; |
+ }; |
+ |
+ // Return a string to represent an EventType. |
+ static const char* EventTypeToString(EventType type); |
+ |
+ MediaLog(); |
+ |
+ // Methods called by loggers when events occur. These generate appropriate |
+ // event parameters so the caller need not worry about them. |
+ void Load(const std::string& url); |
+ |
+ // Add an event to this log. Overriden by inheritors to actually do something |
+ // with it. |
+ // Takes ownership of |event|. |
+ virtual void AddEvent(Event* event); |
+ |
+ // Convenience method for adding an event with no parameters. |
+ void AddEventOfType(EventType type); |
+ |
+ // Convenience method for filling in common fields of a new event. |
+ Event* CreateEvent(EventType type); |
+ |
+protected: |
+ friend class base::RefCountedThreadSafe<MediaLog>; |
+ virtual ~MediaLog(); |
+ |
+private: |
+ // A unique (to this process) id for this MediaLog. |
+ int32 id_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(MediaLog); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_MEDIA_LOG_H_ |