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