Chromium Code Reviews| Index: base/debug/trace_event_impl.h |
| diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h |
| index 7652419e1e03c4510bd3ade5c1037b6313588734..d963e45042a9c5771025692fa2d3ad55d2999ffe 100644 |
| --- a/base/debug/trace_event_impl.h |
| +++ b/base/debug/trace_event_impl.h |
| @@ -46,6 +46,19 @@ class WaitableEvent; |
| namespace debug { |
| +// For any argument of type TRACE_VALUE_TYPE_CONVERTABLE the provided |
| +// class must implement this interface. |
| +class ConvertableToJSON { |
|
nduca
2013/04/09 22:16:42
So lets call this ConvertableToTraceFormat or some
dsinclair
2013/04/10 01:09:31
Done.
|
| + public: |
| + virtual ~ConvertableToJSON() {} |
| + |
| + // Append the JSONified class info to the provided |out| string. The appended |
| + // data must be a valid JSON object. Strings must be propertly quoted, and |
| + // escaped. There is no processing applied to the content after it is |
| + // appended. |
| + virtual void ToJSON(std::string& out) const = 0; |
|
nduca
2013/04/09 22:16:42
Should this use the word Append somehow?
dsinclair
2013/04/10 01:09:31
Done.
|
| +}; |
| + |
| const int kTraceMaxNumArgs = 2; |
| // Output records are "Events" and can be obtained via the |
| @@ -74,7 +87,10 @@ class BASE_EXPORT TraceEvent { |
| const char** arg_names, |
| const unsigned char* arg_types, |
| const unsigned long long* arg_values, |
| + scoped_ptr<ConvertableToJSON> convertable_values[], |
| unsigned char flags); |
| + TraceEvent(const TraceEvent& other); |
| + TraceEvent& operator=(const TraceEvent& other); |
| ~TraceEvent(); |
| // Serialize event data to JSON |
| @@ -106,6 +122,7 @@ class BASE_EXPORT TraceEvent { |
| unsigned long long id_; |
| TraceValue arg_values_[kTraceMaxNumArgs]; |
| const char* arg_names_[kTraceMaxNumArgs]; |
| + scoped_ptr<ConvertableToJSON> convertable_values_[kTraceMaxNumArgs]; |
| const unsigned char* category_enabled_; |
| const char* name_; |
| scoped_refptr<base::RefCountedString> parameter_copy_storage_; |
|
nduca
2013/04/09 22:16:42
we can remove this in a followup
dsinclair
2013/04/10 01:09:31
Ack.
|
| @@ -318,6 +335,7 @@ class BASE_EXPORT TraceLog { |
| const char** arg_names, |
| const unsigned char* arg_types, |
| const unsigned long long* arg_values, |
| + scoped_ptr<ConvertableToJSON> convertable_values[], |
| unsigned char flags); |
| void AddTraceEventWithThreadIdAndTimestamp( |
| char phase, |
| @@ -330,6 +348,7 @@ class BASE_EXPORT TraceLog { |
| const char** arg_names, |
| const unsigned char* arg_types, |
| const unsigned long long* arg_values, |
| + scoped_ptr<ConvertableToJSON> convertable_values[], |
| unsigned char flags); |
| static void AddTraceEventEtw(char phase, |
| const char* name, |