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 #include "components/offline_pages/background/pick_request_task.h" | 5 #include "components/offline_pages/core/background/pick_request_task.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "components/offline_pages/background/device_conditions.h" | 10 #include "components/offline_pages/core/background/device_conditions.h" |
11 #include "components/offline_pages/background/offliner_policy.h" | 11 #include "components/offline_pages/core/background/offliner_policy.h" |
12 #include "components/offline_pages/background/offliner_policy_utils.h" | 12 #include "components/offline_pages/core/background/offliner_policy_utils.h" |
13 #include "components/offline_pages/background/request_coordinator_event_logger.h
" | 13 #include "components/offline_pages/core/background/request_coordinator_event_log
ger.h" |
14 #include "components/offline_pages/background/request_notifier.h" | 14 #include "components/offline_pages/core/background/request_notifier.h" |
15 #include "components/offline_pages/background/request_queue_store.h" | 15 #include "components/offline_pages/core/background/request_queue_store.h" |
16 #include "components/offline_pages/background/save_page_request.h" | 16 #include "components/offline_pages/core/background/save_page_request.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 template <typename T> | 19 template <typename T> |
20 int signum(T t) { | 20 int signum(T t) { |
21 return (T(0) < t) - (t < T(0)); | 21 return (T(0) < t) - (t < T(0)); |
22 } | 22 } |
23 | 23 |
24 bool kCleanupNeeded = true; | 24 bool kCleanupNeeded = true; |
25 bool kNonUserRequestsFound = true; | 25 bool kNonUserRequestsFound = true; |
26 | 26 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 int result = signum(difference.InMilliseconds()); | 246 int result = signum(difference.InMilliseconds()); |
247 | 247 |
248 // Flip the direction of comparison if policy prefers fewer retries. | 248 // Flip the direction of comparison if policy prefers fewer retries. |
249 if (policy_->ShouldPreferEarlierRequests()) | 249 if (policy_->ShouldPreferEarlierRequests()) |
250 result *= -1; | 250 result *= -1; |
251 | 251 |
252 return result; | 252 return result; |
253 } | 253 } |
254 | 254 |
255 } // namespace offline_pages | 255 } // namespace offline_pages |
OLD | NEW |