Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ | |
| 6 #define MEDIA_BASE_MEDIA_LOG_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/process.h" | |
| 11 #include "base/time.h" | |
| 12 #include "base/values.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { | |
| 17 public: | |
| 18 enum EventType { | |
| 19 #define EVENT(type) type, | |
| 20 #include "media_event_types.h" | |
| 21 #undef EVENT | |
| 22 }; | |
| 23 | |
| 24 struct Event { | |
| 25 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
| |
| 26 int32 id; | |
| 27 EventType type; | |
| 28 DictionaryValue params; | |
| 29 base::Time time; | |
| 30 }; | |
| 31 | |
| 32 // Return a string to represent an EventType. | |
| 33 static const char* EventTypeToString(EventType type); | |
| 34 | |
| 35 MediaLog(); | |
| 36 | |
| 37 // Methods called by loggers when events occur. These generate appropriate | |
| 38 // event parameters so the caller need not worry about them. | |
| 39 void Load(const std::string& url); | |
| 40 | |
| 41 // Add an event to this log. Overriden by inheritors to actually do something | |
| 42 // with it. | |
| 43 // Takes ownership of |event|. | |
| 44 virtual void AddEvent(Event* event); | |
| 45 | |
| 46 // Convenience method for adding an event with no parameters. | |
| 47 void AddEventOfType(EventType type); | |
| 48 | |
| 49 // Convenience method for filling in common fields of a new event. | |
| 50 Event* CreateEvent(EventType type); | |
| 51 | |
| 52 protected: | |
| 53 friend class base::RefCountedThreadSafe<MediaLog>; | |
| 54 virtual ~MediaLog(); | |
| 55 | |
| 56 private: | |
| 57 // A unique (to this process) id for this MediaLog. | |
| 58 int32 id_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(MediaLog); | |
| 61 }; | |
| 62 | |
| 63 } // namespace media | |
| 64 | |
| 65 #endif // MEDIA_BASE_MEDIA_LOG_H_ | |
| OLD | NEW |