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

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

Issue 3163028: Fix compilation errors of 56862 (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix include path (again) Created 10 years, 4 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
« no previous file with comments | « chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | chrome/chrome_renderer.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index 960353059f33da301a0f740c2e4a6ed5a5c90c5d..d0af866717515b2e9ae3a6c681f1f5c41fe9ab98 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -20,7 +20,9 @@
#include "third_party/WebKit/WebKit/chromium/public/WebIDBIndex.h"
#include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h"
#include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebIDBTransaction.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
using WebKit::WebDOMStringList;
using WebKit::WebIDBCursor;
@@ -30,8 +32,10 @@ using WebKit::WebIDBIndex;
using WebKit::WebIDBKey;
using WebKit::WebIDBKeyRange;
using WebKit::WebIDBObjectStore;
+using WebKit::WebIDBTransaction;
using WebKit::WebSecurityOrigin;
using WebKit::WebSerializedScriptValue;
+using WebKit::WebVector;
IndexedDBDispatcherHost::IndexedDBDispatcherHost(
IPC::Message::Sender* sender, WebKitContext* webkit_context)
@@ -45,6 +49,8 @@ IndexedDBDispatcherHost::IndexedDBDispatcherHost(
new ObjectStoreDispatcherHost(this))),
ALLOW_THIS_IN_INITIALIZER_LIST(cursor_dispatcher_host_(
new CursorDispatcherHost(this))),
+ ALLOW_THIS_IN_INITIALIZER_LIST(transaction_dispatcher_host_(
+ new TransactionDispatcherHost(this))),
process_handle_(0) {
DCHECK(sender_);
DCHECK(webkit_context_.get());
@@ -92,6 +98,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) {
case ViewHostMsg_IDBCursorKey::ID:
case ViewHostMsg_IDBCursorValue::ID:
case ViewHostMsg_IDBFactoryOpen::ID:
+ case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID:
case ViewHostMsg_IDBDatabaseName::ID:
case ViewHostMsg_IDBDatabaseDescription::ID:
case ViewHostMsg_IDBDatabaseVersion::ID:
@@ -99,6 +106,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) {
case ViewHostMsg_IDBDatabaseCreateObjectStore::ID:
case ViewHostMsg_IDBDatabaseObjectStore::ID:
case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID:
+ case ViewHostMsg_IDBDatabaseTransaction::ID:
case ViewHostMsg_IDBDatabaseDestroyed::ID:
case ViewHostMsg_IDBIndexName::ID:
case ViewHostMsg_IDBIndexKeyPath::ID:
@@ -115,6 +123,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) {
case ViewHostMsg_IDBObjectStoreIndex::ID:
case ViewHostMsg_IDBObjectStoreRemoveIndex::ID:
case ViewHostMsg_IDBObjectStoreDestroyed::ID:
+ case ViewHostMsg_IDBTransactionDestroyed::ID:
break;
default:
return false;
@@ -159,7 +168,8 @@ void IndexedDBDispatcherHost::OnMessageReceivedWebKit(
database_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
index_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
object_store_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
- cursor_dispatcher_host_->OnMessageReceived(message, &msg_is_ok);
+ cursor_dispatcher_host_->OnMessageReceived(message, &msg_is_ok) ||
+ transaction_dispatcher_host_->OnMessageReceived(message, &msg_is_ok);
if (!handled) {
handled = true;
@@ -167,6 +177,8 @@ void IndexedDBDispatcherHost::OnMessageReceivedWebKit(
IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, msg_is_ok)
IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryOpen,
OnIDBFactoryOpen)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_IDBFactoryAbortPendingTransactions,
+ OnIDBFactoryAbortPendingTransactions)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
}
@@ -194,6 +206,11 @@ int32 IndexedDBDispatcherHost::Add(WebIDBObjectStore* idb_object_store) {
return object_store_dispatcher_host_->map_.Add(idb_object_store);
}
+void IndexedDBDispatcherHost::Add(WebIDBTransaction* idb_transaction) {
+ transaction_dispatcher_host_->map_.AddWithID(
+ idb_transaction, idb_transaction->id());
+}
+
void IndexedDBDispatcherHost::OnIDBFactoryOpen(
const ViewHostMsg_IDBFactoryOpen_Params& params) {
// TODO(jorlow): Check the content settings map and use params.routing_id_
@@ -206,6 +223,14 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen(
WebSecurityOrigin::createFromDatabaseIdentifier(params.origin_), NULL);
}
+void IndexedDBDispatcherHost::OnIDBFactoryAbortPendingTransactions(
+ const std::vector<int32>& ids) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
+
+ WebVector<int32> pendingIDs = ids;
+ Context()->GetIDBFactory()->abortPendingTransactions(pendingIDs);
+}
+
//////////////////////////////////////////////////////////////////////
// Helper templates.
//
@@ -277,6 +302,8 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
OnObjectStore)
IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseRemoveObjectStore,
OnRemoveObjectStore)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseTransaction,
+ OnTransaction)
IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -368,6 +395,31 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRemoveObjectStore(
name, new IndexedDBCallbacks<WebIDBObjectStore>(parent_, response_id));
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
+ int32 idb_database_id, const std::vector<string16>& names,
+ int32 mode, int32 timeout, IPC::Message* reply_msg) {
+ WebIDBDatabase* database = parent_->GetOrTerminateProcess(
+ &map_, idb_database_id, reply_msg,
+ ViewHostMsg_IDBDatabaseTransaction::ID);
+ if (!database)
+ return;
+
+ WebDOMStringList object_stores;
+ for (std::vector<string16>::const_iterator it = names.begin();
+ it != names.end(); ++it) {
+ object_stores.append(*it);
+ }
+
+ WebIDBTransaction* transaction = database->transaction(
+ object_stores, mode, timeout);
+ transaction->setCallbacks(
+ new IndexedDBTransactionCallbacks(parent_, transaction->id()));
+ parent_->Add(transaction);
+ ViewHostMsg_IDBDatabaseTransaction::WriteReplyParams(
+ reply_msg, transaction->id());
+ parent_->Send(reply_msg);
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDestroyed(
int32 object_id) {
parent_->DestroyObject(&map_, object_id,
@@ -615,6 +667,7 @@ bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived(
return handled;
}
+
void IndexedDBDispatcherHost::CursorDispatcherHost::Send(
IPC::Message* message) {
// The macro magic in OnMessageReceived requires this to link, but it should
@@ -682,3 +735,41 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed(
parent_->DestroyObject(
&map_, object_id, ViewHostMsg_IDBCursorDestroyed::ID);
}
+
+//////////////////////////////////////////////////////////////////////
+// IndexedDBDispatcherHost::TransactionDispatcherHost
+//
+
+IndexedDBDispatcherHost::TransactionDispatcherHost::TransactionDispatcherHost(
+ IndexedDBDispatcherHost* parent)
+ : parent_(parent) {
+}
+
+IndexedDBDispatcherHost::
+ TransactionDispatcherHost::~TransactionDispatcherHost() {
+}
+
+bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived(
+ const IPC::Message& message, bool* msg_is_ok) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost,
+ message, *msg_is_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+ return handled;
+}
+
+void IndexedDBDispatcherHost::TransactionDispatcherHost::Send(
+ IPC::Message* message) {
+ // The macro magic in OnMessageReceived requires this to link, but it should
+ // never actually be called.
+ NOTREACHED();
+ parent_->Send(message);
+}
+
+void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
+ int32 object_id) {
+ parent_->DestroyObject(
+ &map_, object_id, ViewHostMsg_IDBTransactionDestroyed::ID);
+}
« no previous file with comments | « chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | chrome/chrome_renderer.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698