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

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

Issue 1951483002: [Offline pages] Adding in memory request queue store with tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_store.h
diff --git a/components/offline_pages/background/request_queue_store.h b/components/offline_pages/background/request_queue_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..24f2fd7526fedeacdf83bd04bfcdb0c2780505c3
--- /dev/null
+++ b/components/offline_pages/background/request_queue_store.h
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_
+#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_
+
+#include <stdint.h>
+#include <vector>
+
+#include "base/callback.h"
+
+namespace offline_pages {
+
+class SavePageRequest;
+
+// Interface for classes storing save page requests.
+class RequestQueueStore {
+ public:
+ typedef base::Callback<void(bool, const std::vector<SavePageRequest>&)>
+ GetRequestsCallback;
+ typedef base::Callback<void(bool)> UpdateCallback;
+ typedef base::Callback<void(bool)> ResetCallback;
+
+ virtual ~RequestQueueStore(){};
+
+ // Gets all of the requests from the store.
+ virtual void GetRequests(const GetRequestsCallback& callback) = 0;
Pete Williamson 2016/05/03 20:38:52 Why make this async again? (Sorry if I already as
fgorski 2016/05/03 21:50:21 You know we need to read these from the drive eith
Pete Williamson 2016/05/03 22:00:25 Ah yes, that was why. This is OK as is.
+
+ // Asynchronously adds or updates request in store.
+ // Result of the update is passed in the callback.
+ virtual void AddOrUpdateRequest(const SavePageRequest& request,
+ const UpdateCallback& callback) = 0;
+
+ // Asynchronously removes requests from the store using their IDs.
+ // Result of the update is passed in the callback.
Pete Williamson 2016/05/03 20:38:52 Let's be a bit more specific - returns true if any
fgorski 2016/05/03 21:50:21 Done.
+ virtual void RemoveRequests(const std::vector<int64_t>& request_ids,
+ const UpdateCallback& callback) = 0;
+
+ // Resets the store.
+ virtual void Reset(const ResetCallback& callback) = 0;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698