| OLD | NEW | 
|    1 // Copyright 2013 The Chromium Authors. All rights reserved. |    1 // Copyright 2013 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 COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ |    5 #ifndef COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ | 
|    6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ |    6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ | 
|    7  |    7  | 
|    8 #include <stddef.h> |    8 #include <stddef.h> | 
|    9  |    9  | 
|   10 #include <map> |   10 #include <map> | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   24 class LessByID { |   24 class LessByID { | 
|   25  public: |   25  public: | 
|   26   inline bool operator()(const EntryKernel* a, const EntryKernel* b) const { |   26   inline bool operator()(const EntryKernel* a, const EntryKernel* b) const { | 
|   27     return a->ref(ID) < b->ref(ID); |   27     return a->ref(ID) < b->ref(ID); | 
|   28   } |   28   } | 
|   29 }; |   29 }; | 
|   30 // This should be |std::set<std::unique_ptr<EntryKernel>, LessByID>|. However, |   30 // This should be |std::set<std::unique_ptr<EntryKernel>, LessByID>|. However, | 
|   31 // DeleteJournal::TakeSnapshotAndClear needs to remove the unique_ptr from the |   31 // DeleteJournal::TakeSnapshotAndClear needs to remove the unique_ptr from the | 
|   32 // set, and std::set::extract is only available in C++17. TODO(avi): Switch to |   32 // set, and std::set::extract is only available in C++17. TODO(avi): Switch to | 
|   33 // using a std::set when Chromium allows C++17 use. |   33 // using a std::set when Chromium allows C++17 use. | 
|   34 typedef std::map<const EntryKernel*, std::unique_ptr<EntryKernel>, LessByID> |   34 using JournalIndex = | 
|   35     JournalIndex; |   35     std::map<const EntryKernel*, std::unique_ptr<EntryKernel>, LessByID>; | 
|   36  |   36  | 
|   37 // DeleteJournal manages deleted entries that are not in sync directory until |   37 // DeleteJournal manages deleted entries that are not in sync directory until | 
|   38 // it's safe to drop them after the deletion is confirmed with native models. |   38 // it's safe to drop them after the deletion is confirmed with native models. | 
|   39 // DeleteJournal is thread-safe and can be accessed on any thread. Has to hold |   39 // DeleteJournal is thread-safe and can be accessed on any thread. Has to hold | 
|   40 // a valid transaction object when calling methods of DeleteJournal, thus each |   40 // a valid transaction object when calling methods of DeleteJournal, thus each | 
|   41 // method requires a non-null |trans| parameter. |   41 // method requires a non-null |trans| parameter. | 
|   42 class DeleteJournal { |   42 class DeleteJournal { | 
|   43  public: |   43  public: | 
|   44   // Initialize |delete_journals_| using |initial_journal|. |   44   // Initialize |delete_journals_| using |initial_journal|. | 
|   45   explicit DeleteJournal(std::unique_ptr<JournalIndex> initial_journal); |   45   explicit DeleteJournal(std::unique_ptr<JournalIndex> initial_journal); | 
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  109   // saved to database. |  109   // saved to database. | 
|  110   ModelTypeSet passive_delete_journal_types_; |  110   ModelTypeSet passive_delete_journal_types_; | 
|  111  |  111  | 
|  112   DISALLOW_COPY_AND_ASSIGN(DeleteJournal); |  112   DISALLOW_COPY_AND_ASSIGN(DeleteJournal); | 
|  113 }; |  113 }; | 
|  114  |  114  | 
|  115 }  // namespace syncable |  115 }  // namespace syncable | 
|  116 }  // namespace syncer |  116 }  // namespace syncer | 
|  117  |  117  | 
|  118 #endif  // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ |  118 #endif  // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ | 
| OLD | NEW |