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

Unified Diff: base/debug/trace_event.cc

Issue 7767014: Added support to trace_event for passing static string arguments without copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 4 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
Index: base/debug/trace_event.cc
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index c983df9a4468e416f6a331aa634906db9d6fd0ca..747225d4f0b07cad97830cd8c71e30efd2929a62 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -83,9 +83,10 @@ void TraceValue::AppendAsJSON(std::string* out) const {
*out += temp_string;
break;
case TRACE_TYPE_STRING:
+ case TRACE_TYPE_STATIC_STRING:
*out += "\"";
start_pos = out->size();
- *out += as_string();
+ *out += as_string()? as_string() : "NULL";
// replace " character with '
while ((start_pos = out->find_first_of('\"', start_pos)) !=
std::string::npos)
@@ -440,28 +441,6 @@ int TraceLog::AddTraceEvent(TraceEventPhase phase,
return ret_begin_id;
}
-void TraceLog::AddTraceEventEtw(TraceEventPhase phase,
- const char* name,
- const void* id,
- const char* extra) {
- // Legacy trace points on windows called to ETW
-#if defined(OS_WIN)
- TraceEventETWProvider::Trace(name, phase, id, extra);
-#endif
-
- // Also add new trace event behavior
- static const TraceCategory* category = GetCategory("ETW Trace Event");
- if (category->enabled) {
- TraceLog* tracelog = TraceLog::GetInstance();
- if (!tracelog)
- return;
- tracelog->AddTraceEvent(phase, category, name,
- "id", id,
- "extra", extra ? extra : "",
- -1, 0, false);
- }
-}
-
void TraceLog::AddCurrentMetadataEvents() {
lock_.AssertAcquired();
for(base::hash_map<PlatformThreadId, std::string>::iterator it =
@@ -474,7 +453,7 @@ void TraceLog::AddCurrentMetadataEvents() {
it->first,
TimeTicks(), base::debug::TRACE_EVENT_PHASE_METADATA,
g_category_metadata, "thread_name",
- "name", it->second.c_str(),
+ "name", it->second,
NULL, 0,
false));
}

Powered by Google App Engine
This is Rietveld 408576698