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 |
45 MediaLog(); | 45 MediaLog(); |
46 | 46 |
47 // Add an event to this log. Overriden by inheritors to actually do something | 47 // Add an event to this log. Overriden by inheritors to actually do something |
48 // with it. | 48 // with it. |
49 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); | 49 virtual void AddEvent(scoped_ptr<MediaLogEvent> event); |
50 | 50 |
51 // Helper methods to create events and their parameters. | 51 // Helper methods to create events and their parameters. |
52 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); | 52 scoped_ptr<MediaLogEvent> CreateEvent(MediaLogEvent::Type type); |
53 scoped_ptr<MediaLogEvent> CreateBooleanEvent( | 53 scoped_ptr<MediaLogEvent> CreateBooleanEvent( |
(...skipping 28 matching lines...) Expand all Loading... |
82 private: | 82 private: |
83 // A unique (to this process) id for this MediaLog. | 83 // A unique (to this process) id for this MediaLog. |
84 int32 id_; | 84 int32 id_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(MediaLog); | 86 DISALLOW_COPY_AND_ASSIGN(MediaLog); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace media | 89 } // namespace media |
90 | 90 |
91 #endif // MEDIA_BASE_MEDIA_LOG_H_ | 91 #endif // MEDIA_BASE_MEDIA_LOG_H_ |
OLD | NEW |