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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 int result = signum(difference.InMilliseconds()); | 293 int result = signum(difference.InMilliseconds()); |
294 | 294 |
295 // Flip the direction of comparison if policy prefers fewer retries. | 295 // Flip the direction of comparison if policy prefers fewer retries. |
296 if (policy_->ShouldPreferEarlierRequests()) | 296 if (policy_->ShouldPreferEarlierRequests()) |
297 result *= -1; | 297 result *= -1; |
298 | 298 |
299 return result; | 299 return result; |
300 } | 300 } |
301 | 301 |
302 } // namespace offline_pages | 302 } // namespace offline_pages |
OLD | NEW |