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 | 5 |
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 #include <string> | 10 #include <string> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 namespace base { | 58 namespace base { |
59 | 59 |
60 class WaitableEvent; | 60 class WaitableEvent; |
61 class MessageLoop; | 61 class MessageLoop; |
62 | 62 |
63 namespace debug { | 63 namespace debug { |
64 | 64 |
65 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided | 65 // For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided |
66 // class must implement this interface. | 66 // class must implement this interface. |
67 class ConvertableToTraceFormat : public RefCounted<ConvertableToTraceFormat> { | 67 class BASE_EXPORT ConvertableToTraceFormat |
| 68 : public RefCounted<ConvertableToTraceFormat> { |
68 public: | 69 public: |
69 // Append the class info to the provided |out| string. The appended | 70 // Append the class info to the provided |out| string. The appended |
70 // data must be a valid JSON object. Strings must be properly quoted, and | 71 // data must be a valid JSON object. Strings must be properly quoted, and |
71 // escaped. There is no processing applied to the content after it is | 72 // escaped. There is no processing applied to the content after it is |
72 // appended. | 73 // appended. |
73 virtual void AppendAsTraceFormat(std::string* out) const = 0; | 74 virtual void AppendAsTraceFormat(std::string* out) const = 0; |
74 | 75 |
| 76 std::string ToString() const { |
| 77 std::string result; |
| 78 AppendAsTraceFormat(&result); |
| 79 return result; |
| 80 } |
| 81 |
75 protected: | 82 protected: |
76 virtual ~ConvertableToTraceFormat() {} | 83 virtual ~ConvertableToTraceFormat() {} |
77 | 84 |
78 private: | 85 private: |
79 friend class RefCounted<ConvertableToTraceFormat>; | 86 friend class RefCounted<ConvertableToTraceFormat>; |
80 }; | 87 }; |
81 | 88 |
82 struct TraceEventHandle { | 89 struct TraceEventHandle { |
83 uint32 chunk_seq; | 90 uint32 chunk_seq; |
84 uint16 chunk_index; | 91 uint16 chunk_index; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 744 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
738 subtle::AtomicWord generation_; | 745 subtle::AtomicWord generation_; |
739 | 746 |
740 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 747 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
741 }; | 748 }; |
742 | 749 |
743 } // namespace debug | 750 } // namespace debug |
744 } // namespace base | 751 } // namespace base |
745 | 752 |
746 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 753 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |