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

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

Issue 2369073003: [tracing] Implement Add/RemoveTraceStateObserver for default platform. (Closed)
Patch Set: addressing comments. 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/default-platform.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/default-platform.cc
diff --git a/src/libplatform/default-platform.cc b/src/libplatform/default-platform.cc
index 2f81248ec189cefddeeb3ba7d12b898fdecdc7c4..8686023f9dff0030faed46390520e362157fbc43 100644
--- a/src/libplatform/default-platform.cc
+++ b/src/libplatform/default-platform.cc
@@ -39,9 +39,14 @@ void SetTracingController(
const int DefaultPlatform::kMaxThreadPoolSize = 8;
DefaultPlatform::DefaultPlatform()
- : initialized_(false), thread_pool_size_(0), tracing_controller_(NULL) {}
+ : initialized_(false), thread_pool_size_(0) {}
DefaultPlatform::~DefaultPlatform() {
+ if (tracing_controller_) {
+ tracing_controller_->StopTracing();
+ tracing_controller_.reset();
+ }
+
base::LockGuard<base::Mutex> guard(&lock_);
queue_.Terminate();
if (initialized_) {
@@ -63,11 +68,6 @@ DefaultPlatform::~DefaultPlatform() {
i->second.pop();
}
}
-
- if (tracing_controller_) {
- tracing_controller_->StopTracing();
- delete tracing_controller_;
- }
}
@@ -218,12 +218,22 @@ const char* DefaultPlatform::GetCategoryGroupName(
void DefaultPlatform::SetTracingController(
tracing::TracingController* tracing_controller) {
- tracing_controller_ = tracing_controller;
+ tracing_controller_.reset(tracing_controller);
}
size_t DefaultPlatform::NumberOfAvailableBackgroundThreads() {
return static_cast<size_t>(thread_pool_size_);
}
+void DefaultPlatform::AddTraceStateObserver(TraceStateObserver* observer) {
+ if (!tracing_controller_) return;
+ tracing_controller_->AddTraceStateObserver(observer);
+}
+
+void DefaultPlatform::RemoveTraceStateObserver(TraceStateObserver* observer) {
+ if (!tracing_controller_) return;
+ tracing_controller_->RemoveTraceStateObserver(observer);
+}
+
} // namespace platform
} // namespace v8
« no previous file with comments | « src/libplatform/default-platform.h ('k') | src/libplatform/tracing/tracing-controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698