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 <deque> |
10 #include <memory> | 11 #include <memory> |
11 #include <set> | 12 #include <set> |
12 #include <string> | 13 #include <string> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
18 #include "components/offline_pages/core/background/cleanup_task_factory.h" | 19 #include "components/offline_pages/core/background/cleanup_task_factory.h" |
19 #include "components/offline_pages/core/background/device_conditions.h" | 20 #include "components/offline_pages/core/background/device_conditions.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 void MarkAttemptCompleted(int64_t request_id, const UpdateCallback& callback); | 89 void MarkAttemptCompleted(int64_t request_id, const UpdateCallback& callback); |
89 | 90 |
90 // Make a task to pick the next request, and report our choice to the | 91 // Make a task to pick the next request, and report our choice to the |
91 // callbacks. | 92 // callbacks. |
92 void PickNextRequest( | 93 void PickNextRequest( |
93 OfflinerPolicy* policy, | 94 OfflinerPolicy* policy, |
94 PickRequestTask::RequestPickedCallback picked_callback, | 95 PickRequestTask::RequestPickedCallback picked_callback, |
95 PickRequestTask::RequestNotPickedCallback not_picked_callback, | 96 PickRequestTask::RequestNotPickedCallback not_picked_callback, |
96 PickRequestTask::RequestCountCallback request_count_callback, | 97 PickRequestTask::RequestCountCallback request_count_callback, |
97 DeviceConditions& conditions, | 98 DeviceConditions& conditions, |
98 std::set<int64_t>& disabled_requests); | 99 std::set<int64_t>& disabled_requests, |
| 100 std::deque<int64_t>& prioritized_requests); |
99 | 101 |
100 // Reconcile any requests that were active the last time chrome exited. | 102 // Reconcile any requests that were active the last time chrome exited. |
101 void ReconcileRequests(const UpdateCallback& callback); | 103 void ReconcileRequests(const UpdateCallback& callback); |
102 | 104 |
103 // Cleanup requests that have expired, exceeded the start or completed retry | 105 // Cleanup requests that have expired, exceeded the start or completed retry |
104 // limit. | 106 // limit. |
105 void CleanupRequestQueue(); | 107 void CleanupRequestQueue(); |
106 | 108 |
107 // Takes ownership of the factory. We use a setter to allow users of the | 109 // Takes ownership of the factory. We use a setter to allow users of the |
108 // request queue to not need a CleanupFactory to create it, since we have lots | 110 // request queue to not need a CleanupFactory to create it, since we have lots |
(...skipping 18 matching lines...) Expand all Loading... |
127 | 129 |
128 // Allows us to pass a weak pointer to callbacks. | 130 // Allows us to pass a weak pointer to callbacks. |
129 base::WeakPtrFactory<RequestQueue> weak_ptr_factory_; | 131 base::WeakPtrFactory<RequestQueue> weak_ptr_factory_; |
130 | 132 |
131 DISALLOW_COPY_AND_ASSIGN(RequestQueue); | 133 DISALLOW_COPY_AND_ASSIGN(RequestQueue); |
132 }; | 134 }; |
133 | 135 |
134 } // namespace offline_pages | 136 } // namespace offline_pages |
135 | 137 |
136 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ | 138 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_REQUEST_QUEUE_H_ |
OLD | NEW |