OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/loader/power_save_block_resource_throttle.h" | 5 #include "content/browser/loader/power_save_block_resource_throttle.h" |
6 | 6 |
7 #include "content/public/browser/power_save_blocker_factory.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "device/power_save_blocker/power_save_blocker.h" |
8 | 9 |
9 namespace content { | 10 namespace content { |
10 | 11 |
11 namespace { | 12 namespace { |
12 | 13 |
13 const int kPowerSaveBlockDelaySeconds = 30; | 14 const int kPowerSaveBlockDelaySeconds = 30; |
14 | 15 |
15 } // namespace | 16 } // namespace |
16 | 17 |
17 PowerSaveBlockResourceThrottle::PowerSaveBlockResourceThrottle( | 18 PowerSaveBlockResourceThrottle::PowerSaveBlockResourceThrottle( |
(...skipping 15 matching lines...) Expand all Loading... |
33 // Stop blocking power save after request finishes. | 34 // Stop blocking power save after request finishes. |
34 power_save_blocker_.reset(); | 35 power_save_blocker_.reset(); |
35 timer_.Stop(); | 36 timer_.Stop(); |
36 } | 37 } |
37 | 38 |
38 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const { | 39 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const { |
39 return "PowerSaveBlockResourceThrottle"; | 40 return "PowerSaveBlockResourceThrottle"; |
40 } | 41 } |
41 | 42 |
42 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() { | 43 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() { |
43 power_save_blocker_ = CreatePowerSaveBlocker( | 44 power_save_blocker_ = device::PowerSaveBlocker::CreateWithTaskRunners( |
44 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 45 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
45 PowerSaveBlocker::kReasonOther, "Uploading data to " + host_); | 46 device::PowerSaveBlocker::kReasonOther, "Uploading data to " + host_, |
| 47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 48 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
46 } | 49 } |
47 | 50 |
48 } // namespace content | 51 } // namespace content |
OLD | NEW |