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

Side by Side Diff: components/offline_pages/background/request_queue_in_memory_store.h

Issue 2373933003: [Offline pages] Updating RequestQueue::RemoveRequests to use a TaskQueue (Closed)
Patch Set: Addressing final feedback 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/offline_pages/background/request_queue_store.h" 13 #include "components/offline_pages/background/request_queue_store.h"
14 #include "components/offline_pages/background/save_page_request.h" 14 #include "components/offline_pages/background/save_page_request.h"
15 15
16 namespace offline_pages { 16 namespace offline_pages {
17 17
18 // Interface for classes storing save page requests. 18 // Interface for classes storing save page requests.
19 class RequestQueueInMemoryStore : public RequestQueueStore { 19 class RequestQueueInMemoryStore : public RequestQueueStore {
20 public: 20 public:
21 RequestQueueInMemoryStore(); 21 RequestQueueInMemoryStore();
22 ~RequestQueueInMemoryStore() override; 22 ~RequestQueueInMemoryStore() override;
23 23
24 // RequestQueueStore implementaiton. 24 // RequestQueueStore implementaiton.
25 void GetRequests(const GetRequestsCallback& callback) override; 25 void GetRequests(const GetRequestsCallback& callback) override;
26 void AddRequest(const SavePageRequest& offline_page, 26 void AddRequest(const SavePageRequest& offline_page,
27 const AddCallback& callback) override; 27 const AddCallback& callback) override;
28 void UpdateRequests(const std::vector<SavePageRequest>& requests, 28 void UpdateRequests(const std::vector<SavePageRequest>& requests,
29 const UpdateCallback& callback) override; 29 const UpdateCallback& callback) override;
30
31 // Remove requests by request ID. The callback will get a list of
32 // UpdateMultipleRequestResults and a list of the removed requests (for use by
33 // notifications).
34 void RemoveRequests(const std::vector<int64_t>& request_ids, 30 void RemoveRequests(const std::vector<int64_t>& request_ids,
35 const RemoveCallback& callback) override; 31 const UpdateCallback& callback) override;
36 32
37 void Reset(const ResetCallback& callback) override; 33 void Reset(const ResetCallback& callback) override;
38 StoreState state() const override; 34 StoreState state() const override;
39 35
40 private: 36 private:
41 typedef std::map<int64_t, SavePageRequest> RequestsMap; 37 typedef std::map<int64_t, SavePageRequest> RequestsMap;
42 RequestsMap requests_; 38 RequestsMap requests_;
43 39
44 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); 40 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore);
45 }; 41 };
46 42
47 } // namespace offline_pages 43 } // namespace offline_pages
48 44
49 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ 45 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698