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 24 matching lines...) Expand all Loading... |
35 }; | 35 }; |
36 | 36 |
37 #define MEDIA_LOG(log_cb) LogHelper(log_cb).stream() | 37 #define MEDIA_LOG(log_cb) LogHelper(log_cb).stream() |
38 | 38 |
39 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { | 39 class MEDIA_EXPORT MediaLog : public base::RefCountedThreadSafe<MediaLog> { |
40 public: | 40 public: |
41 // Convert various enums to strings. | 41 // Convert various enums to strings. |
42 static std::string EventTypeToString(MediaLogEvent::Type type); | 42 static std::string EventTypeToString(MediaLogEvent::Type type); |
43 static std::string PipelineStatusToString(PipelineStatus status); | 43 static std::string PipelineStatusToString(PipelineStatus status); |
44 | 44 |
| 45 static std::string MediaEventToLogString(const MediaLogEvent& event); |
| 46 |
45 MediaLog(); | 47 MediaLog(); |
46 | 48 |
47 // Add an event to this log. Overriden by inheritors to actually do something | 49 // Add an event to this log. Overriden by inheritors to actually do something |
48 // with it. | 50 // with it. |
49 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); | 51 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); |
50 | 52 |
51 // Helper methods to create events and their parameters. | 53 // Helper methods to create events and their parameters. |
52 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); | 54 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); |
53 scoped_ptr<MediaLogEvent> CreateBooleanEvent( | 55 scoped_ptr<MediaLogEvent> CreateBooleanEvent( |
54 MediaLogEvent::Type type, const std::string& property, bool value); | 56 MediaLogEvent::Type type, const std::string& property, bool value); |
(...skipping 29 matching lines...) Expand all Loading... |
84 private: | 86 private: |
85 // A unique (to this process) id for this MediaLog. | 87 // A unique (to this process) id for this MediaLog. |
86 int32 id_; | 88 int32 id_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 90 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace media | 93 } // namespace media |
92 | 94 |
93 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 95 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |