Chromium Code Reviews| 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 "chrome/browser/sync_file_system/sync_process_runner.h" | 5 #include "chrome/browser/sync_file_system/sync_process_runner.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "chrome/browser/sync_file_system/logger.h" | 8 #include "chrome/browser/sync_file_system/logger.h" |
| 9 | 9 |
| 10 namespace sync_file_system { | 10 namespace sync_file_system { |
| 11 | 11 |
| 12 const int64 SyncProcessRunner::kSyncDelayInMilliseconds = | |
| 13 1 * base::Time::kMillisecondsPerSecond; | |
|
peria
2014/07/09 06:24:28
Could you add a comment to show this value figures
tzik
2014/07/09 06:48:00
Done.
| |
| 14 const int64 SyncProcessRunner::kSyncDelayWithSyncError = | |
| 15 3 * base::Time::kMillisecondsPerSecond; | |
|
peria
2014/07/09 06:24:28
ditto
tzik
2014/07/09 06:48:00
Done.
| |
| 16 const int64 SyncProcessRunner::kSyncDelayFastInMilliseconds = 100; | |
| 17 const int SyncProcessRunner::kPendingChangeThresholdForFastSync = 10; | |
| 18 const int64 SyncProcessRunner::kSyncDelaySlowInMilliseconds = | |
| 19 30 * base::Time::kMillisecondsPerSecond; // Start with 30 sec + exp backoff | |
|
peria
2014/07/09 06:24:28
This comment seems strange, because the value is c
tzik
2014/07/09 06:48:00
Done.
| |
| 20 const int64 SyncProcessRunner::kSyncDelayMaxInMilliseconds = | |
| 21 30 * 60 * base::Time::kMillisecondsPerSecond; // 30 min | |
| 22 | |
| 12 namespace { | 23 namespace { |
| 13 | 24 |
| 14 // Default delay when more changes are available. | |
| 15 const int64 kSyncDelayInMilliseconds = 1 * base::Time::kMillisecondsPerSecond; | |
| 16 | |
| 17 // Default delay when the previous change has had an error (but remote service | |
| 18 // is running). | |
| 19 const int64 kSyncDelayWithSyncError = 3 * base::Time::kMillisecondsPerSecond; | |
| 20 | |
| 21 // Default delay when there're more than 10 pending changes. | |
| 22 const int64 kSyncDelayFastInMilliseconds = 100; | |
| 23 const int kPendingChangeThresholdForFastSync = 10; | |
| 24 | |
| 25 // Default delay when remote service is temporarily unavailable. | |
| 26 const int64 kSyncDelaySlowInMilliseconds = | |
| 27 30 * base::Time::kMillisecondsPerSecond; // Start with 30 sec + exp backoff | |
| 28 | |
| 29 // Default delay when there're no changes. | |
| 30 const int64 kSyncDelayMaxInMilliseconds = | |
| 31 30 * 60 * base::Time::kMillisecondsPerSecond; // 30 min | |
| 32 | |
| 33 class BaseTimerHelper : public SyncProcessRunner::TimerHelper { | 25 class BaseTimerHelper : public SyncProcessRunner::TimerHelper { |
| 34 public: | 26 public: |
| 35 BaseTimerHelper() {} | 27 BaseTimerHelper() {} |
| 36 | 28 |
| 37 virtual bool IsRunning() OVERRIDE { | 29 virtual bool IsRunning() OVERRIDE { |
| 38 return timer_.IsRunning(); | 30 return timer_.IsRunning(); |
| 39 } | 31 } |
| 40 | 32 |
| 41 virtual void Start(const tracked_objects::Location& from_here, | 33 virtual void Start(const tracked_objects::Location& from_here, |
| 42 const base::TimeDelta& delay, | 34 const base::TimeDelta& delay, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 name_.c_str(), time_to_next.InSeconds()); | 192 name_.c_str(), time_to_next.InSeconds()); |
| 201 } | 193 } |
| 202 current_delay_ = delay; | 194 current_delay_ = delay; |
| 203 | 195 |
| 204 timer_helper_->Start( | 196 timer_helper_->Start( |
| 205 FROM_HERE, time_to_next, | 197 FROM_HERE, time_to_next, |
| 206 base::Bind(&SyncProcessRunner::Run, base::Unretained(this))); | 198 base::Bind(&SyncProcessRunner::Run, base::Unretained(this))); |
| 207 } | 199 } |
| 208 | 200 |
| 209 } // namespace sync_file_system | 201 } // namespace sync_file_system |
| OLD | NEW |