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 #include "sync/syncable/syncable_delete_journal.h" | 5 #include "sync/syncable/syncable_delete_journal.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
8 #include "sync/internal_api/public/base/model_type.h" | 11 #include "sync/internal_api/public/base/model_type.h" |
9 | 12 |
10 namespace syncer { | 13 namespace syncer { |
11 namespace syncable { | 14 namespace syncable { |
12 | 15 |
13 DeleteJournal::DeleteJournal(JournalIndex* initial_journal) { | 16 DeleteJournal::DeleteJournal(JournalIndex* initial_journal) { |
14 CHECK(initial_journal); | 17 CHECK(initial_journal); |
15 delete_journals_.swap(*initial_journal); | 18 delete_journals_.swap(*initial_journal); |
16 } | 19 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 79 } |
77 } | 80 } |
78 passive_delete_journal_types_.Put(type); | 81 passive_delete_journal_types_.Put(type); |
79 } | 82 } |
80 | 83 |
81 void DeleteJournal::PurgeDeleteJournals(BaseTransaction* trans, | 84 void DeleteJournal::PurgeDeleteJournals(BaseTransaction* trans, |
82 const MetahandleSet& to_purge) { | 85 const MetahandleSet& to_purge) { |
83 DCHECK(trans); | 86 DCHECK(trans); |
84 JournalIndex::iterator it = delete_journals_.begin(); | 87 JournalIndex::iterator it = delete_journals_.begin(); |
85 while (it != delete_journals_.end()) { | 88 while (it != delete_journals_.end()) { |
86 int64 handle = (*it)->ref(META_HANDLE); | 89 int64_t handle = (*it)->ref(META_HANDLE); |
87 if (to_purge.count(handle)) { | 90 if (to_purge.count(handle)) { |
88 delete *it; | 91 delete *it; |
89 delete_journals_.erase(it++); | 92 delete_journals_.erase(it++); |
90 } else { | 93 } else { |
91 ++it; | 94 ++it; |
92 } | 95 } |
93 } | 96 } |
94 delete_journals_to_purge_.insert(to_purge.begin(), to_purge.end()); | 97 delete_journals_to_purge_.insert(to_purge.begin(), to_purge.end()); |
95 } | 98 } |
96 | 99 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 switch (type) { | 137 switch (type) { |
135 case BOOKMARKS: | 138 case BOOKMARKS: |
136 return true; | 139 return true; |
137 default: | 140 default: |
138 return false; | 141 return false; |
139 } | 142 } |
140 } | 143 } |
141 | 144 |
142 } // namespace syncable | 145 } // namespace syncable |
143 } // namespace syncer | 146 } // namespace syncer |
OLD | NEW |