OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/retry_verifier.h" | 5 #include "chrome/browser/sync/retry_verifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/sync/engine/polling_constants.h" | 10 #include "sync/engine/polling_constants.h" |
11 #include "chrome/browser/sync/sessions/session_state.h" | 11 #include "sync/sessions/session_state.h" |
12 | 12 |
13 namespace browser_sync { | 13 namespace browser_sync { |
14 | 14 |
15 namespace { | 15 namespace { |
16 // Given the current delay calculate the minimum and maximum wait times for | 16 // Given the current delay calculate the minimum and maximum wait times for |
17 // the next retry. | 17 // the next retry. |
18 DelayInfo CalculateDelay(int64 current_delay) { | 18 DelayInfo CalculateDelay(int64 current_delay) { |
19 int64 backoff_s = std::max(static_cast<int64>(1), current_delay * | 19 int64 backoff_s = std::max(static_cast<int64>(1), current_delay * |
20 browser_sync::kBackoffRandomizationFactor); | 20 browser_sync::kBackoffRandomizationFactor); |
21 | 21 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if (snap.sync_start_time != last_sync_time_) { | 104 if (snap.sync_start_time != last_sync_time_) { |
105 base::TimeDelta delta = snap.sync_start_time - last_sync_time_; | 105 base::TimeDelta delta = snap.sync_start_time - last_sync_time_; |
106 success_ = IsRetryOnTime(delay_table_,retry_count_ -1, delta); | 106 success_ = IsRetryOnTime(delay_table_,retry_count_ -1, delta); |
107 last_sync_time_ = snap.sync_start_time; | 107 last_sync_time_ = snap.sync_start_time; |
108 ++retry_count_; | 108 ++retry_count_; |
109 done_ = (retry_count_ >= kMaxRetry); | 109 done_ = (retry_count_ >= kMaxRetry); |
110 return; | 110 return; |
111 } | 111 } |
112 } | 112 } |
113 } // namespace browser_sync | 113 } // namespace browser_sync |
OLD | NEW |