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