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

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

Issue 12226005: Minimize PowerSaveBlocker usage during uploading data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use OneShotTimer Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/loader/power_save_block_resource_throttle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ 6 #define CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
7 7
8 #include <string>
9
10 #include "base/basictypes.h" 8 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/timer.h"
13 #include "content/public/browser/resource_throttle.h" 12 #include "content/public/browser/resource_throttle.h"
14 13
15 namespace content { 14 namespace content {
16 15
17 class PowerSaveBlocker; 16 class PowerSaveBlocker;
18 17
19 // This ResourceThrottle blocks power save until request finishes. 18 // This ResourceThrottle blocks power save until large upload request finishes.
20 class PowerSaveBlockResourceThrottle : public ResourceThrottle { 19 class PowerSaveBlockResourceThrottle : public ResourceThrottle {
21 public: 20 public:
22 explicit PowerSaveBlockResourceThrottle(const std::string& reason); 21 PowerSaveBlockResourceThrottle();
23 virtual ~PowerSaveBlockResourceThrottle(); 22 virtual ~PowerSaveBlockResourceThrottle();
24 23
25 // ResourceThrottle override. 24 // ResourceThrottle overrides:
25 virtual void WillStartRequest(bool* defer) OVERRIDE;
26 virtual void WillProcessResponse(bool* defer) OVERRIDE; 26 virtual void WillProcessResponse(bool* defer) OVERRIDE;
27 27
28 private: 28 private:
29 void ActivatePowerSaveBlocker();
30
31 base::OneShotTimer<PowerSaveBlockResourceThrottle> timer_;
29 scoped_ptr<PowerSaveBlocker> power_save_blocker_; 32 scoped_ptr<PowerSaveBlocker> power_save_blocker_;
30 33
31 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle); 34 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockResourceThrottle);
32 }; 35 };
33 36
34 } // namespace content 37 } // namespace content
35 38
36 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_ 39 #endif // CONTENT_BROWSER_LOADER_POWER_SAVE_BLOCK_RESOURCE_THROTTLE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/power_save_block_resource_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698