| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/policy/file_based_policy_loader.h" | 5 #include "chrome/browser/policy/file_based_policy_loader.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/files/file_path_watcher.h" |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/values.h" |
| 8 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 9 | 11 |
| 10 using ::base::files::FilePathWatcher; | 12 using ::base::files::FilePathWatcher; |
| 11 | 13 |
| 12 namespace { | 14 namespace { |
| 13 | 15 |
| 14 // Amount of time we wait for the files on disk to settle before trying to load | 16 // Amount of time we wait for the files on disk to settle before trying to load |
| 15 // them. This alleviates the problem of reading partially written files and | 17 // them. This alleviates the problem of reading partially written files and |
| 16 // makes it possible to batch quasi-simultaneous changes. | 18 // makes it possible to batch quasi-simultaneous changes. |
| 17 const int kSettleIntervalSeconds = 5; | 19 const int kSettleIntervalSeconds = 5; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::TimeDelta age = now - last_modification_clock_; | 142 base::TimeDelta age = now - last_modification_clock_; |
| 141 if (age < settle_interval_) { | 143 if (age < settle_interval_) { |
| 142 *delay = settle_interval_ - age; | 144 *delay = settle_interval_ - age; |
| 143 return false; | 145 return false; |
| 144 } | 146 } |
| 145 | 147 |
| 146 return true; | 148 return true; |
| 147 } | 149 } |
| 148 | 150 |
| 149 } // namespace policy | 151 } // namespace policy |
| OLD | NEW |