1// Copyright 2012 The Chromium 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 "base/allocator/type_profiler_control.h"
6
7namespace base {
8namespace type_profiler {
9
10namespace {
11
12#if defined(TYPE_PROFILING)
13const bool kTypeProfilingEnabled = true;
14#else
15const bool kTypeProfilingEnabled = false;
16#endif
17
18bool g_enable_intercept = kTypeProfilingEnabled;
19
20}  // namespace
21
22// static
23void Controller::Stop() {
24  g_enable_intercept = false;
25}
26
27// static
28bool Controller::IsProfiling() {
29  return kTypeProfilingEnabled && g_enable_intercept;
30}
31
32// static
33void Controller::Restart() {
34  g_enable_intercept = kTypeProfilingEnabled;
35}
36
37}  // namespace type_profiler
38}  // namespace base
39