WebKit Bugzilla
Attachment 360396 Details for
Bug 193933
: Use lambdas instead of member pointer functions for TransactionOperationImpl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193933-20190128161151.patch (text/plain), 28.98 KB, created by
Alex Christensen
on 2019-01-28 16:11:51 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-28 16:11:51 PST
Size:
28.98 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 240607) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,38 @@ >+2019-01-28 Alex Christensen <achristensen@webkit.org> >+ >+ Use lambdas instead of member pointer functions for TransactionOperationImpl >+ https://bugs.webkit.org/show_bug.cgi?id=193933 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No change in behavior. This just makes it easier to add new parameters to these functions in a straightforward manner. >+ >+ * Modules/indexeddb/IDBObjectStore.cpp: >+ (WebCore::IDBObjectStore::putOrAdd): >+ * Modules/indexeddb/IDBTransaction.cpp: >+ (WebCore::IDBTransaction::internalAbort): >+ (WebCore::IDBTransaction::commit): >+ (WebCore::IDBTransaction::createObjectStore): >+ (WebCore::IDBTransaction::renameObjectStore): >+ (WebCore::IDBTransaction::createIndex): >+ (WebCore::IDBTransaction::renameIndex): >+ (WebCore::IDBTransaction::doRequestOpenCursor): >+ (WebCore::IDBTransaction::iterateCursor): >+ (WebCore::IDBTransaction::requestGetAllObjectStoreRecords): >+ (WebCore::IDBTransaction::requestGetAllIndexRecords): >+ (WebCore::IDBTransaction::requestGetRecord): >+ (WebCore::IDBTransaction::requestIndexRecord): >+ (WebCore::IDBTransaction::requestCount): >+ (WebCore::IDBTransaction::requestDeleteRecord): >+ (WebCore::IDBTransaction::requestClearObjectStore): >+ (WebCore::IDBTransaction::requestPutOrAdd): >+ (WebCore::IDBTransaction::deleteObjectStore): >+ (WebCore::IDBTransaction::deleteIndex): >+ * Modules/indexeddb/IDBTransaction.h: >+ * Modules/indexeddb/client/TransactionOperation.h: >+ (WebCore::IDBClient::TransactionOperation::doComplete): >+ (WebCore::IDBClient::createTransactionOperation): Deleted. >+ > 2019-01-28 Daniel Bates <dabates@apple.com> > > [iOS] Make Window virtual key code computation match Mac >Index: Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp >=================================================================== >--- Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (revision 240589) >+++ Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (working copy) >@@ -357,7 +357,7 @@ ExceptionOr<Ref<IDBRequest>> IDBObjectSt > } else if (!usesKeyGenerator && !key) > return Exception { DataError, "Failed to store record in an IDBObjectStore: The object store uses out-of-line keys and has no key generator and the key parameter was not provided."_s }; > >- return m_transaction.requestPutOrAdd(state, *this, key.get(), *serializedValue, overwriteMode); >+ return m_transaction.requestPutOrAdd(state, *this, WTFMove(key), *serializedValue, overwriteMode); > } > > ExceptionOr<Ref<IDBRequest>> IDBObjectStore::deleteFunction(ExecState& execState, IDBKeyRange* keyRange) >Index: Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >=================================================================== >--- Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (revision 240589) >+++ Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (working copy) >@@ -246,7 +246,9 @@ void IDBTransaction::internalAbort() > m_abortQueue.swap(m_pendingTransactionOperationQueue); > > LOG(IndexedDBOperations, "IDB abort-on-server operation: Transaction %s", info().identifier().loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::abortOnServerAndCancelRequests)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, nullptr, [protectedThis = makeRef(*this)] (auto& operation) { >+ protectedThis->abortOnServerAndCancelRequests(operation); >+ })); > } > > void IDBTransaction::abortInProgressOperations(const IDBError& error) >@@ -501,7 +503,9 @@ void IDBTransaction::commit() > m_database->willCommitTransaction(*this); > > LOG(IndexedDBOperations, "IDB commit operation: Transaction %s", info().identifier().loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, nullptr, &IDBTransaction::commitOnServer)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, nullptr, [protectedThis = makeRef(*this)] (auto& operation) { >+ protectedThis->commitOnServer(operation); >+ })); > } > > void IDBTransaction::commitOnServer(IDBClient::TransactionOperation& operation) >@@ -659,7 +663,11 @@ Ref<IDBObjectStore> IDBTransaction::crea > m_referencedObjectStores.set(info.name(), WTFMove(objectStore)); > > LOG(IndexedDBOperations, "IDB create object store operation: %s", info.condensedLoggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateObjectStoreOnServer, &IDBTransaction::createObjectStoreOnServer, info)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didCreateObjectStoreOnServer(result); >+ }, [protectedThis = makeRef(*this), info = info.isolatedCopy()] (auto& operation) { >+ protectedThis->createObjectStoreOnServer(operation, info); >+ })); > > return *rawObjectStore; > } >@@ -697,7 +705,11 @@ void IDBTransaction::renameObjectStore(I > uint64_t objectStoreIdentifier = objectStore.info().identifier(); > > LOG(IndexedDBOperations, "IDB rename object store operation: %s to %s", objectStore.info().condensedLoggingString().utf8().data(), newName.utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameObjectStoreOnServer, &IDBTransaction::renameObjectStoreOnServer, objectStoreIdentifier, newName)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didRenameObjectStoreOnServer(result); >+ }, [protectedThis = makeRef(*this), objectStoreIdentifier, newName = newName.isolatedCopy()] (auto& operation) { >+ protectedThis->renameObjectStoreOnServer(operation, objectStoreIdentifier, newName); >+ })); > > m_referencedObjectStores.set(newName, m_referencedObjectStores.take(objectStore.info().name())); > } >@@ -728,7 +740,11 @@ std::unique_ptr<IDBIndex> IDBTransaction > return nullptr; > > LOG(IndexedDBOperations, "IDB create index operation: %s under object store %s", info.condensedLoggingString().utf8().data(), objectStore.info().condensedLoggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didCreateIndexOnServer, &IDBTransaction::createIndexOnServer, info)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didCreateIndexOnServer(result); >+ }, [protectedThis = makeRef(*this), info = info.isolatedCopy()] (auto& operation) { >+ protectedThis->createIndexOnServer(operation, info); >+ })); > > return std::make_unique<IDBIndex>(*scriptExecutionContext(), info, objectStore); > } >@@ -778,7 +794,11 @@ void IDBTransaction::renameIndex(IDBInde > uint64_t indexIdentifier = index.info().identifier(); > > LOG(IndexedDBOperations, "IDB rename index operation: %s to %s under object store %" PRIu64, index.info().condensedLoggingString().utf8().data(), newName.utf8().data(), index.info().objectStoreIdentifier()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameIndexOnServer, &IDBTransaction::renameIndexOnServer, objectStoreIdentifier, indexIdentifier, newName)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didRenameIndexOnServer(result); >+ }, [protectedThis = makeRef(*this), objectStoreIdentifier, indexIdentifier, newName = newName.isolatedCopy()] (auto& operation) { >+ protectedThis->renameIndexOnServer(operation, objectStoreIdentifier, indexIdentifier, newName); >+ })); > } > > void IDBTransaction::renameIndexOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const uint64_t& indexIdentifier, const String& newName) >@@ -830,7 +850,11 @@ Ref<IDBRequest> IDBTransaction::doReques > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB open cursor operation: %s", cursor->info().loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didOpenCursorOnServer, &IDBTransaction::openCursorOnServer, cursor->info())); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didOpenCursorOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), info = cursor->info().isolatedCopy()] (auto& operation) { >+ protectedThis->openCursorOnServer(operation, info); >+ })); > > return request; > } >@@ -861,7 +885,11 @@ void IDBTransaction::iterateCursor(IDBCu > addRequest(*cursor.request()); > > LOG(IndexedDBOperations, "IDB iterate cursor operation: %s %s", cursor.info().loggingString().utf8().data(), data.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, *cursor.request(), &IDBTransaction::didIterateCursorOnServer, &IDBTransaction::iterateCursorOnServer, data)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, *cursor.request(), [protectedThis = makeRef(*this), request = makeRef(*cursor.request())] (const auto& result) { >+ protectedThis->didIterateCursorOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), data = data.isolatedCopy()] (auto& operation) { >+ protectedThis->iterateCursorOnServer(operation, data); >+ })); > } > > // FIXME: changes here >@@ -895,7 +923,11 @@ Ref<IDBRequest> IDBTransaction::requestG > IDBGetAllRecordsData getAllRecordsData { keyRangeData, getAllType, count, objectStore.info().identifier(), 0 }; > > LOG(IndexedDBOperations, "IDB get all object store records operation: %s", getAllRecordsData.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetAllRecordsOnServer, &IDBTransaction::getAllRecordsOnServer, getAllRecordsData)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetAllRecordsOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), getAllRecordsData = getAllRecordsData.isolatedCopy()] (auto& operation) { >+ protectedThis->getAllRecordsOnServer(operation, getAllRecordsData); >+ })); > > return request; > } >@@ -914,7 +946,11 @@ Ref<IDBRequest> IDBTransaction::requestG > IDBGetAllRecordsData getAllRecordsData { keyRangeData, getAllType, count, index.objectStore().info().identifier(), index.info().identifier() }; > > LOG(IndexedDBOperations, "IDB get all index records operation: %s", getAllRecordsData.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetAllRecordsOnServer, &IDBTransaction::getAllRecordsOnServer, getAllRecordsData)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetAllRecordsOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), getAllRecordsData = getAllRecordsData.isolatedCopy()] (auto& operation) { >+ protectedThis->getAllRecordsOnServer(operation, getAllRecordsData); >+ })); > > return request; > } >@@ -967,7 +1003,11 @@ Ref<IDBRequest> IDBTransaction::requestG > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB get record operation: %s %s", objectStore.info().condensedLoggingString().utf8().data(), getRecordData.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, getRecordData)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetRecordOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), getRecordData = getRecordData.isolatedCopy()] (auto& operation) { >+ protectedThis->getRecordOnServer(operation, getRecordData); >+ })); > > return request; > } >@@ -1003,7 +1043,11 @@ Ref<IDBRequest> IDBTransaction::requestI > IDBGetRecordData getRecordData = { range, IDBGetRecordDataType::KeyAndValue }; > > LOG(IndexedDBOperations, "IDB get index record operation: %s %s", index.info().condensedLoggingString().utf8().data(), getRecordData.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetRecordOnServer, &IDBTransaction::getRecordOnServer, getRecordData)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetRecordOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), getRecordData = getRecordData.isolatedCopy()] (auto& operation) { >+ protectedThis->getRecordOnServer(operation, getRecordData); >+ })); > > return request; > } >@@ -1062,7 +1106,11 @@ Ref<IDBRequest> IDBTransaction::requestC > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB object store count operation: %s, range %s", objectStore.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetCountOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), range = range.isolatedCopy()] (auto& operation) { >+ protectedThis->getCountOnServer(operation, range); >+ })); > > return request; > } >@@ -1080,7 +1128,11 @@ Ref<IDBRequest> IDBTransaction::requestC > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB index count operation: %s, range %s", index.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didGetCountOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), range = range.isolatedCopy()] (auto& operation) { >+ protectedThis->getCountOnServer(operation, range); >+ })); > > return request; > } >@@ -1115,7 +1167,11 @@ Ref<IDBRequest> IDBTransaction::requestD > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB delete record operation: %s, range %s", objectStore.info().condensedLoggingString().utf8().data(), range.loggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didDeleteRecordOnServer, &IDBTransaction::deleteRecordOnServer, range)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didDeleteRecordOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), range = range.isolatedCopy()] (auto& operation) { >+ protectedThis->deleteRecordOnServer(operation, range); >+ })); > return request; > } > >@@ -1150,7 +1206,11 @@ Ref<IDBRequest> IDBTransaction::requestC > uint64_t objectStoreIdentifier = objectStore.info().identifier(); > > LOG(IndexedDBOperations, "IDB clear object store operation: %s", objectStore.info().condensedLoggingString().utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didClearObjectStoreOnServer, &IDBTransaction::clearObjectStoreOnServer, objectStoreIdentifier)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didClearObjectStoreOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), objectStoreIdentifier] (auto& operation) { >+ protectedThis->clearObjectStoreOnServer(operation, objectStoreIdentifier); >+ })); > > return request; > } >@@ -1172,7 +1232,7 @@ void IDBTransaction::didClearObjectStore > completeNoncursorRequest(request, resultData); > } > >-Ref<IDBRequest> IDBTransaction::requestPutOrAdd(ExecState& state, IDBObjectStore& objectStore, IDBKey* key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode) >+Ref<IDBRequest> IDBTransaction::requestPutOrAdd(ExecState& state, IDBObjectStore& objectStore, RefPtr<IDBKey>&& key, SerializedScriptValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode) > { > LOG(IndexedDB, "IDBTransaction::requestPutOrAdd"); > ASSERT(isActive()); >@@ -1186,7 +1246,11 @@ Ref<IDBRequest> IDBTransaction::requestP > addRequest(request.get()); > > LOG(IndexedDBOperations, "IDB putOrAdd operation: %s key: %s", objectStore.info().condensedLoggingString().utf8().data(), key ? key->loggingString().utf8().data() : "<null key>"); >- scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didPutOrAddOnServer, &IDBTransaction::putOrAddOnServer, key, &value, overwriteMode)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, request.get(), [protectedThis = makeRef(*this), request = request.copyRef()] (const auto& result) { >+ protectedThis->didPutOrAddOnServer(request.get(), result); >+ }, [protectedThis = makeRef(*this), key, value = makeRef(value), overwriteMode] (auto& operation) { >+ protectedThis->putOrAddOnServer(operation, key.get(), value.ptr(), overwriteMode); >+ })); > > return request; > } >@@ -1270,7 +1334,11 @@ void IDBTransaction::deleteObjectStore(c > } > > LOG(IndexedDBOperations, "IDB delete object store operation: %s", objectStoreName.utf8().data()); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteObjectStoreOnServer, &IDBTransaction::deleteObjectStoreOnServer, objectStoreName)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didDeleteObjectStoreOnServer(result); >+ }, [protectedThis = makeRef(*this), objectStoreName = objectStoreName.isolatedCopy()] (auto& operation) { >+ protectedThis->deleteObjectStoreOnServer(operation, objectStoreName); >+ })); > } > > void IDBTransaction::deleteObjectStoreOnServer(IDBClient::TransactionOperation& operation, const String& objectStoreName) >@@ -1296,7 +1364,11 @@ void IDBTransaction::deleteIndex(uint64_ > ASSERT(isVersionChange()); > > LOG(IndexedDBOperations, "IDB delete index operation: %s (%" PRIu64 ")", indexName.utf8().data(), objectStoreIdentifier); >- scheduleOperation(IDBClient::createTransactionOperation(*this, &IDBTransaction::didDeleteIndexOnServer, &IDBTransaction::deleteIndexOnServer, objectStoreIdentifier, indexName)); >+ scheduleOperation(IDBClient::TransactionOperationImpl::create(*this, [protectedThis = makeRef(*this)] (const auto& result) { >+ protectedThis->didDeleteIndexOnServer(result); >+ }, [protectedThis = makeRef(*this), objectStoreIdentifier, indexName = indexName.isolatedCopy()] (auto& operation) { >+ protectedThis->deleteIndexOnServer(operation, objectStoreIdentifier, indexName); >+ })); > } > > void IDBTransaction::deleteIndexOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& indexName) >Index: Source/WebCore/Modules/indexeddb/IDBTransaction.h >=================================================================== >--- Source/WebCore/Modules/indexeddb/IDBTransaction.h (revision 240589) >+++ Source/WebCore/Modules/indexeddb/IDBTransaction.h (working copy) >@@ -113,7 +113,7 @@ public: > std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&); > void renameIndex(IDBIndex&, const String& newName); > >- Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode); >+ Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, RefPtr<IDBKey>&&, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode); > Ref<IDBRequest> requestGetRecord(JSC::ExecState&, IDBObjectStore&, const IDBGetRecordData&); > Ref<IDBRequest> requestGetAllObjectStoreRecords(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, Optional<uint32_t> count); > Ref<IDBRequest> requestGetAllIndexRecords(JSC::ExecState&, IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, Optional<uint32_t> count); >Index: Source/WebCore/Modules/indexeddb/client/TransactionOperation.h >=================================================================== >--- Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (revision 240589) >+++ Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (working copy) >@@ -96,7 +96,7 @@ public: > > // m_completeFunction might be holding the last ref to this TransactionOperation, > // so we need to do this trick to null it out without first destroying it. >- WTF::Function<void (const IDBResultData&)> oldCompleteFunction; >+ Function<void(const IDBResultData&)> oldCompleteFunction; > std::swap(m_completeFunction, oldCompleteFunction); > > m_performFunction = { }; >@@ -126,8 +126,8 @@ protected: > uint64_t m_indexIdentifier { 0 }; > std::unique_ptr<IDBResourceIdentifier> m_cursorIdentifier; > IndexedDB::IndexRecordType m_indexRecordType; >- WTF::Function<void ()> m_performFunction; >- WTF::Function<void (const IDBResultData&)> m_completeFunction; >+ Function<void()> m_performFunction; >+ Function<void(const IDBResultData&)> m_completeFunction; > > private: > IDBResourceIdentifier transactionIdentifier() const { return m_transaction->info().identifier(); } >@@ -142,124 +142,41 @@ private: > bool m_nextRequestCanGoToServer { true }; > }; > >-template <typename... Arguments> > class TransactionOperationImpl final : public TransactionOperation { > public: >- TransactionOperationImpl(IDBTransaction& transaction, void (IDBTransaction::*completeMethod)(const IDBResultData&), void (IDBTransaction::*performMethod)(TransactionOperation&, Arguments...), Arguments&&... arguments) >+ template<typename... Args> static Ref<TransactionOperationImpl> create(Args&&... args) { return adoptRef(*new TransactionOperationImpl(std::forward<Args>(args)...)); } >+private: >+ TransactionOperationImpl(IDBTransaction& transaction, Function<void(const IDBResultData&)> completeMethod, Function<void(TransactionOperation&)> performMethod) > : TransactionOperation(transaction) > { >- RefPtr<TransactionOperation> protectedThis(this); >- > ASSERT(performMethod); >- m_performFunction = [protectedThis, this, performMethod, arguments...] { >- (&m_transaction.get()->*performMethod)(*this, arguments...); >+ m_performFunction = [protectedThis = makeRef(*this), performMethod = WTFMove(performMethod)] { >+ performMethod(protectedThis.get()); > }; > > if (completeMethod) { >- m_completeFunction = [protectedThis, this, completeMethod](const IDBResultData& resultData) { >- if (completeMethod) >- (&m_transaction.get()->*completeMethod)(resultData); >+ m_completeFunction = [protectedThis = makeRef(*this), completeMethod = WTFMove(completeMethod)] (const IDBResultData& resultData) { >+ completeMethod(resultData); > }; > } > } > >- TransactionOperationImpl(IDBTransaction& transaction, IDBRequest& request, void (IDBTransaction::*completeMethod)(IDBRequest&, const IDBResultData&), void (IDBTransaction::*performMethod)(TransactionOperation&, Arguments...), Arguments&&... arguments) >+ TransactionOperationImpl(IDBTransaction& transaction, IDBRequest& request, Function<void(const IDBResultData&)> completeMethod, Function<void(TransactionOperation&)> performMethod) > : TransactionOperation(transaction, request) > { >- RefPtr<TransactionOperation> protectedThis(this); >- > ASSERT(performMethod); >- m_performFunction = [protectedThis, this, performMethod, arguments...] { >- (&m_transaction.get()->*performMethod)(*this, arguments...); >+ m_performFunction = [protectedThis = makeRef(*this), performMethod = WTFMove(performMethod)] { >+ performMethod(protectedThis.get()); > }; > > if (completeMethod) { >- RefPtr<IDBRequest> refRequest(&request); >- m_completeFunction = [protectedThis, this, refRequest, completeMethod](const IDBResultData& resultData) { >- if (completeMethod) >- (&m_transaction.get()->*completeMethod)(*refRequest, resultData); >+ m_completeFunction = [protectedThis = makeRef(*this), completeMethod = WTFMove(completeMethod)] (const IDBResultData& resultData) { >+ completeMethod(resultData); > }; > } > } > }; > >-inline Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- void (IDBTransaction::*complete)(const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&)) >-{ >- return adoptRef(*new TransactionOperationImpl<>(transaction, complete, perform)); >-} >- >-template<typename MP1, typename P1> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- void (IDBTransaction::*complete)(const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1), >- const P1& parameter1) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1>(transaction, complete, perform, parameter1)); >-} >- >-template<typename MP1, typename P1, typename MP2, typename P2> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- void (IDBTransaction::*complete)(const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2), >- const P1& parameter1, >- const P2& parameter2) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1, MP2>(transaction, complete, perform, parameter1, parameter2)); >-} >- >-template<typename MP1, typename P1, typename MP2, typename P2, typename MP3, typename P3> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- void (IDBTransaction::*complete)(const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2, MP3), >- const P1& parameter1, >- const P2& parameter2, >- const P3& parameter3) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1, MP2, MP3>(transaction, complete, perform, parameter1, parameter2, parameter3)); >-} >- >-template<typename MP1, typename P1> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- IDBRequest& request, >- void (IDBTransaction::*complete)(IDBRequest&, const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1), >- const P1& parameter1) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1>(transaction, request, complete, perform, parameter1)); >-} >- >-template<typename MP1, typename P1, typename MP2, typename P2> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- IDBRequest& request, >- void (IDBTransaction::*complete)(IDBRequest&, const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2), >- const P1& parameter1, >- const P2& parameter2) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1, MP2>(transaction, request, complete, perform, parameter1, parameter2)); >-} >- >-template<typename MP1, typename MP2, typename MP3, typename P1, typename P2, typename P3> >-Ref<TransactionOperation> createTransactionOperation( >- IDBTransaction& transaction, >- IDBRequest& request, >- void (IDBTransaction::*complete)(IDBRequest&, const IDBResultData&), >- void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2, MP3), >- const P1& parameter1, >- const P2& parameter2, >- const P3& parameter3) >-{ >- return adoptRef(*new TransactionOperationImpl<MP1, MP2, MP3>(transaction, request, complete, perform, parameter1, parameter2, parameter3)); >-} >- > } // namespace IDBClient > } // namespace WebCore >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
thorton
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193933
: 360396