Index: chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
index 7520ee3d8f768ebc8450284e38a1a356e3dd73b0..5c1337957930abb1b26a4c6c8a9189311811e6f1 100644 |
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
@@ -870,27 +870,28 @@ void MetadataDatabaseIndexOnDisk::AddToPathIndexes( |
const std::string prefix = |
GenerateTrackerIDByParentAndTitleKeyPrefix(parent_id, title); |
- scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); |
- for (itr->Seek(prefix); itr->Valid(); itr->Next()) { |
- std::string id_str; |
- if (!RemovePrefix(itr->key().ToString(), prefix, &id_str)) |
- break; |
+ if (!title.empty()) { |
+ scoped_ptr<LevelDBWrapper::Iterator> itr(db_->NewIterator()); |
+ for (itr->Seek(prefix); itr->Valid(); itr->Next()) { |
+ std::string id_str; |
+ if (!RemovePrefix(itr->key().ToString(), prefix, &id_str)) |
+ break; |
- int64 tracker_id; |
- if (!base::StringToInt64(id_str, &tracker_id)) |
- continue; |
- if (tracker_id == new_tracker.tracker_id()) { |
- NOTREACHED(); |
- continue; |
- } |
+ int64 tracker_id; |
+ if (!base::StringToInt64(id_str, &tracker_id)) |
+ continue; |
+ if (tracker_id == new_tracker.tracker_id()) { |
+ NOTREACHED(); |
+ continue; |
+ } |
- const std::string multi_key = |
- GenerateMultiBackingParentAndTitleKey(parent_id, title); |
- DVLOG_IF(1, !DBHasKey(multi_key)) |
- << " Add to multi backing file paths: " << parent_id << " " << title; |
- db_->Put(GenerateMultiBackingParentAndTitleKey(parent_id, title), |
- std::string()); |
- break; |
+ const std::string multi_key = |
+ GenerateMultiBackingParentAndTitleKey(parent_id, title); |
+ DVLOG_IF(1, !DBHasKey(multi_key)) |
+ << " Add to multi backing file paths: " << parent_id << " " << title; |
+ db_->Put(multi_key, std::string()); |
+ break; |
+ } |
} |
AddToTrackerIDSetWithPrefix( |
@@ -937,7 +938,7 @@ void MetadataDatabaseIndexOnDisk::UpdateInPathIndexes( |
GenerateActiveTrackerIDByParentAndTitleKey(parent_id, title), |
prefix, new_tracker); |
- if (CountWithPrefix(prefix, tracker_id) != NONE) { |
+ if (!title.empty() && CountWithPrefix(prefix, tracker_id) != NONE) { |
const std::string multi_backing_key = |
GenerateMultiBackingParentAndTitleKey(parent_id, title); |
DVLOG_IF(1, !DBHasKey(multi_backing_key)) |