| OLD | NEW |
| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) { | 454 if (predecessor && predecessor->GetParentId() != new_parent.GetId()) { |
| 455 DCHECK(false); | 455 DCHECK(false); |
| 456 return false; | 456 return false; |
| 457 } | 457 } |
| 458 | 458 |
| 459 syncable::Id new_parent_id = new_parent.GetEntry()->GetId(); | 459 syncable::Id new_parent_id = new_parent.GetEntry()->GetId(); |
| 460 | 460 |
| 461 // Filter out redundant changes if both the parent and the predecessor match. | 461 // Filter out redundant changes if both the parent and the predecessor match. |
| 462 if (new_parent_id == entry_->GetParentId()) { | 462 if (new_parent_id == entry_->GetParentId()) { |
| 463 const syncable::Id& old = entry_->GetPredecessorId(); | 463 const syncable::Id& old = entry_->GetPredecessorId(); |
| 464 if ((!predecessor && old.IsRoot()) || | 464 if ((!predecessor && old.IsNull()) || |
| 465 (predecessor && (old == predecessor->GetEntry()->GetId()))) { | 465 (predecessor && (old == predecessor->GetEntry()->GetId()))) { |
| 466 return true; | 466 return true; |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 entry_->PutParentId(new_parent_id); | 470 entry_->PutParentId(new_parent_id); |
| 471 | 471 |
| 472 // Now set the predecessor, which sets IS_UNSYNCED as necessary. | 472 // Now set the predecessor, which sets IS_UNSYNCED as necessary. |
| 473 return PutPredecessor(predecessor); | 473 return PutPredecessor(predecessor); |
| 474 } | 474 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 MarkForSyncing(); | 513 MarkForSyncing(); |
| 514 | 514 |
| 515 return true; | 515 return true; |
| 516 } | 516 } |
| 517 | 517 |
| 518 void WriteNode::MarkForSyncing() { | 518 void WriteNode::MarkForSyncing() { |
| 519 syncable::MarkForSyncing(entry_); | 519 syncable::MarkForSyncing(entry_); |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace syncer | 522 } // namespace syncer |
| OLD | NEW |