namespace {
+// TraceLog category for NetLog events.
+const char kNetLogTracingCategory[] = TRACE_DISABLED_BY_DEFAULT("netlog");
+
class TracedValue : public base::debug::ConvertableToTraceFormat {
public:
explicit TracedValue(scoped_ptr<base::Value> value) : value_(value.Pass()) {}
private:
- virtual ~TracedValue() {}
+ ~TracedValue() override {}
- virtual void AppendAsTraceFormat(std::string* out) const OVERRIDE {
+ void AppendAsTraceFormat(std::string* out) const override {
if (value_) {
std::string tmp;
base::JSONWriter::Write(value_.get(), &tmp);
switch (entry.phase()) {
case NetLog::PHASE_BEGIN:
TRACE_EVENT_NESTABLE_ASYNC_BEGIN2(
- "netlog", NetLog::EventTypeToString(entry.type()), entry.source().id,
+ kNetLogTracingCategory,
+ NetLog::EventTypeToString(entry.type()), entry.source().id,
"source_type", NetLog::SourceTypeToString(entry.source().type),
"params", scoped_refptr<base::debug::ConvertableToTraceFormat>(
new TracedValue(params.Pass())));
break;
case NetLog::PHASE_END:
TRACE_EVENT_NESTABLE_ASYNC_END2(
- "netlog", NetLog::EventTypeToString(entry.type()), entry.source().id,
+ kNetLogTracingCategory,
+ NetLog::EventTypeToString(entry.type()), entry.source().id,
"source_type", NetLog::SourceTypeToString(entry.source().type),
"params", scoped_refptr<base::debug::ConvertableToTraceFormat>(
new TracedValue(params.Pass())));
break;
case NetLog::PHASE_NONE:
TRACE_EVENT_NESTABLE_ASYNC_INSTANT2(
- "netlog", NetLog::EventTypeToString(entry.type()), entry.source().id,
+ kNetLogTracingCategory,
+ NetLog::EventTypeToString(entry.type()), entry.source().id,
"source_type", NetLog::SourceTypeToString(entry.source().type),
"params", scoped_refptr<base::debug::ConvertableToTraceFormat>(
new TracedValue(params.Pass())));