| 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();
|
|
|