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