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

Side by Side Diff: chrome/browser/sync/engine/get_commit_ids_command.cc

Issue 9036003: Avoid useless SYNC_CYCLE_CONTINUATION sync cycle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/get_commit_ids_command.h" 5 #include "chrome/browser/sync/engine/get_commit_ids_command.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 11 matching lines...) Expand all
22 using sessions::OrderedCommitSet; 22 using sessions::OrderedCommitSet;
23 using sessions::SyncSession; 23 using sessions::SyncSession;
24 using sessions::StatusController; 24 using sessions::StatusController;
25 25
26 GetCommitIdsCommand::GetCommitIdsCommand(int commit_batch_size) 26 GetCommitIdsCommand::GetCommitIdsCommand(int commit_batch_size)
27 : requested_commit_batch_size_(commit_batch_size), 27 : requested_commit_batch_size_(commit_batch_size),
28 passphrase_missing_(false) {} 28 passphrase_missing_(false) {}
29 29
30 GetCommitIdsCommand::~GetCommitIdsCommand() {} 30 GetCommitIdsCommand::~GetCommitIdsCommand() {}
31 31
32 void GetCommitIdsCommand::ExecuteImpl(SyncSession* session) { 32 SyncerError GetCommitIdsCommand::ExecuteImpl(SyncSession* session) {
33 // Gather the full set of unsynced items and store it in the session. They 33 // Gather the full set of unsynced items and store it in the session. They
34 // are not in the correct order for commit. 34 // are not in the correct order for commit.
35 syncable::Directory::UnsyncedMetaHandles all_unsynced_handles; 35 syncable::Directory::UnsyncedMetaHandles all_unsynced_handles;
36 SyncerUtil::GetUnsyncedEntries(session->write_transaction(), 36 SyncerUtil::GetUnsyncedEntries(session->write_transaction(),
37 &all_unsynced_handles); 37 &all_unsynced_handles);
38 38
39 Cryptographer* cryptographer = 39 Cryptographer* cryptographer =
40 session->context()->directory_manager()->GetCryptographer( 40 session->context()->directory_manager()->GetCryptographer(
41 session->write_transaction()); 41 session->write_transaction());
42 if (cryptographer) { 42 if (cryptographer) {
(...skipping 15 matching lines...) Expand all
58 BuildCommitIds(status->unsynced_handles(), session->write_transaction(), 58 BuildCommitIds(status->unsynced_handles(), session->write_transaction(),
59 session->routing_info(), throttled_types); 59 session->routing_info(), throttled_types);
60 60
61 const vector<syncable::Id>& verified_commit_ids = 61 const vector<syncable::Id>& verified_commit_ids =
62 ordered_commit_set_->GetAllCommitIds(); 62 ordered_commit_set_->GetAllCommitIds();
63 63
64 for (size_t i = 0; i < verified_commit_ids.size(); i++) 64 for (size_t i = 0; i < verified_commit_ids.size(); i++)
65 DVLOG(1) << "Debug commit batch result:" << verified_commit_ids[i]; 65 DVLOG(1) << "Debug commit batch result:" << verified_commit_ids[i];
66 66
67 status->set_commit_set(*ordered_commit_set_.get()); 67 status->set_commit_set(*ordered_commit_set_.get());
68 return NO_ERROR;
68 } 69 }
69 70
70 namespace { 71 namespace {
71 72
72 // An entry ready for commit is defined as: 73 // An entry ready for commit is defined as:
73 // 1. Not in conflict (SERVER_VERSION == BASE_VERSION || SERVER_VERSION == 0) 74 // 1. Not in conflict (SERVER_VERSION == BASE_VERSION || SERVER_VERSION == 0)
74 // and not requiring encryption (any entry containing an encrypted datatype 75 // and not requiring encryption (any entry containing an encrypted datatype
75 // while the cryptographer requires a passphrase is not ready for commit.) 76 // while the cryptographer requires a passphrase is not ready for commit.)
76 // 2. Its type is not currently throttled. 77 // 2. Its type is not currently throttled.
77 bool IsEntryReadyForCommit(syncable::ModelTypeSet encrypted_types, 78 bool IsEntryReadyForCommit(syncable::ModelTypeSet encrypted_types,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 355
355 // Add moves and creates, and prepend their uncommitted parents. 356 // Add moves and creates, and prepend their uncommitted parents.
356 AddCreatesAndMoves(unsynced_handles, write_transaction, routes, 357 AddCreatesAndMoves(unsynced_handles, write_transaction, routes,
357 throttled_types); 358 throttled_types);
358 359
359 // Add all deletes. 360 // Add all deletes.
360 AddDeletes(unsynced_handles, write_transaction); 361 AddDeletes(unsynced_handles, write_transaction);
361 } 362 }
362 363
363 } // namespace browser_sync 364 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/get_commit_ids_command.h ('k') | chrome/browser/sync/engine/model_changing_syncer_command.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698