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 "content/browser/power_save_blocker.h" | 5 #include "content/browser/power_save_blocker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 | 9 |
10 // Accessed only from the UI thread. | 10 // Accessed only from the UI thread. |
11 int PowerSaveBlocker::blocker_count_[kPowerSaveBlockPreventStateCount]; | 11 int PowerSaveBlocker::blocker_count_[kPowerSaveBlockPreventStateCount]; |
12 | 12 |
13 PowerSaveBlocker::PowerSaveBlocker(PowerSaveBlockerType type) : type_(type) { | 13 PowerSaveBlocker::PowerSaveBlocker(PowerSaveBlockerType type) : type_(type) { |
14 DCHECK_LT(kPowerSaveBlockPreventNone, type); | 14 DCHECK_LT(kPowerSaveBlockPreventNone, type); |
15 DCHECK_GT(kPowerSaveBlockPreventStateCount, type); | 15 DCHECK_GT(kPowerSaveBlockPreventStateCount, type); |
16 std::vector<int> change(kPowerSaveBlockPreventStateCount); | 16 std::vector<int> change(kPowerSaveBlockPreventStateCount); |
17 ++change[type_]; | 17 ++change[type_]; |
18 PostAdjustBlockCount(change); | 18 PostAdjustBlockCount(change); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 for (PowerSaveBlockerType t = kPowerSaveBlockPreventDisplaySleep; | 54 for (PowerSaveBlockerType t = kPowerSaveBlockPreventDisplaySleep; |
55 t >= kPowerSaveBlockPreventSystemSleep; | 55 t >= kPowerSaveBlockPreventSystemSleep; |
56 t = static_cast<PowerSaveBlockerType>(t - 1)) { | 56 t = static_cast<PowerSaveBlockerType>(t - 1)) { |
57 if (blocker_count_[t]) | 57 if (blocker_count_[t]) |
58 return t; | 58 return t; |
59 } | 59 } |
60 | 60 |
61 return kPowerSaveBlockPreventNone; | 61 return kPowerSaveBlockPreventNone; |
62 } | 62 } |
OLD | NEW |