| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/policy/core/common/async_policy_loader.h" | 5 #include "components/policy/core/common/async_policy_loader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
| 10 #include "components/policy/core/common/policy_bundle.h" | 10 #include "components/policy/core/common/policy_bundle.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // makes it possible to batch quasi-simultaneous changes. | 21 // makes it possible to batch quasi-simultaneous changes. |
| 22 const int kSettleIntervalSeconds = 5; | 22 const int kSettleIntervalSeconds = 5; |
| 23 | 23 |
| 24 // The time interval for rechecking policy. This is the fallback in case the | 24 // The time interval for rechecking policy. This is the fallback in case the |
| 25 // implementation never detects changes. | 25 // implementation never detects changes. |
| 26 const int kReloadIntervalSeconds = 15 * 60; | 26 const int kReloadIntervalSeconds = 15 * 60; |
| 27 | 27 |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 AsyncPolicyLoader::AsyncPolicyLoader( | 30 AsyncPolicyLoader::AsyncPolicyLoader( |
| 31 scoped_refptr<base::SequencedTaskRunner> task_runner) | 31 const scoped_refptr<base::SequencedTaskRunner>& task_runner) |
| 32 : task_runner_(task_runner), | 32 : task_runner_(task_runner), |
| 33 weak_factory_(this) {} | 33 weak_factory_(this) {} |
| 34 | 34 |
| 35 AsyncPolicyLoader::~AsyncPolicyLoader() {} | 35 AsyncPolicyLoader::~AsyncPolicyLoader() {} |
| 36 | 36 |
| 37 Time AsyncPolicyLoader::LastModificationTime() { | 37 Time AsyncPolicyLoader::LastModificationTime() { |
| 38 return Time(); | 38 return Time(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void AsyncPolicyLoader::Reload(bool force) { | 41 void AsyncPolicyLoader::Reload(bool force) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 const TimeDelta age = now - last_modification_clock_; | 129 const TimeDelta age = now - last_modification_clock_; |
| 130 if (age < kSettleInterval) { | 130 if (age < kSettleInterval) { |
| 131 *delay = kSettleInterval - age; | 131 *delay = kSettleInterval - age; |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 | 134 |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace policy | 138 } // namespace policy |
| OLD | NEW |