| 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_CHANGE_REQUESTS_STATE_TASK_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_CHANGE_REQUESTS_STATE_TASK_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_CHANGE_REQUESTS_STATE_TASK_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_CHANGE_REQUESTS_STATE_TASK_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void Run() override; | 30 void Run() override; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 // Step 1. Reading the requests. | 33 // Step 1. Reading the requests. |
| 34 void ReadRequests(); | 34 void ReadRequests(); |
| 35 // Step 2. Selecting requests to be updated. Calls update. | 35 // Step 2. Selecting requests to be updated. Calls update. |
| 36 void SelectItemsToUpdate( | 36 void SelectItemsToUpdate( |
| 37 bool success, | 37 bool success, |
| 38 std::vector<std::unique_ptr<SavePageRequest>> requests); | 38 std::vector<std::unique_ptr<SavePageRequest>> requests); |
| 39 // Step 3. Processes update result, calls callback. | 39 // Step 3. Processes update result, calls callback. |
| 40 void UpdateCompleted(std::unique_ptr<UpdateRequestsResult> update_result); | 40 void UpdateCompleted( |
| 41 std::unique_ptr<QueueResults::UpdateRequestsResult> update_result); |
| 41 | 42 |
| 42 // Completions. | 43 // Completions. |
| 43 void CompleteEarly(ItemActionStatus status); | 44 void CompleteEarly(ItemActionStatus status); |
| 44 void CompleteWithStatus(std::unique_ptr<UpdateRequestsResult> result, | 45 void CompleteWithStatus( |
| 45 ItemActionStatus status); | 46 std::unique_ptr<QueueResults::UpdateRequestsResult> result, |
| 47 ItemActionStatus status); |
| 46 | 48 |
| 47 // Store that this task updates. | 49 // Store that this task updates. |
| 48 RequestQueueStore* store_; | 50 RequestQueueStore* store_; |
| 49 // Request IDs to be updated. | 51 // Request IDs to be updated. |
| 50 std::unordered_set<int64_t> request_ids_; | 52 std::unordered_set<int64_t> request_ids_; |
| 51 // New state to be set on all entries. | 53 // New state to be set on all entries. |
| 52 SavePageRequest::RequestState new_state_; | 54 SavePageRequest::RequestState new_state_; |
| 53 // Callback to complete the task. | 55 // Callback to complete the task. |
| 54 RequestQueueStore::UpdateCallback callback_; | 56 RequestQueueStore::UpdateCallback callback_; |
| 55 | 57 |
| 56 base::WeakPtrFactory<ChangeRequestsStateTask> weak_ptr_factory_; | 58 base::WeakPtrFactory<ChangeRequestsStateTask> weak_ptr_factory_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(ChangeRequestsStateTask); | 60 DISALLOW_COPY_AND_ASSIGN(ChangeRequestsStateTask); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 } // namespace offline_pages | 63 } // namespace offline_pages |
| 62 | 64 |
| 63 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_CHANGE_REQUESTS_STATE_TASK_H_ | 65 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_CHANGE_REQUESTS_STATE_TASK_H_ |
| OLD | NEW |