| 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_BACKGROUND_OFFLINER_POLICY_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| 7 | 7 |
| 8 namespace { | 8 namespace { |
| 9 const int kMaxRetries = 2; | 9 const int kMaxRetries = 2; |
| 10 const int kBackgroundTimeBudgetSeconds = 170; | 10 const int kBackgroundProcessingTimeBudgetSeconds = 170; |
| 11 const int kSinglePageTimeBudgetSeconds = 120; | 11 const int kSinglePageTimeLimitSeconds = 120; |
| 12 const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50; | 12 const int kMinimumBatteryPercentageForNonUserRequestOfflining = 50; |
| 13 } // namespace | 13 } // namespace |
| 14 | 14 |
| 15 namespace offline_pages { | 15 namespace offline_pages { |
| 16 | 16 |
| 17 // Policy for the Background Offlining system. Some policy will belong to the | 17 // Policy for the Background Offlining system. Some policy will belong to the |
| 18 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. | 18 // RequestCoordinator, some to the RequestQueue, and some to the Offliner. |
| 19 class OfflinerPolicy { | 19 class OfflinerPolicy { |
| 20 public: | 20 public: |
| 21 OfflinerPolicy() | 21 OfflinerPolicy() |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 int BatteryPercentageRequiredForUserRequestedPage() const { return 50; } | 61 int BatteryPercentageRequiredForUserRequestedPage() const { return 50; } |
| 62 | 62 |
| 63 // This is so low because we require the device to be plugged in and charging. | 63 // This is so low because we require the device to be plugged in and charging. |
| 64 // If we decide to allow non-user requested pages when not plugged in, we | 64 // If we decide to allow non-user requested pages when not plugged in, we |
| 65 // should raise this somewhat higher. | 65 // should raise this somewhat higher. |
| 66 int BatteryPercentageRequiredForNonUserRequestedPage() const { return 25; } | 66 int BatteryPercentageRequiredForNonUserRequestedPage() const { return 25; } |
| 67 | 67 |
| 68 // How many seconds to keep trying new pages for, before we give up, and | 68 // How many seconds to keep trying new pages for, before we give up, and |
| 69 // return to the scheduler. | 69 // return to the scheduler. |
| 70 int GetBackgroundProcessingTimeBudgetSeconds() const { | 70 int GetBackgroundProcessingTimeBudgetSeconds() const { |
| 71 return kBackgroundTimeBudgetSeconds; | 71 return kBackgroundProcessingTimeBudgetSeconds; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // How long do we allow a page to load before giving up on it | 74 // How long do we allow a page to load before giving up on it |
| 75 int GetSinglePageTimeBudgetInSeconds() const { | 75 int GetSinglePageTimeLimitInSeconds() const { |
| 76 return kSinglePageTimeBudgetSeconds; | 76 return kSinglePageTimeLimitSeconds; |
| 77 } | 77 } |
| 78 | 78 |
| 79 // How much battery must we have before fetching a page not explicitly | 79 // How much battery must we have before fetching a page not explicitly |
| 80 // requested by the user? | 80 // requested by the user? |
| 81 int GetMinimumBatteryPercentageForNonUserRequestOfflining() const { | 81 int GetMinimumBatteryPercentageForNonUserRequestOfflining() const { |
| 82 return kMinimumBatteryPercentageForNonUserRequestOfflining; | 82 return kMinimumBatteryPercentageForNonUserRequestOfflining; |
| 83 } | 83 } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 bool prefer_untried_requests_; | 86 bool prefer_untried_requests_; |
| 87 bool prefer_earlier_requests_; | 87 bool prefer_earlier_requests_; |
| 88 bool retry_count_is_more_important_than_recency_; | 88 bool retry_count_is_more_important_than_recency_; |
| 89 }; | 89 }; |
| 90 } | 90 } |
| 91 | 91 |
| 92 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ | 92 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_OFFLINER_POLICY_H_ |
| OLD | NEW |