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

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

Issue 2228813003: Changes to fit better with the needs of the download manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use typedef to hide an ugly type. 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_queue.h
diff --git a/components/offline_pages/background/request_queue.h b/components/offline_pages/background/request_queue.h
index 429c3757b89acc1cec1d65eb7cab9bc9fc604378..a48775f8ea5928a0f1ff33ddbb3fa7ac4ab78260 100644
--- a/components/offline_pages/background/request_queue.h
+++ b/components/offline_pages/background/request_queue.h
@@ -43,6 +43,10 @@ class RequestQueue {
// exist.
};
+ // Type for a pair of request_id and result.
+ typedef std::vector<std::pair<int64_t, UpdateRequestResult>>
+ UpdateMultipleRequestResults;
+
// Callback used for |GetRequests|.
typedef base::Callback<void(GetRequestsResult,
const std::vector<SavePageRequest>&)>
@@ -52,9 +56,13 @@ class RequestQueue {
typedef base::Callback<void(AddRequestResult, const SavePageRequest& request)>
AddRequestCallback;
- // Callback used by |UdpateRequest| and |RemoveRequest|.
+ // Callback used by |UdpateRequest|.
typedef base::Callback<void(UpdateRequestResult)> UpdateRequestCallback;
+ // Callback used by |RemoveRequests|.
+ typedef base::Callback<void(const UpdateMultipleRequestResults& results)>
+ RemoveRequestsCallback;
+
explicit RequestQueue(std::unique_ptr<RequestQueueStore> store);
~RequestQueue();
@@ -74,14 +82,11 @@ class RequestQueue {
void UpdateRequest(const SavePageRequest& request,
const UpdateRequestCallback& callback);
- // Removes the request matching the |request_id|. Result is returned through
- // |callback|.
- void RemoveRequest(int64_t request_id, const UpdateRequestCallback& callback);
-
- // Removes the requests matching the |client_ids|. Results are returned
- // through |callback|.
- void RemoveRequestsByClientId(const std::vector<ClientId>& client_id,
- const UpdateRequestCallback& callback);
+ // Removes the requests matching the |request_ids|. Result is returned through
+ // |callback|. If a request id cannot be removed, this will still remove the
+ // others.
+ void RemoveRequests(const std::vector<int64_t>& request_ids,
+ const RemoveRequestsCallback& callback);
void GetForUpdateDone(
const RequestQueue::UpdateRequestCallback& update_callback,

Powered by Google App Engine
This is Rietveld 408576698