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

Unified Diff: src/libplatform/default-platform.cc

Issue 2137013006: [Tracing] V8 Tracing Controller (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Setters for TraceConfig categories Created 4 years, 5 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/default-platform.h ('k') | src/libplatform/tracing/trace-buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/default-platform.cc
diff --git a/src/libplatform/default-platform.cc b/src/libplatform/default-platform.cc
index 71ee6bee980372a17ac6d33e5e16e794e1aa21be..2f81248ec189cefddeeb3ba7d12b898fdecdc7c4 100644
--- a/src/libplatform/default-platform.cc
+++ b/src/libplatform/default-platform.cc
@@ -29,11 +29,17 @@ bool PumpMessageLoop(v8::Platform* platform, v8::Isolate* isolate) {
return reinterpret_cast<DefaultPlatform*>(platform)->PumpMessageLoop(isolate);
}
+void SetTracingController(
+ v8::Platform* platform,
+ v8::platform::tracing::TracingController* tracing_controller) {
+ return reinterpret_cast<DefaultPlatform*>(platform)->SetTracingController(
+ tracing_controller);
+}
+
const int DefaultPlatform::kMaxThreadPoolSize = 8;
DefaultPlatform::DefaultPlatform()
- : initialized_(false), thread_pool_size_(0) {}
-
+ : initialized_(false), thread_pool_size_(0), tracing_controller_(NULL) {}
DefaultPlatform::~DefaultPlatform() {
base::LockGuard<base::Mutex> guard(&lock_);
@@ -57,6 +63,11 @@ DefaultPlatform::~DefaultPlatform() {
i->second.pop();
}
}
+
+ if (tracing_controller_) {
+ tracing_controller_->StopTracing();
+ delete tracing_controller_;
+ }
}
@@ -173,15 +184,27 @@ uint64_t DefaultPlatform::AddTraceEvent(
const char* scope, uint64_t id, uint64_t bind_id, int num_args,
const char** arg_names, const uint8_t* arg_types,
const uint64_t* arg_values, unsigned int flags) {
+ if (tracing_controller_) {
+ return tracing_controller_->AddTraceEvent(
+ phase, category_enabled_flag, name, scope, id, bind_id, num_args,
+ arg_names, arg_types, arg_values, flags);
+ }
+
return 0;
}
-
void DefaultPlatform::UpdateTraceEventDuration(
- const uint8_t* category_enabled_flag, const char* name, uint64_t handle) {}
-
+ const uint8_t* category_enabled_flag, const char* name, uint64_t handle) {
+ if (tracing_controller_) {
+ tracing_controller_->UpdateTraceEventDuration(category_enabled_flag, name,
+ handle);
+ }
+}
const uint8_t* DefaultPlatform::GetCategoryGroupEnabled(const char* name) {
+ if (tracing_controller_) {
+ return tracing_controller_->GetCategoryGroupEnabled(name);
+ }
static uint8_t no = 0;
return &no;
}
@@ -193,6 +216,10 @@ const char* DefaultPlatform::GetCategoryGroupName(
return dummy;
}
+void DefaultPlatform::SetTracingController(
+ tracing::TracingController* tracing_controller) {
+ tracing_controller_ = tracing_controller;
+}
size_t DefaultPlatform::NumberOfAvailableBackgroundThreads() {
return static_cast<size_t>(thread_pool_size_);
« no previous file with comments | « src/libplatform/default-platform.h ('k') | src/libplatform/tracing/trace-buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698