| 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_PICKER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "components/offline_pages/background/request_coordinator.h" | 9 #include "components/offline_pages/background/request_coordinator.h" |
| 10 #include "components/offline_pages/background/request_queue.h" | 10 #include "components/offline_pages/background/request_queue.h" |
| 11 | 11 |
| 12 namespace offline_pages { | 12 namespace offline_pages { |
| 13 | |
| 14 class RequestPicker { | 13 class RequestPicker { |
| 15 public: | 14 public: |
| 16 RequestPicker(RequestQueue* requestQueue); | 15 RequestPicker(RequestQueue* requestQueue); |
| 17 | 16 |
| 18 ~RequestPicker(); | 17 ~RequestPicker(); |
| 19 | 18 |
| 20 // Choose which request we should process next based on the current | 19 // Choose which request we should process next based on the current |
| 21 // conditions, and call back to the RequestCoordinator when we have one. | 20 // conditions, and call back to the RequestCoordinator when we have one. |
| 22 void ChooseNextRequest( | 21 void ChooseNextRequest( |
| 23 RequestCoordinator::RequestPickedCallback picked_callback, | 22 RequestCoordinator::RequestPickedCallback picked_callback, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 RequestCoordinator::RequestPickedCallback picked_callback_; | 33 RequestCoordinator::RequestPickedCallback picked_callback_; |
| 35 // Callback for when there are no more reqeusts to pick. | 34 // Callback for when there are no more reqeusts to pick. |
| 36 RequestCoordinator::RequestQueueEmptyCallback empty_callback_; | 35 RequestCoordinator::RequestQueueEmptyCallback empty_callback_; |
| 37 // Allows us to pass a weak pointer to callbacks. | 36 // Allows us to pass a weak pointer to callbacks. |
| 38 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_; | 37 base::WeakPtrFactory<RequestPicker> weak_ptr_factory_; |
| 39 }; | 38 }; |
| 40 | 39 |
| 41 } // namespace offline_pages | 40 } // namespace offline_pages |
| 42 | 41 |
| 43 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ | 42 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_PICKER_H_ |
| OLD | NEW |