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

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: Accomodate worker thread changes 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 9404aefb108296c77a80631f02de07d36d06ba5b..fcbb4f7b2379c8c42e70b914bb44e6c4216ea71c 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -522,6 +522,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)
@@ -599,6 +600,28 @@ 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.thread_id,
+ 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 thread_id,
@@ -677,6 +700,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()
@@ -882,6 +906,29 @@ 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.thread_id,
+ 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);
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698