OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/devtools/devtools_cpu_throttler.h" | 5 #include "content/renderer/devtools/devtools_cpu_throttler.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #include <signal.h> | 8 #include <signal.h> |
9 #define USE_SIGNALS | 9 #define USE_SIGNALS |
10 #endif | 10 #endif |
11 | 11 |
12 #include "base/atomicops.h" | 12 #include "base/atomicops.h" |
| 13 #include "base/macros.h" |
13 #include "base/synchronization/cancellation_flag.h" | 14 #include "base/synchronization/cancellation_flag.h" |
14 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "build/build_config.h" |
15 | 17 |
16 using base::subtle::Atomic32; | 18 using base::subtle::Atomic32; |
17 using base::subtle::Acquire_Load; | 19 using base::subtle::Acquire_Load; |
18 using base::subtle::Release_Store; | 20 using base::subtle::Release_Store; |
19 | 21 |
20 namespace content { | 22 namespace content { |
21 | 23 |
22 class CPUThrottlingThread final : public base::PlatformThread::Delegate { | 24 class CPUThrottlingThread final : public base::PlatformThread::Delegate { |
23 public: | 25 public: |
24 explicit CPUThrottlingThread(double rate); | 26 explicit CPUThrottlingThread(double rate); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return; | 178 return; |
177 } | 179 } |
178 if (throttling_thread_) { | 180 if (throttling_thread_) { |
179 throttling_thread_->SetThrottlingRate(rate); | 181 throttling_thread_->SetThrottlingRate(rate); |
180 } else { | 182 } else { |
181 throttling_thread_.reset(new CPUThrottlingThread(rate)); | 183 throttling_thread_.reset(new CPUThrottlingThread(rate)); |
182 } | 184 } |
183 } | 185 } |
184 | 186 |
185 } // namespace content | 187 } // namespace content |
OLD | NEW |