Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/time.h" | |
| 10 | |
| 11 namespace browser_sync { | |
| 12 namespace sessions { | |
| 13 struct SyncSessionSnapshot; | |
| 14 } | |
| 15 } | |
|
tim (not reviewing)
2011/08/08 23:11:35
} // namespace browser_sync
lipalani1
2011/08/09 01:39:02
Done.
| |
| 16 | |
| 17 // The minimum and maximum wait times for a retry. The actual retry would take | |
| 18 // place somewhere in this range. The algorithm that calculates the retry wait | |
| 19 // time uses rand functions. | |
| 20 struct DelayInfo { | |
| 21 int64 min_delay; | |
| 22 int64 max_delay; | |
| 23 }; | |
| 24 | |
| 25 // Class to verify retries take place using the exponential backoff algorithm. | |
| 26 class RetryVerifier { | |
|
tim (not reviewing)
2011/08/08 23:11:35
something as common-sounding yet specific as this
lipalani1
2011/08/09 01:39:02
Kept the name but put a namespace called sync_test
| |
| 27 public: | |
| 28 static const int kMaxRetry = 5; | |
| 29 RetryVerifier(); | |
| 30 ~RetryVerifier(); | |
| 31 int RetryCount() const { return retry_count_; } | |
|
tim (not reviewing)
2011/08/08 23:11:35
style guide says: retry_count()
lipalani1
2011/08/09 01:39:02
Done.
| |
| 32 void Initialize(const browser_sync::sessions::SyncSessionSnapshot& snap); | |
|
tim (not reviewing)
2011/08/08 23:11:35
what is this param for? (comment)
lipalani1
2011/08/09 01:39:02
added a comment.
On 2011/08/08 23:11:35, timsteele
| |
| 33 void VerifyRetryInterval( | |
| 34 const browser_sync::sessions::SyncSessionSnapshot& snap); | |
| 35 bool Done() const { return done_; } | |
|
tim (not reviewing)
2011/08/08 23:11:35
style guide says: "done()"
lipalani1
2011/08/09 01:39:02
Done.
| |
| 36 bool Success() const { return Done() && success_; } | |
|
tim (not reviewing)
2011/08/08 23:11:35
DidSucceed or Succeeded
lipalani1
2011/08/09 01:39:02
Done.
| |
| 37 | |
| 38 private: | |
| 39 int retry_count_; | |
| 40 base::Time last_sync_time_; | |
| 41 DelayInfo delay_table_[kMaxRetry]; | |
| 42 bool success_; | |
| 43 bool done_; | |
| 44 DISALLOW_COPY_AND_ASSIGN(RetryVerifier); | |
| 45 }; | |
| 46 | |
| 47 #endif // CHROME_BROWSER_SYNC_RETRY_VERIFIER_H_ | |
| OLD | NEW |