Index: content/browser/indexed_db/indexed_db_backing_store.cc |
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc |
index f62b871d90920fa4adec57eb1589040b4de3c66e..5b90e6834c76f1a2281577f2d285243cff388895 100644 |
--- a/content/browser/indexed_db/indexed_db_backing_store.cc |
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc |
@@ -1824,6 +1824,42 @@ leveldb::Status IndexedDBBackingStore::DeleteObjectStore( |
return ClearObjectStore(transaction, database_id, object_store_id); |
} |
+leveldb::Status IndexedDBBackingStore::RenameObjectStore( |
+ IndexedDBBackingStore::Transaction* transaction, |
+ int64_t database_id, |
+ int64_t object_store_id, |
+ const base::string16& new_name) { |
+ IDB_TRACE("IndexedDBBackingStore::RenameObjectStore"); |
+ if (!KeyPrefix::ValidIds(database_id, object_store_id)) |
+ return InvalidDBKeyStatus(); |
+ LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
+ |
+ const std::string name_key = ObjectStoreMetaDataKey::Encode( |
+ database_id, object_store_id, ObjectStoreMetaDataKey::NAME); |
+ const std::string new_names_key = ObjectStoreNamesKey::Encode( |
+ database_id, new_name); |
+ |
+ base::string16 old_name; |
+ bool found = false; |
+ leveldb::Status s = |
+ GetString(leveldb_transaction, name_key, &old_name, &found); |
+ if (!s.ok()) { |
+ INTERNAL_READ_ERROR_UNTESTED(DELETE_OBJECT_STORE); |
+ return s; |
+ } |
+ if (!found) { |
+ INTERNAL_CONSISTENCY_ERROR_UNTESTED(DELETE_OBJECT_STORE); |
+ return InternalInconsistencyStatus(); |
+ } |
+ const std::string old_names_key = ObjectStoreNamesKey::Encode( |
+ database_id, old_name); |
+ |
+ PutString(leveldb_transaction, name_key, new_name); |
+ PutInt(leveldb_transaction, new_names_key, object_store_id); |
+ leveldb_transaction->Remove(old_names_key); |
+ return s; |
+} |
+ |
leveldb::Status IndexedDBBackingStore::GetRecord( |
IndexedDBBackingStore::Transaction* transaction, |
int64_t database_id, |
@@ -2866,6 +2902,24 @@ leveldb::Status IndexedDBBackingStore::DeleteIndex( |
return s; |
} |
+leveldb::Status IndexedDBBackingStore::RenameIndex( |
+ IndexedDBBackingStore::Transaction* transaction, |
+ int64_t database_id, |
+ int64_t object_store_id, |
+ int64_t index_id, |
+ const base::string16& new_name) { |
+ IDB_TRACE("IndexedDBBackingStore::RenameIndex"); |
+ if (!KeyPrefix::ValidIds(database_id, object_store_id, index_id)) |
+ return InvalidDBKeyStatus(); |
+ LevelDBTransaction* leveldb_transaction = transaction->transaction(); |
+ |
+ const std::string name_key = IndexMetaDataKey::Encode( |
+ database_id, object_store_id, index_id, IndexMetaDataKey::NAME); |
+ |
+ PutString(leveldb_transaction, name_key, new_name); |
+ return leveldb::Status::OK(); |
+} |
+ |
leveldb::Status IndexedDBBackingStore::PutIndexDataForRecord( |
IndexedDBBackingStore::Transaction* transaction, |
int64_t database_id, |