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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 BufferingState state); | 94 BufferingState state); |
95 | 95 |
96 // Report a log message at the specified log level. | 96 // Report a log message at the specified log level. |
97 void AddLogEvent(MediaLogLevel level, const std::string& message); | 97 void AddLogEvent(MediaLogLevel level, const std::string& message); |
98 | 98 |
99 // Report a property change without an accompanying event. | 99 // Report a property change without an accompanying event. |
100 void SetStringProperty(const std::string& key, const std::string& value); | 100 void SetStringProperty(const std::string& key, const std::string& value); |
101 void SetDoubleProperty(const std::string& key, double value); | 101 void SetDoubleProperty(const std::string& key, double value); |
102 void SetBooleanProperty(const std::string& key, bool value); | 102 void SetBooleanProperty(const std::string& key, bool value); |
103 | 103 |
| 104 // Getter for |id_|. Used by MojoMediaLogService to construct MediaLogEvents |
| 105 // to log into this MediaLog. |
| 106 int32_t id() const { return id_; } |
| 107 |
104 private: | 108 private: |
105 // A unique (to this process) id for this MediaLog. | 109 // A unique (to this process) id for this MediaLog. |
106 int32_t id_; | 110 int32_t id_; |
107 | 111 |
108 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 112 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
109 }; | 113 }; |
110 | 114 |
111 // Helper class to make it easier to use MediaLog like DVLOG(). | 115 // Helper class to make it easier to use MediaLog like DVLOG(). |
112 class MEDIA_EXPORT LogHelper { | 116 class MEDIA_EXPORT LogHelper { |
113 public: | 117 public: |
(...skipping 29 matching lines...) Expand all Loading... |
143 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ | 147 #define LIMITED_MEDIA_LOG(level, media_log, count, max) \ |
144 LAZY_STREAM(MEDIA_LOG(level, media_log), \ | 148 LAZY_STREAM(MEDIA_LOG(level, media_log), \ |
145 (count) < (max) && ((count)++ || true)) \ | 149 (count) < (max) && ((count)++ || true)) \ |
146 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ | 150 << (((count) == (max)) ? "(Log limit reached. Further similar entries " \ |
147 "may be suppressed): " \ | 151 "may be suppressed): " \ |
148 : "") | 152 : "") |
149 | 153 |
150 } // namespace media | 154 } // namespace media |
151 | 155 |
152 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 156 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |