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 22 matching lines...) Expand all Loading... |
33 LogCB log_cb_; | 33 LogCB log_cb_; |
34 std::stringstream stream_; | 34 std::stringstream stream_; |
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 const char* EventTypeToString(MediaLogEvent::Type type); | 42 static const char* EventTypeToString(MediaLogEvent::Type type); |
43 static const char* PipelineStatusToString(PipelineStatus); | 43 static const char* PipelineStatusToString(PipelineStatus status); |
44 | 44 static bool StringToPipelineStatus(const std::string status, |
| 45 PipelineStatus& out_status); |
45 MediaLog(); | 46 MediaLog(); |
46 | 47 |
47 // Add an event to this log. Overriden by inheritors to actually do something | 48 // Add an event to this log. Overriden by inheritors to actually do something |
48 // with it. | 49 // with it. |
49 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); | 50 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); |
50 | 51 |
51 // Helper methods to create events and their parameters. | 52 // Helper methods to create events and their parameters. |
52 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); | 53 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); |
53 scoped_ptr<MediaLogEvent> CreateBooleanEvent( | 54 scoped_ptr<MediaLogEvent> CreateBooleanEvent( |
54 MediaLogEvent::Type type, const char* property, bool value); | 55 MediaLogEvent::Type type, const char* property, bool value); |
(...skipping 27 matching lines...) Expand all Loading... |
82 private: | 83 private: |
83 // A unique (to this process) id for this MediaLog. | 84 // A unique (to this process) id for this MediaLog. |
84 int32 id_; | 85 int32 id_; |
85 | 86 |
86 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 87 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
87 }; | 88 }; |
88 | 89 |
89 } // namespace media | 90 } // namespace media |
90 | 91 |
91 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 92 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |