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

Unified Diff: include/v8-platform.h

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 | « include/libplatform/v8-tracing.h ('k') | src/libplatform/default-platform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8-platform.h
diff --git a/include/v8-platform.h b/include/v8-platform.h
index d0b7aed8fc5a333bbef5281f8969db521e91c7af..e11567488b6a3ca45780d52d11d6d1b3696b44ba 100644
--- a/include/v8-platform.h
+++ b/include/v8-platform.h
@@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
+#include <string>
namespace v8 {
@@ -17,24 +19,38 @@ class Isolate;
*/
class Task {
public:
- virtual ~Task() {}
+ virtual ~Task() = default;
virtual void Run() = 0;
};
-
/**
-* An IdleTask represents a unit of work to be performed in idle time.
-* The Run method is invoked with an argument that specifies the deadline in
-* seconds returned by MonotonicallyIncreasingTime().
-* The idle task is expected to complete by this deadline.
-*/
+ * An IdleTask represents a unit of work to be performed in idle time.
+ * The Run method is invoked with an argument that specifies the deadline in
+ * seconds returned by MonotonicallyIncreasingTime().
+ * The idle task is expected to complete by this deadline.
+ */
class IdleTask {
public:
- virtual ~IdleTask() {}
+ virtual ~IdleTask() = default;
virtual void Run(double deadline_in_seconds) = 0;
};
+/**
+ * The interface represents complex arguments to trace events.
+ */
+class ConvertableToTraceFormat {
+ public:
+ virtual ~ConvertableToTraceFormat() = default;
+
+ /**
+ * Append the class info to the provided |out| string. The appended
+ * data must be a valid JSON object. Strings must be properly quoted, and
+ * escaped. There is no processing applied to the content after it is
+ * appended.
+ */
+ virtual void AppendAsTraceFormat(std::string* out) const = 0;
+};
/**
* V8 Platform abstraction layer.
@@ -54,7 +70,7 @@ class Platform {
kLongRunningTask
};
- virtual ~Platform() {}
+ virtual ~Platform() = default;
/**
* Gets the number of threads that are used to execute background tasks. Is
@@ -159,6 +175,25 @@ class Platform {
}
/**
+ * Adds a trace event to the platform tracing system. This function call is
+ * usually the result of a TRACE_* macro from trace_event_common.h when
+ * tracing and the category of the particular trace are enabled. It is not
+ * advisable to call this function on its own; it is really only meant to be
+ * used by the trace macros. The returned handle can be used by
+ * UpdateTraceEventDuration to update the duration of COMPLETE events.
+ */
+ virtual uint64_t AddTraceEvent(
+ char phase, const uint8_t* category_enabled_flag, const char* name,
+ const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values,
+ std::unique_ptr<ConvertableToTraceFormat>* arg_convertables,
+ unsigned int flags) {
+ return AddTraceEvent(phase, category_enabled_flag, name, scope, id, bind_id,
+ num_args, arg_names, arg_types, arg_values, flags);
+ }
+
+ /**
* Sets the duration field of a COMPLETE trace event. It must be called with
* the handle returned from AddTraceEvent().
**/
« no previous file with comments | « include/libplatform/v8-tracing.h ('k') | src/libplatform/default-platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698