| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ | 5 #ifndef SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ |
| 6 #define SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ | 6 #define SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ |
| 7 | 7 |
| 8 #include "sync/syncable/directory.h" | 8 #include "sync/syncable/directory.h" |
| 9 | 9 |
| 10 namespace syncer { |
| 10 namespace syncable { | 11 namespace syncable { |
| 11 class ScopedKernelLock; | 12 class ScopedKernelLock; |
| 12 | 13 |
| 13 // A ScopedIndexUpdater temporarily removes an entry from an index, | 14 // A ScopedIndexUpdater temporarily removes an entry from an index, |
| 14 // and restores it to the index when the scope exits. This simplifies | 15 // and restores it to the index when the scope exits. This simplifies |
| 15 // the common pattern where items need to be removed from an index | 16 // the common pattern where items need to be removed from an index |
| 16 // before updating the field. | 17 // before updating the field. |
| 17 // | 18 // |
| 18 // This class is parameterized on the Indexer traits type, which | 19 // This class is parameterized on the Indexer traits type, which |
| 19 // must define a Comparator and a static bool ShouldInclude | 20 // must define a Comparator and a static bool ShouldInclude |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 } | 45 } |
| 45 } | 46 } |
| 46 private: | 47 private: |
| 47 // The entry that was temporarily removed from the index. | 48 // The entry that was temporarily removed from the index. |
| 48 EntryKernel* entry_; | 49 EntryKernel* entry_; |
| 49 // The index which we are updating. | 50 // The index which we are updating. |
| 50 typename Index<Indexer>::Set* const index_; | 51 typename Index<Indexer>::Set* const index_; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace syncable | 54 } // namespace syncable |
| 55 } // namespace syncer |
| 54 | 56 |
| 55 #endif // SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ | 57 #endif // SYNC_SYNCABLE_SCOPED_INDEX_UPDATER_H_ |
| OLD | NEW |