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/mutable_entry.cc

Issue 302173004: sync: Specialize functions that fetch type root (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/GET_BY_SERVER_TAG_DEPRECATED/GET_BY_SERVER_TAG/ Created 6 years, 6 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/mutable_entry.h ('k') | sync/syncable/nigori_util.cc » ('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 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 "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "sync/internal_api/public/base/unique_position.h" 8 #include "sync/internal_api/public/base/unique_position.h"
9 #include "sync/syncable/directory.h" 9 #include "sync/syncable/directory.h"
10 #include "sync/syncable/scoped_kernel_lock.h" 10 #include "sync/syncable/scoped_kernel_lock.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 : ModelNeutralMutableEntry(trans, GET_BY_HANDLE, metahandle), 91 : ModelNeutralMutableEntry(trans, GET_BY_HANDLE, metahandle),
92 write_transaction_(trans) { 92 write_transaction_(trans) {
93 } 93 }
94 94
95 MutableEntry::MutableEntry(WriteTransaction* trans, GetByClientTag, 95 MutableEntry::MutableEntry(WriteTransaction* trans, GetByClientTag,
96 const std::string& tag) 96 const std::string& tag)
97 : ModelNeutralMutableEntry(trans, GET_BY_CLIENT_TAG, tag), 97 : ModelNeutralMutableEntry(trans, GET_BY_CLIENT_TAG, tag),
98 write_transaction_(trans) { 98 write_transaction_(trans) {
99 } 99 }
100 100
101 MutableEntry::MutableEntry(WriteTransaction* trans, GetByServerTag, 101 MutableEntry::MutableEntry(WriteTransaction* trans, GetTypeRoot, ModelType type)
102 const string& tag) 102 : ModelNeutralMutableEntry(trans, GET_TYPE_ROOT, type),
103 : ModelNeutralMutableEntry(trans, GET_BY_SERVER_TAG, tag),
104 write_transaction_(trans) { 103 write_transaction_(trans) {
105 } 104 }
106 105
107 void MutableEntry::PutLocalExternalId(int64 value) { 106 void MutableEntry::PutLocalExternalId(int64 value) {
108 DCHECK(kernel_); 107 DCHECK(kernel_);
109 write_transaction()->TrackChangesTo(kernel_); 108 write_transaction()->TrackChangesTo(kernel_);
110 if (kernel_->ref(LOCAL_EXTERNAL_ID) != value) { 109 if (kernel_->ref(LOCAL_EXTERNAL_ID) != value) {
111 ScopedKernelLock lock(dir()); 110 ScopedKernelLock lock(dir());
112 kernel_->put(LOCAL_EXTERNAL_ID, value); 111 kernel_->put(LOCAL_EXTERNAL_ID, value);
113 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles); 112 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); 270 DCHECK_NE(static_cast<MutableEntry*>(NULL), e);
272 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; 271 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing.";
273 if (!(e->PutIsUnsynced(true))) 272 if (!(e->PutIsUnsynced(true)))
274 return false; 273 return false;
275 e->PutSyncing(false); 274 e->PutSyncing(false);
276 return true; 275 return true;
277 } 276 }
278 277
279 } // namespace syncable 278 } // namespace syncable
280 } // namespace syncer 279 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/mutable_entry.h ('k') | sync/syncable/nigori_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698