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 #include "sync/syncable/mutable_entry.h" | 5 #include "sync/syncable/mutable_entry.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
8 #include "sync/internal_api/public/base/unique_position.h" | 10 #include "sync/internal_api/public/base/unique_position.h" |
9 #include "sync/syncable/directory.h" | 11 #include "sync/syncable/directory.h" |
10 #include "sync/syncable/scoped_kernel_lock.h" | 12 #include "sync/syncable/scoped_kernel_lock.h" |
11 #include "sync/syncable/scoped_parent_child_index_updater.h" | 13 #include "sync/syncable/scoped_parent_child_index_updater.h" |
12 #include "sync/syncable/syncable-inl.h" | 14 #include "sync/syncable/syncable-inl.h" |
13 #include "sync/syncable/syncable_changes_version.h" | 15 #include "sync/syncable/syncable_changes_version.h" |
14 #include "sync/syncable/syncable_util.h" | 16 #include "sync/syncable/syncable_util.h" |
15 #include "sync/syncable/syncable_write_transaction.h" | 17 #include "sync/syncable/syncable_write_transaction.h" |
16 | 18 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 MutableEntry::MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, | 98 MutableEntry::MutableEntry(WriteTransaction* trans, CreateNewUpdateItem, |
97 const Id& id) | 99 const Id& id) |
98 : ModelNeutralMutableEntry(trans, CREATE_NEW_UPDATE_ITEM, id), | 100 : ModelNeutralMutableEntry(trans, CREATE_NEW_UPDATE_ITEM, id), |
99 write_transaction_(trans) {} | 101 write_transaction_(trans) {} |
100 | 102 |
101 MutableEntry::MutableEntry(WriteTransaction* trans, GetById, const Id& id) | 103 MutableEntry::MutableEntry(WriteTransaction* trans, GetById, const Id& id) |
102 : ModelNeutralMutableEntry(trans, GET_BY_ID, id), | 104 : ModelNeutralMutableEntry(trans, GET_BY_ID, id), |
103 write_transaction_(trans) { | 105 write_transaction_(trans) { |
104 } | 106 } |
105 | 107 |
106 MutableEntry::MutableEntry(WriteTransaction* trans, GetByHandle, | 108 MutableEntry::MutableEntry(WriteTransaction* trans, |
107 int64 metahandle) | 109 GetByHandle, |
| 110 int64_t metahandle) |
108 : ModelNeutralMutableEntry(trans, GET_BY_HANDLE, metahandle), | 111 : ModelNeutralMutableEntry(trans, GET_BY_HANDLE, metahandle), |
109 write_transaction_(trans) { | 112 write_transaction_(trans) {} |
110 } | |
111 | 113 |
112 MutableEntry::MutableEntry(WriteTransaction* trans, GetByClientTag, | 114 MutableEntry::MutableEntry(WriteTransaction* trans, GetByClientTag, |
113 const std::string& tag) | 115 const std::string& tag) |
114 : ModelNeutralMutableEntry(trans, GET_BY_CLIENT_TAG, tag), | 116 : ModelNeutralMutableEntry(trans, GET_BY_CLIENT_TAG, tag), |
115 write_transaction_(trans) { | 117 write_transaction_(trans) { |
116 } | 118 } |
117 | 119 |
118 MutableEntry::MutableEntry(WriteTransaction* trans, GetTypeRoot, ModelType type) | 120 MutableEntry::MutableEntry(WriteTransaction* trans, GetTypeRoot, ModelType type) |
119 : ModelNeutralMutableEntry(trans, GET_TYPE_ROOT, type), | 121 : ModelNeutralMutableEntry(trans, GET_TYPE_ROOT, type), |
120 write_transaction_(trans) { | 122 write_transaction_(trans) { |
121 } | 123 } |
122 | 124 |
123 void MutableEntry::PutLocalExternalId(int64 value) { | 125 void MutableEntry::PutLocalExternalId(int64_t value) { |
124 DCHECK(kernel_); | 126 DCHECK(kernel_); |
125 if (kernel_->ref(LOCAL_EXTERNAL_ID) != value) { | 127 if (kernel_->ref(LOCAL_EXTERNAL_ID) != value) { |
126 write_transaction()->TrackChangesTo(kernel_); | 128 write_transaction()->TrackChangesTo(kernel_); |
127 ScopedKernelLock lock(dir()); | 129 ScopedKernelLock lock(dir()); |
128 kernel_->put(LOCAL_EXTERNAL_ID, value); | 130 kernel_->put(LOCAL_EXTERNAL_ID, value); |
129 MarkDirty(); | 131 MarkDirty(); |
130 } | 132 } |
131 } | 133 } |
132 | 134 |
133 void MutableEntry::PutMtime(base::Time value) { | 135 void MutableEntry::PutMtime(base::Time value) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; | 312 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; |
311 if (!(e->PutIsUnsynced(true))) | 313 if (!(e->PutIsUnsynced(true))) |
312 return false; | 314 return false; |
313 if (e->GetSyncing()) | 315 if (e->GetSyncing()) |
314 e->PutDirtySync(true); | 316 e->PutDirtySync(true); |
315 return true; | 317 return true; |
316 } | 318 } |
317 | 319 |
318 } // namespace syncable | 320 } // namespace syncable |
319 } // namespace syncer | 321 } // namespace syncer |
OLD | NEW |