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