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 <set> | 10 #include <set> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "components/sync/base/sync_export.h" | |
16 #include "components/sync/syncable/metahandle_set.h" | 15 #include "components/sync/syncable/metahandle_set.h" |
17 #include "components/sync/syncable/syncable-inl.h" | 16 #include "components/sync/syncable/syncable-inl.h" |
18 | 17 |
19 namespace syncer { | 18 namespace syncer { |
20 namespace syncable { | 19 namespace syncable { |
21 | 20 |
22 class BaseTransaction; | 21 class BaseTransaction; |
23 struct EntryKernel; | 22 struct EntryKernel; |
24 | 23 |
25 typedef std::set<const EntryKernel*, LessField<IdField, ID>> JournalIndex; | 24 typedef std::set<const EntryKernel*, LessField<IdField, ID>> JournalIndex; |
26 | 25 |
27 // DeleteJournal manages deleted entries that are not in sync directory until | 26 // DeleteJournal manages deleted entries that are not in sync directory until |
28 // it's safe to drop them after the deletion is confirmed with native models. | 27 // it's safe to drop them after the deletion is confirmed with native models. |
29 // DeleteJournal is thread-safe and can be accessed on any thread. Has to hold | 28 // DeleteJournal is thread-safe and can be accessed on any thread. Has to hold |
30 // a valid transaction object when calling methods of DeleteJournal, thus each | 29 // a valid transaction object when calling methods of DeleteJournal, thus each |
31 // method requires a non-null |trans| parameter. | 30 // method requires a non-null |trans| parameter. |
32 class SYNC_EXPORT DeleteJournal { | 31 class DeleteJournal { |
33 public: | 32 public: |
34 // Initialize |delete_journals_| using |intitial_journal|, whose content is | 33 // Initialize |delete_journals_| using |intitial_journal|, whose content is |
35 // destroyed during initialization. | 34 // destroyed during initialization. |
36 explicit DeleteJournal(JournalIndex* initial_journal); | 35 explicit DeleteJournal(JournalIndex* initial_journal); |
37 ~DeleteJournal(); | 36 ~DeleteJournal(); |
38 | 37 |
39 // For testing only. | 38 // For testing only. |
40 size_t GetDeleteJournalSize(BaseTransaction* trans) const; | 39 size_t GetDeleteJournalSize(BaseTransaction* trans) const; |
41 | 40 |
42 // Add/remove |entry| to/from |delete_journals_| according to its | 41 // Add/remove |entry| to/from |delete_journals_| according to its |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // saved to database. | 98 // saved to database. |
100 ModelTypeSet passive_delete_journal_types_; | 99 ModelTypeSet passive_delete_journal_types_; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(DeleteJournal); | 101 DISALLOW_COPY_AND_ASSIGN(DeleteJournal); |
103 }; | 102 }; |
104 | 103 |
105 } // namespace syncable | 104 } // namespace syncable |
106 } // namespace syncer | 105 } // namespace syncer |
107 | 106 |
108 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ | 107 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_DELETE_JOURNAL_H_ |
OLD | NEW |