summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/engine/get_commit_ids_command.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync/engine/get_commit_ids_command.cc')
-rw-r--r--chrome/browser/sync/engine/get_commit_ids_command.cc31
1 files changed, 16 insertions, 15 deletions
diff --git a/chrome/browser/sync/engine/get_commit_ids_command.cc b/chrome/browser/sync/engine/get_commit_ids_command.cc
index 4c280ec..aa90ccc 100644
--- a/chrome/browser/sync/engine/get_commit_ids_command.cc
+++ b/chrome/browser/sync/engine/get_commit_ids_command.cc
@@ -44,7 +44,7 @@ void GetCommitIdsCommand::ExecuteImpl(SyncSession* session) {
passphrase_missing_ = cryptographer->has_pending_keys();
};
- const syncable::ModelTypeSet& throttled_types =
+ const syncable::ModelEnumSet throttled_types =
session->context()->GetThrottledTypes();
// We filter out all unready entries from the set of unsynced handles to
// ensure we don't trigger useless sync cycles attempting to retry due to
@@ -74,10 +74,10 @@ namespace {
// and not requiring encryption (any entry containing an encrypted datatype
// while the cryptographer requires a passphrase is not ready for commit.)
// 2. Its type is not currently throttled.
-bool IsEntryReadyForCommit(const syncable::ModelTypeSet& encrypted_types,
+bool IsEntryReadyForCommit(syncable::ModelEnumSet encrypted_types,
bool passphrase_missing,
const syncable::Entry& entry,
- const syncable::ModelTypeSet& throttled_types) {
+ syncable::ModelEnumSet throttled_types) {
if (!entry.Get(syncable::IS_UNSYNCED))
return false;
@@ -93,12 +93,13 @@ bool IsEntryReadyForCommit(const syncable::ModelTypeSet& encrypted_types,
return false;
}
- syncable::ModelType type = entry.GetModelType();
+ const syncable::ModelType type = entry.GetModelType();
// We special case the nigori node because even though it is considered an
// "encrypted type", not all nigori node changes require valid encryption
// (ex: sync_tabs).
- if (type != syncable::NIGORI &&
- encrypted_types.count(type) > 0 &&
+ if (syncable::IsRealDataType(type) &&
+ (type != syncable::NIGORI) &&
+ encrypted_types.Has(type) &&
(passphrase_missing ||
syncable::EntryNeedsEncryption(encrypted_types, entry))) {
// This entry requires encryption but is not properly encrypted (possibly
@@ -111,7 +112,7 @@ bool IsEntryReadyForCommit(const syncable::ModelTypeSet& encrypted_types,
}
// Look at the throttled types.
- if (throttled_types.count(type) > 0)
+ if (syncable::IsRealDataType(type) && throttled_types.Has(type))
return false;
return true;
@@ -121,7 +122,7 @@ bool IsEntryReadyForCommit(const syncable::ModelTypeSet& encrypted_types,
void GetCommitIdsCommand::FilterUnreadyEntries(
syncable::BaseTransaction* trans,
- const syncable::ModelTypeSet& throttled_types,
+ syncable::ModelEnumSet throttled_types,
syncable::Directory::UnsyncedMetaHandles* unsynced_handles) {
syncable::Directory::UnsyncedMetaHandles::iterator iter;
syncable::Directory::UnsyncedMetaHandles new_unsynced_handles;
@@ -144,7 +145,7 @@ void GetCommitIdsCommand::AddUncommittedParentsAndTheirPredecessors(
syncable::BaseTransaction* trans,
syncable::Id parent_id,
const ModelSafeRoutingInfo& routes,
- const syncable::ModelTypeSet& throttled_types) {
+ syncable::ModelEnumSet throttled_types) {
OrderedCommitSet item_dependencies(routes);
// Climb the tree adding entries leaf -> root.
@@ -169,8 +170,8 @@ void GetCommitIdsCommand::AddUncommittedParentsAndTheirPredecessors(
}
bool GetCommitIdsCommand::AddItem(syncable::Entry* item,
- const syncable::ModelTypeSet& throttled_types,
- OrderedCommitSet* result) {
+ syncable::ModelEnumSet throttled_types,
+ OrderedCommitSet* result) {
if (!IsEntryReadyForCommit(encrypted_types_, passphrase_missing_, *item,
throttled_types))
return false;
@@ -186,7 +187,7 @@ bool GetCommitIdsCommand::AddItem(syncable::Entry* item,
bool GetCommitIdsCommand::AddItemThenPredecessors(
syncable::BaseTransaction* trans,
- const syncable::ModelTypeSet& throttled_types,
+ syncable::ModelEnumSet throttled_types,
syncable::Entry* item,
syncable::IndexedBitField inclusion_filter,
OrderedCommitSet* result) {
@@ -210,7 +211,7 @@ bool GetCommitIdsCommand::AddItemThenPredecessors(
void GetCommitIdsCommand::AddPredecessorsThenItem(
syncable::BaseTransaction* trans,
- const syncable::ModelTypeSet& throttled_types,
+ syncable::ModelEnumSet throttled_types,
syncable::Entry* item,
syncable::IndexedBitField inclusion_filter,
const ModelSafeRoutingInfo& routes) {
@@ -230,7 +231,7 @@ void GetCommitIdsCommand::AddCreatesAndMoves(
const vector<int64>& unsynced_handles,
syncable::WriteTransaction* write_transaction,
const ModelSafeRoutingInfo& routes,
- const syncable::ModelTypeSet& throttled_types) {
+ syncable::ModelEnumSet throttled_types) {
// Add moves and creates, and prepend their uncommitted parents.
for (CommitMetahandleIterator iterator(unsynced_handles, write_transaction,
ordered_commit_set_.get());
@@ -341,7 +342,7 @@ void GetCommitIdsCommand::AddDeletes(const vector<int64>& unsynced_handles,
void GetCommitIdsCommand::BuildCommitIds(const vector<int64>& unsynced_handles,
syncable::WriteTransaction* write_transaction,
const ModelSafeRoutingInfo& routes,
- const syncable::ModelTypeSet& throttled_types) {
+ syncable::ModelEnumSet throttled_types) {
ordered_commit_set_.reset(new OrderedCommitSet(routes));
// Commits follow these rules:
// 1. Moves or creates are preceded by needed folder creates, from