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

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

Issue 732633002: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ comments Created 6 years, 1 month 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"
7 #include "content/public/browser/power_save_blocker.h" 8 #include "content/public/browser/power_save_blocker.h"
8 9
9 namespace content { 10 namespace content {
10 11
11 namespace { 12 namespace {
12 13
13 const int kPowerSaveBlockDelaySeconds = 30; 14 const int kPowerSaveBlockDelaySeconds = 30;
14 15
15 } // namespace 16 } // namespace
16 17
17 PowerSaveBlockResourceThrottle::PowerSaveBlockResourceThrottle() { 18 PowerSaveBlockResourceThrottle::PowerSaveBlockResourceThrottle() {
18 } 19 }
19 20
20 PowerSaveBlockResourceThrottle::~PowerSaveBlockResourceThrottle() { 21 PowerSaveBlockResourceThrottle::~PowerSaveBlockResourceThrottle() {
21 } 22 }
22 23
23 void PowerSaveBlockResourceThrottle::WillStartRequest(bool* defer) { 24 void PowerSaveBlockResourceThrottle::WillStartRequest(bool* defer) {
24 // Delay PowerSaveBlocker activation to dismiss small requests. 25 // Delay PowerSaveBlocker activation to dismiss small requests.
25 timer_.Start(FROM_HERE, 26 timer_.Start(FROM_HERE,
26 base::TimeDelta::FromSeconds(kPowerSaveBlockDelaySeconds), 27 base::TimeDelta::FromSeconds(kPowerSaveBlockDelaySeconds),
27 this, 28 this,
28 &PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker); 29 &PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker);
29 } 30 }
30 31
31 void PowerSaveBlockResourceThrottle::WillProcessResponse(bool* defer) { 32 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
32 // Stop blocking power save after request finishes. 38 // Stop blocking power save after request finishes.
33 power_save_blocker_.reset(); 39 power_save_blocker_.reset();
34 timer_.Stop(); 40 timer_.Stop();
35 } 41 }
36 42
37 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const { 43 const char* PowerSaveBlockResourceThrottle::GetNameForLogging() const {
38 return "PowerSaveBlockResourceThrottle"; 44 return "PowerSaveBlockResourceThrottle";
39 } 45 }
40 46
41 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() { 47 void PowerSaveBlockResourceThrottle::ActivatePowerSaveBlocker() {
42 power_save_blocker_ = PowerSaveBlocker::Create( 48 power_save_blocker_ = PowerSaveBlocker::Create(
43 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 49 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
44 "Uploading data."); 50 "Uploading data.");
45 } 51 }
46 52
47 } // namespace content 53 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/mock_url_request_delegate.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698