diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc | 46 | ||||
-rw-r--r-- | chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h | 8 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 17 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.cc | 32 | ||||
-rw-r--r-- | chrome/renderer/indexed_db_dispatcher.h | 14 | ||||
-rw-r--r-- | chrome/renderer/renderer_webidbcursor_impl.cc | 26 |
6 files changed, 133 insertions, 10 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 dadebf0..52ee4a8 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -10,6 +10,7 @@ #include "chrome/browser/renderer_host/browser_render_process_host.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/indexed_db_key.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" #include "chrome/common/serialized_script_value.h" @@ -98,6 +99,9 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { case ViewHostMsg_IDBCursorDirection::ID: case ViewHostMsg_IDBCursorKey::ID: case ViewHostMsg_IDBCursorValue::ID: + case ViewHostMsg_IDBCursorUpdate::ID: + case ViewHostMsg_IDBCursorContinue::ID: + case ViewHostMsg_IDBCursorRemove::ID: case ViewHostMsg_IDBFactoryOpen::ID: case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID: case ViewHostMsg_IDBDatabaseName::ID: @@ -568,7 +572,7 @@ void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( std::vector<string16> index_names; index_names.reserve(web_index_names.length()); for (unsigned i = 0; i < web_index_names.length(); ++i) - index_names[i] = web_index_names.item(i); + index_names.push_back(web_index_names.item(i)); ViewHostMsg_IDBObjectStoreIndexNames::WriteReplyParams(reply_msg, index_names); parent_->Send(reply_msg); @@ -678,6 +682,9 @@ bool IndexedDBDispatcherHost::CursorDispatcherHost::OnMessageReceived( OnDirection) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorKey, OnKey) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBCursorValue, OnValue) + IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorUpdate, OnUpdate) + IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorContinue, OnContinue) + IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorRemove, OnRemove) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBCursorDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -747,6 +754,43 @@ void IndexedDBDispatcherHost::CursorDispatcherHost::OnValue( parent_->Send(reply_msg); } +void IndexedDBDispatcherHost::CursorDispatcherHost::OnUpdate( + int32 cursor_id, + int32 response_id, + const SerializedScriptValue& value) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); + WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( + &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); + if (!idb_cursor) + return; + idb_cursor->update( + value, new IndexedDBCallbacks<void>(parent_, response_id)); +} + +void IndexedDBDispatcherHost::CursorDispatcherHost::OnContinue( + int32 cursor_id, + int32 response_id, + const IndexedDBKey& key) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); + WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( + &map_, cursor_id, NULL, ViewHostMsg_IDBCursorContinue::ID); + if (!idb_cursor) + return; + idb_cursor->continueFunction( + key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id)); +} + +void IndexedDBDispatcherHost::CursorDispatcherHost::OnRemove( + int32 cursor_id, + int32 response_id) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); + WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess( + &map_, cursor_id, NULL, ViewHostMsg_IDBCursorUpdate::ID); + if (!idb_cursor) + return; + idb_cursor->remove(new IndexedDBCallbacks<void>(parent_, response_id)); +} + void IndexedDBDispatcherHost::CursorDispatcherHost::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 d461ee8..d563bfc 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -178,6 +178,14 @@ class IndexedDBDispatcherHost void OnDirection(int32 idb_object_store_id, IPC::Message* reply_msg); void OnKey(int32 idb_object_store_id, IPC::Message* reply_msg); void OnValue(int32 idb_object_store_id, IPC::Message* reply_msg); + void OnUpdate(int32 idb_object_store_id, + int32 response_id, + const SerializedScriptValue& value); + void OnContinue(int32 idb_object_store_id, + int32 response_id, + const IndexedDBKey& key); + void OnRemove(int32 idb_object_store_id, + int32 response_id); void OnDestroyed(int32 idb_cursor_id); IndexedDBDispatcherHost* parent_; diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index c9e1361..4a680e8 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2326,6 +2326,23 @@ IPC_BEGIN_MESSAGES(ViewHost) int32, /* idb_cursor_id */ SerializedScriptValue) + // WebIDBCursor::update() message. + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBCursorUpdate, + int32, /* idb_cursor_id */ + int32, /* response_id */ + SerializedScriptValue /* value */) + + // WebIDBCursor::continue() message. + IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBCursorContinue, + int32, /* idb_cursor_id */ + int32, /* response_id */ + IndexedDBKey /* key */) + + // WebIDBCursor::remove() message. + IPC_MESSAGE_CONTROL2(ViewHostMsg_IDBCursorRemove, + int32, /* idb_cursor_id */ + int32 /* response_id */) + // WebIDBFactory::open() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryOpen, ViewHostMsg_IDBFactoryOpen_Params) diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 1c105d0..fa6d307 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -59,6 +59,38 @@ bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { return handled; } +void IndexedDBDispatcher::RequestIDBCursorUpdate( + const SerializedScriptValue& value, + WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id) { + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + RenderThread::current()->Send( + new ViewHostMsg_IDBCursorUpdate( + idb_cursor_id, pending_callbacks_.Add(callbacks.release()), value)); +} + +void IndexedDBDispatcher::RequestIDBCursorContinue( + const IndexedDBKey& key, + WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id) { + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + RenderThread::current()->Send( + new ViewHostMsg_IDBCursorContinue( + idb_cursor_id, pending_callbacks_.Add(callbacks.release()), key)); +} + +void IndexedDBDispatcher::RequestIDBCursorRemove( + WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id) { + scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); + + RenderThread::current()->Send( + new ViewHostMsg_IDBCursorRemove( + idb_cursor_id, pending_callbacks_.Add(callbacks.release()))); +} + void IndexedDBDispatcher::RequestIDBFactoryOpen( const string16& name, const string16& description, WebIDBCallbacks* callbacks_ptr, const string16& origin, diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h index c74bdfe..e4ec55f 100644 --- a/chrome/renderer/indexed_db_dispatcher.h +++ b/chrome/renderer/indexed_db_dispatcher.h @@ -36,6 +36,20 @@ class IndexedDBDispatcher { WebKit::WebIDBCallbacks* callbacks, const string16& origin, WebKit::WebFrame* web_frame); + void RequestIDBCursorUpdate( + const SerializedScriptValue& value, + WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id); + + void RequestIDBCursorContinue( + const IndexedDBKey& key, + WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id); + + void RequestIDBCursorRemove( + WebKit::WebIDBCallbacks* callbacks_ptr, + int32 idb_cursor_id); + void RequestIDBDatabaseCreateObjectStore( const string16& name, const NullableString16& key_path, bool auto_increment, WebKit::WebIDBCallbacks* callbacks, diff --git a/chrome/renderer/renderer_webidbcursor_impl.cc b/chrome/renderer/renderer_webidbcursor_impl.cc index b647173..dd78eec 100644 --- a/chrome/renderer/renderer_webidbcursor_impl.cc +++ b/chrome/renderer/renderer_webidbcursor_impl.cc @@ -4,7 +4,10 @@ #include "chrome/renderer/renderer_webidbcursor_impl.h" +#include "chrome/common/indexed_db_key.h" #include "chrome/common/render_messages.h" +#include "chrome/common/serialized_script_value.h" +#include "chrome/renderer/indexed_db_dispatcher.h" #include "chrome/renderer/render_thread.h" using WebKit::WebIDBCallbacks; @@ -42,18 +45,23 @@ WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { } void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value, - WebIDBCallbacks* callback) { - // TODO(bulach): implement this. - NOTREACHED(); + WebIDBCallbacks* callbacks) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorUpdate( + SerializedScriptValue(value), callbacks, idb_cursor_id_); } void RendererWebIDBCursorImpl::continueFunction(const WebIDBKey& key, - WebIDBCallbacks* callback) { - // TODO(bulach): implement this. - NOTREACHED(); + WebIDBCallbacks* callbacks) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorContinue( + IndexedDBKey(key), callbacks, idb_cursor_id_); } -void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callback) { - // TODO(bulach): implement this. - NOTREACHED(); +void RendererWebIDBCursorImpl::remove(WebIDBCallbacks* callbacks) { + IndexedDBDispatcher* dispatcher = + RenderThread::current()->indexed_db_dispatcher(); + dispatcher->RequestIDBCursorRemove(callbacks, idb_cursor_id_); } |