| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/profiling.h" | 5 #include "chrome/common/profiling.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/profiler.h" | 10 #include "base/debug/profiler.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 base::Thread* thread_; | 86 base::Thread* thread_; |
| 87 base::Lock lock_; | 87 base::Lock lock_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(ProfilingThreadControl); | 89 DISALLOW_COPY_AND_ASSIGN(ProfilingThreadControl); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 base::LazyInstance<ProfilingThreadControl, | 92 base::LazyInstance<ProfilingThreadControl, |
| 93 base::LeakyLazyInstanceTraits<ProfilingThreadControl> > | 93 base::LeakyLazyInstanceTraits<ProfilingThreadControl> > |
| 94 g_flush_thread_control(base::LINKER_INITIALIZED); | 94 g_flush_thread_control = LAZY_INSTANCE_INITIALIZER; |
| 95 | 95 |
| 96 } // namespace | 96 } // namespace |
| 97 | 97 |
| 98 // static | 98 // static |
| 99 void Profiling::ProcessStarted() { | 99 void Profiling::ProcessStarted() { |
| 100 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 100 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 101 std::string process_type = | 101 std::string process_type = |
| 102 command_line.GetSwitchValueASCII(switches::kProcessType); | 102 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 103 | 103 |
| 104 if (command_line.HasSwitch(switches::kProfilingAtStart)) { | 104 if (command_line.HasSwitch(switches::kProfilingAtStart)) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 132 return base::debug::BeingProfiled(); | 132 return base::debug::BeingProfiled(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 void Profiling::Toggle() { | 136 void Profiling::Toggle() { |
| 137 if (BeingProfiled()) | 137 if (BeingProfiled()) |
| 138 Stop(); | 138 Stop(); |
| 139 else | 139 else |
| 140 Start(); | 140 Start(); |
| 141 } | 141 } |
| OLD | NEW |