Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp

Issue 10630009: Merge 120828 - [Chromium] IndexedDB: Don't close database if pending connections are in flight (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1180/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
===================================================================
--- Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (revision 120957)
+++ Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (working copy)
@@ -109,6 +109,7 @@
, m_identifier(uniqueIdentifier)
, m_factory(factory)
, m_transactionCoordinator(coordinator)
+ , m_pendingConnectionCount(0)
{
ASSERT(!m_name.isNull());
}
@@ -222,7 +223,7 @@
// FIXME: Only fire onBlocked if there are open connections after the
// VersionChangeEvents are received, not just set up to fire.
// https://bugs.webkit.org/show_bug.cgi?id=71130
- if (m_databaseCallbacksSet.size() > 1) {
+ if (connectionCount() > 1) {
callbacks->onBlocked();
RefPtr<PendingSetVersionCall> pendingSetVersionCall = PendingSetVersionCall::create(version, callbacks, databaseCallbacks);
m_pendingSetVersionCalls.append(pendingSetVersionCall);
@@ -278,9 +279,14 @@
}
}
+int32_t IDBDatabaseBackendImpl::connectionCount()
+{
+ return m_databaseCallbacksSet.size() + m_pendingConnectionCount;
+}
+
void IDBDatabaseBackendImpl::processPendingCalls()
{
- ASSERT(m_databaseCallbacksSet.size() <= 1);
+ ASSERT(connectionCount() <= 1);
// Pending calls may be requeued or aborted
Deque<RefPtr<PendingSetVersionCall> > pendingSetVersionCalls;
@@ -345,18 +351,24 @@
void IDBDatabaseBackendImpl::registerFrontendCallbacks(PassRefPtr<IDBDatabaseCallbacks> callbacks)
{
+ ASSERT(m_backingStore.get());
+ ASSERT(m_pendingConnectionCount);
+ --m_pendingConnectionCount;
m_databaseCallbacksSet.add(RefPtr<IDBDatabaseCallbacks>(callbacks));
}
void IDBDatabaseBackendImpl::openConnection(PassRefPtr<IDBCallbacks> callbacks)
{
+ ASSERT(m_backingStore.get());
if (!m_pendingDeleteCalls.isEmpty() || m_runningVersionChangeTransaction || !m_pendingSetVersionCalls.isEmpty())
m_pendingOpenCalls.append(PendingOpenCall::create(callbacks));
else {
if (m_id == InvalidId && !openInternal())
callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error."));
- else
+ else {
+ ++m_pendingConnectionCount;
callbacks->onSuccess(this);
+ }
}
}
@@ -395,12 +407,12 @@
RefPtr<IDBDatabaseCallbacks> callbacks = prpCallbacks;
ASSERT(m_databaseCallbacksSet.contains(callbacks));
m_databaseCallbacksSet.remove(callbacks);
- if (m_databaseCallbacksSet.size() > 1)
+ if (connectionCount() > 1)
return;
processPendingCalls();
- if (!m_databaseCallbacksSet.size()) {
+ if (!connectionCount()) {
TransactionSet transactions(m_transactions);
for (TransactionSet::const_iterator it = transactions.begin(); it != transactions.end(); ++it)
(*it)->abort();
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h ('k') | Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698