Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3133)

Unified Diff: base/debug/trace_event_impl.h

Issue 13590005: Add a ConvertableToTraceFormat type to the trace framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « base/debug/trace_event.h ('k') | base/debug/trace_event_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698