Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 15 |
| 15 namespace offline_pages { | 16 namespace offline_pages { |
| 16 | 17 |
| 17 class SavePageRequest; | |
| 18 | |
| 19 // Interface for classes storing save page requests. | 18 // Interface for classes storing save page requests. |
| 20 class RequestQueueInMemoryStore : public RequestQueueStore { | 19 class RequestQueueInMemoryStore : public RequestQueueStore { |
| 21 public: | 20 public: |
| 22 RequestQueueInMemoryStore(); | 21 RequestQueueInMemoryStore(); |
| 23 ~RequestQueueInMemoryStore() override; | 22 ~RequestQueueInMemoryStore() override; |
| 24 | 23 |
| 25 // RequestQueueStore implementaiton. | 24 // RequestQueueStore implementaiton. |
| 26 void GetRequests(const GetRequestsCallback& callback) override; | 25 void GetRequests(const GetRequestsCallback& callback) override; |
| 26 | |
|
fgorski
2016/08/10 16:00:09
nit: remove this space, as methods below are still
Pete Williamson
2016/08/10 21:38:00
Done.
| |
| 27 void AddOrUpdateRequest(const SavePageRequest& request, | 27 void AddOrUpdateRequest(const SavePageRequest& request, |
| 28 const UpdateCallback& callback) override; | 28 const UpdateCallback& callback) override; |
| 29 // Remove requests by request ID. In case the |request_ids| is empty, the | 29 // Remove requests by request ID. In case the |request_ids| is empty, the |
| 30 // result will be true, but the count of deleted pages will be 0. | 30 // result will be true, but the count of deleted pages will be 0. |
| 31 void RemoveRequests(const std::vector<int64_t>& request_ids, | 31 void RemoveRequests(const std::vector<int64_t>& request_ids, |
| 32 const RemoveCallback& callback) override; | 32 const RemoveCallback& callback) override; |
| 33 // Remove requests by client ID. In case the |client_ids| is empty, the | 33 // Remove requests by client ID. In case the |client_ids| is empty, the |
| 34 // result will be true, but the count of deleted pages will be 0. | 34 // result will be true, but the count of deleted pages will be 0. |
| 35 void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids, | 35 void RemoveRequestsByClientId(const std::vector<ClientId>& client_ids, |
| 36 const RemoveCallback& callback) override; | 36 const RemoveCallback& callback) override; |
| 37 | |
|
fgorski
2016/08/10 16:00:09
nit: same here.
Pete Williamson
2016/08/10 21:38:00
Done.
| |
| 38 // Set the state of associated requests to |new_state|. | |
| 39 void ChangeRequestsState(const std::vector<int64_t>& request_ids, | |
| 40 const SavePageRequest::RequestState new_state, | |
| 41 const UpdateCallback& callback) override; | |
| 42 | |
| 37 void Reset(const ResetCallback& callback) override; | 43 void Reset(const ResetCallback& callback) override; |
| 38 | 44 |
| 39 private: | 45 private: |
| 40 typedef std::map<int64_t, SavePageRequest> RequestsMap; | 46 typedef std::map<int64_t, SavePageRequest> RequestsMap; |
| 41 RequestsMap requests_; | 47 RequestsMap requests_; |
| 42 | 48 |
| 43 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); | 49 DISALLOW_COPY_AND_ASSIGN(RequestQueueInMemoryStore); |
| 44 }; | 50 }; |
| 45 | 51 |
| 46 } // namespace offline_pages | 52 } // namespace offline_pages |
| 47 | 53 |
| 48 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ | 54 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_QUEUE_IN_MEMORY_STORE_H_ |
| OLD | NEW |