| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void ClearConnectedEventRequest(); | 263 void ClearConnectedEventRequest(); |
| 264 | 264 |
| 265 // Handles receiving a connection event. Will start immediate processing. | 265 // Handles receiving a connection event. Will start immediate processing. |
| 266 void HandleConnectedEventForStarting(); | 266 void HandleConnectedEventForStarting(); |
| 267 | 267 |
| 268 // Check the request queue, and schedule a task corresponding | 268 // Check the request queue, and schedule a task corresponding |
| 269 // to the least restrictive type of request in the queue. | 269 // to the least restrictive type of request in the queue. |
| 270 void ScheduleAsNeeded(); | 270 void ScheduleAsNeeded(); |
| 271 | 271 |
| 272 // Callback from the request picker when it has chosen our next request. | 272 // Callback from the request picker when it has chosen our next request. |
| 273 void RequestPicked(const SavePageRequest& request); | 273 void RequestPicked(const SavePageRequest& request, bool cleanup_needed); |
| 274 | 274 |
| 275 // Callback from the request picker when no more requests are in the queue. | 275 // Callback from the request picker when no more requests are in the queue. |
| 276 // The parameter is a signal for what (if any) conditions to schedule future | 276 // The parameter is a signal for what (if any) conditions to schedule future |
| 277 // processing for. | 277 // processing for. |
| 278 void RequestNotPicked(bool non_user_requested_tasks_remaining); | 278 void RequestNotPicked(bool non_user_requested_tasks_remaining, |
| 279 bool cleanup_needed); |
| 279 | 280 |
| 280 // Callback from request picker that receives the current available queued | 281 // Callback from request picker that receives the current available queued |
| 281 // request count as well as the total queued request count (which may be | 282 // request count as well as the total queued request count (which may be |
| 282 // different if unavailable requests are queued such as paused requests). | 283 // different if unavailable requests are queued such as paused requests). |
| 283 // It also receives a flag as to whether this request picking is due to the | 284 // It also receives a flag as to whether this request picking is due to the |
| 284 // start of a request processing window. | 285 // start of a request processing window. |
| 285 void RequestCounts(bool is_start_of_processing, | 286 void RequestCounts(bool is_start_of_processing, |
| 286 size_t total_requests, | 287 size_t total_requests, |
| 287 size_t available_requests); | 288 size_t available_requests); |
| 288 | 289 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 std::unique_ptr<ConnectionNotifier> connection_notifier_; | 419 std::unique_ptr<ConnectionNotifier> connection_notifier_; |
| 419 // Allows us to pass a weak pointer to callbacks. | 420 // Allows us to pass a weak pointer to callbacks. |
| 420 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 421 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 421 | 422 |
| 422 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 423 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 423 }; | 424 }; |
| 424 | 425 |
| 425 } // namespace offline_pages | 426 } // namespace offline_pages |
| 426 | 427 |
| 427 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 428 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |