OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 scoped_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, | 50 scoped_ptr<MediaLogEvent> CreateTimeEvent(MediaLogEvent::Type type, |
51 const std::string& property, | 51 const std::string& property, |
52 base::TimeDelta value); | 52 base::TimeDelta value); |
53 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); | 53 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); |
54 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); | 54 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); |
55 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( | 55 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( |
56 Pipeline::State state); | 56 Pipeline::State state); |
57 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); | 57 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); |
58 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( | 58 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( |
59 size_t width, size_t height); | 59 size_t width, size_t height); |
60 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( | 60 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent(int64_t start, |
61 int64 start, int64 current, int64 end); | 61 int64_t current, |
| 62 int64_t end); |
62 | 63 |
63 // Report a log message at the specified log level. | 64 // Report a log message at the specified log level. |
64 void AddLogEvent(MediaLogLevel level, const std::string& message); | 65 void AddLogEvent(MediaLogLevel level, const std::string& message); |
65 | 66 |
66 // Report a property change without an accompanying event. | 67 // Report a property change without an accompanying event. |
67 void SetStringProperty(const std::string& key, const std::string& value); | 68 void SetStringProperty(const std::string& key, const std::string& value); |
68 void SetIntegerProperty(const std::string& key, int value); | 69 void SetIntegerProperty(const std::string& key, int value); |
69 void SetDoubleProperty(const std::string& key, double value); | 70 void SetDoubleProperty(const std::string& key, double value); |
70 void SetBooleanProperty(const std::string& key, bool value); | 71 void SetBooleanProperty(const std::string& key, bool value); |
71 void SetTimeProperty(const std::string& key, base::TimeDelta value); | 72 void SetTimeProperty(const std::string& key, base::TimeDelta value); |
72 | 73 |
73 protected: | 74 protected: |
74 friend class base::RefCountedThreadSafe<MediaLog>; | 75 friend class base::RefCountedThreadSafe<MediaLog>; |
75 virtual ~MediaLog(); | 76 virtual ~MediaLog(); |
76 | 77 |
77 private: | 78 private: |
78 // A unique (to this process) id for this MediaLog. | 79 // A unique (to this process) id for this MediaLog. |
79 int32 id_; | 80 int32_t id_; |
80 | 81 |
81 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 82 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
82 }; | 83 }; |
83 | 84 |
84 // Helper class to make it easier to use MediaLog like DVLOG(). | 85 // Helper class to make it easier to use MediaLog like DVLOG(). |
85 class MEDIA_EXPORT LogHelper { | 86 class MEDIA_EXPORT LogHelper { |
86 public: | 87 public: |
87 LogHelper(MediaLog::MediaLogLevel level, | 88 LogHelper(MediaLog::MediaLogLevel level, |
88 const scoped_refptr<MediaLog>& media_log); | 89 const scoped_refptr<MediaLog>& media_log); |
89 ~LogHelper(); | 90 ~LogHelper(); |
(...skipping 27 matching lines...) Expand all Loading... |
117 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ | 118 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ |
118 LAZY_STREAM(MEDIA_LOG(level, media_log), \ | 119 LAZY_STREAM(MEDIA_LOG(level, media_log), \ |
119 (count) < (max) && ((count)++ || true)) \ | 120 (count) < (max) && ((count)++ || true)) \ |
120 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ | 121 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ |
121 "may be suppressed): " \ | 122 "may be suppressed): " \ |
122 : "") | 123 : "") |
123 | 124 |
124 } // namespace media | 125 } // namespace media |
125 | 126 |
126 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 127 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |