| 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_REMOVE_REQUESTS_TASK_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REMOVE_REQUESTS_TASK_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REMOVE_REQUESTS_TASK_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REMOVE_REQUESTS_TASK_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // TaskQueue::Task implementation. | 27 // TaskQueue::Task implementation. |
| 28 void Run() override; | 28 void Run() override; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // Step 1. Removes requests from the store. | 31 // Step 1. Removes requests from the store. |
| 32 void RemoveRequests(); | 32 void RemoveRequests(); |
| 33 // Step for early termination, that builds failure result. | 33 // Step for early termination, that builds failure result. |
| 34 void CompleteEarly(ItemActionStatus status); | 34 void CompleteEarly(ItemActionStatus status); |
| 35 // Step 2. Processes update result, calls callback. | 35 // Step 2. Processes update result, calls callback. |
| 36 void CompleteWithResult(std::unique_ptr<UpdateRequestsResult> result); | 36 void CompleteWithResult( |
| 37 std::unique_ptr<QueueResults::UpdateRequestsResult> result); |
| 37 | 38 |
| 38 // Store that this task updates. | 39 // Store that this task updates. |
| 39 RequestQueueStore* store_; | 40 RequestQueueStore* store_; |
| 40 // Request IDs to be updated. | 41 // Request IDs to be updated. |
| 41 // TODO(fgorski): perhaps convert to unique_ptr to a vector. | 42 // TODO(fgorski): perhaps convert to unique_ptr to a vector. |
| 42 std::vector<int64_t> request_ids_; | 43 std::vector<int64_t> request_ids_; |
| 43 // Callback to complete the task. | 44 // Callback to complete the task. |
| 44 RequestQueueStore::UpdateCallback callback_; | 45 RequestQueueStore::UpdateCallback callback_; |
| 45 | 46 |
| 46 base::WeakPtrFactory<RemoveRequestsTask> weak_ptr_factory_; | 47 base::WeakPtrFactory<RemoveRequestsTask> weak_ptr_factory_; |
| 47 | 48 |
| 48 DISALLOW_COPY_AND_ASSIGN(RemoveRequestsTask); | 49 DISALLOW_COPY_AND_ASSIGN(RemoveRequestsTask); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 } // namespace offline_pages | 52 } // namespace offline_pages |
| 52 | 53 |
| 53 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REMOVE_REQUESTS_TASK_H_ | 54 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REMOVE_REQUESTS_TASK_H_ |
| OLD | NEW |