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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ConvertableToTraceFormat : public RefCounted<ConvertableToTraceFormat> { |
68 public: | 68 public: |
69 // Append the class info to the provided |out| string. The appended | 69 // 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 | 70 // 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 | 71 // escaped. There is no processing applied to the content after it is |
72 // appended. | 72 // appended. |
73 virtual void AppendAsTraceFormat(std::string* out) const = 0; | 73 virtual void AppendAsTraceFormat(std::string* out) const = 0; |
74 | 74 |
| 75 std::string ToString() const { |
| 76 std::string result; |
| 77 AppendAsTraceFormat(&result); |
| 78 return result; |
| 79 } |
| 80 |
75 protected: | 81 protected: |
76 virtual ~ConvertableToTraceFormat() {} | 82 virtual ~ConvertableToTraceFormat() {} |
77 | 83 |
78 private: | 84 private: |
79 friend class RefCounted<ConvertableToTraceFormat>; | 85 friend class RefCounted<ConvertableToTraceFormat>; |
80 }; | 86 }; |
81 | 87 |
82 struct TraceEventHandle { | 88 struct TraceEventHandle { |
83 uint32 chunk_seq; | 89 uint32 chunk_seq; |
84 uint16 chunk_index; | 90 uint16 chunk_index; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; | 743 scoped_refptr<MessageLoopProxy> flush_message_loop_proxy_; |
738 subtle::AtomicWord generation_; | 744 subtle::AtomicWord generation_; |
739 | 745 |
740 DISALLOW_COPY_AND_ASSIGN(TraceLog); | 746 DISALLOW_COPY_AND_ASSIGN(TraceLog); |
741 }; | 747 }; |
742 | 748 |
743 } // namespace debug | 749 } // namespace debug |
744 } // namespace base | 750 } // namespace base |
745 | 751 |
746 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ | 752 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ |
OLD | NEW |