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

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

Issue 1062413002: Remove unnecessary instrumentation for several jank bugs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fixes Created 5 years, 8 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
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 "base/profiler/scoped_tracker.h"
8 #include "content/public/browser/power_save_blocker.h" 7 #include "content/public/browser/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() {
19 } 18 }
20 19
21 PowerSaveBlockResourceThrottle::~PowerSaveBlockResourceThrottle() { 20 PowerSaveBlockResourceThrottle::~PowerSaveBlockResourceThrottle() {
22 } 21 }
23 22
24 void PowerSaveBlockResourceThrottle::WillStartRequest(bool* defer) { 23 void PowerSaveBlockResourceThrottle::WillStartRequest(bool* defer) {
25 // Delay PowerSaveBlocker activation to dismiss small requests. 24 // Delay PowerSaveBlocker activation to dismiss small requests.
26 timer_.Start(FROM_HERE, 25 timer_.Start(FROM_HERE,
27 base::TimeDelta::FromSeconds(kPowerSaveBlockDelaySeconds), 26 base::TimeDelta::FromSeconds(kPowerSaveBlockDelaySeconds),
28 this, 27 this,
29 &PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker); 28 &PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker);
30 } 29 }
31 30
32 void PowerSaveBlockResourceThrottle::WillProcessResponse(bool* defer) { 31 void PowerSaveBlockResourceThrottle::WillProcessResponse(bool* defer) {
33 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed.
34 tracked_objects::ScopedTracker tracking_profile(
35 FROM_HERE_WITH_EXPLICIT_FUNCTION(
36 "422516 PowerSaveBlockResourceThrottle::WillProcessResponse"));
37
38 // Stop blocking power save after request finishes. 32 // Stop blocking power save after request finishes.
39 power_save_blocker_.reset(); 33 power_save_blocker_.reset();
40 timer_.Stop(); 34 timer_.Stop();
41 } 35 }
42 36
43 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const { 37 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const {
44 return "PowerSaveBlockResourceThrottle"; 38 return "PowerSaveBlockResourceThrottle";
45 } 39 }
46 40
47 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() { 41 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() {
48 power_save_blocker_ = PowerSaveBlocker::Create( 42 power_save_blocker_ = PowerSaveBlocker::Create(
49 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 43 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
50 PowerSaveBlocker::kReasonOther, "Uploading data"); 44 PowerSaveBlocker::kReasonOther, "Uploading data");
51 } 45 }
52 46
53 } // namespace content 47 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/shader_disk_cache.cc ('k') | content/browser/renderer_host/p2p/socket_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698