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

Unified Diff: components/offline_pages/background/request_picker.h

Issue 2233493003: [Offline Pages] Remove expired requests from the queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing build. Created 4 years, 4 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_picker.h
diff --git a/components/offline_pages/background/request_picker.h b/components/offline_pages/background/request_picker.h
index 3062152ed57e2a5fc6775eb4ec927d365a6d4a1d..6b8af8f43bfa49e4039d533df769dadc3dd942c1 100644
--- a/components/offline_pages/background/request_picker.h
+++ b/components/offline_pages/background/request_picker.h
@@ -15,12 +15,16 @@
namespace offline_pages {
+class RequestNotifier;
+
typedef bool (RequestPicker::*RequestCompareFunction)(
const SavePageRequest* left, const SavePageRequest* right);
class RequestPicker {
public:
- RequestPicker(RequestQueue* requestQueue, OfflinerPolicy* policy);
+ RequestPicker(RequestQueue* requestQueue,
+ OfflinerPolicy* policy,
+ RequestNotifier* notifier);
~RequestPicker();
@@ -63,10 +67,22 @@ class RequestPicker {
int CompareCreationTime(const SavePageRequest* left,
const SavePageRequest* right);
- // unowned pointer to the request queue.
+ // Split all requests into expired ones and still valid ones.
+ void SplitRequests(const std::vector<SavePageRequest>& requests,
+ std::vector<SavePageRequest>& valid_requests,
+ std::vector<SavePageRequest>& expired_requests);
+
+ // Callback used after requests get expired.
+ void OnRequestExpired(
+ const RequestQueue::UpdateMultipleRequestResults& results,
+ const std::vector<SavePageRequest>& requests);
+
+ // Unowned pointer to the request queue.
RequestQueue* queue_;
- // unowned pointer to the policy object.
+ // Unowned pointer to the policy object.
OfflinerPolicy* policy_;
+ // Unowned pointer to the request coordinator.
+ RequestNotifier* notifier_;
// Current conditions on the device
std::unique_ptr<DeviceConditions> current_conditions_;
// True if we prefer less-tried requests
« no previous file with comments | « components/offline_pages/background/request_notifier.h ('k') | components/offline_pages/background/request_picker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698