| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "components/sync/base/model_type.h" | 13 #include "components/sync/base/model_type.h" |
| 14 #include "components/sync/base/sync_export.h" | |
| 15 | 14 |
| 16 namespace tracked_objects { | 15 namespace tracked_objects { |
| 17 class Location; | 16 class Location; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace syncer { | 19 namespace syncer { |
| 21 namespace syncable { | 20 namespace syncable { |
| 22 | 21 |
| 23 class BaseTransaction; | 22 class BaseTransaction; |
| 24 class BaseWriteTransaction; | 23 class BaseWriteTransaction; |
| 25 class ModelNeutralMutableEntry; | 24 class ModelNeutralMutableEntry; |
| 26 class Id; | 25 class Id; |
| 27 | 26 |
| 28 SYNC_EXPORT void ChangeEntryIDAndUpdateChildren(BaseWriteTransaction* trans, | 27 void ChangeEntryIDAndUpdateChildren(BaseWriteTransaction* trans, |
| 29 ModelNeutralMutableEntry* entry, | 28 ModelNeutralMutableEntry* entry, |
| 30 const Id& new_id); | 29 const Id& new_id); |
| 31 | 30 |
| 32 SYNC_EXPORT bool IsLegalNewParent(BaseTransaction* trans, | 31 bool IsLegalNewParent(BaseTransaction* trans, const Id& id, const Id& parentid); |
| 33 const Id& id, | |
| 34 const Id& parentid); | |
| 35 | 32 |
| 36 bool SyncAssert(bool condition, | 33 bool SyncAssert(bool condition, |
| 37 const tracked_objects::Location& location, | 34 const tracked_objects::Location& location, |
| 38 const char* msg, | 35 const char* msg, |
| 39 BaseTransaction* trans); | 36 BaseTransaction* trans); |
| 40 | 37 |
| 41 SYNC_EXPORT int GetUnsyncedEntries(BaseTransaction* trans, | 38 int GetUnsyncedEntries(BaseTransaction* trans, std::vector<int64_t>* handles); |
| 42 std::vector<int64_t>* handles); | |
| 43 | 39 |
| 44 // Generates a fixed-length tag for the given string under the given model_type. | 40 // Generates a fixed-length tag for the given string under the given model_type. |
| 45 SYNC_EXPORT std::string GenerateSyncableHash(ModelType model_type, | 41 std::string GenerateSyncableHash(ModelType model_type, |
| 46 const std::string& client_tag); | 42 const std::string& client_tag); |
| 47 | 43 |
| 48 // A helper for generating the bookmark type's tag. This is required in more | 44 // A helper for generating the bookmark type's tag. This is required in more |
| 49 // than one place, so we define the algorithm here to make sure the | 45 // than one place, so we define the algorithm here to make sure the |
| 50 // implementation is consistent. | 46 // implementation is consistent. |
| 51 SYNC_EXPORT std::string GenerateSyncableBookmarkHash( | 47 std::string GenerateSyncableBookmarkHash( |
| 52 const std::string& originator_cache_guid, | 48 const std::string& originator_cache_guid, |
| 53 const std::string& originator_client_item_id); | 49 const std::string& originator_client_item_id); |
| 54 | 50 |
| 55 } // namespace syncable | 51 } // namespace syncable |
| 56 } // namespace syncer | 52 } // namespace syncer |
| 57 | 53 |
| 58 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ | 54 #endif // COMPONENTS_SYNC_SYNCABLE_SYNCABLE_UTIL_H_ |
| OLD | NEW |