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

Unified Diff: src/d8.cc

Issue 2436273002: [Tracing] Implement TracingCategoryObserver. (Closed)
Patch Set: rebase Created 4 years, 2 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/v8-tracing.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index 69072a22e4fcde79672050c0b99c9b05f9749866..9f45a1a25b2cece8f3c9df4b2ff72812b1978dfa 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -22,6 +22,7 @@
#include "include/libplatform/libplatform.h"
#include "include/libplatform/v8-tracing.h"
+#include "include/v8-tracing.h"
#include "src/api.h"
#include "src/base/cpu.h"
#include "src/base/debug/stack_trace.h"
@@ -152,7 +153,7 @@ class PredictablePlatform : public Platform {
v8::Platform* g_platform = NULL;
-
+std::unique_ptr<tracing::TracingCategoryObserver> g_tracing_category_observer;
static Local<Value> Throw(Isolate* isolate, const char* message) {
return isolate->ThrowException(
@@ -2878,10 +2879,14 @@ int Shell::Main(int argc, char* argv[]) {
platform::tracing::TraceConfig::CreateDefaultTraceConfig();
}
tracing_controller->Initialize(trace_buffer);
- tracing_controller->StartTracing(trace_config);
if (!i::FLAG_verify_predictable) {
platform::SetTracingController(g_platform, tracing_controller);
}
+ g_tracing_category_observer = tracing::TracingCategoryObserver::Create();
+ g_platform->AddTraceStateObserver(
+ reinterpret_cast<Platform::TraceStateObserver*>(
+ g_tracing_category_observer.get()));
+ tracing_controller->StartTracing(trace_config);
}
if (options.dump_heap_constants) {
@@ -2942,6 +2947,9 @@ int Shell::Main(int argc, char* argv[]) {
isolate->Dispose();
V8::Dispose();
V8::ShutdownPlatform();
+ g_platform->RemoveTraceStateObserver(
+ reinterpret_cast<Platform::TraceStateObserver*>(
+ g_tracing_category_observer.get()));
delete g_platform;
return result;
« no previous file with comments | « include/v8-tracing.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698