IndexedDB: Expose mechanism for database to force a connection to close
authorjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 00:41:38 +0000 (00:41 +0000)
committerjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 00:41:38 +0000 (00:41 +0000)
commita9056ea59258be58f1ff54132132f7fe3a5a5724
treec15d44af50f43449da919160f2461f7a37654dd0
parent59c32db54a097ac0018c4424c90b806c904a74cc
IndexedDB: Expose mechanism for database to force a connection to close
https://bugs.webkit.org/show_bug.cgi?id=91010

Reviewed by Tony Chang.

Source/WebCore:

In response to user action (e.g. "delete my browsing data") a connection may
need to be forcibly terminated. This allows an event to be sent to a connection
from the back end via IDBDatabaseCallbacks to initiate closing the connection.

Test: [chromium] webkit_unit_test --gtest_filter='IDBDatabaseBackendTest.ForcedClose'

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::forceClose): Abort all transactions and close.
(WebCore):
* Modules/indexeddb/IDBDatabase.h:
(IDBDatabase): Entry point.
* Modules/indexeddb/IDBDatabaseCallbacks.h:
(IDBDatabaseCallbacks): Event plumbing from back end.
* Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp:
(WebCore::IDBDatabaseCallbacksImpl::onForcedClose): Ditto.
(WebCore):
* Modules/indexeddb/IDBDatabaseCallbacksImpl.h:
(IDBDatabaseCallbacksImpl): Ditto.
* inspector/InspectorIndexedDBAgent.cpp:
(WebCore): Method stub.

Source/WebKit/chromium:

In Chromium, the browsing data deleter has a WebIDBDatabase handle which
it can use to terminate a connection. This handles forcefully closing
the front end connections and the back end, to unblock disk cleanup.

* public/WebIDBDatabase.h:
(WebKit::WebIDBDatabase::forceClose): Entry point.
* public/WebIDBDatabaseCallbacks.h:
(WebKit::WebIDBDatabaseCallbacks::onForcedClose): Plumbing back to front.
* src/IDBDatabaseCallbacksProxy.cpp:
(WebKit::IDBDatabaseCallbacksProxy::onForcedClose): Plumbing back to front.
(WebKit):
* src/IDBDatabaseCallbacksProxy.h:
(IDBDatabaseCallbacksProxy): Plumbing.
* src/WebIDBDatabaseCallbacksImpl.cpp:
(WebKit::WebIDBDatabaseCallbacksImpl::onForcedClose): Plumbing back to front.
(WebKit):
* src/WebIDBDatabaseCallbacksImpl.h:
(WebIDBDatabaseCallbacksImpl): Plumbing back to front.
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::close): Tidy up dropping the callback reference.
(WebKit):
(WebKit::WebIDBDatabaseImpl::forceClose): Terminate the connection by notifying
the back end and the front end, while avoid re-entrant badness.
* src/WebIDBDatabaseImpl.h: Header tweak for unit test.
(WebIDBDatabaseImpl):
* tests/IDBDatabaseBackendTest.cpp: Added unit test to exercise connections.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126516 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabase.h
Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h
Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.h
Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebIDBDatabase.h
Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h
Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.cpp
Source/WebKit/chromium/src/IDBDatabaseCallbacksProxy.h
Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.cpp
Source/WebKit/chromium/src/WebIDBDatabaseCallbacksImpl.h
Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp
Source/WebKit/chromium/src/WebIDBDatabaseImpl.h
Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp