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

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

Issue 265853004: Revert of Keep track of which attachments are referenced by which sync entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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') | no next file » | 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } 226 }
227 227
228 bool MutableEntry::PutPredecessor(const Id& predecessor_id) { 228 bool MutableEntry::PutPredecessor(const Id& predecessor_id) {
229 MutableEntry predecessor(write_transaction(), GET_BY_ID, predecessor_id); 229 MutableEntry predecessor(write_transaction(), GET_BY_ID, predecessor_id);
230 if (!predecessor.good()) 230 if (!predecessor.good())
231 return false; 231 return false;
232 dir()->PutPredecessor(kernel_, predecessor.kernel_); 232 dir()->PutPredecessor(kernel_, predecessor.kernel_);
233 return true; 233 return true;
234 } 234 }
235 235
236 void MutableEntry::PutAttachmentMetadata(
237 const sync_pb::AttachmentMetadata& attachment_metadata) {
238 DCHECK(kernel_);
239 write_transaction()->TrackChangesTo(kernel_);
240 if (kernel_->ref(ATTACHMENT_METADATA).SerializeAsString() !=
241 attachment_metadata.SerializeAsString()) {
242 dir()->UpdateAttachmentIndex(GetMetahandle(),
243 kernel_->ref(ATTACHMENT_METADATA),
244 attachment_metadata);
245 kernel_->put(ATTACHMENT_METADATA, attachment_metadata);
246 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
247 }
248 }
249
250 // This function sets only the flags needed to get this entry to sync. 236 // This function sets only the flags needed to get this entry to sync.
251 bool MarkForSyncing(MutableEntry* e) { 237 bool MarkForSyncing(MutableEntry* e) {
252 DCHECK_NE(static_cast<MutableEntry*>(NULL), e); 238 DCHECK_NE(static_cast<MutableEntry*>(NULL), e);
253 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing."; 239 DCHECK(!e->IsRoot()) << "We shouldn't mark a permanent object for syncing.";
254 if (!(e->PutIsUnsynced(true))) 240 if (!(e->PutIsUnsynced(true)))
255 return false; 241 return false;
256 e->PutSyncing(false); 242 e->PutSyncing(false);
257 return true; 243 return true;
258 } 244 }
259 245
260 } // namespace syncable 246 } // namespace syncable
261 } // namespace syncer 247 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/mutable_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698