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/sync/sessions/sync_session.h" | 5 #include "chrome/browser/sync/sessions/sync_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
10 #include "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 } | 134 } |
135 | 135 |
136 bool SyncSession::HasMoreToSync() const { | 136 bool SyncSession::HasMoreToSync() const { |
137 const StatusController* status = status_controller_.get(); | 137 const StatusController* status = status_controller_.get(); |
138 return ((status->commit_ids().size() < status->unsynced_handles().size()) && | 138 return ((status->commit_ids().size() < status->unsynced_handles().size()) && |
139 status->syncer_status().num_successful_commits > 0) || | 139 status->syncer_status().num_successful_commits > 0) || |
140 status->conflict_sets_built() || | 140 status->conflict_sets_built() || |
141 status->conflicts_resolved(); | 141 status->conflicts_resolved(); |
142 // Or, we have conflicting updates, but we're making progress on | 142 // Or, we have conflicting updates, but we're making progress on |
143 // resolving them... | 143 // resolving them... |
144 } | 144 } |
145 | |
146 bool SyncSession::WasUnableToMakeProgress() const { | |
rlarocque
2011/09/20 20:10:03
This name sucks. I should call it WasAbleToMakePr
| |
147 VLOG(1) << "Was unable to make progress?"; | |
148 const StatusController* status = status_controller_.get(); | |
149 | |
150 // In the future, we should be able to report more about the cause of the | |
151 // errors and return an enum value. Right now that's not possible because | |
152 // our error detection is based on state that can tell us only that an | |
153 // error exists, but not much else. | |
154 | |
155 // We were unable to download all updates, for some unknown reason | |
tim (not reviewing)
2011/09/20 16:21:57
style nit - end comments with periods
| |
156 if (status->num_server_changes_remaining() > 0) | |
157 return true; | |
158 | |
159 // Lots of errors could cause this | |
160 if (status->error().consecutive_errors > 0) | |
tim (not reviewing)
2011/09/20 16:21:57
Are all these errors "all or nothing"? I'm wonder
rlarocque
2011/09/20 20:10:03
In the future, I was hoping we could replace this
| |
161 return true; | |
162 | |
163 return false; | |
164 } | |
145 | 165 |
146 } // namespace sessions | 166 } // namespace sessions |
147 } // namespace browser_sync | 167 } // namespace browser_sync |
OLD | NEW |