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

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

Issue 393083004: Update Commit and GetUpdatesResponse messages to include attachment ids. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update SyncManagerImpl to detect attachment metadata changes. Created 6 years, 5 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/model_neutral_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 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/model_neutral_mutable_entry.h" 5 #include "sync/syncable/model_neutral_mutable_entry.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "sync/internal_api/public/base/unique_position.h" 9 #include "sync/internal_api/public/base/unique_position.h"
10 #include "sync/syncable/directory.h" 10 #include "sync/syncable/directory.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 base_write_transaction_->TrackChangesTo(kernel_); 346 base_write_transaction_->TrackChangesTo(kernel_);
347 if(!kernel_->ref(SERVER_UNIQUE_POSITION).Equals(value)) { 347 if(!kernel_->ref(SERVER_UNIQUE_POSITION).Equals(value)) {
348 // We should never overwrite a valid position with an invalid one. 348 // We should never overwrite a valid position with an invalid one.
349 DCHECK(value.IsValid()); 349 DCHECK(value.IsValid());
350 ScopedKernelLock lock(dir()); 350 ScopedKernelLock lock(dir());
351 kernel_->put(SERVER_UNIQUE_POSITION, value); 351 kernel_->put(SERVER_UNIQUE_POSITION, value);
352 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles); 352 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
353 } 353 }
354 } 354 }
355 355
356 void ModelNeutralMutableEntry::PutServerAttachmentMetadata(
357 const sync_pb::AttachmentMetadata& value) {
358 DCHECK(kernel_);
359 base_write_transaction_->TrackChangesTo(kernel_);
360
361 if (kernel_->ref(SERVER_ATTACHMENT_METADATA).SerializeAsString() !=
362 value.SerializeAsString()) {
363 kernel_->put(SERVER_ATTACHMENT_METADATA, value);
364 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
365 }
366 }
367
356 void ModelNeutralMutableEntry::PutSyncing(bool value) { 368 void ModelNeutralMutableEntry::PutSyncing(bool value) {
357 kernel_->put(SYNCING, value); 369 kernel_->put(SYNCING, value);
358 } 370 }
359 371
360 void ModelNeutralMutableEntry::PutParentIdPropertyOnly(const Id& parent_id) { 372 void ModelNeutralMutableEntry::PutParentIdPropertyOnly(const Id& parent_id) {
361 base_write_transaction_->TrackChangesTo(kernel_); 373 base_write_transaction_->TrackChangesTo(kernel_);
362 dir()->ReindexParentId(base_write_transaction(), kernel_, parent_id); 374 dir()->ReindexParentId(base_write_transaction(), kernel_, parent_id);
363 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles); 375 kernel_->mark_dirty(&dir()->kernel_->dirty_metahandles);
364 } 376 }
365 377
366 void ModelNeutralMutableEntry::UpdateTransactionVersion(int64 value) { 378 void ModelNeutralMutableEntry::UpdateTransactionVersion(int64 value) {
367 ScopedKernelLock lock(dir()); 379 ScopedKernelLock lock(dir());
368 kernel_->put(TRANSACTION_VERSION, value); 380 kernel_->put(TRANSACTION_VERSION, value);
369 kernel_->mark_dirty(&(dir()->kernel_->dirty_metahandles)); 381 kernel_->mark_dirty(&(dir()->kernel_->dirty_metahandles));
370 } 382 }
371 383
372 ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans) 384 ModelNeutralMutableEntry::ModelNeutralMutableEntry(BaseWriteTransaction* trans)
373 : Entry(trans), base_write_transaction_(trans) {} 385 : Entry(trans), base_write_transaction_(trans) {}
374 386
375 MetahandleSet* ModelNeutralMutableEntry::GetDirtyIndexHelper() { 387 MetahandleSet* ModelNeutralMutableEntry::GetDirtyIndexHelper() {
376 return &dir()->kernel_->dirty_metahandles; 388 return &dir()->kernel_->dirty_metahandles;
377 } 389 }
378 390
379 } // namespace syncable 391 } // namespace syncable
380 392
381 } // namespace syncer 393 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/model_neutral_mutable_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698