Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: content/browser/loader/power_save_block_resource_throttle.h

Issue 2893873002: Convert PowerSaveBlockResourceThrottle to be client of WakeLock mojo service. (Closed)
Patch Set: Convert PowerSaveBlockResourceThrottle to be client of WakeLock mojo service. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/compiler_specific.h"
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/sequenced_task_runner.h"
15 #include "base/single_thread_task_runner.h"
16 #include "base/timer/timer.h"
17 #include "content/public/browser/resource_throttle.h"
18
19 namespace device {
20 class PowerSaveBlocker;
21 } // namespace device
22
23 namespace content {
24
25 // This ResourceThrottle blocks power save until large upload request finishes.
26 class PowerSaveBlockResourceThrottle : public ResourceThrottle {
27 public:
28 PowerSaveBlockResourceThrottle(
29 const std::string& host,
30 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
31 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner);
32 ~PowerSaveBlockResourceThrottle() override;
33
34 // ResourceThrottle overrides:
35 void WillStartRequest(bool* defer) override;
36 void WillProcessResponse(bool* defer) override;
37 const char* GetNameForLogging() const override;
38
39 private:
40 void ActivatePowerSaveBlocker();
41
42 const std::string host_;
43 base::OneShotTimer timer_;
44 std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_;
45 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
46 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner_;
47
48 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
OLDNEW
« no previous file with comments | « content/browser/loader/DEPS ('k') | content/browser/loader/power_save_block_resource_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698