Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2038)

Unified Diff: Source/modules/indexeddb/IDBObjectStore.cpp

Issue 1166553004: IndexedDB: Replace 0 with nullptr where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: MOAR Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBOpenDBRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBObjectStore.cpp
diff --git a/Source/modules/indexeddb/IDBObjectStore.cpp b/Source/modules/indexeddb/IDBObjectStore.cpp
index c09a791f117262a887ef8d95b1cde50867ff4f35..729becd6b56dba21e288e94b09522f49d628a803 100644
--- a/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -91,26 +91,26 @@ IDBRequest* IDBObjectStore::get(ScriptState* scriptState, const ScriptValue& key
IDB_TRACE("IDBObjectStore::get");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!keyRange) {
exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage);
- return 0;
+ return nullptr;
}
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
@@ -128,26 +128,26 @@ IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
IDB_TRACE("IDBObjectStore::getAll");
if (!maxCount) {
exceptionState.throwTypeError(IDBDatabase::notValidMaxCountErrorMessage);
- return 0;
+ return nullptr;
}
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->executionContext(), keyRange, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
@@ -203,25 +203,25 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
{
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isReadOnly()) {
exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transactionReadOnlyErrorMessage);
- return 0;
+ return nullptr;
}
Vector<WebBlobInfo> blobInfo;
RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValueFactory::instance().create(scriptState->isolate(), value, &blobInfo, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
// Keys that need to be extracted must be taken from a clone so that
// side effects (i.e. getters) are not triggered. Construct the
@@ -234,7 +234,7 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
if (putMode != WebIDBPutModeCursorUpdate && usesInLineKeys && key) {
exceptionState.throwDOMException(DataError, "The object store uses in-line keys and the key parameter was provided.");
- return 0;
+ return nullptr;
}
// This test logically belongs in IDBCursor, but must operate on the cloned value.
@@ -253,7 +253,7 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
if (!usesInLineKeys && !hasKeyGenerator && !key) {
exceptionState.throwDOMException(DataError, "The object store uses out-of-line keys and has no key generator and the key parameter was not provided.");
- return 0;
+ return nullptr;
}
if (usesInLineKeys) {
if (clone.isEmpty())
@@ -263,16 +263,16 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
return nullptr;
if (keyPathKey && !keyPathKey->isValid()) {
exceptionState.throwDOMException(DataError, "Evaluating the object store's key path yielded a value that is not a valid key.");
- return 0;
+ return nullptr;
}
if (!hasKeyGenerator && !keyPathKey) {
exceptionState.throwDOMException(DataError, "Evaluating the object store's key path did not yield a value.");
- return 0;
+ return nullptr;
}
if (hasKeyGenerator && !keyPathKey) {
if (!canInjectIDBKeyIntoScriptValue(scriptState->isolate(), clone, keyPath)) {
exceptionState.throwDOMException(DataError, "A generated key could not be inserted into the value.");
- return 0;
+ return nullptr;
}
}
if (keyPathKey)
@@ -280,12 +280,12 @@ IDBRequest* IDBObjectStore::put(ScriptState* scriptState, WebIDBPutMode putMode,
}
if (key && !key->isValid()) {
exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErrorMessage);
- return 0;
+ return nullptr;
}
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
Vector<int64_t> indexIds;
@@ -313,31 +313,31 @@ IDBRequest* IDBObjectStore::deleteFunction(ScriptState* scriptState, const Scrip
IDB_TRACE("IDBObjectStore::delete");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isReadOnly()) {
exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transactionReadOnlyErrorMessage);
- return 0;
+ return nullptr;
}
IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), key, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!keyRange) {
exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage);
- return 0;
+ return nullptr;
}
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
@@ -350,23 +350,23 @@ IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exce
IDB_TRACE("IDBObjectStore::clear");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isReadOnly()) {
exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transactionReadOnlyErrorMessage);
- return 0;
+ return nullptr;
}
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
@@ -455,36 +455,36 @@ IDBIndex* IDBObjectStore::createIndex(ScriptState* scriptState, const String& na
IDB_TRACE("IDBObjectStore::createIndex");
if (!m_transaction->isVersionChange()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTransactionErrorMessage);
- return 0;
+ return nullptr;
}
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
if (!keyPath.isValid()) {
exceptionState.throwDOMException(SyntaxError, "The keyPath argument contains an invalid key path.");
- return 0;
+ return nullptr;
}
if (containsIndex(name)) {
exceptionState.throwDOMException(ConstraintError, "An index with the specified name already exists.");
- return 0;
+ return nullptr;
}
if (keyPath.type() == IDBKeyPath::ArrayType && options.multiEntry()) {
exceptionState.throwDOMException(InvalidAccessError, "The keyPath argument was an array and the multiEntry option is true.");
- return 0;
+ return nullptr;
}
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
int64_t indexId = m_metadata.maxIndexId + 1;
@@ -500,7 +500,7 @@ IDBIndex* IDBObjectStore::createIndex(ScriptState* scriptState, const String& na
ASSERT(!exceptionState.hadException());
if (exceptionState.hadException())
- return 0;
+ return nullptr;
IDBRequest* indexRequest = openCursor(scriptState, nullptr, WebIDBCursorDirectionNext, WebIDBTaskTypePreemptive);
indexRequest->preventPropagation();
@@ -516,11 +516,11 @@ IDBIndex* IDBObjectStore::index(const String& name, ExceptionState& exceptionSta
IDB_TRACE("IDBObjectStore::index");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
IDBIndexMap::iterator it = m_indexMap.find(name);
@@ -530,7 +530,7 @@ IDBIndex* IDBObjectStore::index(const String& name, ExceptionState& exceptionSta
int64_t indexId = findIndexId(name);
if (indexId == IDBIndexMetadata::InvalidId) {
exceptionState.throwDOMException(NotFoundError, IDBDatabase::noSuchIndexErrorMessage);
- return 0;
+ return nullptr;
}
const IDBIndexMetadata* indexMetadata(nullptr);
@@ -593,28 +593,28 @@ IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, const ScriptVal
IDB_TRACE("IDBObjectStore::openCursor");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionString, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal);
@@ -634,28 +634,28 @@ IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const Script
IDB_TRACE("IDBObjectStore::openKeyCursor");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
WebIDBCursorDirection direction = IDBCursor::stringToDirection(directionString, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
@@ -670,24 +670,24 @@ IDBRequest* IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& r
IDB_TRACE("IDBObjectStore::count");
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
- return 0;
+ return nullptr;
}
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
- return 0;
+ return nullptr;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
- return 0;
+ return nullptr;
}
IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionContext(), range, exceptionState);
if (exceptionState.hadException())
- return 0;
+ return nullptr;
if (!backendDB()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
- return 0;
+ return nullptr;
}
IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this), m_transaction.get());
« no previous file with comments | « Source/modules/indexeddb/IDBKeyRange.cpp ('k') | Source/modules/indexeddb/IDBOpenDBRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698