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

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

Issue 10536007: Merge 117978 - IndexedDB: Fire error when there are problems opening a DB (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
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 119484)
+++ Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (working copy)
@@ -93,6 +93,14 @@
RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks;
};
+PassRefPtr<IDBDatabaseBackendImpl> IDBDatabaseBackendImpl::create(const String& name, IDBBackingStore* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
+{
+ RefPtr<IDBDatabaseBackendImpl> backend = adoptRef(new IDBDatabaseBackendImpl(name, database, coordinator, factory, uniqueIdentifier));
+ if (!backend->openInternal())
+ return 0;
+ return backend.release();
+}
+
IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingStore* backingStore, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
: m_backingStore(backingStore)
, m_id(InvalidId)
@@ -103,19 +111,17 @@
, m_transactionCoordinator(coordinator)
{
ASSERT(!m_name.isNull());
- openInternal();
}
-void IDBDatabaseBackendImpl::openInternal()
+bool IDBDatabaseBackendImpl::openInternal()
{
bool success = m_backingStore->getIDBDatabaseMetaData(m_name, m_version, m_id);
ASSERT(success == (m_id != InvalidId));
if (success) {
loadObjectStores();
- return;
+ return true;
}
- if (!m_backingStore->createIDBDatabaseMetaData(m_name, m_version, m_id))
- ASSERT_NOT_REACHED(); // FIXME: Need better error handling.
+ return m_backingStore->createIDBDatabaseMetaData(m_name, m_version, m_id);
}
IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
@@ -325,9 +331,10 @@
if (!m_pendingDeleteCalls.isEmpty() || m_runningVersionChangeTransaction || !m_pendingSetVersionCalls.isEmpty())
m_pendingOpenCalls.append(PendingOpenCall::create(callbacks));
else {
- if (m_id == InvalidId)
- openInternal();
- callbacks->onSuccess(this);
+ if (m_id == InvalidId && !openInternal())
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error."));
+ else
+ callbacks->onSuccess(this);
}
}
« no previous file with comments | « Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h ('k') | Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698