Index: Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp |
=================================================================== |
--- Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (revision 119524) |
+++ Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (working copy) |
@@ -93,14 +93,6 @@ |
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) |
@@ -111,17 +103,19 @@ |
, m_transactionCoordinator(coordinator) |
{ |
ASSERT(!m_name.isNull()); |
+ openInternal(); |
} |
-bool IDBDatabaseBackendImpl::openInternal() |
+void IDBDatabaseBackendImpl::openInternal() |
{ |
bool success = m_backingStore->getIDBDatabaseMetaData(m_name, m_version, m_id); |
ASSERT(success == (m_id != InvalidId)); |
if (success) { |
loadObjectStores(); |
- return true; |
+ return; |
} |
- return m_backingStore->createIDBDatabaseMetaData(m_name, m_version, m_id); |
+ if (!m_backingStore->createIDBDatabaseMetaData(m_name, m_version, m_id)) |
+ ASSERT_NOT_REACHED(); // FIXME: Need better error handling. |
} |
IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl() |
@@ -331,10 +325,9 @@ |
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 |
- callbacks->onSuccess(this); |
+ if (m_id == InvalidId) |
+ openInternal(); |
+ callbacks->onSuccess(this); |
} |
} |