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/request_coordinator_event_logger.h
" | 12 #include "components/offline_pages/core/background/request_coordinator_event_log
ger.h" |
13 #include "components/offline_pages/background/request_notifier.h" | 13 #include "components/offline_pages/core/background/request_notifier.h" |
14 #include "components/offline_pages/background/request_queue_store.h" | 14 #include "components/offline_pages/core/background/request_queue_store.h" |
15 #include "components/offline_pages/background/save_page_request.h" | 15 #include "components/offline_pages/core/background/save_page_request.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 template <typename T> | 18 template <typename T> |
19 int signum(T t) { | 19 int signum(T t) { |
20 return (T(0) < t) - (t < T(0)); | 20 return (T(0) < t) - (t < T(0)); |
21 } | 21 } |
22 | 22 |
23 #define CALL_MEMBER_FUNCTION(object, ptrToMember) ((object)->*(ptrToMember)) | 23 #define CALL_MEMBER_FUNCTION(object, ptrToMember) ((object)->*(ptrToMember)) |
24 } // namespace | 24 } // namespace |
25 | 25 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 int result = signum(difference.InMilliseconds()); | 305 int result = signum(difference.InMilliseconds()); |
306 | 306 |
307 // Flip the direction of comparison if policy prefers fewer retries. | 307 // Flip the direction of comparison if policy prefers fewer retries. |
308 if (policy_->ShouldPreferEarlierRequests()) | 308 if (policy_->ShouldPreferEarlierRequests()) |
309 result *= -1; | 309 result *= -1; |
310 | 310 |
311 return result; | 311 return result; |
312 } | 312 } |
313 | 313 |
314 } // namespace offline_pages | 314 } // namespace offline_pages |
OLD | NEW |