chromeos: Stop removing the entry from the storage of DriveResourceMetadata when unnecessary

RemoveDirectoryChild is the only place where the entry must be removed.
For all other RemoveDirectoryChild users, just destroying parent-child relationship is enough.

BUG=None
TEST=unit_tests


Review URL: https://chromiumcodereview.appspot.com/13876003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192994 0039d316-1c4b-4281-b951-d872f2087c98
parent 87f118ae
......@@ -1033,6 +1033,7 @@ void DriveResourceMetadata::RemoveDirectoryChild(
scoped_ptr<DriveEntryProto> entry = storage_->GetEntry(child_resource_id);
DCHECK(entry);
DetachEntryFromDirectory(child_resource_id);
storage_->RemoveEntry(entry->resource_id());
if (entry->file_info().is_directory())
RemoveDirectoryChildren(child_resource_id);
}
......@@ -1048,10 +1049,7 @@ void DriveResourceMetadata::DetachEntryFromDirectory(
DCHECK_EQ(entry->resource_id(),
storage_->GetChild(entry->parent_resource_id(),
entry->base_name()));
// Remove entry from resource map first.
storage_->RemoveEntry(entry->resource_id());
// Then delete it from tree.
storage_->RemoveChild(entry->parent_resource_id(), entry->base_name());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment