summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 14:23:42 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 14:23:42 +0000
commit7638b15cfd0a0ae642d65161ab0ea361e23ae4c6 (patch)
tree6bd4261b8317ddc836cf30996ac897975f61f108 /chrome
parent9a86b04e0f0df56fcc55eee8b1d380cdc83bc54b (diff)
downloadchromium_src-7638b15cfd0a0ae642d65161ab0ea361e23ae4c6.zip
chromium_src-7638b15cfd0a0ae642d65161ab0ea361e23ae4c6.tar.gz
chromium_src-7638b15cfd0a0ae642d65161ab0ea361e23ae4c6.tar.bz2
Implement the Chrome half of setVersion.
TEST=setVersion layout test works in non-single-process-mode BUG=none Review URL: http://codereview.chromium.org/3116043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc15
-rw-r--r--chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h3
-rw-r--r--chrome/common/render_messages_internal.h6
-rw-r--r--chrome/renderer/indexed_db_dispatcher.cc12
-rw-r--r--chrome/renderer/indexed_db_dispatcher.h5
-rw-r--r--chrome/renderer/renderer_webidbdatabase_impl.cc8
-rw-r--r--chrome/renderer/renderer_webidbdatabase_impl.h3
7 files changed, 52 insertions, 0 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 9967548..dadebf0 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -107,6 +107,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) {
case ViewHostMsg_IDBDatabaseCreateObjectStore::ID:
case ViewHostMsg_IDBDatabaseObjectStore::ID:
case ViewHostMsg_IDBDatabaseRemoveObjectStore::ID:
+ case ViewHostMsg_IDBDatabaseSetVersion::ID:
case ViewHostMsg_IDBDatabaseTransaction::ID:
case ViewHostMsg_IDBDatabaseDestroyed::ID:
case ViewHostMsg_IDBIndexName::ID:
@@ -304,6 +305,8 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
OnObjectStore)
IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseRemoveObjectStore,
OnRemoveObjectStore)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseSetVersion,
+ OnSetVersion)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBDatabaseTransaction,
OnTransaction)
IPC_MESSAGE_HANDLER(ViewHostMsg_IDBDatabaseDestroyed, OnDestroyed)
@@ -397,6 +400,18 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnRemoveObjectStore(
name, new IndexedDBCallbacks<void>(parent_, response_id));
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion(
+ int32 idb_database_id, int32 response_id, const string16& version) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
+ WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
+ &map_, idb_database_id, NULL,
+ ViewHostMsg_IDBDatabaseSetVersion::ID);
+ if (!idb_database)
+ return;
+ idb_database->setVersion(
+ version, new IndexedDBCallbacks<void>(parent_, response_id));
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
int32 idb_database_id, const std::vector<string16>& names,
int32 mode, int32 timeout, IPC::Message* reply_msg) {
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 acf4acc..d461ee8 100644
--- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h
+++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h
@@ -106,6 +106,9 @@ class IndexedDBDispatcherHost
IPC::Message* reply_msg);
void OnRemoveObjectStore(int32 idb_database_id, int32 response_id,
const string16& name);
+ void OnSetVersion(int32 idb_database_id,
+ int32 response_id,
+ const string16& version);
void OnTransaction(int32 idb_database_id,
const std::vector<string16>& names,
int32 mode, int32 timeout, IPC::Message* reply_msg);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 97b17d9..be0e220 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -2369,6 +2369,12 @@ IPC_BEGIN_MESSAGES(ViewHost)
int32, /* response_id */
string16 /* name */)
+ // WebIDBDatabase::setVersion() message.
+ IPC_MESSAGE_CONTROL3(ViewHostMsg_IDBDatabaseSetVersion,
+ int32, /* idb_database_id */
+ int32, /* response_id */
+ string16 /* version */)
+
// WebIDBDatabase::transaction() message.
// TODO: make this message async. Have the renderer create a
// temporary ID and keep a map in the browser process of real
diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc
index ac1a3e4..1c105d0 100644
--- a/chrome/renderer/indexed_db_dispatcher.cc
+++ b/chrome/renderer/indexed_db_dispatcher.cc
@@ -105,6 +105,18 @@ void IndexedDBDispatcher::RequestIDBDatabaseRemoveObjectStore(
idb_database_id, pending_callbacks_.Add(callbacks.release()), name));
}
+void IndexedDBDispatcher::RequestIDBDatabaseSetVersion(
+ const string16& version,
+ WebIDBCallbacks* callbacks_ptr,
+ int32 idb_database_id) {
+ scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
+
+ RenderThread::current()->Send(
+ new ViewHostMsg_IDBDatabaseSetVersion(
+ idb_database_id, pending_callbacks_.Add(callbacks.release()),
+ version));
+}
+
void IndexedDBDispatcher::RequestIDBObjectStoreGet(
const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks_ptr,
int32 idb_object_store_id) {
diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h
index c2602e0..c74bdfe 100644
--- a/chrome/renderer/indexed_db_dispatcher.h
+++ b/chrome/renderer/indexed_db_dispatcher.h
@@ -45,6 +45,11 @@ class IndexedDBDispatcher {
const string16& name, WebKit::WebIDBCallbacks* callbacks,
int32 idb_database_id);
+ void RequestIDBDatabaseSetVersion(
+ const string16& version,
+ WebKit::WebIDBCallbacks* callbacks,
+ int32 idb_database_id);
+
void RequestIDBObjectStoreGet(
const IndexedDBKey& key, WebKit::WebIDBCallbacks* callbacks,
int32 idb_object_store_id);
diff --git a/chrome/renderer/renderer_webidbdatabase_impl.cc b/chrome/renderer/renderer_webidbdatabase_impl.cc
index e3dd32f..fb8b607 100644
--- a/chrome/renderer/renderer_webidbdatabase_impl.cc
+++ b/chrome/renderer/renderer_webidbdatabase_impl.cc
@@ -78,6 +78,14 @@ void RendererWebIDBDatabaseImpl::removeObjectStore(
name, callbacks, idb_database_id_);
}
+void RendererWebIDBDatabaseImpl::setVersion(
+ const WebString& version, WebIDBCallbacks* callbacks) {
+ IndexedDBDispatcher* dispatcher =
+ RenderThread::current()->indexed_db_dispatcher();
+ dispatcher->RequestIDBDatabaseSetVersion(
+ version, callbacks, idb_database_id_);
+}
+
WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::transaction(
const WebDOMStringList& names, unsigned short mode,
unsigned long timeout) {
diff --git a/chrome/renderer/renderer_webidbdatabase_impl.h b/chrome/renderer/renderer_webidbdatabase_impl.h
index dfd054e..b315344 100644
--- a/chrome/renderer/renderer_webidbdatabase_impl.h
+++ b/chrome/renderer/renderer_webidbdatabase_impl.h
@@ -32,9 +32,12 @@ class RendererWebIDBDatabaseImpl : public WebKit::WebIDBDatabase {
bool auto_increment, WebKit::WebIDBCallbacks* callbacks);
virtual void removeObjectStore(
const WebKit::WebString& name, WebKit::WebIDBCallbacks* callbacks);
+ virtual void setVersion(
+ const WebKit::WebString& version, WebKit::WebIDBCallbacks* callbacks);
virtual WebKit::WebIDBTransaction* transaction(
const WebKit::WebDOMStringList& names,
unsigned short mode, unsigned long timeout);
+
private:
int32 idb_database_id_;
};