Chromium Code Reviews| 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_CORE_BACKGROUND_REQUEST_QUEUE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 // Make a task to pick the next request, and report our choice to the | 90 // Make a task to pick the next request, and report our choice to the |
| 91 // callbacks. | 91 // callbacks. |
| 92 void PickNextRequest( | 92 void PickNextRequest( |
| 93 OfflinerPolicy* policy, | 93 OfflinerPolicy* policy, |
| 94 PickRequestTask::RequestPickedCallback picked_callback, | 94 PickRequestTask::RequestPickedCallback picked_callback, |
| 95 PickRequestTask::RequestNotPickedCallback not_picked_callback, | 95 PickRequestTask::RequestNotPickedCallback not_picked_callback, |
| 96 PickRequestTask::RequestCountCallback request_count_callback, | 96 PickRequestTask::RequestCountCallback request_count_callback, |
| 97 DeviceConditions& conditions, | 97 DeviceConditions& conditions, |
| 98 std::set<int64_t>& disabled_requests); | 98 std::set<int64_t>& disabled_requests); |
| 99 | 99 |
| 100 // Reconcile any requests that were active when chrome exited. | |
|
dougarnett
2016/12/12 17:16:14
... previously exited. ?
Pete Williamson
2016/12/15 18:37:43
Done.
| |
| 101 void ReconcileRequests(const UpdateCallback& callback); | |
| 102 | |
| 100 // Cleanup requests that have expired, exceeded the start or completed retry | 103 // Cleanup requests that have expired, exceeded the start or completed retry |
| 101 // limit. | 104 // limit. |
| 102 void CleanupRequestQueue(); | 105 void CleanupRequestQueue(); |
| 103 | 106 |
| 104 // Takes ownership of the factory. We use a setter to allow users of the | 107 // Takes ownership of the factory. We use a setter to allow users of the |
| 105 // request queue to not need a CleanupFactory to create it, since we have lots | 108 // request queue to not need a CleanupFactory to create it, since we have lots |
| 106 // of code using the request queue. The request coordinator will set a | 109 // of code using the request queue. The request coordinator will set a |
| 107 // factory before calling CleanupRequestQueue. | 110 // factory before calling CleanupRequestQueue. |
| 108 void SetCleanupFactory(std::unique_ptr<CleanupTaskFactory> factory) { | 111 void SetCleanupFactory(std::unique_ptr<CleanupTaskFactory> factory) { |
| 109 cleanup_factory_ = std::move(factory); | 112 cleanup_factory_ = std::move(factory); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 124 | 127 |
| 125 // Allows us to pass a weak pointer to callbacks. | 128 // Allows us to pass a weak pointer to callbacks. |
| 126 base::WeakPtrFactory<RequestQueue> weak_ptr_factory_; | 129 base::WeakPtrFactory<RequestQueue> weak_ptr_factory_; |
| 127 | 130 |
| 128 DISALLOW_COPY_AND_ASSIGN(RequestQueue); | 131 DISALLOW_COPY_AND_ASSIGN(RequestQueue); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } // namespace offline_pages | 134 } // namespace offline_pages |
| 132 | 135 |
| 133 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ | 136 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ |
| OLD | NEW |