| 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 30 matching lines...) Expand all Loading... |
| 41 // to avoid wasteful evaluation of subsequent stream arguments. | 41 // to avoid wasteful evaluation of subsequent stream arguments. |
| 42 #define LIMITED_MEDIA_LOG(log_cb, count, max) \ | 42 #define LIMITED_MEDIA_LOG(log_cb, count, max) \ |
| 43 LAZY_STREAM(MEDIA_LOG(log_cb), (count) < (max) && ((count)++ || true)) | 43 LAZY_STREAM(MEDIA_LOG(log_cb), (count) < (max) && ((count)++ || true)) |
| 44 | 44 |
| 45 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 45 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
| 46 public: | 46 public: |
| 47 // Convert various enums to strings. | 47 // Convert various enums to strings. |
| 48 static std::string EventTypeToString(MediaLogEvent::Type type); | 48 static std::string EventTypeToString(MediaLogEvent::Type type); |
| 49 static std::string PipelineStatusToString(PipelineStatus status); | 49 static std::string PipelineStatusToString(PipelineStatus status); |
| 50 | 50 |
| 51 static std::string MediaEventToLogString(const MediaLogEvent& event); |
| 52 |
| 51 MediaLog(); | 53 MediaLog(); |
| 52 | 54 |
| 53 // Add an event to this log. Overriden by inheritors to actually do something | 55 // Add an event to this log. Overriden by inheritors to actually do something |
| 54 // with it. | 56 // with it. |
| 55 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); | 57 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); |
| 56 | 58 |
| 57 // Helper methods to create events and their parameters. | 59 // Helper methods to create events and their parameters. |
| 58 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); | 60 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); |
| 59 scoped_ptr<MediaLogEvent> CreateBooleanEvent( | 61 scoped_ptr<MediaLogEvent> CreateBooleanEvent( |
| 60 MediaLogEvent::Type type, const std::string& property, bool value); | 62 MediaLogEvent::Type type, const std::string& property, bool value); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 90 private: | 92 private: |
| 91 // A unique (to this process) id for this MediaLog. | 93 // A unique (to this process) id for this MediaLog. |
| 92 int32 id_; | 94 int32 id_; |
| 93 | 95 |
| 94 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 96 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace media | 99 } // namespace media |
| 98 | 100 |
| 99 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 101 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
| OLD | NEW |