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..d9f8f1ccdf04c433a5f8a973be2eb8943271fcbb 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 ConvertableToTraceFormat { |
+ public: |
+ virtual ~ConvertableToTraceFormat() {} |
+ |
+ // Append the 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 AppendAsTraceFormat(std::string* out) const = 0; |
+}; |
+ |
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<ConvertableToTraceFormat> 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<ConvertableToTraceFormat> convertable_values_[kTraceMaxNumArgs]; |
const unsigned char* category_enabled_; |
const char* name_; |
scoped_refptr<base::RefCountedString> parameter_copy_storage_; |
@@ -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<ConvertableToTraceFormat> 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<ConvertableToTraceFormat> convertable_values[], |
unsigned char flags); |
static void AddTraceEventEtw(char phase, |
const char* name, |