| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 SYNC_ENGINE_SYNCER_UTIL_H_ | 8 #ifndef SYNC_ENGINE_SYNCER_UTIL_H_ |
| 9 #define SYNC_ENGINE_SYNCER_UTIL_H_ | 9 #define SYNC_ENGINE_SYNCER_UTIL_H_ |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "sync/base/sync_export.h" | |
| 16 #include "sync/engine/syncer.h" | 15 #include "sync/engine/syncer.h" |
| 17 #include "sync/engine/syncer_types.h" | 16 #include "sync/engine/syncer_types.h" |
| 18 #include "sync/syncable/entry_kernel.h" | 17 #include "sync/syncable/entry_kernel.h" |
| 19 #include "sync/syncable/metahandle_set.h" | 18 #include "sync/syncable/metahandle_set.h" |
| 20 #include "sync/syncable/mutable_entry.h" | 19 #include "sync/syncable/mutable_entry.h" |
| 21 #include "sync/syncable/syncable_id.h" | 20 #include "sync/syncable/syncable_id.h" |
| 22 | 21 |
| 23 namespace sync_pb { | 22 namespace sync_pb { |
| 24 class SyncEntity; | 23 class SyncEntity; |
| 25 } // namespace sync_pb | 24 } // namespace sync_pb |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 Cryptographer* cryptographer); | 51 Cryptographer* cryptographer); |
| 53 | 52 |
| 54 // Returns the most accurate position information available in this update. It | 53 // Returns the most accurate position information available in this update. It |
| 55 // prefers to use the unique_position() field, but will fall back to using the | 54 // prefers to use the unique_position() field, but will fall back to using the |
| 56 // int64-based position_in_parent if necessary. | 55 // int64-based position_in_parent if necessary. |
| 57 // | 56 // |
| 58 // The suffix parameter is the unique bookmark tag for the item being updated. | 57 // The suffix parameter is the unique bookmark tag for the item being updated. |
| 59 // | 58 // |
| 60 // Will return an invalid position if no valid position can be constructed, or | 59 // Will return an invalid position if no valid position can be constructed, or |
| 61 // if this type does not support positioning. | 60 // if this type does not support positioning. |
| 62 SYNC_EXPORT_PRIVATE UniquePosition GetUpdatePosition( | 61 UniquePosition GetUpdatePosition(const sync_pb::SyncEntity& update, |
| 63 const sync_pb::SyncEntity& update, | 62 const std::string& suffix); |
| 64 const std::string& suffix); | |
| 65 | 63 |
| 66 // Fetch the cache_guid and item_id-based unique bookmark tag from an update. | 64 // Fetch the cache_guid and item_id-based unique bookmark tag from an update. |
| 67 // Will return an empty string if someting unexpected happens. | 65 // Will return an empty string if someting unexpected happens. |
| 68 SYNC_EXPORT_PRIVATE std::string GetUniqueBookmarkTagFromUpdate( | 66 std::string GetUniqueBookmarkTagFromUpdate(const sync_pb::SyncEntity& update); |
| 69 const sync_pb::SyncEntity& update); | |
| 70 | 67 |
| 71 // Pass in name to avoid redundant UTF8 conversion. | 68 // Pass in name to avoid redundant UTF8 conversion. |
| 72 void UpdateServerFieldsFromUpdate( | 69 void UpdateServerFieldsFromUpdate( |
| 73 syncable::ModelNeutralMutableEntry* local_entry, | 70 syncable::ModelNeutralMutableEntry* local_entry, |
| 74 const sync_pb::SyncEntity& server_entry, | 71 const sync_pb::SyncEntity& server_entry, |
| 75 const std::string& name); | 72 const std::string& name); |
| 76 | 73 |
| 77 // Creates a new Entry iff no Entry exists with the given id. | 74 // Creates a new Entry iff no Entry exists with the given id. |
| 78 void CreateNewEntry(syncable::ModelNeutralWriteTransaction *trans, | 75 void CreateNewEntry(syncable::ModelNeutralWriteTransaction *trans, |
| 79 const syncable::Id& id); | 76 const syncable::Id& id); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 106 syncable::ModelNeutralMutableEntry* target); | 103 syncable::ModelNeutralMutableEntry* target); |
| 107 | 104 |
| 108 void MarkDeletedChildrenSynced( | 105 void MarkDeletedChildrenSynced( |
| 109 syncable::Directory* dir, | 106 syncable::Directory* dir, |
| 110 syncable::BaseWriteTransaction* trans, | 107 syncable::BaseWriteTransaction* trans, |
| 111 std::set<syncable::Id>* deleted_folders); | 108 std::set<syncable::Id>* deleted_folders); |
| 112 | 109 |
| 113 } // namespace syncer | 110 } // namespace syncer |
| 114 | 111 |
| 115 #endif // SYNC_ENGINE_SYNCER_UTIL_H_ | 112 #endif // SYNC_ENGINE_SYNCER_UTIL_H_ |
| OLD | NEW |