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

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

Issue 10038041: sync: Loop committing items without downloading updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
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 const SyncSessionSnapshot& snapshot = TakeSnapshot(); 175 const SyncSessionSnapshot& snapshot = TakeSnapshot();
178 event.snapshot = &snapshot; 176 event.snapshot = &snapshot;
179 177
180 DVLOG(1) << "Sending event with snapshot: " << snapshot.ToString(); 178 DVLOG(1) << "Sending event with snapshot: " << snapshot.ToString();
181 context()->NotifyListeners(event); 179 context()->NotifyListeners(event);
182 } 180 }
183 181
184 bool SyncSession::HasMoreToSync() const { 182 bool SyncSession::HasMoreToSync() const {
185 const StatusController* status = status_controller_.get(); 183 const StatusController* status = status_controller_.get();
186 return ((status->commit_ids().size() < status->unsynced_handles().size()) && 184 return status->conflicts_resolved();
187 status->syncer_status().num_successful_commits > 0) ||
188 status->conflicts_resolved();
189 // Or, we have conflicting updates, but we're making progress on
190 // resolving them...
191 } 185 }
192 186
193 const std::set<ModelSafeGroup>& SyncSession::GetEnabledGroups() const { 187 const std::set<ModelSafeGroup>& SyncSession::GetEnabledGroups() const {
194 return enabled_groups_; 188 return enabled_groups_;
195 } 189 }
196 190
197 std::set<ModelSafeGroup> SyncSession::GetEnabledGroupsWithConflicts() const { 191 std::set<ModelSafeGroup> SyncSession::GetEnabledGroupsWithConflicts() const {
198 const std::set<ModelSafeGroup>& enabled_groups = GetEnabledGroups(); 192 const std::set<ModelSafeGroup>& enabled_groups = GetEnabledGroups();
199 std::set<ModelSafeGroup> enabled_groups_with_conflicts; 193 std::set<ModelSafeGroup> enabled_groups_with_conflicts;
200 for (std::set<ModelSafeGroup>::const_iterator it = 194 for (std::set<ModelSafeGroup>::const_iterator it =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 IsError(status_controller_->error().last_post_commit_result); 240 IsError(status_controller_->error().last_post_commit_result);
247 const bool process_commit_response_error = 241 const bool process_commit_response_error =
248 IsError(status_controller_->error().last_process_commit_response_result); 242 IsError(status_controller_->error().last_process_commit_response_result);
249 return !download_updates_error 243 return !download_updates_error
250 && !post_commit_error 244 && !post_commit_error
251 && !process_commit_response_error; 245 && !process_commit_response_error;
252 } 246 }
253 247
254 } // namespace sessions 248 } // namespace sessions
255 } // namespace browser_sync 249 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698