Diff
Modified: trunk/Source/WebCore/ChangeLog (136193 => 136194)
--- trunk/Source/WebCore/ChangeLog 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/ChangeLog 2012-11-30 02:22:20 UTC (rev 136194)
@@ -1,3 +1,47 @@
+2012-11-29 David Grogan <[email protected]>
+
+ IndexedDB: Propagate more leveldb errors to script
+ https://bugs.webkit.org/show_bug.cgi?id=103580
+
+ Reviewed by Tony Chang.
+
+ LevelDBDatabase used a single return value to indicate both I/O problems
+ and a missing key. Now an out variable is used to indicate if the
+ requested key was found. The return value is used to report corruption
+ or disk error.
+
+ This is a small step toward propagating low level errors everywhere
+ possible. So far only one scenario will newly cause script to receive
+ an error: when leveldb has trouble looking for existing keys during an
+ objectstore->add.
+
+ * Modules/indexeddb/IDBBackingStore.cpp:
+ (WebCore::getInt):
+ (WebCore::getVarInt):
+ (WebCore::getString):
+ (WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
+ (WebCore::IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber):
+ (WebCore::IDBBackingStore::keyExistsInObjectStore):
+ * Modules/indexeddb/IDBBackingStore.h:
+ (IDBBackingStore):
+ * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+ (WebCore::IDBObjectStoreBackendImpl::setIndexKeys):
+ (WebCore::IDBObjectStoreBackendImpl::putInternal):
+ (WebCore::IDBObjectStoreBackendImpl::generateKey):
+ (WebCore::IDBObjectStoreBackendImpl::updateKeyGenerator):
+ * Modules/indexeddb/IDBObjectStoreBackendImpl.h:
+ (IDBObjectStoreBackendImpl):
+ * platform/leveldb/LevelDBDatabase.cpp:
+ (WebCore::LevelDBDatabase::safeGet):
+ * platform/leveldb/LevelDBDatabase.h:
+ (LevelDBDatabase):
+ * platform/leveldb/LevelDBTransaction.cpp:
+ (WebCore::LevelDBTransaction::safeGet):
+ (WebCore):
+ (WebCore::LevelDBTransaction::get):
+ * platform/leveldb/LevelDBTransaction.h:
+ (LevelDBTransaction):
+
2012-11-29 Sheriff Bot <[email protected]>
Unreviewed, rolling out r136171.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp (136193 => 136194)
--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp 2012-11-30 02:22:20 UTC (rev 136194)
@@ -91,7 +91,11 @@
static bool getInt(DBOrTransaction* db, const LevelDBSlice& key, int64_t& foundInt)
{
Vector<char> result;
- if (!db->get(key, result))
+ bool found = false;
+ bool ok = db->safeGet(key, result, found);
+ // FIXME: Notify the caller if !ok.
+ ASSERT_UNUSED(ok, ok);
+ if (!found)
return false;
foundInt = decodeInt(result.begin(), result.end());
@@ -108,7 +112,11 @@
static bool getVarInt(DBOrTransaction* db, const LevelDBSlice& key, int64_t& foundInt)
{
Vector<char> result;
- if (!db->get(key, result))
+ bool found = false;
+ bool ok = db->safeGet(key, result, found);
+ // FIXME: Notify the caller if !ok.
+ ASSERT_UNUSED(ok, ok);
+ if (!found)
return false;
return decodeVarInt(result.begin(), result.end(), foundInt) == result.end();
@@ -123,7 +131,11 @@
static bool getString(DBOrTransaction* db, const LevelDBSlice& key, String& foundString)
{
Vector<char> result;
- if (!db->get(key, result))
+ bool found = false;
+ bool ok = db->safeGet(key, result, found);
+ // FIXME: Notify the caller if !ok.
+ ASSERT_UNUSED(ok, ok);
+ if (!found)
return false;
foundString = decodeString(result.begin(), result.end());
@@ -699,16 +711,22 @@
}
-int64_t IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId)
+bool IDBBackingStore::getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t& keyGeneratorCurrentNumber)
{
LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber);
- int64_t keyGeneratorCurrentNumber = -1;
+ keyGeneratorCurrentNumber = -1;
Vector<char> data;
- if (levelDBTransaction->get(keyGeneratorCurrentNumberKey, data))
+ bool found = false;
+ bool ok = levelDBTransaction->safeGet(keyGeneratorCurrentNumberKey, data, found);
+ if (!ok) {
+ InternalError(IDBLevelDBBackingStoreReadError);
+ return false;
+ }
+ if (found)
keyGeneratorCurrentNumber = decodeInt(data.begin(), data.end());
else {
// Previously, the key generator state was not stored explicitly but derived from the
@@ -741,29 +759,39 @@
return keyGeneratorCurrentNumber;
}
-void IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent)
+bool IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent)
{
LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
if (checkCurrent) {
- int64_t currentNumber = getKeyGeneratorCurrentNumber(transaction, databaseId, objectStoreId);
+ int64_t currentNumber;
+ bool ok = getKeyGeneratorCurrentNumber(transaction, databaseId, objectStoreId, currentNumber);
+ if (!ok)
+ return false;
if (newNumber <= currentNumber)
- return;
+ return true;
}
const Vector<char> keyGeneratorCurrentNumberKey = ObjectStoreMetaDataKey::encode(databaseId, objectStoreId, ObjectStoreMetaDataKey::KeyGeneratorCurrentNumber);
putInt(levelDBTransaction, keyGeneratorCurrentNumberKey, newNumber);
+ return true;
}
-bool IDBBackingStore::keyExistsInObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, RecordIdentifier* foundRecordIdentifier)
+bool IDBBackingStore::keyExistsInObjectStore(IDBBackingStore::Transaction* transaction, int64_t databaseId, int64_t objectStoreId, const IDBKey& key, RecordIdentifier* foundRecordIdentifier, bool& found)
{
IDB_TRACE("IDBBackingStore::keyExistsInObjectStore");
+ found = false;
LevelDBTransaction* levelDBTransaction = IDBBackingStore::Transaction::levelDBTransactionFrom(transaction);
const Vector<char> leveldbKey = ObjectStoreDataKey::encode(databaseId, objectStoreId, key);
Vector<char> data;
- if (!levelDBTransaction->get(leveldbKey, data))
+ bool ok = levelDBTransaction->safeGet(leveldbKey, data, found);
+ if (!ok) {
+ InternalError(IDBLevelDBBackingStoreReadError);
return false;
+ }
+ if (!found)
+ return true;
int64_t version;
if (!decodeVarInt(data.begin(), data.end(), version))
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h (136193 => 136194)
--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStore.h 2012-11-30 02:22:20 UTC (rev 136194)
@@ -81,9 +81,9 @@
virtual void putRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, RecordIdentifier*);
virtual void clearObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId);
virtual void deleteRecord(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&);
- virtual int64_t getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId);
- virtual void maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent);
- virtual bool keyExistsInObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier);
+ virtual bool getKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) WARN_UNUSED_RETURN;
+ virtual bool maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent) WARN_UNUSED_RETURN;
+ virtual bool keyExistsInObjectStore(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier, bool& found) WARN_UNUSED_RETURN;
virtual Vector<IDBIndexMetadata> getIndexes(int64_t databaseId, int64_t objectStoreId);
virtual bool createIndex(IDBBackingStore::Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (136193 => 136194)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp 2012-11-30 02:22:20 UTC (rev 136194)
@@ -231,7 +231,14 @@
// FIXME: This method could be asynchronous, but we need to evaluate if it's worth the extra complexity.
IDBBackingStore::RecordIdentifier recordIdentifier;
- if (!backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), databaseId(), id(), *primaryKey, &recordIdentifier)) {
+ bool found = false;
+ bool ok = backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), databaseId(), id(), *primaryKey, &recordIdentifier, found);
+ if (!ok) {
+ LOG_ERROR("keyExistsInObjectStore reported an error");
+ transaction->abort(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error setting index keys."));
+ return;
+ }
+ if (!found) {
transaction->abort();
return;
}
@@ -300,9 +307,17 @@
ASSERT(key && key->isValid());
IDBBackingStore::RecordIdentifier recordIdentifier;
- if (putMode == AddOnly && objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, &recordIdentifier)) {
- callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store."));
- return;
+ if (putMode == AddOnly) {
+ bool found = false;
+ bool ok = objectStore->backingStore()->keyExistsInObjectStore(transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->id(), *key, &recordIdentifier, found);
+ if (!ok) {
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error checking key existence."));
+ return;
+ }
+ if (found) {
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store."));
+ return;
+ }
}
Vector<OwnPtr<IndexWriter> > indexWriters;
@@ -321,8 +336,13 @@
indexWriter->writeIndexKeys(recordIdentifier, *objectStore->backingStore(), transaction->backingStoreTransaction(), objectStore->databaseId(), objectStore->m_metadata.id);
}
- if (autoIncrement && putMode != CursorUpdate && key->type() == IDBKey::NumberType)
- objectStore->updateKeyGenerator(transaction, key.get(), !keyWasGenerated);
+ if (autoIncrement && putMode != CursorUpdate && key->type() == IDBKey::NumberType) {
+ bool ok = objectStore->updateKeyGenerator(transaction, key.get(), !keyWasGenerated);
+ if (!ok) {
+ callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error updating key generator."));
+ return;
+ }
+ }
callbacks->onSuccess(key.release());
}
@@ -525,17 +545,22 @@
PassRefPtr<IDBKey> IDBObjectStoreBackendImpl::generateKey(PassRefPtr<IDBTransactionBackendImpl> transaction)
{
const int64_t maxGeneratorValue = 9007199254740992LL; // Maximum integer storable as ECMAScript number.
- int64_t currentNumber = backingStore()->getKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id());
+ int64_t currentNumber;
+ bool ok = backingStore()->getKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), currentNumber);
+ if (!ok) {
+ LOG_ERROR("Failed to getKeyGeneratorCurrentNumber");
+ return IDBKey::createInvalid();
+ }
if (currentNumber < 0 || currentNumber > maxGeneratorValue)
return IDBKey::createInvalid();
return IDBKey::createNumber(currentNumber);
}
-void IDBObjectStoreBackendImpl::updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl> transaction, const IDBKey* key, bool checkCurrent)
+bool IDBObjectStoreBackendImpl::updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl> transaction, const IDBKey* key, bool checkCurrent)
{
ASSERT(key && key->type() == IDBKey::NumberType);
- backingStore()->maybeUpdateKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), static_cast<int64_t>(floor(key->number())) + 1, checkCurrent);
+ return backingStore()->maybeUpdateKeyGeneratorCurrentNumber(transaction->backingStoreTransaction(), databaseId(), id(), static_cast<int64_t>(floor(key->number())) + 1, checkCurrent);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h (136193 => 136194)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h 2012-11-30 02:22:20 UTC (rev 136194)
@@ -96,7 +96,7 @@
void loadIndexes();
PassRefPtr<IDBKey> generateKey(PassRefPtr<IDBTransactionBackendImpl>);
- void updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl>, const IDBKey*, bool checkCurrent);
+ bool updateKeyGenerator(PassRefPtr<IDBTransactionBackendImpl>, const IDBKey*, bool checkCurrent);
static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>);
static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendImpl>, PassOwnPtr<Vector<int64_t> > popIndexNames, PassOwnPtr<Vector<IndexKeys> >);
Modified: trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp (136193 => 136194)
--- trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.cpp 2012-11-30 02:22:20 UTC (rev 136194)
@@ -198,8 +198,9 @@
return false;
}
-bool LevelDBDatabase::get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* snapshot)
+bool LevelDBDatabase::safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found, const LevelDBSnapshot* snapshot)
{
+ found = false;
std::string result;
leveldb::ReadOptions readOptions;
readOptions.verify_checksums = true; // FIXME: Disable this if the performance impact is too great.
@@ -207,11 +208,12 @@
const leveldb::Status s = m_db->Get(readOptions, makeSlice(key), &result);
if (s.ok()) {
+ found = true;
value = makeVector(result);
return true;
}
if (s.IsNotFound())
- return false;
+ return true;
LOG_ERROR("LevelDB get failed: %s", s.ToString().c_str());
return false;
}
Modified: trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.h (136193 => 136194)
--- trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.h 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBDatabase.h 2012-11-30 02:22:20 UTC (rev 136194)
@@ -69,7 +69,7 @@
bool put(const LevelDBSlice& key, const Vector<char>& value);
bool remove(const LevelDBSlice& key);
- bool get(const LevelDBSlice& key, Vector<char>& value, const LevelDBSnapshot* = 0);
+ bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found, const LevelDBSnapshot* = 0);
bool write(LevelDBWriteBatch&);
PassOwnPtr<LevelDBIterator> createIterator(const LevelDBSnapshot* = 0);
const LevelDBComparator* comparator() const;
Modified: trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp (136193 => 136194)
--- trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.cpp 2012-11-30 02:22:20 UTC (rev 136194)
@@ -107,22 +107,40 @@
set(key, Vector<char>(), true);
}
-bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value)
+bool LevelDBTransaction::safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found)
{
+ found = false;
ASSERT(!m_finished);
AVLTreeNode* node = m_tree.search(key);
if (node) {
if (node->deleted)
- return false;
+ return true;
value = node->value;
+ found = true;
return true;
}
- return m_db->get(key, value, &m_snapshot);
+ bool ok = m_db->safeGet(key, value, found, &m_snapshot);
+ if (!ok) {
+ ASSERT(!found);
+ return false;
+ }
+ return true;
}
+bool LevelDBTransaction::get(const LevelDBSlice& key, Vector<char>& value)
+{
+ bool found = false;
+ bool ok = safeGet(key, value, found);
+ if (!ok) {
+ ASSERT(!found);
+ ASSERT_NOT_REACHED();
+ }
+ return ok && found;
+}
+
bool LevelDBTransaction::commit()
{
ASSERT(!m_finished);
Modified: trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h (136193 => 136194)
--- trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebCore/platform/leveldb/LevelDBTransaction.h 2012-11-30 02:22:20 UTC (rev 136194)
@@ -54,6 +54,8 @@
~LevelDBTransaction();
void put(const LevelDBSlice& key, const Vector<char>& value);
void remove(const LevelDBSlice& key);
+ bool safeGet(const LevelDBSlice& key, Vector<char>& value, bool& found);
+ // FIXME: Convert all callers of get to safeGet then remove get.
bool get(const LevelDBSlice& key, Vector<char>& value);
bool commit();
void rollback();
Modified: trunk/Source/WebKit/chromium/ChangeLog (136193 => 136194)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-11-30 02:22:20 UTC (rev 136194)
@@ -1,3 +1,13 @@
+2012-11-29 David Grogan <[email protected]>
+
+ IndexedDB: Propagate more leveldb errors to script
+ https://bugs.webkit.org/show_bug.cgi?id=103580
+
+ Reviewed by Tony Chang.
+
+ * tests/IDBFakeBackingStore.h:
+ Update method signatures.
+
2012-11-29 Sheriff Bot <[email protected]>
Unreviewed, rolling out r136171.
Modified: trunk/Source/WebKit/chromium/tests/IDBFakeBackingStore.h (136193 => 136194)
--- trunk/Source/WebKit/chromium/tests/IDBFakeBackingStore.h 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebKit/chromium/tests/IDBFakeBackingStore.h 2012-11-30 02:22:20 UTC (rev 136194)
@@ -47,9 +47,9 @@
virtual void putRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, const String& value, RecordIdentifier*) OVERRIDE { }
virtual void clearObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { }
virtual void deleteRecord(Transaction*, int64_t databaseId, int64_t objectStoreId, const RecordIdentifier&) OVERRIDE { }
- virtual int64_t getKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId) OVERRIDE { return 0; }
- virtual void maybeUpdateKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) OVERRIDE { }
- virtual bool keyExistsInObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier) OVERRIDE { return false; }
+ virtual bool getKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t& currentNumber) OVERRIDE { return true; }
+ virtual bool maybeUpdateKeyGeneratorCurrentNumber(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t newNumber, bool checkCurrent) OVERRIDE { return true; }
+ virtual bool keyExistsInObjectStore(Transaction*, int64_t databaseId, int64_t objectStoreId, const IDBKey&, RecordIdentifier* foundRecordIdentifier, bool& found) OVERRIDE { return true; }
virtual Vector<IDBIndexMetadata> getIndexes(int64_t databaseId, int64_t objectStoreId) OVERRIDE { return Vector<IDBIndexMetadata>(); }
virtual bool createIndex(Transaction*, int64_t databaseId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath&, bool isUnique, bool isMultiEntry) OVERRIDE { return false; };
Modified: trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp (136193 => 136194)
--- trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp 2012-11-30 02:18:39 UTC (rev 136193)
+++ trunk/Source/WebKit/chromium/tests/LevelDBTest.cpp 2012-11-30 02:22:20 UTC (rev 136194)
@@ -79,8 +79,10 @@
leveldb = LevelDBDatabase::open(path, &comparator);
EXPECT_TRUE(leveldb);
- success = leveldb->get(key, gotValue);
+ bool found = false;
+ success = leveldb->safeGet(key, gotValue, found);
EXPECT_TRUE(success);
+ EXPECT_TRUE(found);
EXPECT_EQ(putValue, gotValue);
leveldb.release();
EXPECT_FALSE(leveldb);
@@ -98,8 +100,9 @@
leveldb = LevelDBDatabase::open(path, &comparator);
EXPECT_TRUE(leveldb);
- success = leveldb->get(key, gotValue);
- EXPECT_FALSE(success);
+ success = leveldb->safeGet(key, gotValue, found);
+ EXPECT_TRUE(success);
+ EXPECT_FALSE(found);
}
TEST(LevelDBDatabaseTest, Transaction)
@@ -129,8 +132,10 @@
EXPECT_TRUE(success);
EXPECT_EQ(comparator.compare(gotValue, oldValue), 0);
- success = leveldb->get(key, gotValue);
+ bool found = false;
+ success = leveldb->safeGet(key, gotValue, found);
EXPECT_TRUE(success);
+ EXPECT_TRUE(found);
EXPECT_EQ(comparator.compare(gotValue, newValue), 0);
const Vector<char> addedKey = encodeString("added key");
@@ -138,8 +143,9 @@
success = leveldb->put(addedKey, addedValue);
EXPECT_TRUE(success);
- success = leveldb->get(addedKey, gotValue);
+ success = leveldb->safeGet(addedKey, gotValue, found);
EXPECT_TRUE(success);
+ EXPECT_TRUE(found);
EXPECT_EQ(comparator.compare(gotValue, addedValue), 0);
success = transaction->get(addedKey, gotValue);