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> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include <memory> |
| 10 |
10 #include "sync/internal_api/public/base/unique_position.h" | 11 #include "sync/internal_api/public/base/unique_position.h" |
11 #include "sync/syncable/directory.h" | 12 #include "sync/syncable/directory.h" |
12 #include "sync/syncable/scoped_kernel_lock.h" | 13 #include "sync/syncable/scoped_kernel_lock.h" |
13 #include "sync/syncable/scoped_parent_child_index_updater.h" | 14 #include "sync/syncable/scoped_parent_child_index_updater.h" |
14 #include "sync/syncable/syncable-inl.h" | 15 #include "sync/syncable/syncable-inl.h" |
15 #include "sync/syncable/syncable_changes_version.h" | 16 #include "sync/syncable/syncable_changes_version.h" |
16 #include "sync/syncable/syncable_util.h" | 17 #include "sync/syncable/syncable_util.h" |
17 #include "sync/syncable/syncable_write_transaction.h" | 18 #include "sync/syncable/syncable_write_transaction.h" |
18 | 19 |
19 using std::string; | 20 using std::string; |
20 | 21 |
21 namespace syncer { | 22 namespace syncer { |
22 namespace syncable { | 23 namespace syncable { |
23 | 24 |
24 void MutableEntry::Init(WriteTransaction* trans, | 25 void MutableEntry::Init(WriteTransaction* trans, |
25 ModelType model_type, | 26 ModelType model_type, |
26 const Id& parent_id, | 27 const Id& parent_id, |
27 const string& name) { | 28 const string& name) { |
28 scoped_ptr<EntryKernel> kernel(new EntryKernel); | 29 std::unique_ptr<EntryKernel> kernel(new EntryKernel); |
29 kernel_ = NULL; | 30 kernel_ = NULL; |
30 | 31 |
31 kernel->put(ID, trans->directory_->NextId()); | 32 kernel->put(ID, trans->directory_->NextId()); |
32 kernel->put(META_HANDLE, trans->directory_->NextMetahandle()); | 33 kernel->put(META_HANDLE, trans->directory_->NextMetahandle()); |
33 kernel->mark_dirty(&trans->directory_->kernel()->dirty_metahandles); | 34 kernel->mark_dirty(&trans->directory_->kernel()->dirty_metahandles); |
34 kernel->put(NON_UNIQUE_NAME, name); | 35 kernel->put(NON_UNIQUE_NAME, name); |
35 const base::Time& now = base::Time::Now(); | 36 const base::Time& now = base::Time::Now(); |
36 kernel->put(CTIME, now); | 37 kernel->put(CTIME, now); |
37 kernel->put(MTIME, now); | 38 kernel->put(MTIME, now); |
38 // We match the database defaults here | 39 // We match the database defaults here |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; | 313 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; |
313 if (!(e->PutIsUnsynced(true))) | 314 if (!(e->PutIsUnsynced(true))) |
314 return false; | 315 return false; |
315 if (e->GetSyncing()) | 316 if (e->GetSyncing()) |
316 e->PutDirtySync(true); | 317 e->PutDirtySync(true); |
317 return true; | 318 return true; |
318 } | 319 } |
319 | 320 |
320 } // namespace syncable | 321 } // namespace syncable |
321 } // namespace syncer | 322 } // namespace syncer |
OLD | NEW |