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

Unified Diff: components/offline_pages/background/request_coordinator.cc

Issue 2450293002: Tune web page background fetching (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/background/request_coordinator.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index 5b12e4443f6e20ab5b96b28de9ba227085c20b5c..33374fbf323c1d12796f837522972bf72a8b978b 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -211,6 +211,14 @@ void RequestCoordinator::StopPrerendering(Offliner::RequestStatus stop_status) {
if (offliner_ && is_busy_) {
DCHECK(active_request_.get());
offliner_->Cancel();
+
+ // If we timed out, let the offliner done callback handle it.
+ if (stop_status == Offliner::RequestStatus::REQUEST_COORDINATOR_TIMED_OUT) {
dougarnett 2016/10/26 23:23:26 It would be good to break this change out into a s
Pete Williamson 2016/10/28 00:39:44 Done. I think we should check it in anyway, since
+ return;
+ }
+
+ // Otherwise, this attempt never really had a chance to run, mark it
+ // aborted.
AbortRequestAttempt(active_request_.get());
}
@@ -487,22 +495,15 @@ RequestCoordinator::TryImmediateStart() {
// Make sure we are not on svelte device to start immediately.
if (is_low_end_device_) {
+ DVLOG(2) << "low end device, returning";
// Let the scheduler know we are done processing and failed due to svelte.
immediate_schedule_callback_.Run(false);
return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE;
}
- // Make sure we have reasonable network quality (or at least a connection).
- if (network_quality_estimator_) {
- // TODO(dougarnett): Add UMA for quality type experienced.
- net::EffectiveConnectionType quality =
- network_quality_estimator_->GetEffectiveConnectionType();
- if (quality < net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_2G)
- return OfflinerImmediateStartStatus::WEAK_CONNECTION;
- } else if (GetConnectionType() ==
- net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE) {
+ if (GetConnectionType() ==
+ net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE)
return OfflinerImmediateStartStatus::NO_CONNECTION;
- }
// Start processing with manufactured conservative battery conditions
// (i.e., assume no battery).
@@ -537,6 +538,7 @@ void RequestCoordinator::TryNextRequest() {
// Let the scheduler know we are done processing.
// TODO: Make sure the scheduler callback is valid before running it.
scheduler_callback_.Run(true);
+ DVLOG(2) << " out of time, giving up. " << __func__;
return;
}
@@ -553,6 +555,7 @@ void RequestCoordinator::TryNextRequest() {
// Called by the request picker when a request has been picked.
void RequestCoordinator::RequestPicked(const SavePageRequest& request) {
+ DVLOG(2) << request.url() << " " << __func__;
is_starting_ = false;
// Make sure we were not stopped while picking.
@@ -564,6 +567,7 @@ void RequestCoordinator::RequestPicked(const SavePageRequest& request) {
void RequestCoordinator::RequestNotPicked(
bool non_user_requested_tasks_remaining) {
+ DVLOG(2) << __func__;
is_starting_ = false;
// Clear the outstanding "safety" task in the scheduler.

Powered by Google App Engine
This is Rietveld 408576698