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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 base::TimeDelta value); | 53 base::TimeDelta value); |
54 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); | 54 scoped_ptr<MediaLogEvent> CreateLoadEvent(const std::string& url); |
55 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); | 55 scoped_ptr<MediaLogEvent> CreateSeekEvent(float seconds); |
56 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( | 56 scoped_ptr<MediaLogEvent> CreatePipelineStateChangedEvent( |
57 Pipeline::State state); | 57 Pipeline::State state); |
58 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); | 58 scoped_ptr<MediaLogEvent> CreatePipelineErrorEvent(PipelineStatus error); |
59 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( | 59 scoped_ptr<MediaLogEvent> CreateVideoSizeSetEvent( |
60 size_t width, size_t height); | 60 size_t width, size_t height); |
61 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( | 61 scoped_ptr<MediaLogEvent> CreateBufferedExtentsChangedEvent( |
62 int64 start, int64 current, int64 end); | 62 int64 start, int64 current, int64 end); |
63 scoped_ptr<MediaLogEvent> CreateLogEvent(MediaLogLevel level, | 63 |
64 const std::string& message); | 64 // Report a log message at the specified log level. |
| 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>; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 LogHelper((MediaLog::MEDIALOG_##level), (log_cb)).stream() | 107 LogHelper((MediaLog::MEDIALOG_##level), (log_cb)).stream() |
107 | 108 |
108 // Logs only while count < max. Increments count for each log. Use LAZY_STREAM | 109 // Logs only while count < max. Increments count for each log. Use LAZY_STREAM |
109 // to avoid wasteful evaluation of subsequent stream arguments. | 110 // to avoid wasteful evaluation of subsequent stream arguments. |
110 #define LIMITED_MEDIA_LOG(level, log_cb, count, max) \ | 111 #define LIMITED_MEDIA_LOG(level, log_cb, count, max) \ |
111 LAZY_STREAM(MEDIA_LOG(level, log_cb), (count) < (max) && ((count)++ || true)) | 112 LAZY_STREAM(MEDIA_LOG(level, log_cb), (count) < (max) && ((count)++ || true)) |
112 | 113 |
113 } // namespace media | 114 } // namespace media |
114 | 115 |
115 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 116 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |