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