Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Unified Diff: content/browser/indexed_db/indexed_db_dispatcher_host.cc

Issue 2276593002: Support renaming of IndexedDB indexes and object stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test coverage for the (slightly incorrect) behavior in strict mode when our flag is not enabl… Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_dispatcher_host.cc
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index 03f7a6e63f41af1fe114e096ba43427ed2f4be60..639bee5fe8511f7c4285416ca70a6f75012de3ab 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -504,6 +504,8 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
OnCreateObjectStore)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore,
OnDeleteObjectStore)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseRenameObjectStore,
+ OnRenameObjectStore)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction,
OnCreateTransaction)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose)
@@ -524,6 +526,7 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClear, OnClear)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateIndex, OnCreateIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteIndex, OnDeleteIndex)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseRenameIndex, OnRenameIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseAbort, OnAbort)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCommit, OnCommit)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -563,6 +566,21 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
parent_->HostTransactionId(transaction_id), object_store_id);
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRenameObjectStore(
+ int32_t ipc_database_id,
+ int64_t transaction_id,
+ int64_t object_store_id,
+ const base::string16& new_name) {
+ DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
+ IndexedDBConnection* connection =
+ parent_->GetOrTerminateProcess(&map_, ipc_database_id);
+ if (!connection || !connection->IsConnected())
+ return;
+
+ connection->database()->RenameObjectStore(
+ parent_->HostTransactionId(transaction_id), object_store_id, new_name);
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateTransaction(
const IndexedDBHostMsg_DatabaseCreateTransaction_Params& params) {
DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
@@ -954,6 +972,23 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteIndex(
parent_->HostTransactionId(transaction_id), object_store_id, index_id);
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRenameIndex(
+ int32_t ipc_database_id,
+ int64_t transaction_id,
+ int64_t object_store_id,
+ int64_t index_id,
+ const base::string16& new_name) {
+ DCHECK(parent_->context()->TaskRunner()->RunsTasksOnCurrentThread());
+ IndexedDBConnection* connection =
+ parent_->GetOrTerminateProcess(&map_, ipc_database_id);
+ if (!connection || !connection->IsConnected())
+ return;
+
+ connection->database()->RenameIndex(
+ parent_->HostTransactionId(transaction_id), object_store_id, index_id,
+ new_name);
+}
+
//////////////////////////////////////////////////////////////////////
// IndexedDBDispatcherHost::CursorDispatcherHost
//

Powered by Google App Engine
This is Rietveld 408576698