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

Unified Diff: src/tracing/tracing-category-observer.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 | « src/tracing/tracing-category-observer.h ('k') | src/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/tracing/tracing-category-observer.cc
diff --git a/src/tracing/tracing-category-observer.cc b/src/tracing/tracing-category-observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f9315b4ce456beb5d55b0b02c6ca06d00e6b006e
--- /dev/null
+++ b/src/tracing/tracing-category-observer.cc
@@ -0,0 +1,40 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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"
+
+namespace v8 {
+namespace tracing {
+
+std::unique_ptr<TracingCategoryObserver> TracingCategoryObserver::Create() {
+ return std::unique_ptr<TracingCategoryObserver>(
+ new TracingCategoryObserverImpl());
+}
+
+TracingCategoryObserverImpl::TracingCategoryObserverImpl() {}
+
+TracingCategoryObserverImpl::~TracingCategoryObserverImpl() {
+ OnTraceDisabled();
+}
+
+void TracingCategoryObserverImpl::OnTraceEnabled() {
+ bool enabled = false;
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(
+ TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), &enabled);
+ if (enabled) {
+ v8::internal::FLAG_runtime_stats |= ENABLED_BY_TRACING;
+ }
+}
+
+void TracingCategoryObserverImpl::OnTraceDisabled() {
+ v8::internal::FLAG_runtime_stats &= ~ENABLED_BY_TRACING;
+}
+
+} // namespace tracing
+} // namespace v8
« no previous file with comments | « src/tracing/tracing-category-observer.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698