| Index: src/tracing/tracing-flag.cc
|
| diff --git a/src/tracing/tracing-flag.cc b/src/tracing/tracing-flag.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ac835b1511a5ecffd9e0599a5a1ba1bbae58158d
|
| --- /dev/null
|
| +++ b/src/tracing/tracing-flag.cc
|
| @@ -0,0 +1,44 @@
|
| +// 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-flag.h"
|
| +
|
| +#include "include/v8.h"
|
| +#include "src/flags.h"
|
| +#include "src/tracing/trace-event.h"
|
| +#include "src/v8.h"
|
| +
|
| +namespace v8 {
|
| +
|
| +std::unique_ptr<Platform::TracingFlag> Platform::TracingFlag::Create() {
|
| + return std::unique_ptr<Platform::TracingFlag>(new tracing::TracingFlagImpl());
|
| +}
|
| +
|
| +namespace tracing {
|
| +
|
| +TracingFlagImpl::TracingFlagImpl()
|
| + : platform_(v8::internal::V8::GetCurrentPlatform()) {
|
| + platform_->AddTraceStateObserver(this);
|
| +}
|
| +
|
| +TracingFlagImpl::~TracingFlagImpl() {
|
| + OnTraceDisabled();
|
| + platform_->RemoveTraceStateObserver(this);
|
| +}
|
| +
|
| +void TracingFlagImpl::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 TracingFlagImpl::OnTraceDisabled() {
|
| + v8::internal::FLAG_runtime_stats &= ~ENABLED_BY_TRACING;
|
| +}
|
| +
|
| +} // namespace tracing
|
| +} // namespace v8
|
|
|