| 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 <vector> | 10 #include <vector> |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Callback from the request picker when no more requests are in the queue. | 276 // Callback from the request picker when no more requests are in the queue. |
| 277 // The parameter is a signal for what (if any) conditions to schedule future | 277 // The parameter is a signal for what (if any) conditions to schedule future |
| 278 // processing for. | 278 // processing for. |
| 279 void RequestNotPicked(bool non_user_requested_tasks_remaining); | 279 void RequestNotPicked(bool non_user_requested_tasks_remaining); |
| 280 | 280 |
| 281 void HandleWatchdogTimeout(); | 281 void HandleWatchdogTimeout(); |
| 282 | 282 |
| 283 // Cancels an in progress pre-rendering, and updates state appropriately. | 283 // Cancels an in progress pre-rendering, and updates state appropriately. |
| 284 void StopPrerendering(Offliner::RequestStatus stop_status); | 284 void StopPrerendering(Offliner::RequestStatus stop_status); |
| 285 | 285 |
| 286 // Marks attempt on the request and sends it to offliner in continuation. |
| 286 void SendRequestToOffliner(const SavePageRequest& request); | 287 void SendRequestToOffliner(const SavePageRequest& request); |
| 287 | 288 |
| 289 // Continuation of |SendRequestToOffliner| after the request is marked as |
| 290 // started. |
| 291 void StartOffliner(int64_t request_id, |
| 292 const std::string& client_namespace, |
| 293 std::unique_ptr<UpdateRequestsResult> update_result); |
| 294 |
| 288 // Called by the offliner when an offlining request is completed. (and by | 295 // Called by the offliner when an offlining request is completed. (and by |
| 289 // tests). | 296 // tests). |
| 290 void OfflinerDoneCallback(const SavePageRequest& request, | 297 void OfflinerDoneCallback(const SavePageRequest& request, |
| 291 Offliner::RequestStatus status); | 298 Offliner::RequestStatus status); |
| 292 | 299 |
| 293 void TryNextRequest(); | 300 void TryNextRequest(); |
| 294 | 301 |
| 295 // If there is an active request in the list, cancel that request. | 302 // If there is an active request in the list, cancel that request. |
| 296 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); | 303 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); |
| 297 | 304 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 base::Callback<void(bool)> immediate_schedule_callback_; | 386 base::Callback<void(bool)> immediate_schedule_callback_; |
| 380 // Allows us to pass a weak pointer to callbacks. | 387 // Allows us to pass a weak pointer to callbacks. |
| 381 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 388 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 382 | 389 |
| 383 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 390 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 384 }; | 391 }; |
| 385 | 392 |
| 386 } // namespace offline_pages | 393 } // namespace offline_pages |
| 387 | 394 |
| 388 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 395 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |