| 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_COORDINATOR_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 // Records a completed attempt for the request and update it in the queue | 297 // Records a completed attempt for the request and update it in the queue |
| 298 // (possibly removing it). | 298 // (possibly removing it). |
| 299 void UpdateRequestForCompletedAttempt(const SavePageRequest& request, | 299 void UpdateRequestForCompletedAttempt(const SavePageRequest& request, |
| 300 Offliner::RequestStatus status); | 300 Offliner::RequestStatus status); |
| 301 | 301 |
| 302 // Returns whether we should try another request based on the outcome | 302 // Returns whether we should try another request based on the outcome |
| 303 // of the previous one. | 303 // of the previous one. |
| 304 bool ShouldTryNextRequest(Offliner::RequestStatus previous_request_status); | 304 bool ShouldTryNextRequest(Offliner::RequestStatus previous_request_status); |
| 305 | 305 |
| 306 void TryNextRequest(); | 306 void TryNextRequest(bool is_start_of_processing); |
| 307 | 307 |
| 308 // If there is an active request in the list, cancel that request. | 308 // If there is an active request in the list, cancel that request. |
| 309 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); | 309 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); |
| 310 | 310 |
| 311 // Records an aborted attempt for the request and update it in the queue | 311 // Records an aborted attempt for the request and update it in the queue |
| 312 // (possibly removing it). | 312 // (possibly removing it). |
| 313 void UpdateRequestForAbortedAttempt(const SavePageRequest& request); | 313 void UpdateRequestForAbortedAttempt(const SavePageRequest& request); |
| 314 | 314 |
| 315 // Remove the attempted request from the queue with status to pass through to | 315 // Remove the attempted request from the queue with status to pass through to |
| 316 // any observers and UMA histogram. | 316 // any observers and UMA histogram. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 base::Callback<void(bool)> immediate_schedule_callback_; | 398 base::Callback<void(bool)> immediate_schedule_callback_; |
| 399 // Allows us to pass a weak pointer to callbacks. | 399 // Allows us to pass a weak pointer to callbacks. |
| 400 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 400 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 401 | 401 |
| 402 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 402 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 } // namespace offline_pages | 405 } // namespace offline_pages |
| 406 | 406 |
| 407 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 407 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |