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

Unified Diff: src/libplatform/tracing/trace-writer.cc

Issue 2367603002: [tracing] Support ConvertableToTraceFormat argument type. (Closed)
Patch Set: Fix layout tests failures & reland. Created 4 years, 3 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 | « src/libplatform/tracing/trace-writer.h ('k') | src/libplatform/tracing/tracing-controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/tracing/trace-writer.cc
diff --git a/src/libplatform/tracing/trace-writer.cc b/src/libplatform/tracing/trace-writer.cc
index ec95527d5f6a892e4cc9437b5f526af471219830..7445087c565850395b89b0ddc9b78be764743563 100644
--- a/src/libplatform/tracing/trace-writer.cc
+++ b/src/libplatform/tracing/trace-writer.cc
@@ -7,6 +7,7 @@
#include <cmath>
#include "base/trace_event/common/trace_event_common.h"
+#include "include/v8-platform.h"
#include "src/base/platform/platform.h"
namespace v8 {
@@ -112,6 +113,12 @@ void JSONTraceWriter::AppendArgValue(uint8_t type,
}
}
+void JSONTraceWriter::AppendArgValue(ConvertableToTraceFormat* value) {
+ std::string arg_stringified;
+ value->AppendAsTraceFormat(&arg_stringified);
+ stream_ << arg_stringified;
+}
+
JSONTraceWriter::JSONTraceWriter(std::ostream& stream) : stream_(stream) {
stream_ << "{\"traceEvents\":[";
}
@@ -143,10 +150,16 @@ void JSONTraceWriter::AppendTraceEvent(TraceObject* trace_event) {
const char** arg_names = trace_event->arg_names();
const uint8_t* arg_types = trace_event->arg_types();
TraceObject::ArgValue* arg_values = trace_event->arg_values();
+ std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables =
+ trace_event->arg_convertables();
for (int i = 0; i < trace_event->num_args(); ++i) {
if (i > 0) stream_ << ",";
stream_ << "\"" << arg_names[i] << "\":";
- AppendArgValue(arg_types[i], arg_values[i]);
+ if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
+ AppendArgValue(arg_convertables[i].get());
+ } else {
+ AppendArgValue(arg_types[i], arg_values[i]);
+ }
}
stream_ << "}}";
// TODO(fmeawad): Add support for Flow Events.
« no previous file with comments | « src/libplatform/tracing/trace-writer.h ('k') | src/libplatform/tracing/tracing-controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698