summaryrefslogtreecommitdiffstats
path: root/content/common/indexed_db
diff options
context:
space:
mode:
authoralecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 04:39:56 +0000
committeralecflett@chromium.org <alecflett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 04:39:56 +0000
commit33b12f1babeba2db715f3c9f80111dc3fe355c40 (patch)
treec3365b56466c2a37de75ce204f7d58a05e67b37e /content/common/indexed_db
parentf838bbf77b3e5d6544819fd7f98a07d052ebd26f (diff)
downloadchromium_src-33b12f1babeba2db715f3c9f80111dc3fe355c40.zip
chromium_src-33b12f1babeba2db715f3c9f80111dc3fe355c40.tar.gz
chromium_src-33b12f1babeba2db715f3c9f80111dc3fe355c40.tar.bz2
IPC implementation for create/delete ObjectStore/Index
R=jsbell,dgrogan,Tom Sepez BUG=161958 Review URL: https://chromiumcodereview.appspot.com/11791009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175703 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/indexed_db')
-rw-r--r--content/common/indexed_db/indexed_db_messages.h70
-rw-r--r--content/common/indexed_db/proxy_webidbdatabase_impl.cc69
-rw-r--r--content/common/indexed_db/proxy_webidbdatabase_impl.h20
3 files changed, 149 insertions, 10 deletions
diff --git a/content/common/indexed_db/indexed_db_messages.h b/content/common/indexed_db/indexed_db_messages.h
index 20c6fd8..634b3fe 100644
--- a/content/common/indexed_db/indexed_db_messages.h
+++ b/content/common/indexed_db/indexed_db_messages.h
@@ -69,7 +69,7 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_FactoryDeleteDatabase_Params)
IPC_STRUCT_END()
// Used to create an object store.
-IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params)
+IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStoreOld_Params)
// The storage id of the object store.
IPC_STRUCT_MEMBER(int64, id)
// The name of the object store.
@@ -84,6 +84,22 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params)
IPC_STRUCT_MEMBER(int32, ipc_database_id)
IPC_STRUCT_END()
+// Used to create an object store.
+IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateObjectStore_Params)
+ // The database the object store belongs to.
+ IPC_STRUCT_MEMBER(int32, ipc_database_id)
+ // The transaction its associated with.
+ IPC_STRUCT_MEMBER(int64, transaction_id)
+ // The storage id of the object store.
+ IPC_STRUCT_MEMBER(int64, object_store_id)
+ // The name of the object store.
+ IPC_STRUCT_MEMBER(string16, name)
+ // The keyPath of the object store.
+ IPC_STRUCT_MEMBER(content::IndexedDBKeyPath, key_path)
+ // Whether the object store created should have a key generator.
+ IPC_STRUCT_MEMBER(bool, auto_increment)
+IPC_STRUCT_END()
+
IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseGet_Params)
IPC_STRUCT_MEMBER(int32, ipc_thread_id)
// The id any response should contain.
@@ -251,6 +267,26 @@ IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseSetIndexKeys_Params)
IPC_STRUCT_END()
// Used to create an index.
+IPC_STRUCT_BEGIN(IndexedDBHostMsg_DatabaseCreateIndex_Params)
+ // The transaction this is associated with.
+ IPC_STRUCT_MEMBER(int64, transaction_id)
+ // The database being used.
+ IPC_STRUCT_MEMBER(int32, ipc_database_id)
+ // The object store the index belongs to.
+ IPC_STRUCT_MEMBER(int64, object_store_id)
+ // The storage id of the index.
+ IPC_STRUCT_MEMBER(int64, index_id)
+ // The name of the index.
+ IPC_STRUCT_MEMBER(string16, name)
+ // The keyPath of the index.
+ IPC_STRUCT_MEMBER(content::IndexedDBKeyPath, key_path)
+ // Whether the index created has unique keys.
+ IPC_STRUCT_MEMBER(bool, unique)
+ // Whether the index created produces keys for each array entry.
+ IPC_STRUCT_MEMBER(bool, multi_entry)
+IPC_STRUCT_END()
+
+// Used to create an index.
IPC_STRUCT_BEGIN(IndexedDBHostMsg_ObjectStoreCreateIndex_Params)
// The storage id of the index.
IPC_STRUCT_MEMBER(int64, id)
@@ -501,18 +537,29 @@ IPC_SYNC_MESSAGE_CONTROL1_1(IndexedDBHostMsg_DatabaseMetadata,
IndexedDBDatabaseMetadata /* metadata */)
// WebIDBDatabase::createObjectStore() message.
-IPC_SYNC_MESSAGE_CONTROL1_2(IndexedDBHostMsg_DatabaseCreateObjectStore,
- IndexedDBHostMsg_DatabaseCreateObjectStore_Params,
- int32, /* ipc_object_store_id */
- WebKit::WebExceptionCode /* ec */)
+IPC_SYNC_MESSAGE_CONTROL1_2(
+ IndexedDBHostMsg_DatabaseCreateObjectStoreOld,
+ IndexedDBHostMsg_DatabaseCreateObjectStoreOld_Params,
+ int32, /* ipc_object_store_id */
+ WebKit::WebExceptionCode /* ec */)
+
+// WebIDBDatabase::createObjectStore() message.
+IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseCreateObjectStore,
+ IndexedDBHostMsg_DatabaseCreateObjectStore_Params)
// WebIDBDatabase::deleteObjectStore() message.
-IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStore,
+IPC_SYNC_MESSAGE_CONTROL3_1(IndexedDBHostMsg_DatabaseDeleteObjectStoreOld,
int32, /* ipc_database_id */
int64, /* object_store_id */
int32, /* ipc_transaction_id */
WebKit::WebExceptionCode /* ec */)
+// WebIDBDatabase::deleteObjectStore() message.
+IPC_MESSAGE_CONTROL3(IndexedDBHostMsg_DatabaseDeleteObjectStore,
+ int32, /* ipc_database_id */
+ int64, /* transaction_id */
+ int64) /* object_store_id */
+
// WebIDBDatabase::createTransaction() message.
// TODO: make this message async.
IPC_SYNC_MESSAGE_CONTROL5_1(IndexedDBHostMsg_DatabaseCreateTransaction,
@@ -570,6 +617,17 @@ IPC_MESSAGE_CONTROL5(IndexedDBHostMsg_DatabaseClear,
int64, /* transaction_id */
int64) /* object_store_id */
+// WebIDBDatabase::createIndex() message.
+IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_DatabaseCreateIndex,
+ IndexedDBHostMsg_DatabaseCreateIndex_Params)
+
+// WebIDBDatabase::deleteIndex() message.
+IPC_MESSAGE_CONTROL4(IndexedDBHostMsg_DatabaseDeleteIndex,
+ int32, /* ipc_database_id */
+ int64, /* transaction_id */
+ int64, /* object_store_id */
+ int64) /* index_id */
+
// WebIDBIndex::openObjectCursor() message.
IPC_MESSAGE_CONTROL1(IndexedDBHostMsg_IndexOpenObjectCursor,
IndexedDBHostMsg_IndexOpenCursor_Params)
diff --git a/content/common/indexed_db/proxy_webidbdatabase_impl.cc b/content/common/indexed_db/proxy_webidbdatabase_impl.cc
index 2bf3999..46d6dc5 100644
--- a/content/common/indexed_db/proxy_webidbdatabase_impl.cc
+++ b/content/common/indexed_db/proxy_webidbdatabase_impl.cc
@@ -99,7 +99,7 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore(
bool auto_increment,
const WebKit::WebIDBTransaction& transaction,
WebExceptionCode& ec) {
- IndexedDBHostMsg_DatabaseCreateObjectStore_Params params;
+ IndexedDBHostMsg_DatabaseCreateObjectStoreOld_Params params;
params.id = id;
params.name = name;
params.key_path = IndexedDBKeyPath(key_path);
@@ -109,23 +109,51 @@ WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore(
int object_store;
IndexedDBDispatcher::Send(
- new IndexedDBHostMsg_DatabaseCreateObjectStore(
+ new IndexedDBHostMsg_DatabaseCreateObjectStoreOld(
params, &object_store, &ec));
if (!object_store)
return NULL;
return new RendererWebIDBObjectStoreImpl(object_store);
}
+void RendererWebIDBDatabaseImpl::createObjectStore(
+ long long transaction_id,
+ long long object_store_id,
+ const WebKit::WebString& name,
+ const WebKit::WebIDBKeyPath& key_path,
+ bool auto_increment) {
+ IndexedDBHostMsg_DatabaseCreateObjectStore_Params params;
+ params.ipc_database_id = ipc_database_id_;
+ params.transaction_id = transaction_id;
+ params.object_store_id = object_store_id;
+ params.name = name;
+ params.key_path = IndexedDBKeyPath(key_path);
+ params.auto_increment = auto_increment;
+
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseCreateObjectStore(params));
+}
+
void RendererWebIDBDatabaseImpl::deleteObjectStore(
long long object_store_id,
const WebIDBTransaction& transaction,
WebExceptionCode& ec) {
IndexedDBDispatcher::Send(
- new IndexedDBHostMsg_DatabaseDeleteObjectStore(
+ new IndexedDBHostMsg_DatabaseDeleteObjectStoreOld(
ipc_database_id_, object_store_id,
IndexedDBDispatcher::TransactionId(transaction), &ec));
}
+void RendererWebIDBDatabaseImpl::deleteObjectStore(
+ long long transaction_id,
+ long long object_store_id) {
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseDeleteObjectStore(
+ ipc_database_id_,
+ transaction_id,
+ object_store_id));
+}
+
WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::createTransaction(
long long transaction_id,
const WebVector<long long>& object_store_ids,
@@ -273,4 +301,39 @@ void RendererWebIDBDatabaseImpl::clear(
ipc_database_id_,
transaction_id, object_store_id, callbacks);
}
+
+void RendererWebIDBDatabaseImpl::createIndex(
+ long long transaction_id,
+ long long object_store_id,
+ long long index_id,
+ const WebString& name,
+ const WebIDBKeyPath& key_path,
+ bool unique,
+ bool multi_entry)
+{
+ IndexedDBHostMsg_DatabaseCreateIndex_Params params;
+ params.ipc_database_id = ipc_database_id_;
+ params.transaction_id = transaction_id;
+ params.object_store_id = object_store_id;
+ params.index_id = index_id;
+ params.name = name;
+ params.key_path = IndexedDBKeyPath(key_path);
+ params.unique = unique;
+ params.multi_entry = multi_entry;
+
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseCreateIndex(params));
+}
+
+void RendererWebIDBDatabaseImpl::deleteIndex(
+ long long transaction_id,
+ long long object_store_id,
+ long long index_id)
+{
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseDeleteIndex(
+ ipc_database_id_,
+ transaction_id,
+ object_store_id, index_id));
+}
} // namespace content
diff --git a/content/common/indexed_db/proxy_webidbdatabase_impl.h b/content/common/indexed_db/proxy_webidbdatabase_impl.h
index 3e04297..dcf14eb 100644
--- a/content/common/indexed_db/proxy_webidbdatabase_impl.h
+++ b/content/common/indexed_db/proxy_webidbdatabase_impl.h
@@ -31,10 +31,19 @@ class RendererWebIDBDatabaseImpl : public WebKit::WebIDBDatabase {
bool auto_increment,
const WebKit::WebIDBTransaction& transaction,
WebKit::WebExceptionCode& ec);
+ virtual void createObjectStore(
+ long long transaction_id,
+ long long objectstore_id,
+ const WebKit::WebString& name,
+ const WebKit::WebIDBKeyPath& key_path,
+ bool auto_increment);
virtual void deleteObjectStore(
long long object_store_id,
const WebKit::WebIDBTransaction& transaction,
WebKit::WebExceptionCode& ec);
+ virtual void deleteObjectStore(
+ long long transaction_id,
+ long long object_store_id);
virtual WebKit::WebIDBTransaction* createTransaction(
long long transaction_id,
const WebKit::WebVector<long long>& scope,
@@ -82,7 +91,16 @@ class RendererWebIDBDatabaseImpl : public WebKit::WebIDBDatabase {
virtual void clear(long long transactionId,
long long objectStoreId,
WebKit::WebIDBCallbacks*);
-
+ virtual void createIndex(long long transactionId,
+ long long objectStoreId,
+ long long indexId,
+ const WebKit::WebString& name,
+ const WebKit::WebIDBKeyPath&,
+ bool unique,
+ bool multiEntry);
+ virtual void deleteIndex(long long transactionId, long
+ long objectStoreId,
+ long long indexId);
private:
int32 ipc_database_id_;
};