diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-24 12:16:17 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-24 12:16:17 +0000 |
commit | 507902277eebc76641b21243039865f61fd7f13a (patch) | |
tree | d855b8cff498f9998e118e6f76668ddb794257c9 /chrome | |
parent | ef811fd19fc58d4ebf90904eec8ac5e4251c3e22 (diff) | |
download | chromium_src-507902277eebc76641b21243039865f61fd7f13a.zip chromium_src-507902277eebc76641b21243039865f61fd7f13a.tar.gz chromium_src-507902277eebc76641b21243039865f61fd7f13a.tar.bz2 |
Revert 60457 - Adds IDBFactory::didCompleteEventsForTransaction plumbing
(depends on https://bugs.webkit.org/show_bug.cgi?id=44700)
TEST=IndexedDBBrowserTest.TransactionGetTest
This takes over http://codereview.chromium.org/3310022/show
Review URL: http://codereview.chromium.org/3394007
TBR=andreip@chromium.org
Review URL: http://codereview.chromium.org/3405031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60459 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
12 files changed, 28 insertions, 135 deletions
diff --git a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc index 1692628..451cf09 100644 --- a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc +++ b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc @@ -112,7 +112,3 @@ IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, SplitFilename) { test_on_webkit_thread->security_origin().toString().utf8(); EXPECT_EQ("http://host:1", origin_str); } - -IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, TransactionGetTest) { - SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_get_test.html")))); -} 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 626416c..595a8cb 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -111,6 +111,7 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { case ViewHostMsg_IDBCursorRemove::ID: case ViewHostMsg_IDBCursorDestroyed::ID: case ViewHostMsg_IDBFactoryOpen::ID: + case ViewHostMsg_IDBFactoryAbortPendingTransactions::ID: case ViewHostMsg_IDBDatabaseName::ID: case ViewHostMsg_IDBDatabaseDescription::ID: case ViewHostMsg_IDBDatabaseVersion::ID: @@ -143,7 +144,6 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { case ViewHostMsg_IDBObjectStoreDestroyed::ID: case ViewHostMsg_IDBTransactionAbort::ID: case ViewHostMsg_IDBTransactionDestroyed::ID: - case ViewHostMsg_IDBTransactionDidCompleteTaskEvents::ID: case ViewHostMsg_IDBTransactionObjectStore::ID: break; default: @@ -198,6 +198,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() } @@ -271,6 +273,12 @@ void IndexedDBDispatcherHost::OnIDBFactoryOpen( webkit_glue::FilePathToWebString(indexed_db_path)); } +// TODO(andreip): remove this method entirely once WK rolls to r68143. +void IndexedDBDispatcherHost::OnIDBFactoryAbortPendingTransactions( + const std::vector<int32>& ids) { + DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); +} + ////////////////////////////////////////////////////////////////////// // Helper templates. // @@ -966,8 +974,6 @@ bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionAbort, OnAbort) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_IDBTransactionObjectStore, OnObjectStore) - IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDidCompleteTaskEvents, - OnDidCompleteTaskEvents) IPC_MESSAGE_HANDLER(ViewHostMsg_IDBTransactionDestroyed, OnDestroyed) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -996,29 +1002,17 @@ 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_IDBTransactionObjectStore::ID); + 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); + reply_msg, object_id); parent_->Send(reply_msg); } -void IndexedDBDispatcherHost:: - TransactionDispatcherHost::OnDidCompleteTaskEvents(int transaction_id) { - DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT)); - WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( - &map_, transaction_id, 0, - ViewHostMsg_IDBTransactionDidCompleteTaskEvents::ID); - if (!idb_transaction) - return; - - idb_transaction->didCompleteTaskEvents(); -} - 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 f048cbe..982c861 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.h @@ -74,6 +74,7 @@ class IndexedDBDispatcherHost // below. void OnMessageReceivedWebKit(const IPC::Message& message); void OnIDBFactoryOpen(const ViewHostMsg_IDBFactoryOpen_Params& p); + void OnIDBFactoryAbortPendingTransactions(const std::vector<int32>& ids); // Helper templates. template <class ReturnType> @@ -220,7 +221,6 @@ class IndexedDBDispatcherHost void OnAbort(int32 transaction_id); void OnObjectStore(int32 transaction_id, const string16& name, IPC::Message* reply_msg); - void OnDidCompleteTaskEvents(int transaction_id); 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 7b0682f..1d6d04a 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2373,6 +2373,10 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryOpen, ViewHostMsg_IDBFactoryOpen_Params) + // WebIDBFactory::abortPendingTransactions() message. + IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBFactoryAbortPendingTransactions, + std::vector<int32> /* transaction_ids */) + // WebIDBDatabase::name() message. IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_IDBDatabaseName, int32, /* idb_database_id */ @@ -2551,10 +2555,6 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionAbort, int32 /* idb_transaction_id */) - // IDBTransaction::DidCompleteTaskEvents() message. - IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDidCompleteTaskEvents, - int32 /* idb_transaction_id */) - // WebIDBTransaction::~WebIDBTransaction() message. IPC_MESSAGE_CONTROL1(ViewHostMsg_IDBTransactionDestroyed, int32 /* idb_transaction_id */) diff --git a/chrome/renderer/renderer_webidbfactory_impl.cc b/chrome/renderer/renderer_webidbfactory_impl.cc index 776c6f1..f06e190 100644 --- a/chrome/renderer/renderer_webidbfactory_impl.cc +++ b/chrome/renderer/renderer_webidbfactory_impl.cc @@ -33,3 +33,13 @@ void RendererWebIDBFactoryImpl::open( dispatcher->RequestIDBFactoryOpen( name, description, callbacks, origin.databaseIdentifier(), web_frame); } + +void RendererWebIDBFactoryImpl::abortPendingTransactions( + const WebKit::WebVector<int>& pendingIDs) { + std::vector<int> ids; + for (size_t i = 0; i < pendingIDs.size(); ++i) { + ids.push_back(pendingIDs[i]); + } + RenderThread::current()->Send( + new ViewHostMsg_IDBFactoryAbortPendingTransactions(ids)); +} diff --git a/chrome/renderer/renderer_webidbfactory_impl.h b/chrome/renderer/renderer_webidbfactory_impl.h index de4d4ee..3953249 100644 --- a/chrome/renderer/renderer_webidbfactory_impl.h +++ b/chrome/renderer/renderer_webidbfactory_impl.h @@ -29,6 +29,8 @@ class RendererWebIDBFactoryImpl : public WebKit::WebIDBFactory { WebKit::WebIDBCallbacks* callbacks, const WebKit::WebSecurityOrigin& origin, WebKit::WebFrame* web_frame, const WebKit::WebString& dataDir); + virtual void abortPendingTransactions( + const WebKit::WebVector<int>& pendingIDs); }; #endif // CHROME_RENDERER_RENDERER_WEBIDBFACTORY_IMPL_H_ diff --git a/chrome/renderer/renderer_webidbobjectstore_impl.cc b/chrome/renderer/renderer_webidbobjectstore_impl.cc index ce456dd1..28c14f4 100644 --- a/chrome/renderer/renderer_webidbobjectstore_impl.cc +++ b/chrome/renderer/renderer_webidbobjectstore_impl.cc @@ -14,7 +14,6 @@ #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBKey.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyRange.h" -#include "third_party/WebKit/WebKit/chromium/public/WebIDBTransaction.h" #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" @@ -24,7 +23,6 @@ using WebKit::WebIDBCallbacks; using WebKit::WebIDBKeyRange; using WebKit::WebIDBIndex; using WebKit::WebIDBKey; -using WebKit::WebIDBTransaction; using WebKit::WebSerializedScriptValue; using WebKit::WebString; diff --git a/chrome/renderer/renderer_webidbtransaction_impl.cc b/chrome/renderer/renderer_webidbtransaction_impl.cc index 3aa2387..dddb2d2 100644 --- a/chrome/renderer/renderer_webidbtransaction_impl.cc +++ b/chrome/renderer/renderer_webidbtransaction_impl.cc @@ -40,8 +40,6 @@ WebIDBObjectStore* RendererWebIDBTransactionImpl::objectStore( RenderThread::current()->Send( new ViewHostMsg_IDBTransactionObjectStore( idb_transaction_id_, name, &object_store_id)); - if (!object_store_id) - return NULL; return new RendererWebIDBObjectStoreImpl(object_store_id); } @@ -51,13 +49,6 @@ void RendererWebIDBTransactionImpl::abort() idb_transaction_id_)); } -void RendererWebIDBTransactionImpl::didCompleteTaskEvents() -{ - RenderThread::current()->Send( - new ViewHostMsg_IDBTransactionDidCompleteTaskEvents( - idb_transaction_id_)); -} - int RendererWebIDBTransactionImpl::id() const { return idb_transaction_id_; diff --git a/chrome/renderer/renderer_webidbtransaction_impl.h b/chrome/renderer/renderer_webidbtransaction_impl.h index d1f74fb..4369104 100644 --- a/chrome/renderer/renderer_webidbtransaction_impl.h +++ b/chrome/renderer/renderer_webidbtransaction_impl.h @@ -23,7 +23,6 @@ class RendererWebIDBTransactionImpl : public WebKit::WebIDBTransaction { virtual int mode() const; virtual WebKit::WebIDBObjectStore* objectStore(const WebKit::WebString& name); virtual void abort(); - virtual void didCompleteTaskEvents(); virtual int id() const; virtual void setCallbacks(WebKit::WebIDBTransactionCallbacks*); diff --git a/chrome/test/data/indexeddb/common.js b/chrome/test/data/indexeddb/common.js index 9ebd361..b773fe3 100644 --- a/chrome/test/data/indexeddb/common.js +++ b/chrome/test/data/indexeddb/common.js @@ -22,23 +22,11 @@ function getLog() return "" + document.getElementById('status').innerHTML; } -function unexpectedSuccessCallback() -{ - fail('unexpectedSuccessCallback'); -} - function unexpectedErrorCallback() { fail('unexpectedErrorCallback'); } -function deleteAllObjectStores(db) -{ - objectStores = db.objectStores; - for (var i = 0; i < objectStores.length; ++i) - db.removeObjectStore(objectStores[i]); -} - // The following functions are based on // WebKit/LayoutTests/fast/js/resources/js-test-pre.js // so that the tests will look similar to the existing layout tests. @@ -91,8 +79,3 @@ function shouldBeTrue(_a) { shouldBe(_a, "true"); } function shouldBeFalse(_a) { shouldBe(_a, "false"); } function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } function shouldBeNull(_a) { shouldBe(_a, "null"); } -function shouldBeEqualToString(a, b) -{ - var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"") + '"'; - shouldBe(a, unevaledString); -} diff --git a/chrome/test/data/indexeddb/transaction_get_test.html b/chrome/test/data/indexeddb/transaction_get_test.html deleted file mode 100644 index edc1e0f..0000000 --- a/chrome/test/data/indexeddb/transaction_get_test.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> - <head> - <title>IndexedDB transaction get test</title> - <script type="text/javascript" src="common.js"></script> - <script type="text/javascript" src="transaction_get_test.js"></script> - </head> - <body onLoad="test()"> - <div id="status">Starting...</div> - </body> -</html> diff --git a/chrome/test/data/indexeddb/transaction_get_test.js b/chrome/test/data/indexeddb/transaction_get_test.js deleted file mode 100644 index e9c992a..0000000 --- a/chrome/test/data/indexeddb/transaction_get_test.js +++ /dev/null @@ -1,70 +0,0 @@ -function afterCommit() -{ - try { - debug("Accessing a committed transaction should throw"); - var store = transaction.objectStore('storeName'); - } catch (e) { - exc = e; - shouldBe('exc.code', '9'); - } - done(); -} - -function nonExistingKey() -{ - window.setTimeout('afterCommit()', 0); -} - -function gotValue() -{ - value = event.result; - shouldBeEqualToString('value', 'myValue'); -} - -function startTransaction() -{ - debug("Using get in a transaction"); - transaction = db.transaction(); - //transaction.onabort = unexpectedErrorCallback; - store = transaction.objectStore('storeName'); - shouldBeEqualToString("store.name", "storeName"); - result = store.get('myKey'); - result.onsuccess = gotValue; - result.onerror = unexpectedErrorCallback; - - var emptyResult = store.get('nonExistingKey'); - emptyResult.onsuccess = unexpectedSuccessCallback; - emptyResult.onerror = nonExistingKey; -} - -function populateObjectStore(objectStore) -{ - result = objectStore.add('myValue', 'myKey'); - result.onsuccess = startTransaction; -} - -function createObjectStoreSuccess() -{ - var objectStore = event.result; - populateObjectStore(objectStore); -} - -function openSuccess() -{ - db = event.result; - - deleteAllObjectStores(db); - - result = db.createObjectStore('storeName'); - result.onsuccess = createObjectStoreSuccess; - result.onerror = unexpectedErrorCallback; -} - -function test() -{ - result = indexedDB.open('name', 'description'); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; -} - -test(); |