OLD | NEW |
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_ENGINE_SYNCER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 LongChangelistCreatesFakeOrphanedEntries); | 123 LongChangelistCreatesFakeOrphanedEntries); |
124 FRIEND_TEST_ALL_PREFIXES(SyncerTest, QuicklyMergeDualCreatedHierarchy); | 124 FRIEND_TEST_ALL_PREFIXES(SyncerTest, QuicklyMergeDualCreatedHierarchy); |
125 FRIEND_TEST_ALL_PREFIXES(SyncerTest, LongChangelistWithApplicationConflict); | 125 FRIEND_TEST_ALL_PREFIXES(SyncerTest, LongChangelistWithApplicationConflict); |
126 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); | 126 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); |
127 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, | 127 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, |
128 EntryCreatedInNewFolderMidSync); | 128 EntryCreatedInNewFolderMidSync); |
129 | 129 |
130 DISALLOW_COPY_AND_ASSIGN(Syncer); | 130 DISALLOW_COPY_AND_ASSIGN(Syncer); |
131 }; | 131 }; |
132 | 132 |
133 // Inline utility functions. | |
134 | |
135 // Given iterator ranges from two collections sorted according to a common | |
136 // strict weak ordering, return true if the two ranges contain any common | |
137 // items, and false if they do not. This function is in this header so that it | |
138 // can be tested. | |
139 template <class Iterator1, class Iterator2> | |
140 bool SortedCollectionsIntersect(Iterator1 begin1, Iterator1 end1, | |
141 Iterator2 begin2, Iterator2 end2) { | |
142 Iterator1 i1 = begin1; | |
143 Iterator2 i2 = begin2; | |
144 while (i1 != end1 && i2 != end2) { | |
145 if (*i1 == *i2) | |
146 return true; | |
147 if (*i1 > *i2) | |
148 ++i2; | |
149 else | |
150 ++i1; | |
151 } | |
152 return false; | |
153 } | |
154 // Utility function declarations. | 133 // Utility function declarations. |
155 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); | 134 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); |
156 void ClearServerData(syncable::MutableEntry* entry); | 135 void ClearServerData(syncable::MutableEntry* entry); |
157 | 136 |
158 } // namespace browser_sync | 137 } // namespace browser_sync |
159 | 138 |
160 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ | 139 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_H_ |
161 | 140 |
OLD | NEW |