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

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

Issue 2893873002: Convert PowerSaveBlockResourceThrottle to be client of WakeLock mojo service. (Closed)
Patch Set: Addressed Charlie's comments. 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_WAKE_LOCK_RESOURCE_THROTTLE_H_
6 #define CONTENT_BROWSER_LOADER_WAKE_LOCK_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/timer/timer.h"
14 #include "content/public/browser/resource_throttle.h"
15 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
16
17 namespace content {
18
19 // This ResourceThrottle holds wake lock until large upload request finishes.
20 class WakeLockResourceThrottle : public ResourceThrottle {
21 public:
22 WakeLockResourceThrottle(const std::string& host);
23 ~WakeLockResourceThrottle() override;
24
25 // ResourceThrottle overrides:
26 void WillStartRequest(bool* defer) override;
27 void WillProcessResponse(bool* defer) override;
28 const char* GetNameForLogging() const override;
29
30 private:
31 void RequestWakeLock();
32
33 const std::string host_;
34 base::OneShotTimer timer_;
35
36 // Destruction of wake_lock_ will trigger
Charlie Harrison 2017/05/18 16:43:49 Suggested rephrasing: Destruction of wake_lock_ wi
ke.he 2017/05/19 03:35:52 Done.
37 // WakeLockServicImpl::OnConnectionError in remote Device Service side, in
38 // which the wake lock is well updated. So no need to call CancelWakeLock() in
39 // destructor of this class.
40 device::mojom::WakeLockServicePtr wake_lock_;
41
42 DISALLOW_COPY_AND_ASSIGN(WakeLockResourceThrottle);
43 };
44
45 } // namespace content
46
47 #endif // CONTENT_BROWSER_LOADER_WAKE_LOCK_RESOURCE_THROTTLE_H_
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/wake_lock_resource_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698