diff options
author | andreip@chromium.org <andreip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-24 14:56:05 +0000 |
---|---|---|
committer | andreip@chromium.org <andreip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-24 14:56:05 +0000 |
commit | bd70b7b7a4b63d04529fc3a0a58f259cf0ff0dd3 (patch) | |
tree | 894e40d0779dfec6e60d359ee215d610f5823ae2 | |
parent | 2af936fe9da93bbbe1837d1b02f0243494076bea (diff) | |
download | chromium_src-bd70b7b7a4b63d04529fc3a0a58f259cf0ff0dd3.zip chromium_src-bd70b7b7a4b63d04529fc3a0a58f259cf0ff0dd3.tar.gz chromium_src-bd70b7b7a4b63d04529fc3a0a58f259cf0ff0dd3.tar.bz2 |
Implement IDBTransaction::objectStore
This depends on https://bugs.webkit.org/show_bug.cgi?id=44446
Review URL: http://codereview.chromium.org/3165053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57185 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 35 insertions, 6 deletions
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 d1f79bb..78d0580 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -124,6 +124,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { case ViewHostMsg_IDBObjectStoreRemoveIndex::ID: case ViewHostMsg_IDBObjectStoreDestroyed::ID: case ViewHostMsg_IDBTransactionDestroyed::ID: + case ViewHostMsg_IDBTransactionObjectStore::ID: break; default: return false; @@ -754,6 +755,8 @@ bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost, message, *msg_is_ok) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBTransactionObjectStore, + OnObjectStore) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -768,6 +771,21 @@ void IndexedDBDispatcherHost::TransactionDispatcherHost::Send( parent_->Send(message); } +void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( + int32 transaction_id, const string16& name, IPC::Message* reply_msg) { + WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( + &map_, transaction_id, reply_msg, + ViewHostMsg_IDBDatabaseObjectStore::ID); + if (!idb_transaction) + return; + + WebIDBObjectStore* object_store = idb_transaction->objectStore(name); + int32 object_id = object_store ? parent_->Add(object_store) : 0; + ViewHostMsg_IDBTransactionObjectStore::WriteReplyParams( + reply_msg, object_id); + parent_->Send(reply_msg); +} + void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( int32 object_id) { parent_->DestroyObject( diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h index ed3357e..acf4acc 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -190,6 +190,8 @@ class IndexedDBDispatcherHost void Send(IPC::Message* message); // TODO: add the rest of the transaction methods. + void OnObjectStore(int32 transaction_id, const string16& name, + IPC::Message* reply_msg); void OnDestroyed(int32 idb_transaction_id); IndexedDBDispatcherHost* parent_; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index ec47c92..1527854 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2432,9 +2432,15 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBCursorDestroyed, int32 /* idb_cursor_id */) + // IDBTransaction::ObjectStore message. + IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_IDBTransactionObjectStore, + int32, /* transaction_id */ + string16, /* name */ + int32 /* object_store_id */) + // WebIDBTransaction::~WebIDBTransaction() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDestroyed, - int32 /* idb_index_id */) + int32 /* idb_transaction_id */) // Get file size in bytes. Set result to -1 if failed to get the file size. IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetFileSize, diff --git a/chrome/renderer/renderer_webidbdatabase_impl.cc b/chrome/renderer/renderer_webidbdatabase_impl.cc index 0c69d85..e3dd32f 100644 --- a/chrome/renderer/renderer_webidbdatabase_impl.cc +++ b/chrome/renderer/renderer_webidbdatabase_impl.cc @@ -90,5 +90,5 @@ WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction( RenderThread::current()->Send( new ViewHostMsg_IDBDatabaseTransaction( idb_database_id_, object_stores, mode, timeout, &transaction_id)); - return new RendererWebIDBTransactionImpl(transaction_id); + return new RendererWebIDBTransactionImpl(transaction_id); } diff --git a/chrome/renderer/renderer_webidbtransaction_impl.cc b/chrome/renderer/renderer_webidbtransaction_impl.cc index 8faf9a1..230237f 100644 --- a/chrome/renderer/renderer_webidbtransaction_impl.cc +++ b/chrome/renderer/renderer_webidbtransaction_impl.cc @@ -5,8 +5,9 @@ #include "chrome/renderer/renderer_webidbtransaction_impl.h" #include "chrome/common/render_messages.h" -#include "chrome/renderer/render_thread.h" #include "chrome/renderer/indexed_db_dispatcher.h" +#include "chrome/renderer/render_thread.h" +#include "chrome/renderer/renderer_webidbobjectstore_impl.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBObjectStore.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBTransactionCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" @@ -35,9 +36,11 @@ int RendererWebIDBTransactionImpl::mode() const WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( const WebString& name) { - // TODO: implement - DCHECK(false); - return 0; + int object_store_id; + RenderThread::current()->Send( + new ViewHostMsg_IDBTransactionObjectStore( + idb_transaction_id_, name, &object_store_id)); + return new RendererWebIDBObjectStoreImpl(object_store_id); } void RendererWebIDBTransactionImpl::abort() |