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

Unified Diff: chrome/browser/sync/engine/get_commit_ids_command.cc

Issue 8851006: [Sync] Replace all instances of ModelTypeSet with ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/get_commit_ids_command.cc
diff --git a/chrome/browser/sync/engine/get_commit_ids_command.cc b/chrome/browser/sync/engine/get_commit_ids_command.cc
index 3000649c44510ece1d7c26f5cfde0c6493901ef1..b04271985dfa6c66cc7cdd0288dcb7e374f60e2e 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,8 +93,8 @@ bool IsEntryReadyForCommit(const syncable::ModelTypeSet& encrypted_types,
return false;
}
- syncable::ModelType type = entry.GetModelType();
- if (encrypted_types.count(type) > 0 &&
+ const syncable::ModelType type = entry.GetModelType();
+ if (syncable::IsRealDataType(type) && encrypted_types.Has(type) &&
(passphrase_missing ||
syncable::EntryNeedsEncryption(encrypted_types, entry))) {
// This entry requires encryption but is not properly encrypted (possibly
@@ -107,7 +107,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;
@@ -117,7 +117,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;
@@ -140,7 +140,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.
@@ -165,8 +165,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;
@@ -182,7 +182,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) {
@@ -206,7 +206,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) {
@@ -226,7 +226,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());
@@ -337,7 +337,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

Powered by Google App Engine
This is Rietveld 408576698