OSDN Git Service

Merge WebKit at r71558: Initial merge by git.
[android-x86/external-webkit.git] / WebCore / storage / IDBCursorBackendImpl.cpp
index 40b46c6..8d5c8a1 100644 (file)
@@ -37,6 +37,7 @@
 #include "IDBKeyRange.h"
 #include "IDBObjectStoreBackendImpl.h"
 #include "IDBRequest.h"
+#include "IDBSQLiteDatabase.h"
 #include "IDBTransactionBackendInterface.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
 
 namespace WebCore {
 
-IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBObjectStoreBackendImpl> idbObjectStore, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, IDBTransactionBackendInterface* transaction)
-    : m_idbObjectStore(idbObjectStore)
-    , m_keyRange(keyRange)
-    , m_direction(direction)
-    , m_query(query)
-    , m_isSerializedScriptValueCursor(true)
-    , m_transaction(transaction)
-{
-    loadCurrentRow();
-}
-
-IDBCursorBackendImpl::IDBCursorBackendImpl(PassRefPtr<IDBIndexBackendImpl> idbIndex, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction)
-    : m_idbIndex(idbIndex)
+IDBCursorBackendImpl::IDBCursorBackendImpl(IDBSQLiteDatabase* database, PassRefPtr<IDBKeyRange> keyRange, IDBCursor::Direction direction, PassOwnPtr<SQLiteStatement> query, bool isSerializedScriptValueCursor, IDBTransactionBackendInterface* transaction)
+    : m_database(database)
     , m_keyRange(keyRange)
     , m_direction(direction)
     , m_query(query)
@@ -113,7 +103,7 @@ void IDBCursorBackendImpl::updateInternal(ScriptExecutionContext*, PassRefPtr<ID
     }
 
     String sql = "UPDATE ObjectStoreData SET value = ? WHERE id = ?";
-    SQLiteStatement updateQuery(cursor->database()->sqliteDatabase(), sql);
+    SQLiteStatement updateQuery(cursor->database(), sql);
     
     bool ok = updateQuery.prepare() == SQLResultOk;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
@@ -189,7 +179,7 @@ void IDBCursorBackendImpl::removeInternal(ScriptExecutionContext*, PassRefPtr<ID
     }
 
     String sql = "DELETE FROM ObjectStoreData WHERE id = ?";
-    SQLiteStatement deleteQuery(cursor->database()->sqliteDatabase(), sql);
+    SQLiteStatement deleteQuery(cursor->database(), sql);
     
     bool ok = deleteQuery.prepare() == SQLResultOk;
     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling.
@@ -214,11 +204,9 @@ void IDBCursorBackendImpl::loadCurrentRow()
         m_currentIDBKeyValue = IDBKey::fromQuery(*m_query, 4);
 }
 
-IDBDatabaseBackendImpl* IDBCursorBackendImpl::database() const
+SQLiteDatabase& IDBCursorBackendImpl::database() const
 {
-    if (m_idbObjectStore)
-        return m_idbObjectStore->database();
-    return m_idbIndex->objectStore()->database();
+    return m_database->db();
 }
 
 } // namespace WebCore