| Index: chrome/browser/sync_file_system/drive_backend/metadata_database.cc
|
| diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
|
| index 22524d13954a80ed49a7dedcbcf26fc16e742433..5dcc46f78362e088c70075a341c01b654b999c99 100644
|
| --- a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
|
| +++ b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
|
| @@ -886,11 +886,26 @@ void MetadataDatabase::UpdateTracker(int64 tracker_id,
|
| return;
|
| }
|
|
|
| - // Check if the tracker was retitled. If it was, update the title and its
|
| - // index in advance.
|
| - if (!tracker->has_synced_details() ||
|
| - tracker->synced_details().title() != updated_details.title()) {
|
| - UpdateTrackerTitle(tracker, updated_details.title(), batch.get());
|
| + if (tracker->has_synced_details()) {
|
| + // Check if the tracker was retitled. If it was, there should exist another
|
| + // tracker for the new title, so delete old tracker.
|
| + if (tracker->synced_details().title() != updated_details.title()) {
|
| + RemoveTracker(tracker->tracker_id(), batch.get());
|
| + WriteToDatabase(batch.Pass(), callback);
|
| + return;
|
| + }
|
| +
|
| + // Check if the tracker's parent is still in |parent_tracker_ids|.
|
| + // If not, there should exist another tracker for the new parent, so delete
|
| + // old tracker.
|
| + DCHECK(ContainsKey(tracker_by_id_, tracker->parent_tracker_id()));
|
| + FileTracker* parent_tracker = tracker_by_id_[tracker->parent_tracker_id()];
|
| + if (!HasFileAsParent(tracker->synced_details(),
|
| + parent_tracker->file_id())) {
|
| + RemoveTracker(tracker->tracker_id(), batch.get());
|
| + WriteToDatabase(batch.Pass(), callback);
|
| + return;
|
| + }
|
| }
|
|
|
| *tracker->mutable_synced_details() = updated_details;
|
|
|