Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: sync/sessions/sync_session.cc

Issue 10210009: sync: Loop committing items without downloading updates (v2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/sessions/status_controller_unittest.cc ('k') | sync/sessions/sync_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 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 "sync/sessions/sync_session.h" 5 #include "sync/sessions/sync_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 return SyncSessionSnapshot( 153 return SyncSessionSnapshot(
154 status_controller_->syncer_status(), 154 status_controller_->syncer_status(),
155 status_controller_->error(), 155 status_controller_->error(),
156 status_controller_->num_server_changes_remaining(), 156 status_controller_->num_server_changes_remaining(),
157 is_share_useable, 157 is_share_useable,
158 initial_sync_ended, 158 initial_sync_ended,
159 download_progress_markers, 159 download_progress_markers,
160 HasMoreToSync(), 160 HasMoreToSync(),
161 delegate_->IsSyncingCurrentlySilenced(), 161 delegate_->IsSyncingCurrentlySilenced(),
162 status_controller_->unsynced_handles().size(),
163 status_controller_->TotalNumEncryptionConflictingItems(), 162 status_controller_->TotalNumEncryptionConflictingItems(),
164 status_controller_->TotalNumHierarchyConflictingItems(), 163 status_controller_->TotalNumHierarchyConflictingItems(),
165 status_controller_->TotalNumSimpleConflictingItems(), 164 status_controller_->TotalNumSimpleConflictingItems(),
166 status_controller_->TotalNumServerConflictingItems(), 165 status_controller_->TotalNumServerConflictingItems(),
167 status_controller_->did_commit_items(),
168 source_, 166 source_,
169 context_->notifications_enabled(), 167 context_->notifications_enabled(),
170 dir->GetEntriesCount(), 168 dir->GetEntriesCount(),
171 status_controller_->sync_start_time(), 169 status_controller_->sync_start_time(),
172 !Succeeded()); 170 !Succeeded());
173 } 171 }
174 172
175 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) { 173 void SyncSession::SendEventNotification(SyncEngineEvent::EventCause cause) {
176 SyncEngineEvent event(cause); 174 SyncEngineEvent event(cause);
177 event.snapshot = TakeSnapshot(); 175 event.snapshot = TakeSnapshot();
178 176
179 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString(); 177 DVLOG(1) << "Sending event with snapshot: " << event.snapshot.ToString();
180 context()->NotifyListeners(event); 178 context()->NotifyListeners(event);
181 } 179 }
182 180
183 bool SyncSession::HasMoreToSync() const { 181 bool SyncSession::HasMoreToSync() const {
184 const StatusController* status = status_controller_.get(); 182 const StatusController* status = status_controller_.get();
185 return ((status->commit_ids().size() < status->unsynced_handles().size()) && 183 return status->conflicts_resolved();
186 status->syncer_status().num_successful_commits > 0) ||
187 status->conflicts_resolved();
188 // Or, we have conflicting updates, but we're making progress on
189 // resolving them...
190 } 184 }
191 185
192 const std::set<ModelSafeGroup>& SyncSession::GetEnabledGroups() const { 186 const std::set<ModelSafeGroup>& SyncSession::GetEnabledGroups() const {
193 return enabled_groups_; 187 return enabled_groups_;
194 } 188 }
195 189
196 std::set<ModelSafeGroup> SyncSession::GetEnabledGroupsWithConflicts() const { 190 std::set<ModelSafeGroup> SyncSession::GetEnabledGroupsWithConflicts() const {
197 const std::set<ModelSafeGroup>& enabled_groups = GetEnabledGroups(); 191 const std::set<ModelSafeGroup>& enabled_groups = GetEnabledGroups();
198 std::set<ModelSafeGroup> enabled_groups_with_conflicts; 192 std::set<ModelSafeGroup> enabled_groups_with_conflicts;
199 for (std::set<ModelSafeGroup>::const_iterator it = 193 for (std::set<ModelSafeGroup>::const_iterator it =
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 IsError(status_controller_->error().last_post_commit_result); 238 IsError(status_controller_->error().last_post_commit_result);
245 const bool process_commit_response_error = 239 const bool process_commit_response_error =
246 IsError(status_controller_->error().last_process_commit_response_result); 240 IsError(status_controller_->error().last_process_commit_response_result);
247 return !download_updates_error 241 return !download_updates_error
248 && !post_commit_error 242 && !post_commit_error
249 && !process_commit_response_error; 243 && !process_commit_response_error;
250 } 244 }
251 245
252 } // namespace sessions 246 } // namespace sessions
253 } // namespace browser_sync 247 } // namespace browser_sync
OLDNEW
« no previous file with comments | « sync/sessions/status_controller_unittest.cc ('k') | sync/sessions/sync_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698