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

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

Issue 2412823002: Improve the page download: (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 c4d602e0aecdb5a67c671041ef82a39b9c130300..11f4725ad38e46cfe6f5b3ad10db64de8a9590c4 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -638,12 +638,18 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
}
void RequestCoordinator::EnableForOffliner(int64_t request_id) {
- disabled_requests_.erase(request_id);
- // If we are not busy, start processing right away.
- StartProcessingIfConnected();
+ if (disabled_requests_.find(request_id) == disabled_requests_.end())
+ return;
+ disabled_requests_.erase(request_id);
+ // If we are not busy, start processing right away.
+ StartProcessingIfConnected();
}
void RequestCoordinator::MarkRequestCompleted(int64_t request_id) {
+ if (disabled_requests_.find(request_id) == disabled_requests_.end())
Pete Williamson 2016/10/12 17:33:36 Ah, nice catch.
Dmitry Titov 2016/10/12 23:11:14 Acknowledged.
+ return;
+ disabled_requests_.erase(request_id);
+
// Remove the request, but send out SUCCEEDED instead of removed.
std::vector<int64_t> request_ids { request_id };
queue_->RemoveRequests(

Powered by Google App Engine
This is Rietveld 408576698