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_MUTABLE_ENTRY_H_ | 5 #ifndef SYNC_SYNCABLE_MUTABLE_ENTRY_H_ |
6 #define SYNC_SYNCABLE_MUTABLE_ENTRY_H_ | 6 #define SYNC_SYNCABLE_MUTABLE_ENTRY_H_ |
7 | 7 |
8 #include "sync/base/sync_export.h" | 8 #include "sync/base/sync_export.h" |
| 9 #include "sync/internal_api/public/base/model_type.h" |
9 #include "sync/internal_api/public/base/node_ordinal.h" | 10 #include "sync/internal_api/public/base/node_ordinal.h" |
10 #include "sync/syncable/entry.h" | 11 #include "sync/syncable/entry.h" |
11 #include "sync/syncable/metahandle_set.h" | 12 #include "sync/syncable/metahandle_set.h" |
12 | 13 |
13 namespace syncer { | 14 namespace syncer { |
14 class WriteNode; | 15 class WriteNode; |
15 | 16 |
16 namespace syncable { | 17 namespace syncable { |
17 | 18 |
18 class WriteTransaction; | 19 class WriteTransaction; |
19 | 20 |
20 enum Create { | 21 enum Create { |
21 CREATE | 22 CREATE |
22 }; | 23 }; |
23 | 24 |
24 enum CreateNewUpdateItem { | 25 enum CreateNewUpdateItem { |
25 CREATE_NEW_UPDATE_ITEM | 26 CREATE_NEW_UPDATE_ITEM |
26 }; | 27 }; |
27 | 28 |
28 // A mutable meta entry. Changes get committed to the database when the | 29 // A mutable meta entry. Changes get committed to the database when the |
29 // WriteTransaction is destroyed. | 30 // WriteTransaction is destroyed. |
30 class SYNC_EXPORT_PRIVATE MutableEntry : public Entry { | 31 class SYNC_EXPORT_PRIVATE MutableEntry : public Entry { |
31 void Init(WriteTransaction* trans, const Id& parent_id, | 32 void Init(WriteTransaction* trans, ModelType model_type, |
32 const std::string& name); | 33 const Id& parent_id, const std::string& name); |
33 | 34 |
34 public: | 35 public: |
35 MutableEntry(WriteTransaction* trans, Create, const Id& parent_id, | 36 MutableEntry(WriteTransaction* trans, Create, ModelType model_type, |
36 const std::string& name); | 37 const Id& parent_id, const std::string& name); |
37 MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, const Id& id); | 38 MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, const Id& id); |
38 MutableEntry(WriteTransaction* trans, GetByHandle, int64); | 39 MutableEntry(WriteTransaction* trans, GetByHandle, int64); |
39 MutableEntry(WriteTransaction* trans, GetById, const Id&); | 40 MutableEntry(WriteTransaction* trans, GetById, const Id&); |
40 MutableEntry(WriteTransaction* trans, GetByClientTag, const std::string& tag); | 41 MutableEntry(WriteTransaction* trans, GetByClientTag, const std::string& tag); |
41 MutableEntry(WriteTransaction* trans, GetByServerTag, const std::string& tag); | 42 MutableEntry(WriteTransaction* trans, GetByServerTag, const std::string& tag); |
42 | 43 |
43 inline WriteTransaction* write_transaction() const { | 44 inline WriteTransaction* write_transaction() const { |
44 return write_transaction_; | 45 return write_transaction_; |
45 } | 46 } |
46 | 47 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DISALLOW_COPY_AND_ASSIGN(MutableEntry); | 113 DISALLOW_COPY_AND_ASSIGN(MutableEntry); |
113 }; | 114 }; |
114 | 115 |
115 // This function sets only the flags needed to get this entry to sync. | 116 // This function sets only the flags needed to get this entry to sync. |
116 bool MarkForSyncing(syncable::MutableEntry* e); | 117 bool MarkForSyncing(syncable::MutableEntry* e); |
117 | 118 |
118 } // namespace syncable | 119 } // namespace syncable |
119 } // namespace syncer | 120 } // namespace syncer |
120 | 121 |
121 #endif // SYNC_SYNCABLE_MUTABLE_ENTRY_H_ | 122 #endif // SYNC_SYNCABLE_MUTABLE_ENTRY_H_ |
OLD | NEW |