| 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 #include "media/base/pipeline_impl.h" | 11 #include "media/base/pipeline_impl.h" |
| 12 #include "media/base/pipeline_status.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 | 15 |
| 15 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 16 class MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| 16 public: | 17 public: |
| 17 // Convert various enums to strings. | 18 // Convert various enums to strings. |
| 18 static const char* EventTypeToString(MediaLogEvent::Type type); | 19 static const char* EventTypeToString(MediaLogEvent::Type type); |
| 19 static const char* PipelineStateToString(PipelineImpl::State); | 20 static const char* PipelineStateToString(PipelineImpl::State); |
| 21 static const char* PipelineStatusToString(PipelineStatus); |
| 20 | 22 |
| 21 MediaLog(); | 23 MediaLog(); |
| 22 | 24 |
| 23 // Add an event to this log. Overriden by inheritors to actually do something | 25 // Add an event to this log. Overriden by inheritors to actually do something |
| 24 // with it. | 26 // with it. |
| 25 // Takes ownership of |event|. | 27 // Takes ownership of |event|. |
| 26 virtual void AddEvent(MediaLogEvent* event); | 28 virtual void AddEvent(MediaLogEvent* event); |
| 27 | 29 |
| 28 // Helper methods to create events and their parameters. | 30 // Helper methods to create events and their parameters. |
| 29 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); | 31 MediaLogEvent* CreateEvent(MediaLogEvent::Type type); |
| 32 MediaLogEvent* CreateBooleanEvent(MediaLogEvent::Type type, |
| 33 const char* property, bool value); |
| 34 MediaLogEvent* CreateIntegerEvent(MediaLogEvent::Type type, |
| 35 const char* property, int64 value); |
| 36 MediaLogEvent* CreateTimeEvent(MediaLogEvent::Type type, |
| 37 const char* property, base::TimeDelta value); |
| 30 MediaLogEvent* CreateLoadEvent(const std::string& url); | 38 MediaLogEvent* CreateLoadEvent(const std::string& url); |
| 31 MediaLogEvent* CreateSeekEvent(float seconds); | 39 MediaLogEvent* CreateSeekEvent(float seconds); |
| 32 MediaLogEvent* CreatePipelineStateChangedEvent(PipelineImpl::State state); | 40 MediaLogEvent* CreatePipelineStateChangedEvent(PipelineImpl::State state); |
| 41 MediaLogEvent* CreatePipelineErrorEvent(PipelineStatus error); |
| 42 MediaLogEvent* CreateVideoSizeSetEvent(size_t width, size_t height); |
| 33 MediaLogEvent* CreateBufferedExtentsChangedEvent(size_t start, size_t current, | 43 MediaLogEvent* CreateBufferedExtentsChangedEvent(size_t start, size_t current, |
| 34 size_t end); | 44 size_t end); |
| 35 | 45 |
| 36 protected: | 46 protected: |
| 37 friend class base::RefCountedThreadSafe<MediaLog>; | 47 friend class base::RefCountedThreadSafe<MediaLog>; |
| 38 virtual ~MediaLog(); | 48 virtual ~MediaLog(); |
| 39 | 49 |
| 40 private: | 50 private: |
| 41 // A unique (to this process) id for this MediaLog. | 51 // A unique (to this process) id for this MediaLog. |
| 42 int32 id_; | 52 int32 id_; |
| 43 | 53 |
| 44 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 54 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
| 45 }; | 55 }; |
| 46 | 56 |
| 47 } // namespace media | 57 } // namespace media |
| 48 | 58 |
| 49 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 59 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
| OLD | NEW |