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

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

Issue 2429213009: Fix occasional crash in TryNextRequest (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d1d380b005043d4a541073c48f6832a005653476..829fc85a3a68d28ba235b499e80cebe15fd99b48 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -136,6 +136,7 @@ RequestCoordinator::RequestCoordinator(
network_quality_estimator_(network_quality_estimator),
active_request_(nullptr),
last_offlining_status_(Offliner::RequestStatus::UNKNOWN),
+ scheduler_callback_(base::Bind(&EmptySchedulerCallback)),
immediate_schedule_callback_(base::Bind(&EmptySchedulerCallback)),
weak_ptr_factory_(this) {
DCHECK(policy_ != nullptr);
@@ -239,6 +240,7 @@ bool RequestCoordinator::CancelActiveRequestIfItMatches(
if (request_ids.end() != std::find(request_ids.begin(), request_ids.end(),
active_request_->request_id())) {
StopPrerendering(Offliner::RequestStatus::REQUEST_COORDINATOR_CANCELED);
+ active_request_.reset(nullptr);
return true;
}
}
@@ -485,6 +487,7 @@ void RequestCoordinator::TryNextRequest() {
is_starting_ = false;
// Let the scheduler know we are done processing.
+ // TODO: Make sure the scheduler callback is valid before running it.
dougarnett 2016/10/21 16:46:02 wonder if we could base on processing_state != STO
scheduler_callback_.Run(true);
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698