Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: sync/syncable/directory.cc

Issue 218623014: [Sync] Add context proto and directory support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and address comments Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_backing_store.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(ModelType type,
796 sync_pb::DataTypeContext* context) const {
rlarocque 2014/04/03 21:17:56 This is better, but I think you'll still want to h
Nicolas Zea 2014/04/03 22:11:49 Done.
797 ScopedKernelLock lock(this);
798 context->CopyFrom(kernel_->persisted_info.datatype_context[type]);
799 }
800
801 void Directory::SetDataTypeContext(
802 ModelType type,
803 const sync_pb::DataTypeContext& context) {
804 ScopedKernelLock lock(this);
805 kernel_->persisted_info.datatype_context[type].CopyFrom(context);
806 kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
807 }
808
795 ModelTypeSet Directory::InitialSyncEndedTypes() { 809 ModelTypeSet Directory::InitialSyncEndedTypes() {
796 syncable::ReadTransaction trans(FROM_HERE, this); 810 syncable::ReadTransaction trans(FROM_HERE, this);
797 ModelTypeSet protocol_types = ProtocolTypes(); 811 ModelTypeSet protocol_types = ProtocolTypes();
798 ModelTypeSet initial_sync_ended_types; 812 ModelTypeSet initial_sync_ended_types;
799 for (ModelTypeSet::Iterator i = protocol_types.First(); i.Good(); i.Inc()) { 813 for (ModelTypeSet::Iterator i = protocol_types.First(); i.Good(); i.Inc()) {
800 if (InitialSyncEndedForType(&trans, i.Get())) { 814 if (InitialSyncEndedForType(&trans, i.Get())) {
801 initial_sync_ended_types.Put(i.Get()); 815 initial_sync_ended_types.Put(i.Get());
802 } 816 }
803 } 817 }
804 return initial_sync_ended_types; 818 return initial_sync_ended_types;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 1312
1299 for (OrderedChildSet::const_iterator i = children->begin(); 1313 for (OrderedChildSet::const_iterator i = children->begin();
1300 i != children->end(); ++i) { 1314 i != children->end(); ++i) {
1301 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID)); 1315 DCHECK_EQ(parent_id, (*i)->ref(PARENT_ID));
1302 result->push_back((*i)->ref(META_HANDLE)); 1316 result->push_back((*i)->ref(META_HANDLE));
1303 } 1317 }
1304 } 1318 }
1305 1319
1306 } // namespace syncable 1320 } // namespace syncable
1307 } // namespace syncer 1321 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory.h ('k') | sync/syncable/directory_backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698