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

Side by Side Diff: sync/internal_api/write_node.cc

Issue 1226213002: Sync: Support nodes with implicit permanent folders: Node Browser and out-of-order loading from DB (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed comments Created 5 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
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/syncable/entry_kernel.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/internal_api/public/write_node.h" 5 #include "sync/internal_api/public/write_node.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "sync/internal_api/public/base_transaction.h" 10 #include "sync/internal_api/public/base_transaction.h"
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 if (!entry_->good()) 379 if (!entry_->good())
380 return INIT_FAILED_COULD_NOT_CREATE_ENTRY; 380 return INIT_FAILED_COULD_NOT_CREATE_ENTRY;
381 381
382 // Has no impact if the client tag is already set. 382 // Has no impact if the client tag is already set.
383 entry_->PutUniqueClientTag(hash); 383 entry_->PutUniqueClientTag(hash);
384 384
385 // We don't support directory and tag combinations. 385 // We don't support directory and tag combinations.
386 entry_->PutIsDir(false); 386 entry_->PutIsDir(false);
387 387
388 if (!parent_id.IsNull()) { 388 if (entry_->ShouldMaintainPosition()) {
389 if (!PutPredecessor(NULL)) 389 if (!entry_->PutPredecessor(syncable::Id()))
390 return INIT_FAILED_SET_PREDECESSOR; 390 return INIT_FAILED_SET_PREDECESSOR;
391 } 391 }
392 392
393 // Mark this entry as unsynced, to wake up the syncer. 393 // Mark this entry as unsynced, to wake up the syncer.
394 MarkForSyncing(); 394 MarkForSyncing();
395 395
396 return INIT_SUCCESS; 396 return INIT_SUCCESS;
397 } 397 }
398 398
399 bool WriteNode::SetPosition(const BaseNode& new_parent, 399 bool WriteNode::SetPosition(const BaseNode& new_parent,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 syncable::Id predecessor_id = predecessor ? 463 syncable::Id predecessor_id = predecessor ?
464 predecessor->GetEntry()->GetId() : syncable::Id(); 464 predecessor->GetEntry()->GetId() : syncable::Id();
465 return entry_->PutPredecessor(predecessor_id); 465 return entry_->PutPredecessor(predecessor_id);
466 } 466 }
467 467
468 void WriteNode::MarkForSyncing() { 468 void WriteNode::MarkForSyncing() {
469 syncable::MarkForSyncing(entry_); 469 syncable::MarkForSyncing(entry_);
470 } 470 }
471 471
472 } // namespace syncer 472 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/internal_api/sync_manager_impl_unittest.cc ('k') | sync/syncable/entry_kernel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698