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

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

Issue 2420543004: 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..087be6fa282ab13431bbe9e88b9f980e9117a73a 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -638,12 +638,22 @@ 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();
+ // Since the recent tab helper might call multiple times, ignore subsequent
+ // calls for a particular request_id.
+ 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) {
+ // Since the recent tab helper might call multiple times, ignore subsequent
+ // calls for a particular request_id.
+ if (disabled_requests_.find(request_id) == disabled_requests_.end())
+ 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