| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ |
| 6 #define SYNC_SYNCABLE_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "sync/base/sync_export.h" | 14 #include "components/sync/base/model_type.h" |
| 15 #include "sync/internal_api/public/base/model_type.h" | 15 #include "components/sync/base/sync_export.h" |
| 16 #include "sync/syncable/entry.h" | 16 #include "components/sync/syncable/entry.h" |
| 17 | 17 |
| 18 namespace syncer { | 18 namespace syncer { |
| 19 class WriteNode; | 19 class WriteNode; |
| 20 | 20 |
| 21 namespace syncable { | 21 namespace syncable { |
| 22 | 22 |
| 23 class BaseWriteTransaction; | 23 class BaseWriteTransaction; |
| 24 | 24 |
| 25 enum CreateNewUpdateItem { | 25 enum CreateNewUpdateItem { CREATE_NEW_UPDATE_ITEM }; |
| 26 CREATE_NEW_UPDATE_ITEM | |
| 27 }; | |
| 28 | 26 |
| 29 enum CreateNewTypeRoot { CREATE_NEW_TYPE_ROOT }; | 27 enum CreateNewTypeRoot { CREATE_NEW_TYPE_ROOT }; |
| 30 | 28 |
| 31 // This Entry includes all the operations one can safely perform on the sync | 29 // This Entry includes all the operations one can safely perform on the sync |
| 32 // thread. In particular, it does not expose setters to make changes that need | 30 // thread. In particular, it does not expose setters to make changes that need |
| 33 // to be communicated to the model (and the model's thread). It is not possible | 31 // to be communicated to the model (and the model's thread). It is not possible |
| 34 // to change an entry's SPECIFICS or UNIQUE_POSITION fields with this kind of | 32 // to change an entry's SPECIFICS or UNIQUE_POSITION fields with this kind of |
| 35 // entry. | 33 // entry. |
| 36 class SYNC_EXPORT ModelNeutralMutableEntry : public Entry { | 34 class SYNC_EXPORT ModelNeutralMutableEntry : public Entry { |
| 37 public: | 35 public: |
| 38 ModelNeutralMutableEntry(BaseWriteTransaction* trans, | 36 ModelNeutralMutableEntry(BaseWriteTransaction* trans, |
| 39 CreateNewUpdateItem, | 37 CreateNewUpdateItem, |
| 40 const Id& id); | 38 const Id& id); |
| 41 ModelNeutralMutableEntry(BaseWriteTransaction* trans, | 39 ModelNeutralMutableEntry(BaseWriteTransaction* trans, |
| 42 CreateNewTypeRoot, | 40 CreateNewTypeRoot, |
| 43 ModelType type); | 41 ModelType type); |
| 44 ModelNeutralMutableEntry(BaseWriteTransaction* trans, GetByHandle, int64_t); | 42 ModelNeutralMutableEntry(BaseWriteTransaction* trans, GetByHandle, int64_t); |
| 45 ModelNeutralMutableEntry(BaseWriteTransaction* trans, GetById, const Id&); | 43 ModelNeutralMutableEntry(BaseWriteTransaction* trans, GetById, const Id&); |
| 46 ModelNeutralMutableEntry( | 44 ModelNeutralMutableEntry(BaseWriteTransaction* trans, |
| 47 BaseWriteTransaction* trans, | 45 GetByClientTag, |
| 48 GetByClientTag, | 46 const std::string& tag); |
| 49 const std::string& tag); | 47 ModelNeutralMutableEntry(BaseWriteTransaction* trans, |
| 50 ModelNeutralMutableEntry( | 48 GetTypeRoot, |
| 51 BaseWriteTransaction* trans, | 49 ModelType type); |
| 52 GetTypeRoot, | |
| 53 ModelType type); | |
| 54 | 50 |
| 55 inline BaseWriteTransaction* base_write_transaction() const { | 51 inline BaseWriteTransaction* base_write_transaction() const { |
| 56 return base_write_transaction_; | 52 return base_write_transaction_; |
| 57 } | 53 } |
| 58 | 54 |
| 59 // Non-model-changing setters. These setters will change properties internal | 55 // Non-model-changing setters. These setters will change properties internal |
| 60 // to the node. These fields are important for bookkeeping in the sync | 56 // to the node. These fields are important for bookkeeping in the sync |
| 61 // internals, but it is not necessary to communicate changes in these fields | 57 // internals, but it is not necessary to communicate changes in these fields |
| 62 // to the local models. | 58 // to the local models. |
| 63 // | 59 // |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // floating around if at all possible. Could we store this in Directory? | 115 // floating around if at all possible. Could we store this in Directory? |
| 120 // Scope: Set on construction, never changed after that. | 116 // Scope: Set on construction, never changed after that. |
| 121 BaseWriteTransaction* const base_write_transaction_; | 117 BaseWriteTransaction* const base_write_transaction_; |
| 122 | 118 |
| 123 DISALLOW_COPY_AND_ASSIGN(ModelNeutralMutableEntry); | 119 DISALLOW_COPY_AND_ASSIGN(ModelNeutralMutableEntry); |
| 124 }; | 120 }; |
| 125 | 121 |
| 126 } // namespace syncable | 122 } // namespace syncable |
| 127 } // namespace syncer | 123 } // namespace syncer |
| 128 | 124 |
| 129 #endif // SYNC_SYNCABLE_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ | 125 #endif // COMPONENTS_SYNC_SYNCABLE_MODEL_NEUTRAL_MUTABLE_ENTRY_H_ |
| OLD | NEW |