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 #include "sync/syncable/directory.h" | 5 #include "sync/syncable/directory.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 int64 Directory::GetTransactionVersion(ModelType type) const { | 785 int64 Directory::GetTransactionVersion(ModelType type) const { |
786 kernel_->transaction_mutex.AssertAcquired(); | 786 kernel_->transaction_mutex.AssertAcquired(); |
787 return kernel_->persisted_info.transaction_version[type]; | 787 return kernel_->persisted_info.transaction_version[type]; |
788 } | 788 } |
789 | 789 |
790 void Directory::IncrementTransactionVersion(ModelType type) { | 790 void Directory::IncrementTransactionVersion(ModelType type) { |
791 kernel_->transaction_mutex.AssertAcquired(); | 791 kernel_->transaction_mutex.AssertAcquired(); |
792 kernel_->persisted_info.transaction_version[type]++; | 792 kernel_->persisted_info.transaction_version[type]++; |
793 } | 793 } |
794 | 794 |
| 795 void Directory::GetDataTypeContext(BaseTransaction* trans, |
| 796 ModelType type, |
| 797 sync_pb::DataTypeContext* context) const { |
| 798 ScopedKernelLock lock(this); |
| 799 context->CopyFrom(kernel_->persisted_info.datatype_context[type]); |
| 800 } |
| 801 |
| 802 void Directory::SetDataTypeContext( |
| 803 BaseWriteTransaction* trans, |
| 804 ModelType type, |
| 805 const sync_pb::DataTypeContext& context) { |
| 806 ScopedKernelLock lock(this); |
| 807 kernel_->persisted_info.datatype_context[type].CopyFrom(context); |
| 808 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY; |
| 809 } |
| 810 |
795 ModelTypeSet Directory::InitialSyncEndedTypes() { | 811 ModelTypeSet Directory::InitialSyncEndedTypes() { |
796 syncable::ReadTransaction trans(FROM_HERE, this); | 812 syncable::ReadTransaction trans(FROM_HERE, this); |
797 ModelTypeSet protocol_types = ProtocolTypes(); | 813 ModelTypeSet protocol_types = ProtocolTypes(); |
798 ModelTypeSet initial_sync_ended_types; | 814 ModelTypeSet initial_sync_ended_types; |
799 for (ModelTypeSet::Iterator i = protocol_types.First(); i.Good(); i.Inc()) { | 815 for (ModelTypeSet::Iterator i = protocol_types.First(); i.Good(); i.Inc()) { |
800 if (InitialSyncEndedForType(&trans, i.Get())) { | 816 if (InitialSyncEndedForType(&trans, i.Get())) { |
801 initial_sync_ended_types.Put(i.Get()); | 817 initial_sync_ended_types.Put(i.Get()); |
802 } | 818 } |
803 } | 819 } |
804 return initial_sync_ended_types; | 820 return initial_sync_ended_types; |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 | 1314 |
1299 for (OrderedChildSet::const_iterator i = children->begin(); | 1315 for (OrderedChildSet::const_iterator i = children->begin(); |
1300 i != children->end(); ++i) { | 1316 i != children->end(); ++i) { |
1301 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); | 1317 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); |
1302 result->push_back((*i)->ref(META_HANDLE)); | 1318 result->push_back((*i)->ref(META_HANDLE)); |
1303 } | 1319 } |
1304 } | 1320 } |
1305 | 1321 |
1306 } // namespace syncable | 1322 } // namespace syncable |
1307 } // namespace syncer | 1323 } // namespace syncer |
OLD | NEW |