| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "modules/indexeddb/IDBDatabase.h" | 39 #include "modules/indexeddb/IDBDatabase.h" |
| 40 #include "modules/indexeddb/IDBKeyPath.h" | 40 #include "modules/indexeddb/IDBKeyPath.h" |
| 41 #include "modules/indexeddb/IDBTracing.h" | 41 #include "modules/indexeddb/IDBTracing.h" |
| 42 #include "modules/indexeddb/WebIDBCallbacksImpl.h" | 42 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
| 43 #include "platform/SharedBuffer.h" | 43 #include "platform/SharedBuffer.h" |
| 44 #include "public/platform/WebBlobInfo.h" | 44 #include "public/platform/WebBlobInfo.h" |
| 45 #include "public/platform/WebData.h" | 45 #include "public/platform/WebData.h" |
| 46 #include "public/platform/WebVector.h" | 46 #include "public/platform/WebVector.h" |
| 47 #include "public/platform/modules/indexeddb/WebIDBKey.h" | 47 #include "public/platform/modules/indexeddb/WebIDBKey.h" |
| 48 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" | 48 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" |
| 49 #include <memory> | |
| 50 #include <v8.h> | 49 #include <v8.h> |
| 51 | 50 |
| 52 using blink::WebBlobInfo; | 51 using blink::WebBlobInfo; |
| 53 using blink::WebIDBCallbacks; | 52 using blink::WebIDBCallbacks; |
| 54 using blink::WebIDBCursor; | 53 using blink::WebIDBCursor; |
| 55 using blink::WebIDBDatabase; | 54 using blink::WebIDBDatabase; |
| 56 using blink::WebVector; | 55 using blink::WebVector; |
| 57 | 56 |
| 58 namespace blink { | 57 namespace blink { |
| 59 | 58 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if (!keyRange) { | 106 if (!keyRange) { |
| 108 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); | 107 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); |
| 109 return nullptr; | 108 return nullptr; |
| 110 } | 109 } |
| 111 if (!backendDB()) { | 110 if (!backendDB()) { |
| 112 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 111 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 113 return nullptr; | 112 return nullptr; |
| 114 } | 113 } |
| 115 | 114 |
| 116 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 115 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 117 backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, key
Range, false, WebIDBCallbacksImpl::create(request).release()); | 116 backendDB()->get(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, key
Range, false, WebIDBCallbacksImpl::create(request).leakPtr()); |
| 118 return request; | 117 return request; |
| 119 } | 118 } |
| 120 | 119 |
| 121 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, ExceptionState& exceptionState) | 120 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, ExceptionState& exceptionState) |
| 122 { | 121 { |
| 123 return getAll(scriptState, keyRange, std::numeric_limits<uint32_t>::max(), e
xceptionState); | 122 return getAll(scriptState, keyRange, std::numeric_limits<uint32_t>::max(), e
xceptionState); |
| 124 } | 123 } |
| 125 | 124 |
| 126 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, unsigned long maxCount, ExceptionState& exceptionState) | 125 IDBRequest* IDBObjectStore::getAll(ScriptState* scriptState, const ScriptValue&
keyRange, unsigned long maxCount, ExceptionState& exceptionState) |
| 127 { | 126 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 143 } | 142 } |
| 144 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); | 143 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); |
| 145 if (exceptionState.hadException()) | 144 if (exceptionState.hadException()) |
| 146 return nullptr; | 145 return nullptr; |
| 147 if (!backendDB()) { | 146 if (!backendDB()) { |
| 148 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 147 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 149 return nullptr; | 148 return nullptr; |
| 150 } | 149 } |
| 151 | 150 |
| 152 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 151 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 153 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, false, WebIDBCallbacksImpl::create(request).release()); | 152 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, false, WebIDBCallbacksImpl::create(request).leakPtr()); |
| 154 return request; | 153 return request; |
| 155 } | 154 } |
| 156 | 155 |
| 157 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, ExceptionState& exceptionState) | 156 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, ExceptionState& exceptionState) |
| 158 { | 157 { |
| 159 return getAllKeys(scriptState, keyRange, std::numeric_limits<uint32_t>::max(
), exceptionState); | 158 return getAllKeys(scriptState, keyRange, std::numeric_limits<uint32_t>::max(
), exceptionState); |
| 160 } | 159 } |
| 161 | 160 |
| 162 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, unsigned long maxCount, ExceptionState& exceptionState) | 161 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* scriptState, const ScriptVal
ue& keyRange, unsigned long maxCount, ExceptionState& exceptionState) |
| 163 { | 162 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 179 } | 178 } |
| 180 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); | 179 IDBKeyRange* range = IDBKeyRange::fromScriptValue(scriptState->getExecutionC
ontext(), keyRange, exceptionState); |
| 181 if (exceptionState.hadException()) | 180 if (exceptionState.hadException()) |
| 182 return nullptr; | 181 return nullptr; |
| 183 if (!backendDB()) { | 182 if (!backendDB()) { |
| 184 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 183 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 185 return nullptr; | 184 return nullptr; |
| 186 } | 185 } |
| 187 | 186 |
| 188 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 187 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 189 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, true, WebIDBCallbacksImpl::create(request).release()); | 188 backendDB()->getAll(m_transaction->id(), id(), IDBIndexMetadata::InvalidId,
range, maxCount, true, WebIDBCallbacksImpl::create(request).leakPtr()); |
| 190 return request; | 189 return request; |
| 191 } | 190 } |
| 192 | 191 |
| 193 static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada
ta& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* in
dexKeys) | 192 static void generateIndexKeysForValue(v8::Isolate* isolate, const IDBIndexMetada
ta& indexMetadata, const ScriptValue& objectValue, IDBObjectStore::IndexKeys* in
dexKeys) |
| 194 { | 193 { |
| 195 ASSERT(indexKeys); | 194 ASSERT(indexKeys); |
| 196 NonThrowableExceptionState exceptionState; | 195 NonThrowableExceptionState exceptionState; |
| 197 IDBKey* indexKey = ScriptValue::to<IDBKey*>(isolate, objectValue, exceptionS
tate, indexMetadata.keyPath); | 196 IDBKey* indexKey = ScriptValue::to<IDBKey*>(isolate, objectValue, exceptionS
tate, indexMetadata.keyPath); |
| 198 | 197 |
| 199 if (!indexKey) | 198 if (!indexKey) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 generateIndexKeysForValue(scriptState->isolate(), it.value, clone, &keys
); | 333 generateIndexKeysForValue(scriptState->isolate(), it.value, clone, &keys
); |
| 335 indexIds.append(it.key); | 334 indexIds.append(it.key); |
| 336 indexKeys.append(keys); | 335 indexKeys.append(keys); |
| 337 } | 336 } |
| 338 | 337 |
| 339 IDBRequest* request = IDBRequest::create(scriptState, source, m_transaction.
get()); | 338 IDBRequest* request = IDBRequest::create(scriptState, source, m_transaction.
get()); |
| 340 Vector<char> wireBytes; | 339 Vector<char> wireBytes; |
| 341 serializedValue->toWireBytes(wireBytes); | 340 serializedValue->toWireBytes(wireBytes); |
| 342 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); | 341 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); |
| 343 | 342 |
| 344 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo,
key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).r
elease(), indexIds, indexKeys); | 343 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo,
key, static_cast<WebIDBPutMode>(putMode), WebIDBCallbacksImpl::create(request).l
eakPtr(), indexIds, indexKeys); |
| 345 return request; | 344 return request; |
| 346 } | 345 } |
| 347 | 346 |
| 348 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* scriptState, const Scrip
tValue& key, ExceptionState& exceptionState) | 347 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* scriptState, const Scrip
tValue& key, ExceptionState& exceptionState) |
| 349 { | 348 { |
| 350 IDB_TRACE("IDBObjectStore::delete"); | 349 IDB_TRACE("IDBObjectStore::delete"); |
| 351 if (isDeleted()) { | 350 if (isDeleted()) { |
| 352 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 351 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 353 return nullptr; | 352 return nullptr; |
| 354 } | 353 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 371 if (!keyRange) { | 370 if (!keyRange) { |
| 372 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); | 371 exceptionState.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRange
ErrorMessage); |
| 373 return nullptr; | 372 return nullptr; |
| 374 } | 373 } |
| 375 if (!backendDB()) { | 374 if (!backendDB()) { |
| 376 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 375 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 377 return nullptr; | 376 return nullptr; |
| 378 } | 377 } |
| 379 | 378 |
| 380 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 379 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 381 backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallback
sImpl::create(request).release()); | 380 backendDB()->deleteRange(m_transaction->id(), id(), keyRange, WebIDBCallback
sImpl::create(request).leakPtr()); |
| 382 return request; | 381 return request; |
| 383 } | 382 } |
| 384 | 383 |
| 385 IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exce
ptionState) | 384 IDBRequest* IDBObjectStore::clear(ScriptState* scriptState, ExceptionState& exce
ptionState) |
| 386 { | 385 { |
| 387 IDB_TRACE("IDBObjectStore::clear"); | 386 IDB_TRACE("IDBObjectStore::clear"); |
| 388 if (isDeleted()) { | 387 if (isDeleted()) { |
| 389 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 388 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 390 return nullptr; | 389 return nullptr; |
| 391 } | 390 } |
| 392 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 391 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
| 393 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 392 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
| 394 return nullptr; | 393 return nullptr; |
| 395 } | 394 } |
| 396 if (!m_transaction->isActive()) { | 395 if (!m_transaction->isActive()) { |
| 397 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 396 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
| 398 return nullptr; | 397 return nullptr; |
| 399 } | 398 } |
| 400 if (m_transaction->isReadOnly()) { | 399 if (m_transaction->isReadOnly()) { |
| 401 exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transaction
ReadOnlyErrorMessage); | 400 exceptionState.throwDOMException(ReadOnlyError, IDBDatabase::transaction
ReadOnlyErrorMessage); |
| 402 return nullptr; | 401 return nullptr; |
| 403 } | 402 } |
| 404 if (!backendDB()) { | 403 if (!backendDB()) { |
| 405 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 404 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 406 return nullptr; | 405 return nullptr; |
| 407 } | 406 } |
| 408 | 407 |
| 409 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 408 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 410 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).release()); | 409 backendDB()->clear(m_transaction->id(), id(), WebIDBCallbacksImpl::create(re
quest).leakPtr()); |
| 411 return request; | 410 return request; |
| 412 } | 411 } |
| 413 | 412 |
| 414 namespace { | 413 namespace { |
| 415 // This class creates the index keys for a given index by extracting | 414 // This class creates the index keys for a given index by extracting |
| 416 // them from the SerializedScriptValue, for all the existing values in | 415 // them from the SerializedScriptValue, for all the existing values in |
| 417 // the objectStore. It only needs to be kept alive by virtue of being | 416 // the objectStore. It only needs to be kept alive by virtue of being |
| 418 // a listener on an IDBRequest object, in the same way that JavaScript | 417 // a listener on an IDBRequest object, in the same way that JavaScript |
| 419 // cursor success handlers are kept alive. | 418 // cursor success handlers are kept alive. |
| 420 class IndexPopulator final : public EventListener { | 419 class IndexPopulator final : public EventListener { |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 } | 658 } |
| 660 | 659 |
| 661 return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal); | 660 return openCursor(scriptState, keyRange, direction, WebIDBTaskTypeNormal); |
| 662 } | 661 } |
| 663 | 662 |
| 664 IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, IDBKeyRange* ra
nge, WebIDBCursorDirection direction, WebIDBTaskType taskType) | 663 IDBRequest* IDBObjectStore::openCursor(ScriptState* scriptState, IDBKeyRange* ra
nge, WebIDBCursorDirection direction, WebIDBTaskType taskType) |
| 665 { | 664 { |
| 666 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 665 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 667 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); | 666 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); |
| 668 | 667 |
| 669 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).rele
ase()); | 668 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, range, direction, false, taskType, WebIDBCallbacksImpl::create(request).leak
Ptr()); |
| 670 return request; | 669 return request; |
| 671 } | 670 } |
| 672 | 671 |
| 673 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const Script
Value& range, const String& directionString, ExceptionState& exceptionState) | 672 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* scriptState, const Script
Value& range, const String& directionString, ExceptionState& exceptionState) |
| 674 { | 673 { |
| 675 IDB_TRACE("IDBObjectStore::openKeyCursor"); | 674 IDB_TRACE("IDBObjectStore::openKeyCursor"); |
| 676 if (isDeleted()) { | 675 if (isDeleted()) { |
| 677 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 676 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 678 return nullptr; | 677 return nullptr; |
| 679 } | 678 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 692 return nullptr; | 691 return nullptr; |
| 693 | 692 |
| 694 if (!backendDB()) { | 693 if (!backendDB()) { |
| 695 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 694 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 696 return nullptr; | 695 return nullptr; |
| 697 } | 696 } |
| 698 | 697 |
| 699 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 698 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 700 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); | 699 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); |
| 701 | 700 |
| 702 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create
(request).release()); | 701 backendDB()->openCursor(m_transaction->id(), id(), IDBIndexMetadata::Invalid
Id, keyRange, direction, true, WebIDBTaskTypeNormal, WebIDBCallbacksImpl::create
(request).leakPtr()); |
| 703 return request; | 702 return request; |
| 704 } | 703 } |
| 705 | 704 |
| 706 IDBRequest* IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& r
ange, ExceptionState& exceptionState) | 705 IDBRequest* IDBObjectStore::count(ScriptState* scriptState, const ScriptValue& r
ange, ExceptionState& exceptionState) |
| 707 { | 706 { |
| 708 IDB_TRACE("IDBObjectStore::count"); | 707 IDB_TRACE("IDBObjectStore::count"); |
| 709 if (isDeleted()) { | 708 if (isDeleted()) { |
| 710 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); | 709 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS
toreDeletedErrorMessage); |
| 711 return nullptr; | 710 return nullptr; |
| 712 } | 711 } |
| 713 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 712 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
| 714 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 713 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
| 715 return nullptr; | 714 return nullptr; |
| 716 } | 715 } |
| 717 if (!m_transaction->isActive()) { | 716 if (!m_transaction->isActive()) { |
| 718 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 717 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
| 719 return nullptr; | 718 return nullptr; |
| 720 } | 719 } |
| 721 | 720 |
| 722 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecuti
onContext(), range, exceptionState); | 721 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->getExecuti
onContext(), range, exceptionState); |
| 723 if (exceptionState.hadException()) | 722 if (exceptionState.hadException()) |
| 724 return nullptr; | 723 return nullptr; |
| 725 | 724 |
| 726 if (!backendDB()) { | 725 if (!backendDB()) { |
| 727 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 726 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
| 728 return nullptr; | 727 return nullptr; |
| 729 } | 728 } |
| 730 | 729 |
| 731 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 730 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
| 732 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k
eyRange, WebIDBCallbacksImpl::create(request).release()); | 731 backendDB()->count(m_transaction->id(), id(), IDBIndexMetadata::InvalidId, k
eyRange, WebIDBCallbacksImpl::create(request).leakPtr()); |
| 733 return request; | 732 return request; |
| 734 } | 733 } |
| 735 | 734 |
| 736 void IDBObjectStore::abort() | 735 void IDBObjectStore::abort() |
| 737 { | 736 { |
| 738 for (auto& index : m_createdIndexes) | 737 for (auto& index : m_createdIndexes) |
| 739 index->markDeleted(); | 738 index->markDeleted(); |
| 740 } | 739 } |
| 741 | 740 |
| 742 void IDBObjectStore::transactionFinished() | 741 void IDBObjectStore::transactionFinished() |
| (...skipping 16 matching lines...) Expand all Loading... |
| 759 } | 758 } |
| 760 return IDBIndexMetadata::InvalidId; | 759 return IDBIndexMetadata::InvalidId; |
| 761 } | 760 } |
| 762 | 761 |
| 763 WebIDBDatabase* IDBObjectStore::backendDB() const | 762 WebIDBDatabase* IDBObjectStore::backendDB() const |
| 764 { | 763 { |
| 765 return m_transaction->backendDB(); | 764 return m_transaction->backendDB(); |
| 766 } | 765 } |
| 767 | 766 |
| 768 } // namespace blink | 767 } // namespace blink |
| OLD | NEW |