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

Unified Diff: src/tracing/tracing-category-observer.cc

Issue 2471583004: [Tracing] Make TracingCategoryObserver v8 internal. (Closed)
Patch Set: use unique_ptr Created 4 years, 1 month 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
Index: src/tracing/tracing-category-observer.cc
diff --git a/src/tracing/tracing-category-observer.cc b/src/tracing/tracing-category-observer.cc
index f9315b4ce456beb5d55b0b02c6ca06d00e6b006e..9a318bd699a8082121541a0560fc39992572d852 100644
--- a/src/tracing/tracing-category-observer.cc
+++ b/src/tracing/tracing-category-observer.cc
@@ -4,7 +4,6 @@
#include "src/tracing/tracing-category-observer.h"
-#include "include/v8.h"
#include "src/flags.h"
#include "src/tracing/trace-event.h"
#include "src/v8.h"
@@ -12,18 +11,21 @@
namespace v8 {
namespace tracing {
-std::unique_ptr<TracingCategoryObserver> TracingCategoryObserver::Create() {
- return std::unique_ptr<TracingCategoryObserver>(
- new TracingCategoryObserverImpl());
-}
+TracingCategoryObserver* TracingCategoryObserver::instance_ = nullptr;
-TracingCategoryObserverImpl::TracingCategoryObserverImpl() {}
+void TracingCategoryObserver::SetUp() {
+ TracingCategoryObserver::instance_ = new TracingCategoryObserver();
+ v8::internal::V8::GetCurrentPlatform()->AddTraceStateObserver(
+ TracingCategoryObserver::instance_);
+}
-TracingCategoryObserverImpl::~TracingCategoryObserverImpl() {
- OnTraceDisabled();
+void TracingCategoryObserver::TearDown() {
+ v8::internal::V8::GetCurrentPlatform()->RemoveTraceStateObserver(
+ TracingCategoryObserver::instance_);
+ delete TracingCategoryObserver::instance_;
}
-void TracingCategoryObserverImpl::OnTraceEnabled() {
+void TracingCategoryObserver::OnTraceEnabled() {
bool enabled = false;
TRACE_EVENT_CATEGORY_GROUP_ENABLED(
TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), &enabled);
@@ -32,7 +34,7 @@ void TracingCategoryObserverImpl::OnTraceEnabled() {
}
}
-void TracingCategoryObserverImpl::OnTraceDisabled() {
+void TracingCategoryObserver::OnTraceDisabled() {
v8::internal::FLAG_runtime_stats &= ~ENABLED_BY_TRACING;
}
« src/d8.cc ('K') | « src/tracing/tracing-category-observer.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698