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

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

Issue 8779003: Chromium side of IDBIndex.count() and IDBObjectStore.count() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/in_process_webkit/indexed_db_dispatcher_host.cc
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index d03b1d6fcf36b161cba143b9248be2b0cf7312a9..f14c39fbd4bcdf4fc5cdd9f5c12ca4c17b3df500 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -514,6 +514,7 @@ bool IndexedDBDispatcherHost::IndexDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenObjectCursor,
OnOpenObjectCursor)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenKeyCursor, OnOpenKeyCursor)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexCount, OnCount)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetObject, OnGetObject)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetKey, OnGetKey)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexDestroyed, OnDestroyed)
@@ -589,6 +590,27 @@ void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor(
params.direction, callbacks.release(), *idb_transaction, *ec);
}
+void IndexedDBDispatcherHost::IndexDispatcherHost::OnCount(
+ const IndexedDBHostMsg_IndexCount_Params& params,
+ WebKit::WebExceptionCode* ec) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(
+ &map_, params.idb_index_id);
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
+ if (!idb_transaction || !idb_index)
+ return;
+
+ *ec = 0;
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_,
+ params.response_id));
+ idb_index->count(
+ WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
+ params.upper_open),
+ callbacks.release(), *idb_transaction, *ec);
+}
+
void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject(
int idb_index_id,
int32 response_id,
@@ -664,6 +686,7 @@ bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -861,6 +884,28 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnOpenCursor(
params.direction, callbacks.release(), *idb_transaction, *ec);
}
+void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnCount(
+ const IndexedDBHostMsg_ObjectStoreCount_Params& params,
+ WebKit::WebExceptionCode* ec) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+ WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
+ &parent_->object_store_dispatcher_host_->map_,
+ params.idb_object_store_id);
+ WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
+ &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
+ if (!idb_transaction || !idb_object_store)
+ return;
+
+ *ec = 0;
+ scoped_ptr<WebIDBCallbacks> callbacks(
+ new IndexedDBCallbacks<WebSerializedScriptValue>(parent_,
+ params.response_id));
+ idb_object_store->count(
+ WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open,
+ params.upper_open),
+ callbacks.release(), *idb_transaction, *ec);
+}
+
void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed(
int32 object_id) {
parent_->DestroyObject(&map_, object_id);

Powered by Google App Engine
This is Rietveld 408576698