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