Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ | 5 #ifndef MEDIA_BASE_MEDIA_LOG_H_ |
| 6 #define MEDIA_BASE_MEDIA_LOG_H_ | 6 #define MEDIA_BASE_MEDIA_LOG_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "media/base/media_log_event.h" | 10 #include "media/base/media_log_event.h" |
| 11 | 11 |
| 12 namespace media { | 12 namespace media { |
| 13 | 13 |
| 14 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 14 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| 15 public: | 15 public: |
| 16 | 16 |
|
scherkus (not reviewing)
2011/08/09 00:59:40
nit: nuke blank line here
Scott Franklin
2011/08/09 01:16:08
Done.
| |
| 17 // Return a string to represent an EventType. | 17 // Return a string to represent an EventType. |
| 18 static const char* EventTypeToString(MediaLogEvent::Type type); | 18 static const char* EventTypeToString(MediaLogEvent::Type type); |
| 19 | 19 |
| 20 MediaLog(); | 20 MediaLog(); |
| 21 | 21 |
| 22 // Methods called by loggers when events occur. These generate appropriate | 22 // Helper methods to create specific types of events with their parameters. |
| 23 // event parameters so the caller need not worry about them. | 23 MediaLogEvent* CreateLoadEvent(const std::string& url); |
| 24 void Load(const std::string& url); | 24 MediaLogEvent* CreateBufferedExtentsChangedEvent(size_t start, size_t current, |
|
scherkus (not reviewing)
2011/08/09 00:59:40
nit: move these down to CreateEvent() + update .cc
Scott Franklin
2011/08/09 01:16:08
Done.
| |
| 25 size_t end); | |
| 25 | 26 |
| 26 // Add an event to this log. Overriden by inheritors to actually do something | 27 // Add an event to this log. Overriden by inheritors to actually do something |
| 27 // with it. | 28 // with it. |
| 28 // Takes ownership of |event|. | 29 // Takes ownership of |event|. |
| 29 virtual void AddEvent(MediaLogEvent* event); | 30 virtual void AddEvent(MediaLogEvent* event); |
| 30 | 31 |
| 31 // Convenience method for adding an event with no parameters. | |
| 32 void AddEventOfType(MediaLogEvent::Type type); | |
| 33 | |
| 34 // Convenience method for filling in common fields of a new event. | 32 // Convenience method for filling in common fields of a new event. |
| 35 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); | 33 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); |
| 36 | 34 |
| 37 protected: | 35 protected: |
| 38 friend class base::RefCountedThreadSafe<MediaLog>; | 36 friend class base::RefCountedThreadSafe<MediaLog>; |
| 39 virtual ~MediaLog(); | 37 virtual ~MediaLog(); |
| 40 | 38 |
| 41 private: | 39 private: |
| 42 // A unique (to this process) id for this MediaLog. | 40 // A unique (to this process) id for this MediaLog. |
| 43 int32 id_; | 41 int32 id_; |
| 44 | 42 |
| 45 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 43 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
| 46 }; | 44 }; |
| 47 | 45 |
| 48 } // namespace media | 46 } // namespace media |
| 49 | 47 |
| 50 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 48 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
| OLD | NEW |