| 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 // Utility functions manipulating syncable::Entries, intended for use by the | 5 // Utility functions manipulating syncable::Entries, intended for use by the |
| 6 // syncer. | 6 // syncer. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| 9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| 10 #pragma once | 10 #pragma once |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // Pass in name to avoid redundant UTF8 conversion. | 61 // Pass in name to avoid redundant UTF8 conversion. |
| 62 static void UpdateServerFieldsFromUpdate( | 62 static void UpdateServerFieldsFromUpdate( |
| 63 syncable::MutableEntry* local_entry, | 63 syncable::MutableEntry* local_entry, |
| 64 const SyncEntity& server_entry, | 64 const SyncEntity& server_entry, |
| 65 const std::string& name); | 65 const std::string& name); |
| 66 | 66 |
| 67 // Creates a new Entry iff no Entry exists with the given id. | 67 // Creates a new Entry iff no Entry exists with the given id. |
| 68 static void CreateNewEntry(syncable::WriteTransaction *trans, | 68 static void CreateNewEntry(syncable::WriteTransaction *trans, |
| 69 const syncable::Id& id); | 69 const syncable::Id& id); |
| 70 | 70 |
| 71 static bool ServerAndLocalEntriesMatch(syncable::Entry* entry); | |
| 72 | |
| 73 static void SplitServerInformationIntoNewEntry( | 71 static void SplitServerInformationIntoNewEntry( |
| 74 syncable::WriteTransaction* trans, | 72 syncable::WriteTransaction* trans, |
| 75 syncable::MutableEntry* entry); | 73 syncable::MutableEntry* entry); |
| 76 | 74 |
| 77 // This function is called on an entry when we can update the user-facing data | 75 // This function is called on an entry when we can update the user-facing data |
| 78 // from the server data. | 76 // from the server data. |
| 79 static void UpdateLocalDataFromServerData(syncable::WriteTransaction* trans, | 77 static void UpdateLocalDataFromServerData(syncable::WriteTransaction* trans, |
| 80 syncable::MutableEntry* entry); | 78 syncable::MutableEntry* entry); |
| 81 | 79 |
| 82 static VerifyCommitResult ValidateCommitEntry(syncable::Entry* entry); | 80 static VerifyCommitResult ValidateCommitEntry(syncable::Entry* entry); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 syncable::BaseTransaction* trans, | 121 syncable::BaseTransaction* trans, |
| 124 syncable::Entry* item, | 122 syncable::Entry* item, |
| 125 syncable::IndexedBitField inclusion_filter, | 123 syncable::IndexedBitField inclusion_filter, |
| 126 syncable::MetahandleSet* inserted_items, | 124 syncable::MetahandleSet* inserted_items, |
| 127 std::vector<syncable::Id>* commit_ids); | 125 std::vector<syncable::Id>* commit_ids); |
| 128 | 126 |
| 129 static void MarkDeletedChildrenSynced( | 127 static void MarkDeletedChildrenSynced( |
| 130 const syncable::ScopedDirLookup &dir, | 128 const syncable::ScopedDirLookup &dir, |
| 131 std::set<syncable::Id>* deleted_folders); | 129 std::set<syncable::Id>* deleted_folders); |
| 132 | 130 |
| 133 // Examine the up-to-date predecessors of this item according to the server | |
| 134 // position, and then again according to the local position. Return true | |
| 135 // if they match. For an up-to-date item, this should be the case. | |
| 136 static bool ServerAndLocalOrdersMatch(syncable::Entry* entry); | |
| 137 | |
| 138 private: | 131 private: |
| 139 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncerUtil); | 132 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncerUtil); |
| 140 }; | 133 }; |
| 141 | 134 |
| 142 } // namespace browser_sync | 135 } // namespace browser_sync |
| 143 | 136 |
| 144 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ | 137 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_UTIL_H_ |
| OLD | NEW |