Changeset 163245 in webkit


Ignore:
Timestamp:
Feb 1, 2014 11:04:02 AM (10 years ago)
Author:
beidson@apple.com
Message:

IDB: Index cursor complete advance() and iterate() support
<rdar://problem/15941916> and https://bugs.webkit.org/show_bug.cgi?id=127870

Reviewed by Dan Bernstein.

Source/WebCore:

  • Modules/indexeddb/IDBRequest.cpp:

(WebCore::IDBRequest::onSuccess): Always use the value buffer for the script object.

Source/WebKit2:

  • DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:

(WebKit::SQLiteIDBCursor::advanceOnce): Look up the found record value from the

object store records based on the key we found from the index.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163244 r163245  
     12014-02-01  Brady Eidson  <beidson@apple.com>
     2
     3        IDB: Index cursor complete advance() and iterate() support
     4        <rdar://problem/15941916> and https://bugs.webkit.org/show_bug.cgi?id=127870
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * Modules/indexeddb/IDBRequest.cpp:
     9        (WebCore::IDBRequest::onSuccess): Always use the value buffer for the script object.
     10
    1112014-02-01  Alexey Proskuryakov  <ap@apple.com>
    212
  • trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp

    r163234 r163245  
    288288    RefPtr<IDBKey> primaryKey = backend->primaryKey();
    289289
    290     Deprecated::ScriptValue value;
    291 
    292     if (backend->valueKey())
    293         value = idbKeyToScriptValue(requestState(), backend->valueKey());
    294     else
    295         value = deserializeIDBValueBuffer(requestState(), backend->valueBuffer());
     290    Deprecated::ScriptValue value = deserializeIDBValueBuffer(requestState(), backend->valueBuffer());
    296291
    297292    ASSERT(!m_pendingCursor);
     
    410405}
    411406
    412 void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> buffer, PassRefPtr<IDBKey> valueKey)
     407void IDBRequest::onSuccess(PassRefPtr<IDBKey> key, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer> buffer, PassRefPtr<IDBKey>)
    413408{
    414409    LOG(StorageAPI, "IDBRequest::onSuccess(key, primaryKey, valueBuffer, valueKey)");
     
    418413    DOMRequestState::Scope scope(m_requestState);
    419414
    420     Deprecated::ScriptValue value;
    421     if (valueKey)
    422         value = idbKeyToScriptValue(requestState(), valueKey);
    423     else
    424         value = deserializeIDBValueBuffer(requestState(), buffer);
     415    Deprecated::ScriptValue value = deserializeIDBValueBuffer(requestState(), buffer);
    425416
    426417    ASSERT(m_pendingCursor);
  • trunk/Source/WebKit2/ChangeLog

    r163243 r163245  
     12014-02-01  Brady Eidson  <beidson@apple.com>
     2
     3        IDB: Index cursor complete advance() and iterate() support
     4        <rdar://problem/15941916> and https://bugs.webkit.org/show_bug.cgi?id=127870
     5
     6        Reviewed by Dan Bernstein.
     7
     8        * DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp:
     9        (WebKit::SQLiteIDBCursor::advanceOnce): Look up the found record value from the
     10          object store records based on the key we found from the index.
     11
    1122014-01-31  Anders Carlsson  <andersca@apple.com>
    213
  • trunk/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/SQLiteIDBCursor.cpp

    r163237 r163245  
    284284    if (m_indexID != IDBIndexMetadata::InvalidId) {
    285285        if (!deserializeIDBKeyData(reinterpret_cast<const uint8_t*>(keyData.data()), keyData.size(), m_currentValueKey)) {
    286             LOG_ERROR("Unable to deserialize value data from database while advancing cursor");
     286            LOG_ERROR("Unable to deserialize value data from database while advancing index cursor");
    287287            m_completed = true;
    288288            return false;
    289289        }
    290290
    291         // Index cursors should only have a m_currentValueKey, and not m_currentValueBuffer
    292         m_currentValueBuffer.clear();
     291        SQLiteStatement objectStoreStatement(*m_statement->database(), "SELECT value FROM Records WHERE key = CAST(? AS TEXT) and objectStoreID = ?;");
     292
     293        if (objectStoreStatement.prepare() != SQLResultOk
     294            || objectStoreStatement.bindBlob(1, m_currentValueBuffer.data(), m_currentValueBuffer.size()) != SQLResultOk
     295            || objectStoreStatement.bindInt64(2, m_objectStoreID) != SQLResultOk
     296            || objectStoreStatement.step() != SQLResultRow) {
     297            LOG_ERROR("Could not create index cursor statement into object store records");
     298            return false;
     299        }
     300
     301        objectStoreStatement.getColumnBlobAsVector(0, m_currentValueBuffer);
    293302    }
    294303
Note: See TracChangeset for help on using the changeset viewer.