1 // Copyright (c) 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 #ifndef CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_ 6 #define CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_ 7 8 #include "base/files/file_path.h" 9 #include "base/tracked_objects.h" 10 11 //------------------------------------------------------------------------------ 12 // Provide simple way to to start global tracking, and to tear down tracking 13 // when done. The design has evolved to *not* do any teardown (and just leak 14 // all allocated data structures). This class is currently used to ensure 15 // that the profiler data is output during shutdown, if this feature has been 16 // requested. 17 18 namespace task_profiler { 19 20 class AutoTracking { 21 public: 22 AutoTracking() { 23 tracked_objects::ThreadData::Initialize(); 24 } 25 26 ~AutoTracking(); 27 28 void set_output_file_path(const base::FilePath &path); 29 30 private: 31 base::FilePath output_file_path_; 32 33 DISALLOW_COPY_AND_ASSIGN(AutoTracking); 34 }; 35 36 } // namespace task_profiler 37 38 #endif // CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_ 39