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

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

Issue 23809005: sync: Implement per-type GetCommitIds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments + algorithm improvements 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 | « no previous file | sync/engine/get_commit_ids.h » ('j') | sync/engine/get_commit_ids.h » ('J')
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.h"
10 #include "sync/engine/process_commit_response_command.h" 10 #include "sync/engine/process_commit_response_command.h"
11 #include "sync/engine/syncer.h"
11 #include "sync/engine/syncer_proto_util.h" 12 #include "sync/engine/syncer_proto_util.h"
12 #include "sync/sessions/sync_session.h" 13 #include "sync/sessions/sync_session.h"
13 #include "sync/syncable/mutable_entry.h" 14 #include "sync/syncable/mutable_entry.h"
14 #include "sync/syncable/syncable_write_transaction.h" 15 #include "sync/syncable/syncable_write_transaction.h"
15 16
16 namespace syncer { 17 namespace syncer {
17 18
18 using sessions::SyncSession; 19 using sessions::SyncSession;
19 using sessions::StatusController; 20 using sessions::StatusController;
20 using syncable::SYNCER; 21 using syncable::SYNCER;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ExtensionsActivity::Records* extensions_activity_buffer) { 70 ExtensionsActivity::Records* extensions_activity_buffer) {
70 TRACE_EVENT0("sync", "PrepareCommitMessage"); 71 TRACE_EVENT0("sync", "PrepareCommitMessage");
71 72
72 commit_set->Clear(); 73 commit_set->Clear();
73 commit_message->Clear(); 74 commit_message->Clear();
74 75
75 WriteTransaction trans(FROM_HERE, SYNCER, session->context()->directory()); 76 WriteTransaction trans(FROM_HERE, SYNCER, session->context()->directory());
76 77
77 // Fetch the items to commit. 78 // Fetch the items to commit.
78 const size_t batch_size = session->context()->max_commit_batch_size(); 79 const size_t batch_size = session->context()->max_commit_batch_size();
79 GetCommitIdsCommand get_commit_ids_command(&trans, 80 GetCommitIds(&trans, requested_types, batch_size, commit_set);
80 requested_types,
81 batch_size,
82 commit_set);
83 get_commit_ids_command.Execute(session);
84 81
85 DVLOG(1) << "Commit message will contain " << commit_set->Size() << " items."; 82 DVLOG(1) << "Commit message will contain " << commit_set->Size() << " items.";
86 if (commit_set->Empty()) { 83 if (commit_set->Empty()) {
87 return false; 84 return false;
88 } 85 }
89 86
90 // Serialize the message. 87 // Serialize the message.
91 BuildCommitCommand build_commit_command(&trans, 88 BuildCommitCommand build_commit_command(&trans,
92 *commit_set, 89 *commit_set,
93 commit_message, 90 commit_message,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 sessions::OrderedCommitSet commit_set(session->context()->routing_info()); 179 sessions::OrderedCommitSet commit_set(session->context()->routing_info());
183 SyncerError result = 180 SyncerError result =
184 BuildAndPostCommitsImpl(requested_types, syncer, session, &commit_set); 181 BuildAndPostCommitsImpl(requested_types, syncer, session, &commit_set);
185 if (result != SYNCER_OK) { 182 if (result != SYNCER_OK) {
186 ClearSyncingBits(session->context()->directory(), commit_set); 183 ClearSyncingBits(session->context()->directory(), commit_set);
187 } 184 }
188 return result; 185 return result;
189 } 186 }
190 187
191 } // namespace syncer 188 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/engine/get_commit_ids.h » ('j') | sync/engine/get_commit_ids.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698