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

Side by Side Diff: chrome/browser/sync/syncable/syncable.h

Issue 8772074: [Sync] Convert syncable/ directory to ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo 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 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <bitset> 10 #include <bitset>
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 ~PersistedKernelInfo(); 766 ~PersistedKernelInfo();
767 767
768 // Set the |download_progress| entry for the given model to a 768 // Set the |download_progress| entry for the given model to a
769 // "first sync" start point. When such a value is sent to the server, 769 // "first sync" start point. When such a value is sent to the server,
770 // a full download of all objects of the model will be initiated. 770 // a full download of all objects of the model will be initiated.
771 void reset_download_progress(ModelType model_type); 771 void reset_download_progress(ModelType model_type);
772 772
773 // Last sync timestamp fetched from the server. 773 // Last sync timestamp fetched from the server.
774 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; 774 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT];
775 // true iff we ever reached the end of the changelog. 775 // true iff we ever reached the end of the changelog.
776 ModelTypeBitSet initial_sync_ended; 776 ModelEnumSet initial_sync_ended;
777 // The store birthday we were given by the server. Contents are opaque to 777 // The store birthday we were given by the server. Contents are opaque to
778 // the client. 778 // the client.
779 std::string store_birthday; 779 std::string store_birthday;
780 // The next local ID that has not been used with this cache-GUID. 780 // The next local ID that has not been used with this cache-GUID.
781 int64 next_id; 781 int64 next_id;
782 // The persisted notification state. 782 // The persisted notification state.
783 std::string notification_state; 783 std::string notification_state;
784 }; 784 };
785 785
786 // What the Directory needs on initialization to create itself and its Kernel. 786 // What the Directory needs on initialization to create itself and its Kernel.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 const MetahandleSet& handles, 997 const MetahandleSet& handles,
998 const IdFilter& idfilter); 998 const IdFilter& idfilter);
999 999
1000 // Purges all data associated with any entries whose ModelType or 1000 // Purges all data associated with any entries whose ModelType or
1001 // ServerModelType is found in |types|, from _both_ memory and disk. 1001 // ServerModelType is found in |types|, from _both_ memory and disk.
1002 // Only valid, "real" model types are allowed in |types| (see model_type.h 1002 // Only valid, "real" model types are allowed in |types| (see model_type.h
1003 // for definitions). "Purge" is just meant to distinguish from "deleting" 1003 // for definitions). "Purge" is just meant to distinguish from "deleting"
1004 // entries, which means something different in the syncable namespace. 1004 // entries, which means something different in the syncable namespace.
1005 // WARNING! This can be real slow, as it iterates over all entries. 1005 // WARNING! This can be real slow, as it iterates over all entries.
1006 // WARNING! Performs synchronous I/O. 1006 // WARNING! Performs synchronous I/O.
1007 virtual void PurgeEntriesWithTypeIn(const std::set<ModelType>& types); 1007 virtual void PurgeEntriesWithTypeIn(ModelEnumSet types);
1008 1008
1009 private: 1009 private:
1010 // Helper to prime ids_index, parent_id_and_names_index, unsynced_metahandles 1010 // Helper to prime ids_index, parent_id_and_names_index, unsynced_metahandles
1011 // and unapplied_metahandles from metahandles_index. 1011 // and unapplied_metahandles from metahandles_index.
1012 void InitializeIndices(); 1012 void InitializeIndices();
1013 1013
1014 // Constructs a consistent snapshot of the current Directory state and 1014 // Constructs a consistent snapshot of the current Directory state and
1015 // indices (by deep copy) under a ReadTransaction for use in |snapshot|. 1015 // indices (by deep copy) under a ReadTransaction for use in |snapshot|.
1016 // See SaveChanges() for more information. 1016 // See SaveChanges() for more information.
1017 void TakeSnapshotForSaveChanges(SaveChangesSnapshot* snapshot); 1017 void TakeSnapshotForSaveChanges(SaveChangesSnapshot* snapshot);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 WriterTag writer, Directory* directory); 1252 WriterTag writer, Directory* directory);
1253 WriteTransaction(const tracked_objects::Location& from_here, 1253 WriteTransaction(const tracked_objects::Location& from_here,
1254 WriterTag writer, const ScopedDirLookup& directory); 1254 WriterTag writer, const ScopedDirLookup& directory);
1255 1255
1256 virtual ~WriteTransaction(); 1256 virtual ~WriteTransaction();
1257 1257
1258 void SaveOriginal(const EntryKernel* entry); 1258 void SaveOriginal(const EntryKernel* entry);
1259 1259
1260 protected: 1260 protected:
1261 // Overridden by tests. 1261 // Overridden by tests.
1262 virtual void NotifyTransactionComplete( 1262 virtual void NotifyTransactionComplete(ModelEnumSet models_with_changes);
1263 ModelTypeBitSet models_with_changes);
1264 1263
1265 private: 1264 private:
1266 // Clears |mutations_|. 1265 // Clears |mutations_|.
1267 ImmutableEntryKernelMutationMap RecordMutations(); 1266 ImmutableEntryKernelMutationMap RecordMutations();
1268 1267
1269 void UnlockAndNotify(const ImmutableEntryKernelMutationMap& mutations); 1268 void UnlockAndNotify(const ImmutableEntryKernelMutationMap& mutations);
1270 1269
1271 ModelTypeBitSet NotifyTransactionChangingAndEnding( 1270 ModelEnumSet NotifyTransactionChangingAndEnding(
1272 const ImmutableEntryKernelMutationMap& mutations); 1271 const ImmutableEntryKernelMutationMap& mutations);
1273 1272
1274 // Only the original fields are filled in until |RecordMutations()|. 1273 // Only the original fields are filled in until |RecordMutations()|.
1275 // We use a mutation map instead of a kernel set to avoid copying. 1274 // We use a mutation map instead of a kernel set to avoid copying.
1276 EntryKernelMutationMap mutations_; 1275 EntryKernelMutationMap mutations_;
1277 1276
1278 DISALLOW_COPY_AND_ASSIGN(WriteTransaction); 1277 DISALLOW_COPY_AND_ASSIGN(WriteTransaction);
1279 }; 1278 };
1280 1279
1281 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); 1280 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid);
1282 1281
1283 // This function sets only the flags needed to get this entry to sync. 1282 // This function sets only the flags needed to get this entry to sync.
1284 void MarkForSyncing(syncable::MutableEntry* e); 1283 void MarkForSyncing(syncable::MutableEntry* e);
1285 1284
1286 } // namespace syncable 1285 } // namespace syncable
1287 1286
1288 std::ostream& operator <<(std::ostream&, const syncable::Blob&); 1287 std::ostream& operator <<(std::ostream&, const syncable::Blob&);
1289 1288
1290 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 1289 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/syncable/model_type_test_util.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698