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

Side by Side Diff: sync/engine/model_changing_syncer_command.cc

Issue 10523003: Refactor following sync commit loop change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another rebase Created 8 years, 6 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/engine/model_changing_syncer_command.h" 5 #include "sync/engine/model_changing_syncer_command.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "sync/sessions/status_controller.h" 10 #include "sync/sessions/status_controller.h"
11 #include "sync/sessions/sync_session.h" 11 #include "sync/sessions/sync_session.h"
12 12
13 namespace browser_sync { 13 namespace browser_sync {
14 14
15 SyncerError ModelChangingSyncerCommand::ExecuteImpl( 15 SyncerError ModelChangingSyncerCommand::ExecuteImpl(
16 sessions::SyncSession* session) { 16 sessions::SyncSession* session) {
17 work_session_ = session; 17 work_session_ = session;
18 SyncerError result = ModelNeutralExecuteImpl(work_session_); 18 SyncerError result = SYNCER_OK;
19
20 if (result != SYNCER_OK)
21 return result;
22 19
23 const std::set<ModelSafeGroup>& groups_to_change = 20 const std::set<ModelSafeGroup>& groups_to_change =
24 GetGroupsToChange(*work_session_); 21 GetGroupsToChange(*work_session_);
25 for (size_t i = 0; i < session->workers().size(); ++i) { 22 for (size_t i = 0; i < session->workers().size(); ++i) {
26 ModelSafeWorker* worker = work_session_->workers()[i]; 23 ModelSafeWorker* worker = work_session_->workers()[i];
27 ModelSafeGroup group = worker->GetModelSafeGroup(); 24 ModelSafeGroup group = worker->GetModelSafeGroup();
28 // Skip workers whose group isn't active. 25 // Skip workers whose group isn't active.
29 if (groups_to_change.count(group) == 0u) { 26 if (groups_to_change.count(group) == 0u) {
30 DVLOG(2) << "Skipping worker for group " 27 DVLOG(2) << "Skipping worker for group "
31 << ModelSafeGroupToString(group); 28 << ModelSafeGroupToString(group);
(...skipping 12 matching lines...) Expand all
44 SyncerError this_worker_result = worker->DoWorkAndWaitUntilDone(c); 41 SyncerError this_worker_result = worker->DoWorkAndWaitUntilDone(c);
45 // TODO(rlarocque): Figure out a better way to deal with errors from 42 // TODO(rlarocque): Figure out a better way to deal with errors from
46 // multiple models at once. See also: crbug.com/109422. 43 // multiple models at once. See also: crbug.com/109422.
47 if (this_worker_result != SYNCER_OK) 44 if (this_worker_result != SYNCER_OK)
48 result = this_worker_result; 45 result = this_worker_result;
49 } 46 }
50 47
51 return result; 48 return result;
52 } 49 }
53 50
54 SyncerError ModelChangingSyncerCommand::ModelNeutralExecuteImpl(
55 sessions::SyncSession* session) {
56 return SYNCER_OK;
57 }
58
59 } // namespace browser_sync 51 } // namespace browser_sync
OLDNEW
« no previous file with comments | « sync/engine/model_changing_syncer_command.h ('k') | sync/engine/process_commit_response_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698