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

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

Issue 23694004: sync: Remove IDs from OrderedCommitSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/engine/build_commit_command.cc ('k') | sync/engine/get_commit_ids_command.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/commit.h" 5 #include "sync/engine/commit.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "sync/engine/build_commit_command.h" 8 #include "sync/engine/build_commit_command.h"
9 #include "sync/engine/get_commit_ids_command.h" 9 #include "sync/engine/get_commit_ids_command.h"
10 #include "sync/engine/process_commit_response_command.h" 10 #include "sync/engine/process_commit_response_command.h"
11 #include "sync/engine/syncer_proto_util.h" 11 #include "sync/engine/syncer_proto_util.h"
12 #include "sync/sessions/sync_session.h" 12 #include "sync/sessions/sync_session.h"
13 #include "sync/syncable/mutable_entry.h" 13 #include "sync/syncable/mutable_entry.h"
14 #include "sync/syncable/syncable_write_transaction.h" 14 #include "sync/syncable/syncable_write_transaction.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 using sessions::SyncSession; 18 using sessions::SyncSession;
19 using sessions::StatusController; 19 using sessions::StatusController;
20 using syncable::SYNCER; 20 using syncable::SYNCER;
21 using syncable::WriteTransaction; 21 using syncable::WriteTransaction;
22 22
23 namespace { 23 namespace {
24 24
25 // Sets the SYNCING bits of all items in the commit set to value_to_set. 25 // Sets the SYNCING bits of all items in the commit set to value_to_set.
26 void SetAllSyncingBitsToValue(WriteTransaction* trans, 26 void SetAllSyncingBitsToValue(WriteTransaction* trans,
27 const sessions::OrderedCommitSet& commit_set, 27 const sessions::OrderedCommitSet& commit_set,
28 bool value_to_set) { 28 bool value_to_set) {
29 const std::vector<syncable::Id>& commit_ids = commit_set.GetAllCommitIds(); 29 const std::vector<int64>& commit_handles = commit_set.GetAllCommitHandles();
30 for (std::vector<syncable::Id>::const_iterator it = commit_ids.begin(); 30 for (std::vector<int64>::const_iterator it = commit_handles.begin();
31 it != commit_ids.end(); ++it) { 31 it != commit_handles.end(); ++it) {
32 syncable::MutableEntry entry(trans, syncable::GET_BY_ID, *it); 32 syncable::MutableEntry entry(trans, syncable::GET_BY_HANDLE, *it);
33 if (entry.good()) { 33 if (entry.good()) {
34 entry.Put(syncable::SYNCING, value_to_set); 34 entry.Put(syncable::SYNCING, value_to_set);
35 } 35 }
36 } 36 }
37 } 37 }
38 38
39 // Sets the SYNCING bits for all items in the OrderedCommitSet. 39 // Sets the SYNCING bits for all items in the OrderedCommitSet.
40 void SetSyncingBits(WriteTransaction* trans, 40 void SetSyncingBits(WriteTransaction* trans,
41 const sessions::OrderedCommitSet& commit_set) { 41 const sessions::OrderedCommitSet& commit_set) {
42 SetAllSyncingBitsToValue(trans, commit_set, true); 42 SetAllSyncingBitsToValue(trans, commit_set, true);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 sessions::OrderedCommitSet commit_set(session->context()->routing_info()); 182 sessions::OrderedCommitSet commit_set(session->context()->routing_info());
183 SyncerError result = 183 SyncerError result =
184 BuildAndPostCommitsImpl(requested_types, syncer, session, &commit_set); 184 BuildAndPostCommitsImpl(requested_types, syncer, session, &commit_set);
185 if (result != SYNCER_OK) { 185 if (result != SYNCER_OK) {
186 ClearSyncingBits(session->context()->directory(), commit_set); 186 ClearSyncingBits(session->context()->directory(), commit_set);
187 } 187 }
188 return result; 188 return result;
189 } 189 }
190 190
191 } // namespace syncer 191 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/build_commit_command.cc ('k') | sync/engine/get_commit_ids_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698