Changeset 83443 in webkit


Ignore:
Timestamp:
Apr 11, 2011 8:56:50 AM (13 years ago)
Author:
hans@chromium.org
Message:

2011-04-05 Hans Wennborg <hans@chromium.org>

Reviewed by Steve Block.

IndexedDB: Introduce skeleton for LevelDB backend
https://bugs.webkit.org/show_bug.cgi?id=57827

No new tests: no new functionality (yet).

  • WebCore.gyp/WebCore.gyp:

Add dependency on leveldb when ENABLE_LEVELDB=1 in feature_defines.

  • WebCore.gypi:

Add new files.

  • storage/IDBBackingStore.h: (WebCore::IDBBackingStore::ObjectStoreRecordIdentifier::~ObjectStoreRecordIdentifier):

Introduce abstract type ObjectStoreRecordIdentifier. The SQLite
backend uses integers to refer to a specific row in a table, but
the LevelDB backend will use something else.

  • storage/IDBDatabaseBackendImpl.cpp: (WebCore::IDBDatabaseBackendImpl::createObjectStore): (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal): (WebCore::IDBDatabaseBackendImpl::deleteObjectStoreInternal): (WebCore::IDBDatabaseBackendImpl::loadObjectStores):

Change functions to pass along the database id for operations that
concern object stores. We want to be able to group object stores
ids per database.

  • storage/IDBFactoryBackendImpl.cpp: (WebCore::IDBFactoryBackendImpl::open):

Decide which backend to use based on the backingStoreType
parameter.

  • storage/IDBIndexBackendImpl.cpp: (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl): (WebCore::IDBIndexBackendImpl::openCursorInternal): (WebCore::IDBIndexBackendImpl::getInternal): (WebCore::IDBIndexBackendImpl::addingKeyAllowed):
  • storage/IDBIndexBackendImpl.h: (WebCore::IDBIndexBackendImpl::create):

Pass database and object store id to backend functions concerning
indexes.

  • storage/IDBLevelDBBackingStore.cpp: Added. (WebCore::IDBLevelDBBackingStore::IDBLevelDBBackingStore): (WebCore::IDBLevelDBBackingStore::~IDBLevelDBBackingStore): (WebCore::IDBLevelDBBackingStore::open): (WebCore::IDBLevelDBBackingStore::extractIDBDatabaseMetaData): (WebCore::IDBLevelDBBackingStore::setIDBDatabaseMetaData): (WebCore::IDBLevelDBBackingStore::getObjectStores): (WebCore::IDBLevelDBBackingStore::createObjectStore): (WebCore::IDBLevelDBBackingStore::deleteObjectStore): (WebCore::IDBLevelDBBackingStore::getObjectStoreRecord): (WebCore::IDBLevelDBBackingStore::putObjectStoreRecord): (WebCore::IDBLevelDBBackingStore::clearObjectStore): (WebCore::IDBLevelDBBackingStore::deleteObjectStoreRecord): (WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber): (WebCore::IDBLevelDBBackingStore::keyExistsInObjectStore): (WebCore::IDBLevelDBBackingStore::forEachObjectStoreRecord): (WebCore::IDBLevelDBBackingStore::getIndexes): (WebCore::IDBLevelDBBackingStore::createIndex): (WebCore::IDBLevelDBBackingStore::deleteIndex): (WebCore::IDBLevelDBBackingStore::putIndexDataForRecord): (WebCore::IDBLevelDBBackingStore::deleteIndexDataForRecord): (WebCore::IDBLevelDBBackingStore::getObjectViaIndex): (WebCore::IDBLevelDBBackingStore::getPrimaryKeyViaIndex): (WebCore::IDBLevelDBBackingStore::keyExistsInIndex): (WebCore::IDBLevelDBBackingStore::openObjectStoreCursor): (WebCore::IDBLevelDBBackingStore::openIndexKeyCursor): (WebCore::IDBLevelDBBackingStore::openIndexCursor): (WebCore::IDBLevelDBBackingStore::createTransaction):
  • storage/IDBLevelDBBackingStore.h: Added.

Add an empty implementation of the LevelDB backend.

  • storage/IDBObjectStoreBackendImpl.cpp:

Keep track of database id, use the new RecordIdentifier.

(WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
(WebCore::IDBObjectStoreBackendImpl::getInternal):
(WebCore::IDBObjectStoreBackendImpl::putInternal):
(WebCore::IDBObjectStoreBackendImpl::deleteInternal):
(WebCore::IDBObjectStoreBackendImpl::clearInternal):
(WebCore::populateIndex):
(WebCore::IDBObjectStoreBackendImpl::createIndex):
(WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
(WebCore::IDBObjectStoreBackendImpl::deleteIndexInternal):
(WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
(WebCore::IDBObjectStoreBackendImpl::loadIndexes):
(WebCore::IDBObjectStoreBackendImpl::genAutoIncrementKey):

  • storage/IDBObjectStoreBackendImpl.h: (WebCore::IDBObjectStoreBackendImpl::create): (WebCore::IDBObjectStoreBackendImpl::databaseId):
  • storage/IDBSQLiteBackingStore.cpp: (WebCore::IDBSQLiteBackingStore::open): (WebCore::IDBSQLiteBackingStore::createObjectStore): (WebCore::IDBSQLiteBackingStore::deleteObjectStore): (WebCore::IDBSQLiteBackingStore::getObjectStoreRecord): (WebCore::IDBSQLiteBackingStore::putObjectStoreRecord): (WebCore::IDBSQLiteBackingStore::clearObjectStore): (WebCore::IDBSQLiteBackingStore::deleteObjectStoreRecord): (WebCore::IDBSQLiteBackingStore::nextAutoIncrementNumber): (WebCore::IDBSQLiteBackingStore::keyExistsInObjectStore): (WebCore::IDBSQLiteBackingStore::forEachObjectStoreRecord): (WebCore::IDBSQLiteBackingStore::getIndexes): (WebCore::IDBSQLiteBackingStore::createIndex): (WebCore::IDBSQLiteBackingStore::deleteIndex): (WebCore::IDBSQLiteBackingStore::putIndexDataForRecord): (WebCore::IDBSQLiteBackingStore::deleteIndexDataForRecord): (WebCore::IDBSQLiteBackingStore::getObjectViaIndex): (WebCore::IDBSQLiteBackingStore::getPrimaryKeyViaIndex): (WebCore::IDBSQLiteBackingStore::keyExistsInIndex): (WebCore::IDBSQLiteBackingStore::openObjectStoreCursor): (WebCore::IDBSQLiteBackingStore::openIndexKeyCursor): (WebCore::IDBSQLiteBackingStore::openIndexCursor):
  • storage/IDBSQLiteBackingStore.h:

2011-04-05 Hans Wennborg <hans@chromium.org>

Reviewed by Steve Block.

IndexedDB: Introduce skeleton for LevelDB backend
https://bugs.webkit.org/show_bug.cgi?id=57827

  • features.gypi:

Add ENABLE_LEVELDB=0.

  • public/WebIDBFactory.h: (WebKit::WebIDBFactory::open):

Remove pre-roll open() function.

Location:
trunk/Source
Files:
2 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r83441 r83443  
     12011-04-05  Hans Wennborg  <hans@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        IndexedDB: Introduce skeleton for LevelDB backend
     6        https://bugs.webkit.org/show_bug.cgi?id=57827
     7
     8        No new tests: no new functionality (yet).
     9
     10        * WebCore.gyp/WebCore.gyp:
     11            Add dependency on leveldb when ENABLE_LEVELDB=1 in feature_defines.
     12        * WebCore.gypi:
     13            Add new files.
     14        * storage/IDBBackingStore.h:
     15        (WebCore::IDBBackingStore::ObjectStoreRecordIdentifier::~ObjectStoreRecordIdentifier):
     16            Introduce abstract type ObjectStoreRecordIdentifier. The SQLite
     17            backend uses integers to refer to a specific row in a table, but
     18            the LevelDB backend will use something else.
     19        * storage/IDBDatabaseBackendImpl.cpp:
     20        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
     21        (WebCore::IDBDatabaseBackendImpl::createObjectStoreInternal):
     22        (WebCore::IDBDatabaseBackendImpl::deleteObjectStoreInternal):
     23        (WebCore::IDBDatabaseBackendImpl::loadObjectStores):
     24            Change functions to pass along the database id for operations that
     25            concern object stores. We want to be able to group object stores
     26            ids per database.
     27        * storage/IDBFactoryBackendImpl.cpp:
     28        (WebCore::IDBFactoryBackendImpl::open):
     29            Decide which backend to use based on the backingStoreType
     30            parameter.
     31        * storage/IDBIndexBackendImpl.cpp:
     32        (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl):
     33        (WebCore::IDBIndexBackendImpl::openCursorInternal):
     34        (WebCore::IDBIndexBackendImpl::getInternal):
     35        (WebCore::IDBIndexBackendImpl::addingKeyAllowed):
     36        * storage/IDBIndexBackendImpl.h:
     37        (WebCore::IDBIndexBackendImpl::create):
     38            Pass database and object store id to backend functions concerning
     39            indexes.
     40        * storage/IDBLevelDBBackingStore.cpp: Added.
     41        (WebCore::IDBLevelDBBackingStore::IDBLevelDBBackingStore):
     42        (WebCore::IDBLevelDBBackingStore::~IDBLevelDBBackingStore):
     43        (WebCore::IDBLevelDBBackingStore::open):
     44        (WebCore::IDBLevelDBBackingStore::extractIDBDatabaseMetaData):
     45        (WebCore::IDBLevelDBBackingStore::setIDBDatabaseMetaData):
     46        (WebCore::IDBLevelDBBackingStore::getObjectStores):
     47        (WebCore::IDBLevelDBBackingStore::createObjectStore):
     48        (WebCore::IDBLevelDBBackingStore::deleteObjectStore):
     49        (WebCore::IDBLevelDBBackingStore::getObjectStoreRecord):
     50        (WebCore::IDBLevelDBBackingStore::putObjectStoreRecord):
     51        (WebCore::IDBLevelDBBackingStore::clearObjectStore):
     52        (WebCore::IDBLevelDBBackingStore::deleteObjectStoreRecord):
     53        (WebCore::IDBLevelDBBackingStore::nextAutoIncrementNumber):
     54        (WebCore::IDBLevelDBBackingStore::keyExistsInObjectStore):
     55        (WebCore::IDBLevelDBBackingStore::forEachObjectStoreRecord):
     56        (WebCore::IDBLevelDBBackingStore::getIndexes):
     57        (WebCore::IDBLevelDBBackingStore::createIndex):
     58        (WebCore::IDBLevelDBBackingStore::deleteIndex):
     59        (WebCore::IDBLevelDBBackingStore::putIndexDataForRecord):
     60        (WebCore::IDBLevelDBBackingStore::deleteIndexDataForRecord):
     61        (WebCore::IDBLevelDBBackingStore::getObjectViaIndex):
     62        (WebCore::IDBLevelDBBackingStore::getPrimaryKeyViaIndex):
     63        (WebCore::IDBLevelDBBackingStore::keyExistsInIndex):
     64        (WebCore::IDBLevelDBBackingStore::openObjectStoreCursor):
     65        (WebCore::IDBLevelDBBackingStore::openIndexKeyCursor):
     66        (WebCore::IDBLevelDBBackingStore::openIndexCursor):
     67        (WebCore::IDBLevelDBBackingStore::createTransaction):
     68        * storage/IDBLevelDBBackingStore.h: Added.
     69            Add an empty implementation of the LevelDB backend.
     70        * storage/IDBObjectStoreBackendImpl.cpp:
     71            Keep track of database id, use the new RecordIdentifier.
     72        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
     73        (WebCore::IDBObjectStoreBackendImpl::getInternal):
     74        (WebCore::IDBObjectStoreBackendImpl::putInternal):
     75        (WebCore::IDBObjectStoreBackendImpl::deleteInternal):
     76        (WebCore::IDBObjectStoreBackendImpl::clearInternal):
     77        (WebCore::populateIndex):
     78        (WebCore::IDBObjectStoreBackendImpl::createIndex):
     79        (WebCore::IDBObjectStoreBackendImpl::createIndexInternal):
     80        (WebCore::IDBObjectStoreBackendImpl::deleteIndexInternal):
     81        (WebCore::IDBObjectStoreBackendImpl::openCursorInternal):
     82        (WebCore::IDBObjectStoreBackendImpl::loadIndexes):
     83        (WebCore::IDBObjectStoreBackendImpl::genAutoIncrementKey):
     84        * storage/IDBObjectStoreBackendImpl.h:
     85        (WebCore::IDBObjectStoreBackendImpl::create):
     86        (WebCore::IDBObjectStoreBackendImpl::databaseId):
     87        * storage/IDBSQLiteBackingStore.cpp:
     88        (WebCore::IDBSQLiteBackingStore::open):
     89        (WebCore::IDBSQLiteBackingStore::createObjectStore):
     90        (WebCore::IDBSQLiteBackingStore::deleteObjectStore):
     91        (WebCore::IDBSQLiteBackingStore::getObjectStoreRecord):
     92        (WebCore::IDBSQLiteBackingStore::putObjectStoreRecord):
     93        (WebCore::IDBSQLiteBackingStore::clearObjectStore):
     94        (WebCore::IDBSQLiteBackingStore::deleteObjectStoreRecord):
     95        (WebCore::IDBSQLiteBackingStore::nextAutoIncrementNumber):
     96        (WebCore::IDBSQLiteBackingStore::keyExistsInObjectStore):
     97        (WebCore::IDBSQLiteBackingStore::forEachObjectStoreRecord):
     98        (WebCore::IDBSQLiteBackingStore::getIndexes):
     99        (WebCore::IDBSQLiteBackingStore::createIndex):
     100        (WebCore::IDBSQLiteBackingStore::deleteIndex):
     101        (WebCore::IDBSQLiteBackingStore::putIndexDataForRecord):
     102        (WebCore::IDBSQLiteBackingStore::deleteIndexDataForRecord):
     103        (WebCore::IDBSQLiteBackingStore::getObjectViaIndex):
     104        (WebCore::IDBSQLiteBackingStore::getPrimaryKeyViaIndex):
     105        (WebCore::IDBSQLiteBackingStore::keyExistsInIndex):
     106        (WebCore::IDBSQLiteBackingStore::openObjectStoreCursor):
     107        (WebCore::IDBSQLiteBackingStore::openIndexKeyCursor):
     108        (WebCore::IDBSQLiteBackingStore::openIndexCursor):
     109        * storage/IDBSQLiteBackingStore.h:
     110
    11112011-04-11  Alexander Pavlov  <apavlov@chromium.org>
    2112
  • trunk/Source/WebCore/WebCore.gyp/WebCore.gyp

    r82863 r83443  
    11851185          },
    11861186        }],
     1187        ['"ENABLE_LEVELDB=1" in feature_defines', {
     1188          'dependencies': [
     1189            '<(chromium_src_dir)/third_party/leveldb/leveldb.gyp:leveldb',
     1190          ],
     1191          'export_dependent_settings': [
     1192            '<(chromium_src_dir)/third_party/leveldb/leveldb.gyp:leveldb',
     1193          ],
     1194        }],
    11871195      ],
    11881196    },
  • trunk/Source/WebCore/WebCore.gypi

    r83344 r83443  
    54815481            'storage/IDBKeyRange.cpp',
    54825482            'storage/IDBKeyRange.h',
     5483            'storage/IDBLevelDBBackingStore.cpp',
     5484            'storage/IDBLevelDBBackingStore.h',
    54835485            'storage/IDBObjectStore.cpp',
    54845486            'storage/IDBObjectStore.h',
  • trunk/Source/WebCore/storage/IDBBackingStore.h

    r80834 r83443  
    5151
    5252    virtual void getObjectStores(int64_t databaseId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundAutoIncrementFlags) = 0;
    53     virtual bool createObjectStore(const String& name, const String& keyPath, bool autoIncrement, int64_t databaseId, int64_t& assignedObjectStoreId) = 0;
    54     virtual void deleteObjectStore(int64_t objectStoreId) = 0;
    55     virtual String getObjectStoreRecord(int64_t objectStoreId, const IDBKey&) = 0;
    56     virtual bool putObjectStoreRecord(int64_t objectStoreId, const IDBKey&, const String& value, int64_t& rowId, bool invalidRowId) = 0;
    57     virtual void clearObjectStore(int64_t objectStoreId) = 0;
    58     virtual void deleteObjectStoreRecord(int64_t objectStoreId, int64_t objectStoreDataId) = 0;
    59     virtual double nextAutoIncrementNumber(int64_t objectStoreId) = 0;
    60     virtual bool keyExistsInObjectStore(int64_t objectStoreId, const IDBKey&, int64_t& foundObjectStoreDataId) = 0;
     53    virtual bool createObjectStore(int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement, int64_t& assignedObjectStoreId) = 0;
     54    virtual void deleteObjectStore(int64_t databaseId, int64_t objectStoreId) = 0;
     55
     56    class ObjectStoreRecordIdentifier : public RefCounted<ObjectStoreRecordIdentifier> {
     57    public:
     58        virtual bool isValid() const = 0;
     59        virtual ~ObjectStoreRecordIdentifier() {}
     60    };
     61    virtual PassRefPtr<ObjectStoreRecordIdentifier> createInvalidRecordIdentifier() = 0;
     62
     63    virtual String getObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&) = 0;
     64    virtual bool putObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, ObjectStoreRecordIdentifier*) = 0;
     65    virtual void clearObjectStore(int64_t databaseId, int64_t objectStoreId) = 0;
     66    virtual void deleteObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const ObjectStoreRecordIdentifier*) = 0;
     67    virtual double nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId) = 0;
     68    virtual bool keyExistsInObjectStore(int64_t databaseId, int64_t objectStoreId, const IDBKey&, ObjectStoreRecordIdentifier* foundRecordIdentifier) = 0;
    6169
    6270    class ObjectStoreRecordCallback {
    6371    public:
    64          virtual bool callback(int64_t objectStoreDataId, const String& value) = 0;
     72         virtual bool callback(const ObjectStoreRecordIdentifier*, const String& value) = 0;
    6573         virtual ~ObjectStoreRecordCallback() {};
    6674    };
    67     virtual bool forEachObjectStoreRecord(int64_t objectStoreId, ObjectStoreRecordCallback&) = 0;
     75    virtual bool forEachObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&) = 0;
    6876
    69     virtual void getIndexes(int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags) = 0;
    70     virtual bool createIndex(int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId) = 0;
    71     virtual void deleteIndex(int64_t indexId) = 0;
    72     virtual bool putIndexDataForRecord(int64_t indexId, const IDBKey&, int64_t objectStoreDataId) = 0;
    73     virtual bool deleteIndexDataForRecord(int64_t objectStoreDataId) = 0;
    74     virtual String getObjectViaIndex(int64_t indexId, const IDBKey&) = 0;
    75     virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t indexId, const IDBKey&) = 0;
    76     virtual bool keyExistsInIndex(int64_t indexId, const IDBKey&) = 0;
     77    virtual void getIndexes(int64_t databaseId, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags) = 0;
     78    virtual bool createIndex(int64_t databaseId, int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId) = 0;
     79    virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId) = 0;
     80    virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*) = 0;
     81    virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*) = 0;
     82    virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) = 0;
     83    virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&) = 0;
     84    virtual bool keyExistsInIndex(int64_t databaseid, int64_t objectStoreId, int64_t indexId, const IDBKey&) = 0;
    7785
    7886    class Cursor : public RefCounted<Cursor> {
     
    8290        virtual PassRefPtr<IDBKey> primaryKey() = 0;
    8391        virtual String value() = 0;
    84         virtual int64_t objectStoreDataId() = 0;
     92        virtual PassRefPtr<ObjectStoreRecordIdentifier> objectStoreRecordIdentifier() = 0;
    8593        virtual int64_t indexDataId() = 0;
    8694        virtual ~Cursor() {};
    8795    };
    8896
    89     virtual PassRefPtr<Cursor> openObjectStoreCursor(int64_t objectStoreId, const IDBKeyRange*, IDBCursor::Direction) = 0;
    90     virtual PassRefPtr<Cursor> openIndexKeyCursor(int64_t indexId, const IDBKeyRange*, IDBCursor::Direction) = 0;
    91     virtual PassRefPtr<Cursor> openIndexCursor(int64_t indexId, const IDBKeyRange*, IDBCursor::Direction) = 0;
     97    virtual PassRefPtr<Cursor> openObjectStoreCursor(int64_t databaseId, int64_t objectStoreId, const IDBKeyRange*, IDBCursor::Direction) = 0;
     98    virtual PassRefPtr<Cursor> openIndexKeyCursor(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKeyRange*, IDBCursor::Direction) = 0;
     99    virtual PassRefPtr<Cursor> openIndexCursor(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKeyRange*, IDBCursor::Direction) = 0;
    92100
    93101    class Transaction : public RefCounted<Transaction> {
  • trunk/Source/WebCore/storage/IDBDatabaseBackendImpl.cpp

    r80315 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9898}
    9999
    100 PassRefPtr<IDBObjectStoreBackendInterface>  IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
     100PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendImpl::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transactionPtr, ExceptionCode& ec)
    101101{
    102102    ASSERT(transactionPtr->mode() == IDBTransaction::VERSION_CHANGE);
     
    107107    }
    108108
    109     RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(m_backingStore.get(), name, keyPath, autoIncrement);
     109    RefPtr<IDBObjectStoreBackendImpl> objectStore = IDBObjectStoreBackendImpl::create(m_backingStore.get(), m_id, name, keyPath, autoIncrement);
    110110    ASSERT(objectStore->name() == name);
    111111
     
    126126    int64_t objectStoreId;
    127127
    128     if (!database->m_backingStore->createObjectStore(objectStore->name(), objectStore->keyPath(), objectStore->autoIncrement(), database->id(), objectStoreId)) {
     128    if (!database->m_backingStore->createObjectStore(database->id(), objectStore->name(), objectStore->keyPath(), objectStore->autoIncrement(), objectStoreId)) {
    129129        transaction->abort();
    130130        return;
     
    159159void IDBDatabaseBackendImpl::deleteObjectStoreInternal(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendImpl> database, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBTransactionBackendInterface> transaction)
    160160{
    161     database->m_backingStore->deleteObjectStore(objectStore->id());
     161    database->m_backingStore->deleteObjectStore(database->id(), objectStore->id());
    162162    transaction->didCompleteTaskEvents();
    163163}
     
    251251
    252252    for (size_t i = 0; i < ids.size(); i++)
    253         m_objectStores.set(names[i], IDBObjectStoreBackendImpl::create(m_backingStore.get(), ids[i], names[i], keyPaths[i], autoIncrementFlags[i]));
     253        m_objectStores.set(names[i], IDBObjectStoreBackendImpl::create(m_backingStore.get(), m_id, ids[i], names[i], keyPaths[i], autoIncrementFlags[i]));
    254254}
    255255
  • trunk/Source/WebCore/storage/IDBFactoryBackendImpl.cpp

    r80834 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333#include "IDBDatabaseBackendImpl.h"
    3434#include "IDBDatabaseException.h"
     35#include "IDBLevelDBBackingStore.h"
    3536#include "IDBSQLiteBackingStore.h"
    3637#include "IDBTransactionCoordinator.h"
     
    7071}
    7172
    72 void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDir, int64_t maximumSize, BackingStoreType)
     73void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDir, int64_t maximumSize, BackingStoreType backingStoreType)
    7374{
    7475    String fileIdentifier = securityOrigin->databaseIdentifier();
     
    8788        backingStore = it2->second;
    8889    else {
    89         backingStore = IDBSQLiteBackingStore::open(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);
     90        if (backingStoreType == DefaultBackingStore)
     91            backingStore = IDBSQLiteBackingStore::open(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);
     92#if ENABLE(LEVELDB)
     93        else if (backingStoreType == LevelDBBackingStore)
     94            backingStore = IDBLevelDBBackingStore::open(securityOrigin.get(), dataDir, maximumSize, fileIdentifier, this);
     95#endif
    9096        if (!backingStore) {
    9197            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error."));
  • trunk/Source/WebCore/storage/IDBIndexBackendImpl.cpp

    r80220 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4141namespace WebCore {
    4242
    43 IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
     43IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreBackendImpl* objectStoreBackend, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
    4444    : m_backingStore(backingStore)
     45    , m_databaseId(databaseId)
     46    , m_objectStoreBackend(objectStoreBackend)
    4547    , m_id(id)
    4648    , m_name(name)
     
    5153}
    5254
    53 IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, const String& name, const String& storeName, const String& keyPath, bool unique)
     55IDBIndexBackendImpl::IDBIndexBackendImpl(IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreBackendImpl* objectStoreBackend, const String& name, const String& storeName, const String& keyPath, bool unique)
    5456    : m_backingStore(backingStore)
     57    , m_databaseId(databaseId)
     58    , m_objectStoreBackend(objectStoreBackend)
    5559    , m_id(InvalidId)
    5660    , m_name(name)
     
    7377    switch (cursorType) {
    7478    case IDBCursorBackendInterface::IndexKeyCursor:
    75         backingStoreCursor = index->m_backingStore->openIndexKeyCursor(index->id(), range.get(), direction);
     79        backingStoreCursor = index->m_backingStore->openIndexKeyCursor(index->m_databaseId, index->m_objectStoreBackend->id(), index->id(), range.get(), direction);
    7680        break;
    7781    case IDBCursorBackendInterface::IndexCursor:
    78         backingStoreCursor = index->m_backingStore->openIndexCursor(index->id(), range.get(), direction);
     82        backingStoreCursor = index->m_backingStore->openIndexCursor(index->m_databaseId, index->m_objectStoreBackend->id(), index->id(), range.get(), direction);
    7983        break;
    8084    case IDBCursorBackendInterface::ObjectStoreCursor:
     
    121125    // FIXME: Split getInternal into two functions, getting rid off |getObject|.
    122126    if (getObject) {
    123         String value = index->m_backingStore->getObjectViaIndex(index->id(), *key);
     127        String value = index->m_backingStore->getObjectViaIndex(index->m_databaseId, index->m_objectStoreBackend->id(), index->id(), *key);
    124128        if (value.isNull()) {
    125129            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the index."));
     
    128132        callbacks->onSuccess(SerializedScriptValue::createFromWire(value));
    129133    } else {
    130         RefPtr<IDBKey> keyResult = index->m_backingStore->getPrimaryKeyViaIndex(index->id(), *key);
     134        RefPtr<IDBKey> keyResult = index->m_backingStore->getPrimaryKeyViaIndex(index->m_databaseId, index->m_objectStoreBackend->id(), index->id(), *key);
    131135        if (!keyResult) {
    132136            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the index."));
     
    160164        return true;
    161165
    162     return !m_backingStore->keyExistsInIndex(m_id, *key);
     166    return !m_backingStore->keyExistsInIndex(m_databaseId, m_objectStoreBackend->id(), m_id, *key);
    163167}
    164168
  • trunk/Source/WebCore/storage/IDBIndexBackendImpl.h

    r80315 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4141class IDBIndexBackendImpl : public IDBIndexBackendInterface {
    4242public:
    43     static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
     43    static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreBackendImpl* objectStoreBackend, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique)
    4444    {
    45         return adoptRef(new IDBIndexBackendImpl(backingStore, id, name, storeName, keyPath, unique));
     45        return adoptRef(new IDBIndexBackendImpl(backingStore, databaseId, objectStoreBackend, id, name, storeName, keyPath, unique));
    4646    }
    47     static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, const String& name, const String& storeName, const String& keyPath, bool unique)
     47    static PassRefPtr<IDBIndexBackendImpl> create(IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreBackendImpl* objectStoreBackend, const String& name, const String& storeName, const String& keyPath, bool unique)
    4848    {
    49         return adoptRef(new IDBIndexBackendImpl(backingStore, name, storeName, keyPath, unique));
     49        return adoptRef(new IDBIndexBackendImpl(backingStore, databaseId, objectStoreBackend, name, storeName, keyPath, unique));
    5050    }
    5151    virtual ~IDBIndexBackendImpl();
     
    7373
    7474private:
    75     IDBIndexBackendImpl(IDBBackingStore*, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique);
    76     IDBIndexBackendImpl(IDBBackingStore*, const String& name, const String& storeName, const String& keyPath, bool unique);
     75    IDBIndexBackendImpl(IDBBackingStore*, int64_t databaseId, const IDBObjectStoreBackendImpl*, int64_t id, const String& name, const String& storeName, const String& keyPath, bool unique);
     76    IDBIndexBackendImpl(IDBBackingStore*, int64_t databaseId, const IDBObjectStoreBackendImpl*, const String& name, const String& storeName, const String& keyPath, bool unique);
    7777
    7878    static void openCursorInternal(ScriptExecutionContext*, PassRefPtr<IDBIndexBackendImpl>, PassRefPtr<IDBKeyRange>, unsigned short direction, IDBCursorBackendInterface::CursorType, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>);
     
    8383    RefPtr<IDBBackingStore> m_backingStore;
    8484
     85    int64_t m_databaseId;
     86    const IDBObjectStoreBackendImpl* m_objectStoreBackend;
    8587    int64_t m_id;
    8688    String m_name;
  • trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp

    r80220 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5151}
    5252
    53 IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
     53IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, int64_t databaseId, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
    5454    : m_backingStore(backingStore)
     55    , m_databaseId(databaseId)
    5556    , m_id(id)
    5657    , m_name(name)
     
    6263}
    6364
    64 IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, const String& name, const String& keyPath, bool autoIncrement)
     65IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBBackingStore* backingStore, int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement)
    6566    : m_backingStore(backingStore)
     67    , m_databaseId(databaseId)
    6668    , m_id(InvalidId)
    6769    , m_name(name)
     
    9193void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
    9294{
    93     String wireData = objectStore->m_backingStore->getObjectStoreRecord(objectStore->id(), *key);
     95    String wireData = objectStore->m_backingStore->getObjectStoreRecord(objectStore->m_databaseId, objectStore->id(), *key);
    9496    if (wireData.isNull()) {
    9597        callbacks->onSuccess(SerializedScriptValue::undefinedValue());
     
    228230    }
    229231
    230     int64_t dataRowId = InvalidId;
    231     bool isExistingValue = objectStore->m_backingStore->keyExistsInObjectStore(objectStore->id(), *key, dataRowId);
     232    RefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> recordIdentifier = objectStore->m_backingStore->createInvalidRecordIdentifier();
     233    bool isExistingValue = objectStore->m_backingStore->keyExistsInObjectStore(objectStore->m_databaseId, objectStore->id(), *key, recordIdentifier.get());
    232234
    233235    if (putMode == AddOnly && isExistingValue) {
     
    238240    // Before this point, don't do any mutation.  After this point, rollback the transaction in case of error.
    239241
    240     if (!objectStore->m_backingStore->putObjectStoreRecord(objectStore->id(), *key, value->toWireString(), dataRowId, dataRowId == InvalidId)) {
    241         // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors.
    242         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage."));
    243         transaction->abort();
    244         return;
    245     }
    246 
    247     if (!objectStore->m_backingStore->deleteIndexDataForRecord(dataRowId)) {
     242    if (!objectStore->m_backingStore->putObjectStoreRecord(objectStore->m_databaseId, objectStore->id(), *key, value->toWireString(), recordIdentifier.get())) {
    248243        // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors.
    249244        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage."));
     
    256251        if (!it->second->hasValidId())
    257252            continue; // The index object has been created, but does not exist in the database yet.
    258         if (!objectStore->m_backingStore->putIndexDataForRecord(it->second->id(), *indexKeys[i], dataRowId)) {
     253
     254        if (!objectStore->m_backingStore->deleteIndexDataForRecord(objectStore->m_databaseId, objectStore->id(), it->second->id(), recordIdentifier.get())) {
    259255            // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors.
    260256            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage."));
     
    262258            return;
    263259        }
     260
     261        if (!objectStore->m_backingStore->putIndexDataForRecord(objectStore->m_databaseId, objectStore->id(), it->second->id(), *indexKeys[i], recordIdentifier.get())) {
     262            // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors.
     263            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Error writing data to stable storage."));
     264            transaction->abort();
     265            return;
     266        }
    264267    }
    265268
     
    284287void IDBObjectStoreBackendImpl::deleteInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks)
    285288{
    286     int64_t id;
    287     if (!objectStore->m_backingStore->keyExistsInObjectStore(objectStore->id(), *key, id)) {
     289    RefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> recordIdentifier = objectStore->m_backingStore->createInvalidRecordIdentifier();
     290    if (!objectStore->m_backingStore->keyExistsInObjectStore(objectStore->m_databaseId, objectStore->id(), *key, recordIdentifier.get())) {
    288291        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the object store."));
    289292        return;
    290293    }
    291294
    292     objectStore->m_backingStore->deleteObjectStoreRecord(objectStore->id(), id);
     295    for (IndexMap::iterator it = objectStore->m_indexes.begin(); it != objectStore->m_indexes.end(); ++it) {
     296        if (!it->second->hasValidId())
     297            continue; // The index object has been created, but does not exist in the database yet.
     298
     299        if (!objectStore->m_backingStore->deleteIndexDataForRecord(objectStore->m_databaseId, objectStore->id(), it->second->id(), recordIdentifier.get()))
     300            ASSERT_NOT_REACHED();
     301    }
     302
     303    objectStore->m_backingStore->deleteObjectStoreRecord(objectStore->m_databaseId, objectStore->id(), recordIdentifier.get());
    293304    callbacks->onSuccess(SerializedScriptValue::nullValue());
    294305}
     
    310321void IDBObjectStoreBackendImpl::clearInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBCallbacks> callbacks)
    311322{
    312     objectStore->m_backingStore->clearObjectStore(objectStore->id());
     323    objectStore->m_backingStore->clearObjectStore(objectStore->m_databaseId, objectStore->id());
    313324    callbacks->onSuccess(SerializedScriptValue::undefinedValue());
    314325}
     
    317328class PopulateIndexCallback : public IDBBackingStore::ObjectStoreRecordCallback {
    318329public:
    319     PopulateIndexCallback(IDBBackingStore& backingStore, const String& indexKeyPath, int64_t indexId)
     330    PopulateIndexCallback(IDBBackingStore& backingStore, const String& indexKeyPath, int64_t databaseId, int64_t objectStoreId, int64_t indexId)
    320331        : m_backingStore(backingStore)
    321332        , m_indexKeyPath(indexKeyPath)
     333        , m_databaseId(databaseId)
     334        , m_objectStoreId(objectStoreId)
    322335        , m_indexId(indexId)
    323336    {
    324337    }
    325338
    326     virtual bool callback(int64_t objectStoreDataId, const String& value)
     339    virtual bool callback(const IDBBackingStore::ObjectStoreRecordIdentifier* recordIdentifier, const String& value)
    327340    {
    328341        RefPtr<SerializedScriptValue> objectValue = SerializedScriptValue::createFromWire(value);
    329342        RefPtr<IDBKey> indexKey = fetchKeyFromKeyPath(objectValue.get(), m_indexKeyPath);
    330343
    331         if (!m_backingStore.putIndexDataForRecord(m_indexId, *indexKey, objectStoreDataId))
     344        if (!m_backingStore.putIndexDataForRecord(m_databaseId, m_objectStoreId, m_indexId, *indexKey, recordIdentifier))
    332345            return false;
    333346
     
    338351    IDBBackingStore& m_backingStore;
    339352    const String& m_indexKeyPath;
     353    int64_t m_databaseId;
     354    int64_t m_objectStoreId;
    340355    int64_t m_indexId;
    341356};
    342357}
    343358
    344 static bool populateIndex(IDBBackingStore& backingStore, int64_t objectStoreId, int64_t indexId, const String& indexKeyPath)
    345 {
    346     PopulateIndexCallback callback(backingStore, indexKeyPath, indexId);
    347     if (!backingStore.forEachObjectStoreRecord(objectStoreId, callback))
     359static bool populateIndex(IDBBackingStore& backingStore, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& indexKeyPath)
     360{
     361    PopulateIndexCallback callback(backingStore, indexKeyPath, databaseId, objectStoreId, indexId);
     362    if (!backingStore.forEachObjectStoreRecord(databaseId, objectStoreId, callback))
    348363        return false;
    349364    return true;
     
    361376    }
    362377
    363     RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_backingStore.get(), name, m_name, keyPath, unique);
     378    RefPtr<IDBIndexBackendImpl> index = IDBIndexBackendImpl::create(m_backingStore.get(), m_databaseId, this, name, m_name, keyPath, unique);
    364379    ASSERT(index->name() == name);
    365380
     
    379394{
    380395    int64_t id;
    381     if (!objectStore->m_backingStore->createIndex(objectStore->m_id, index->name(), index->keyPath(), index->unique(), id)) {
     396    if (!objectStore->m_backingStore->createIndex(objectStore->m_databaseId, objectStore->id(), index->name(), index->keyPath(), index->unique(), id)) {
    382397        transaction->abort();
    383398        return;
     
    386401    index->setId(id);
    387402
    388     if (!populateIndex(*objectStore->m_backingStore, objectStore->m_id, id, index->keyPath())) {
     403    if (!populateIndex(*objectStore->m_backingStore, objectStore->m_databaseId, objectStore->m_id, id, index->keyPath())) {
    389404        transaction->abort();
    390405        return;
     
    429444void IDBObjectStoreBackendImpl::deleteIndexInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<IDBIndexBackendImpl> index, PassRefPtr<IDBTransactionBackendInterface> transaction)
    430445{
    431     objectStore->m_backingStore->deleteIndex(index->id());
     446    objectStore->m_backingStore->deleteIndex(objectStore->m_databaseId, objectStore->id(), index->id());
    432447    transaction->didCompleteTaskEvents();
    433448}
     
    447462    IDBCursor::Direction direction = static_cast<IDBCursor::Direction>(tmpDirection);
    448463
    449     RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->m_backingStore->openObjectStoreCursor(objectStore->id(), range.get(), direction);
     464    RefPtr<IDBBackingStore::Cursor> backingStoreCursor = objectStore->m_backingStore->openObjectStoreCursor(objectStore->m_databaseId, objectStore->id(), range.get(), direction);
    450465    if (!backingStoreCursor) {
    451466        callbacks->onSuccess(SerializedScriptValue::nullValue());
     
    463478    Vector<String> keyPaths;
    464479    Vector<bool> uniqueFlags;
    465     m_backingStore->getIndexes(m_id, ids, names, keyPaths, uniqueFlags);
     480    m_backingStore->getIndexes(m_databaseId, m_id, ids, names, keyPaths, uniqueFlags);
    466481
    467482    ASSERT(names.size() == ids.size());
     
    470485
    471486    for (size_t i = 0; i < ids.size(); i++)
    472         m_indexes.set(names[i], IDBIndexBackendImpl::create(m_backingStore.get(), ids[i], names[i], m_name, keyPaths[i], uniqueFlags[i]));
     487        m_indexes.set(names[i], IDBIndexBackendImpl::create(m_backingStore.get(), m_databaseId, this, ids[i], names[i], m_name, keyPaths[i], uniqueFlags[i]));
    473488}
    474489
     
    491506        return IDBKey::createNumber(m_autoIncrementNumber++);
    492507
    493     m_autoIncrementNumber = static_cast<int>(m_backingStore->nextAutoIncrementNumber(id()));
     508    m_autoIncrementNumber = static_cast<int>(m_backingStore->nextAutoIncrementNumber(m_databaseId, id()));
    494509    return IDBKey::createNumber(m_autoIncrementNumber++);
    495510}
  • trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.h

    r80315 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4343class IDBObjectStoreBackendImpl : public IDBObjectStoreBackendInterface {
    4444public:
    45     static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
     45    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, int64_t databaseId, int64_t id, const String& name, const String& keyPath, bool autoIncrement)
    4646    {
    47         return adoptRef(new IDBObjectStoreBackendImpl(backingStore, id, name, keyPath, autoIncrement));
     47        return adoptRef(new IDBObjectStoreBackendImpl(backingStore, databaseId, id, name, keyPath, autoIncrement));
    4848    }
    49     static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, const String& name, const String& keyPath, bool autoIncrement)
     49    static PassRefPtr<IDBObjectStoreBackendImpl> create(IDBBackingStore* backingStore, int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement)
    5050    {
    51         return adoptRef(new IDBObjectStoreBackendImpl(backingStore, name, keyPath, autoIncrement));
     51        return adoptRef(new IDBObjectStoreBackendImpl(backingStore, databaseId, name, keyPath, autoIncrement));
    5252    }
    5353    virtual ~IDBObjectStoreBackendImpl();
     
    6060    }
    6161    void setId(int64_t id) { m_id = id; }
     62    int64_t databaseId() const { return m_databaseId; }
    6263
    6364    virtual String name() const { return m_name; }
     
    7879
    7980private:
    80     IDBObjectStoreBackendImpl(IDBBackingStore*, int64_t id, const String& name, const String& keyPath, bool autoIncrement);
    81     IDBObjectStoreBackendImpl(IDBBackingStore*, const String& name, const String& keyPath, bool autoIncrement);
     81    IDBObjectStoreBackendImpl(IDBBackingStore*, int64_t databaseId, int64_t id, const String& name, const String& keyPath, bool autoIncrement);
     82    IDBObjectStoreBackendImpl(IDBBackingStore*, int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement);
    8283
    8384    void loadIndexes();
     
    100101    RefPtr<IDBBackingStore> m_backingStore;
    101102
     103    int64_t m_databaseId;
    102104    int64_t m_id;
    103105    String m_name;
  • trunk/Source/WebCore/storage/IDBSQLiteBackingStore.cpp

    r80834 r83443  
    174174        if (!makeAllDirectories(pathBase)) {
    175175            // FIXME: Is there any other thing we could possibly do to recover at this point? If so, do it rather than just erroring out.
    176             LOG_ERROR("Unabled to create LocalStorage database path %s", pathBase.utf8().data());
     176            LOG_ERROR("Unable to create Indexed DB database path %s", pathBase.utf8().data());
    177177            return 0;
    178178        }
     
    264264}
    265265
    266 bool IDBSQLiteBackingStore::createObjectStore(const String& name, const String& keyPath, bool autoIncrement, int64_t databaseId, int64_t& assignedObjectStoreId)
     266bool IDBSQLiteBackingStore::createObjectStore(int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement, int64_t& assignedObjectStoreId)
    267267{
    268268    SQLiteStatement query(m_db, "INSERT INTO ObjectStores (name, keyPath, doAutoIncrement, databaseId) VALUES (?, ?, ?, ?)");
     
    292292}
    293293
    294 void IDBSQLiteBackingStore::deleteObjectStore(int64_t objectStoreId)
     294void IDBSQLiteBackingStore::deleteObjectStore(int64_t, int64_t objectStoreId)
    295295{
    296296    doDelete(m_db, "DELETE FROM ObjectStores WHERE id = ?", objectStoreId);
     
    298298    doDelete(m_db, "DELETE FROM IndexData WHERE indexId IN (SELECT id FROM Indexes WHERE objectStoreId = ?)", objectStoreId);
    299299    doDelete(m_db, "DELETE FROM Indexes WHERE objectStoreId = ?", objectStoreId);
     300}
     301
     302namespace {
     303class SQLiteRecordIdentifier : public IDBBackingStore::ObjectStoreRecordIdentifier {
     304public:
     305    static PassRefPtr<SQLiteRecordIdentifier> create() { return adoptRef(new SQLiteRecordIdentifier()); }
     306    static PassRefPtr<SQLiteRecordIdentifier> create(int64_t id) { return adoptRef(new SQLiteRecordIdentifier(id)); }
     307    virtual bool isValid() const { return m_id != -1; }
     308    int64_t id() const { return m_id; }
     309    void setId(int64_t id) { m_id = id; }
     310private:
     311    SQLiteRecordIdentifier() : m_id(-1) { }
     312    SQLiteRecordIdentifier(int64_t id) : m_id(id) { }
     313    int64_t m_id;
     314};
     315}
     316
     317PassRefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> IDBSQLiteBackingStore::createInvalidRecordIdentifier()
     318{
     319    return SQLiteRecordIdentifier::create();
    300320}
    301321
     
    374394}
    375395
    376 String IDBSQLiteBackingStore::getObjectStoreRecord(int64_t objectStoreId, const IDBKey& key)
     396String IDBSQLiteBackingStore::getObjectStoreRecord(int64_t, int64_t objectStoreId, const IDBKey& key)
    377397{
    378398    SQLiteStatement query(m_db, "SELECT keyString, keyDate, keyNumber, value FROM ObjectStoreData WHERE objectStoreId = ? AND " + whereSyntaxForKey(key));
     
    423443}
    424444
    425 bool IDBSQLiteBackingStore::putObjectStoreRecord(int64_t objectStoreId, const IDBKey& key, const String& value, int64_t& rowId, bool invalidRowId)
    426 {
    427     String sql = !invalidRowId ? "UPDATE ObjectStoreData SET keyString = ?, keyDate = ?, keyNumber = ?, value = ? WHERE id = ?"
    428                                : "INSERT INTO ObjectStoreData (keyString, keyDate, keyNumber, value, objectStoreId) VALUES (?, ?, ?, ?, ?)";
     445bool IDBSQLiteBackingStore::putObjectStoreRecord(int64_t, int64_t objectStoreId, const IDBKey& key, const String& value, ObjectStoreRecordIdentifier* recordIdentifier)
     446{
     447    SQLiteRecordIdentifier* sqliteRecordIdentifier = static_cast<SQLiteRecordIdentifier*>(recordIdentifier);
     448
     449    String sql = sqliteRecordIdentifier->isValid() ? "UPDATE ObjectStoreData SET keyString = ?, keyDate = ?, keyNumber = ?, value = ? WHERE id = ?"
     450                                                   : "INSERT INTO ObjectStoreData (keyString, keyDate, keyNumber, value, objectStoreId) VALUES (?, ?, ?, ?, ?)";
    429451    SQLiteStatement query(m_db, sql);
    430452    if (query.prepare() != SQLResultOk)
     
    433455    bindKeyToQueryWithNulls(query, 1, key);
    434456    query.bindBlob(4, value);
    435     if (!invalidRowId)
    436         query.bindInt64(5, rowId);
     457    if (sqliteRecordIdentifier->isValid())
     458        query.bindInt64(5, sqliteRecordIdentifier->id());
    437459    else
    438460        query.bindInt64(5, objectStoreId);
     
    441463        return false;
    442464
    443     if (invalidRowId)
    444         rowId = m_db.lastInsertRowID();
     465    if (!sqliteRecordIdentifier->isValid())
     466        sqliteRecordIdentifier->setId(m_db.lastInsertRowID());
    445467
    446468    return true;
    447469}
    448470
    449 void IDBSQLiteBackingStore::clearObjectStore(int64_t objectStoreId)
     471void IDBSQLiteBackingStore::clearObjectStore(int64_t, int64_t objectStoreId)
    450472{
    451473    doDelete(m_db, "DELETE FROM IndexData WHERE objectStoreDataId IN (SELECT id FROM ObjectStoreData WHERE objectStoreId = ?)", objectStoreId);
     
    453475}
    454476
    455 void IDBSQLiteBackingStore::deleteObjectStoreRecord(int64_t, int64_t objectStoreDataId)
    456 {
     477void IDBSQLiteBackingStore::deleteObjectStoreRecord(int64_t, int64_t objectStoreId, const ObjectStoreRecordIdentifier* recordIdentifier)
     478{
     479    const SQLiteRecordIdentifier* sqliteRecordIdentifier = static_cast<const SQLiteRecordIdentifier*>(recordIdentifier);
     480    ASSERT(sqliteRecordIdentifier->isValid());
     481
    457482    SQLiteStatement osQuery(m_db, "DELETE FROM ObjectStoreData WHERE id = ?");
    458483    bool ok = osQuery.prepare() == SQLResultOk;
    459484    ASSERT_UNUSED(ok, ok); // FIXME: Better error handling?
    460485
    461     osQuery.bindInt64(1, objectStoreDataId);
     486    osQuery.bindInt64(1, sqliteRecordIdentifier->id());
    462487
    463488    ok = osQuery.step() == SQLResultDone;
    464489    ASSERT_UNUSED(ok, ok);
    465 
    466     SQLiteStatement indexQuery(m_db, "DELETE FROM IndexData WHERE objectStoreDataId = ?");
    467     ok = indexQuery.prepare() == SQLResultOk;
    468     ASSERT_UNUSED(ok, ok); // FIXME: Better error handling?
    469 
    470     indexQuery.bindInt64(1, objectStoreDataId);
    471 
    472     ok = indexQuery.step() == SQLResultDone;
    473     ASSERT_UNUSED(ok, ok);
    474 }
    475 
    476 double IDBSQLiteBackingStore::nextAutoIncrementNumber(int64_t objectStoreId)
     490}
     491
     492double IDBSQLiteBackingStore::nextAutoIncrementNumber(int64_t, int64_t objectStoreId)
    477493{
    478494    SQLiteStatement query(m_db, "SELECT max(keyNumber) + 1 FROM ObjectStoreData WHERE objectStoreId = ? AND keyString IS NULL AND keyDate IS NULL");
     
    488504}
    489505
    490 bool IDBSQLiteBackingStore::keyExistsInObjectStore(int64_t objectStoreId, const IDBKey& key, int64_t& foundObjectStoreDataId)
    491 {
     506bool IDBSQLiteBackingStore::keyExistsInObjectStore(int64_t, int64_t objectStoreId, const IDBKey& key, ObjectStoreRecordIdentifier* foundRecordIdentifier)
     507{
     508    SQLiteRecordIdentifier* sqliteRecordIdentifier = static_cast<SQLiteRecordIdentifier*>(foundRecordIdentifier);
     509
    492510    String sql = String("SELECT id FROM ObjectStoreData WHERE objectStoreId = ? AND ") + whereSyntaxForKey(key);
    493511    SQLiteStatement query(m_db, sql);
     
    501519        return false;
    502520
    503     foundObjectStoreDataId = query.getColumnInt64(0);
     521    sqliteRecordIdentifier->setId(query.getColumnInt64(0));
    504522    return true;
    505523}
    506524
    507 bool IDBSQLiteBackingStore::forEachObjectStoreRecord(int64_t objectStoreId, ObjectStoreRecordCallback& callback)
     525bool IDBSQLiteBackingStore::forEachObjectStoreRecord(int64_t, int64_t objectStoreId, ObjectStoreRecordCallback& callback)
    508526{
    509527    SQLiteStatement query(m_db, "SELECT id, value FROM ObjectStoreData WHERE objectStoreId = ?");
     
    516534        int64_t objectStoreDataId = query.getColumnInt64(0);
    517535        String value = query.getColumnBlobAsString(1);
    518         if (!callback.callback(objectStoreDataId, value))
     536        RefPtr<SQLiteRecordIdentifier> recordIdentifier = SQLiteRecordIdentifier::create(objectStoreDataId);
     537        if (!callback.callback(recordIdentifier.get(), value))
    519538            return false;
    520539    }
     
    523542}
    524543
    525 void IDBSQLiteBackingStore::getIndexes(int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags)
     544void IDBSQLiteBackingStore::getIndexes(int64_t, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags)
    526545{
    527546    SQLiteStatement query(m_db, "SELECT id, name, keyPath, isUnique FROM Indexes WHERE objectStoreId = ?");
     
    544563}
    545564
    546 bool IDBSQLiteBackingStore::createIndex(int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId)
     565bool IDBSQLiteBackingStore::createIndex(int64_t, int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId)
    547566{
    548567    SQLiteStatement query(m_db, "INSERT INTO Indexes (objectStoreId, name, keyPath, isUnique) VALUES (?, ?, ?, ?)");
     
    562581}
    563582
    564 void IDBSQLiteBackingStore::deleteIndex(int64_t indexId)
     583void IDBSQLiteBackingStore::deleteIndex(int64_t, int64_t, int64_t indexId)
    565584{
    566585    doDelete(m_db, "DELETE FROM Indexes WHERE id = ?", indexId);
     
    568587}
    569588
    570 bool IDBSQLiteBackingStore::putIndexDataForRecord(int64_t indexId, const IDBKey& key, int64_t objectStoreDataId)
    571 {
     589bool IDBSQLiteBackingStore::putIndexDataForRecord(int64_t, int64_t, int64_t indexId, const IDBKey& key, const ObjectStoreRecordIdentifier* recordIdentifier)
     590{
     591    const SQLiteRecordIdentifier* sqliteRecordIdentifier = static_cast<const SQLiteRecordIdentifier*>(recordIdentifier);
     592
    572593    SQLiteStatement query(m_db, "INSERT INTO IndexData (keyString, keyDate, keyNumber, indexId, objectStoreDataId) VALUES (?, ?, ?, ?, ?)");
    573594    if (query.prepare() != SQLResultOk)
     
    576597    bindKeyToQueryWithNulls(query, 1, key);
    577598    query.bindInt64(4, indexId);
    578     query.bindInt64(5, objectStoreDataId);
     599    query.bindInt64(5, sqliteRecordIdentifier->id());
    579600
    580601    return query.step() == SQLResultDone;
    581602}
    582603
    583 bool IDBSQLiteBackingStore::deleteIndexDataForRecord(int64_t objectStoreDataId)
    584 {
    585     SQLiteStatement query(m_db, "DELETE FROM IndexData WHERE objectStoreDataId = ?");
     604bool IDBSQLiteBackingStore::deleteIndexDataForRecord(int64_t, int64_t, int64_t indexId, const ObjectStoreRecordIdentifier* recordIdentifier)
     605{
     606    const SQLiteRecordIdentifier* sqliteRecordIdentifier = static_cast<const SQLiteRecordIdentifier*>(recordIdentifier);
     607
     608    SQLiteStatement query(m_db, "DELETE FROM IndexData WHERE objectStoreDataId = ? AND indexId = ?");
    586609    if (query.prepare() != SQLResultOk)
    587610        return false;
    588611
    589     query.bindInt64(1, objectStoreDataId);
     612    query.bindInt64(1, sqliteRecordIdentifier->id());
     613    query.bindInt64(2, indexId);
    590614    return query.step() == SQLResultDone;
    591615}
    592616
    593 String IDBSQLiteBackingStore::getObjectViaIndex(int64_t indexId, const IDBKey& key)
     617String IDBSQLiteBackingStore::getObjectViaIndex(int64_t, int64_t, int64_t indexId, const IDBKey& key)
    594618{
    595619    String sql = String("SELECT ")
     
    630654}
    631655
    632 PassRefPtr<IDBKey> IDBSQLiteBackingStore::getPrimaryKeyViaIndex(int64_t indexId, const IDBKey& key)
     656PassRefPtr<IDBKey> IDBSQLiteBackingStore::getPrimaryKeyViaIndex(int64_t, int64_t, int64_t indexId, const IDBKey& key)
    633657{
    634658    String sql = String("SELECT ")
     
    652676}
    653677
    654 bool IDBSQLiteBackingStore::keyExistsInIndex(int64_t indexId, const IDBKey& key)
     678bool IDBSQLiteBackingStore::keyExistsInIndex(int64_t, int64_t, int64_t indexId, const IDBKey& key)
    655679{
    656680    String sql = String("SELECT id FROM IndexData WHERE indexId = ? AND ") + whereSyntaxForKey(key);
     
    683707    virtual PassRefPtr<IDBKey> primaryKey() { return m_currentKey; }
    684708    virtual String value() = 0;
    685     virtual int64_t objectStoreDataId() = 0;
     709    virtual PassRefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> objectStoreRecordIdentifier() = 0;
    686710    virtual int64_t indexDataId() = 0;
    687711
     
    742766    // CursorImplCommon.
    743767    virtual String value() { return m_currentValue; }
    744     virtual int64_t objectStoreDataId() { return m_currentId; }
     768    virtual PassRefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> objectStoreRecordIdentifier() { return SQLiteRecordIdentifier::create(m_currentId); }
    745769    virtual int64_t indexDataId() { ASSERT_NOT_REACHED(); return 0; }
    746770    virtual void loadCurrentRow();
     
    780804    virtual PassRefPtr<IDBKey> primaryKey() { return m_currentPrimaryKey; }
    781805    virtual String value() { ASSERT_NOT_REACHED(); return String(); }
    782     virtual int64_t objectStoreDataId() { ASSERT_NOT_REACHED(); return 0; }
     806    virtual PassRefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> objectStoreRecordIdentifier() { ASSERT_NOT_REACHED(); return 0; }
    783807    virtual int64_t indexDataId() { return m_currentId; }
    784808    virtual void loadCurrentRow();
     
    818842    virtual PassRefPtr<IDBKey> primaryKey() { return m_currentPrimaryKey; }
    819843    virtual String value() { return m_currentValue; }
    820     virtual int64_t objectStoreDataId() { ASSERT_NOT_REACHED(); return 0; }
     844    virtual PassRefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> objectStoreRecordIdentifier() { ASSERT_NOT_REACHED(); return 0; }
    821845    virtual int64_t indexDataId() { return m_currentId; }
    822846    virtual void loadCurrentRow();
     
    850874} // namespace
    851875
    852 PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openObjectStoreCursor(int64_t objectStoreId, const IDBKeyRange* range, IDBCursor::Direction direction)
     876PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openObjectStoreCursor(int64_t, int64_t objectStoreId, const IDBKeyRange* range, IDBCursor::Direction direction)
    853877{
    854878    bool lowerBound = range && range->lower();
     
    887911}
    888912
    889 PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openIndexKeyCursor(int64_t indexId, const IDBKeyRange* range, IDBCursor::Direction direction)
     913PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openIndexKeyCursor(int64_t, int64_t, int64_t indexId, const IDBKeyRange* range, IDBCursor::Direction direction)
    890914{
    891915    String sql = String("SELECT IndexData.id, IndexData.keyString, IndexData.keyDate, IndexData.keyNumber, ")
     
    927951}
    928952
    929 PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openIndexCursor(int64_t indexId, const IDBKeyRange* range, IDBCursor::Direction direction)
     953PassRefPtr<IDBBackingStore::Cursor> IDBSQLiteBackingStore::openIndexCursor(int64_t, int64_t, int64_t indexId, const IDBKeyRange* range, IDBCursor::Direction direction)
    930954{
    931955    String sql = String("SELECT IndexData.id, IndexData.keyString, IndexData.keyDate, IndexData.keyNumber, ")
  • trunk/Source/WebCore/storage/IDBSQLiteBackingStore.h

    r80834 r83443  
    4242
    4343    virtual void getObjectStores(int64_t databaseId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundAutoIncrementFlags);
    44     virtual bool createObjectStore(const String& name, const String& keyPath, bool autoIncrement, int64_t databaseId, int64_t& assignedObjectStoreId);
    45     virtual void deleteObjectStore(int64_t objectStoreId);
    46     virtual String getObjectStoreRecord(int64_t objectStoreId, const IDBKey&);
    47     virtual bool putObjectStoreRecord(int64_t objectStoreId, const IDBKey&, const String& value, int64_t& rowId, bool invalidRowId);
    48     virtual void clearObjectStore(int64_t objectStoreId);
    49     virtual void deleteObjectStoreRecord(int64_t objectStoreId, int64_t objectStoreDataId);
    50     virtual double nextAutoIncrementNumber(int64_t objectStoreId);
    51     virtual bool keyExistsInObjectStore(int64_t objectStoreId, const IDBKey&, int64_t& foundObjectStoreDataId);
     44    virtual bool createObjectStore(int64_t databaseId, const String& name, const String& keyPath, bool autoIncrement, int64_t& assignedObjectStoreId);
     45    virtual void deleteObjectStore(int64_t databaseId, int64_t objectStoreId);
     46    virtual PassRefPtr<ObjectStoreRecordIdentifier> createInvalidRecordIdentifier();
     47    virtual String getObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&);
     48    virtual bool putObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, ObjectStoreRecordIdentifier*);
     49    virtual void clearObjectStore(int64_t databaseId, int64_t objectStoreId);
     50    virtual void deleteObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, const ObjectStoreRecordIdentifier*);
     51    virtual double nextAutoIncrementNumber(int64_t databaseId, int64_t objectStoreId);
     52    virtual bool keyExistsInObjectStore(int64_t databaseId, int64_t objectStoreId, const IDBKey&, ObjectStoreRecordIdentifier* foundRecordIdentifier);
    5253
    53     virtual bool forEachObjectStoreRecord(int64_t objectStoreId, ObjectStoreRecordCallback&);
     54    virtual bool forEachObjectStoreRecord(int64_t databaseId, int64_t objectStoreId, ObjectStoreRecordCallback&);
    5455
    55     virtual void getIndexes(int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags);
    56     virtual bool createIndex(int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId);
    57     virtual void deleteIndex(int64_t indexId);
    58     virtual bool putIndexDataForRecord(int64_t indexId, const IDBKey&, int64_t objectStoreDataId);
    59     virtual bool deleteIndexDataForRecord(int64_t objectStoreDataId);
    60     virtual String getObjectViaIndex(int64_t indexId, const IDBKey&);
    61     virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t indexId, const IDBKey&);
    62     virtual bool keyExistsInIndex(int64_t indexId, const IDBKey&);
     56    virtual void getIndexes(int64_t databaseId, int64_t objectStoreId, Vector<int64_t>& foundIds, Vector<String>& foundNames, Vector<String>& foundKeyPaths, Vector<bool>& foundUniqueFlags);
     57    virtual bool createIndex(int64_t databaseId, int64_t objectStoreId, const String& name, const String& keyPath, bool isUnique, int64_t& indexId);
     58    virtual void deleteIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId);
     59    virtual bool putIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&, const ObjectStoreRecordIdentifier*);
     60    virtual bool deleteIndexDataForRecord(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const ObjectStoreRecordIdentifier*);
     61    virtual String getObjectViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&);
     62    virtual PassRefPtr<IDBKey> getPrimaryKeyViaIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&);
     63    virtual bool keyExistsInIndex(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKey&);
    6364
    64     virtual PassRefPtr<Cursor> openObjectStoreCursor(int64_t objectStoreId, const IDBKeyRange*, IDBCursor::Direction);
    65     virtual PassRefPtr<Cursor> openIndexKeyCursor(int64_t indexId, const IDBKeyRange*, IDBCursor::Direction);
    66     virtual PassRefPtr<Cursor> openIndexCursor(int64_t indexId, const IDBKeyRange*, IDBCursor::Direction);
     65    virtual PassRefPtr<Cursor> openObjectStoreCursor(int64_t databaseId, int64_t objectStoreId, const IDBKeyRange*, IDBCursor::Direction);
     66    virtual PassRefPtr<Cursor> openIndexKeyCursor(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKeyRange*, IDBCursor::Direction);
     67    virtual PassRefPtr<Cursor> openIndexCursor(int64_t databaseId, int64_t objectStoreId, int64_t indexId, const IDBKeyRange*, IDBCursor::Direction);
    6768
    6869    virtual PassRefPtr<Transaction> createTransaction();
  • trunk/Source/WebKit/chromium/ChangeLog

    r83420 r83443  
     12011-04-05  Hans Wennborg  <hans@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        IndexedDB: Introduce skeleton for LevelDB backend
     6        https://bugs.webkit.org/show_bug.cgi?id=57827
     7
     8        * features.gypi:
     9            Add ENABLE_LEVELDB=0.
     10        * public/WebIDBFactory.h:
     11        (WebKit::WebIDBFactory::open):
     12            Remove pre-roll open() function.
     13
    1142011-04-10  Kent Tamura  <tkent@chromium.org>
    215
  • trunk/Source/WebKit/chromium/features.gypi

    r83342 r83443  
    6666        'ENABLE_JAVASCRIPT_DEBUGGER=1',
    6767        'ENABLE_JSC_MULTIPLE_THREADS=0',
     68        'ENABLE_LEVELDB=0',
    6869        'ENABLE_LINK_PREFETCH=1',
    6970        'ENABLE_MATHML=0',
  • trunk/Source/WebKit/chromium/public/WebIDBFactory.h

    r80635 r83443  
    11/*
    2  * Copyright (C) 2010 Google Inc. All rights reserved.
     2 * Copyright (C) 2011 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858
    5959    // The WebKit implementation of open ignores the WebFrame* parameter.
    60     // FIXME: Assert not reached when Chromium side is updated.
    61     virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir, unsigned long long maximumSize, BackingStoreType) { open(name, callbacks, origin, frame, dataDir, maximumSize); }
    62 
    63     // FIXME: Remove this when Chromium side is updated.
    64     virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir, unsigned long long maximumSize) { open(name, callbacks, origin, frame, dataDir, maximumSize, DefaultBackingStore); }
     60    virtual void open(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir, unsigned long long maximumSize, BackingStoreType) { WEBKIT_ASSERT_NOT_REACHED(); }
    6561
    6662    virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); }
Note: See TracChangeset for help on using the changeset viewer.