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

Side by Side Diff: src/tracing/tracing-flag.cc

Issue 2436273002: [Tracing] Implement TracingCategoryObserver. (Closed)
Patch Set: fix compilation error 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "src/tracing/tracing-flag.h"
6
7 #include "include/v8.h"
8 #include "src/flags.h"
9 #include "src/tracing/trace-event.h"
10 #include "src/v8.h"
11
12 namespace v8 {
13
14 std::unique_ptr<Platform::TracingFlag> Platform::TracingFlag::Create() {
15 return std::unique_ptr<Platform::TracingFlag>(new tracing::TracingFlagImpl());
16 }
17
18 namespace tracing {
19
20 TracingFlagImpl::TracingFlagImpl()
21 : platform_(v8::internal::V8::GetCurrentPlatform()) {
22 platform_->AddTraceStateObserver(this);
23 }
24
25 TracingFlagImpl::~TracingFlagImpl() {
26 OnTraceDisabled();
27 platform_->RemoveTraceStateObserver(this);
28 }
29
30 void TracingFlagImpl::OnTraceEnabled() {
31 bool enabled = false;
32 TRACE_EVENT_CATEGORY_GROUP_ENABLED(
33 TRACE_DISABLED_BY_DEFAULT("v8.runtime_stats"), &enabled);
34 if (enabled) {
35 v8::internal::FLAG_runtime_stats |= ENABLED_BY_TRACING;
36 }
37 }
38
39 void TracingFlagImpl::OnTraceDisabled() {
40 v8::internal::FLAG_runtime_stats &= ~ENABLED_BY_TRACING;
41 }
42
43 } // namespace tracing
44 } // namespace v8
OLDNEW
« src/flag-definitions.h ('K') | « src/tracing/tracing-flag.h ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698