Diff
Modified: trunk/Source/WebCore/ChangeLog (218047 => 218048)
--- trunk/Source/WebCore/ChangeLog 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/ChangeLog 2017-06-10 05:24:39 UTC (rev 218048)
@@ -1,3 +1,48 @@
+2017-06-09 Chris Dumez <[email protected]>
+
+ Use WTF::Function instead of std::function in indexeddb code
+ https://bugs.webkit.org/show_bug.cgi?id=173198
+
+ Reviewed by Sam Weinig.
+
+ Use WTF::Function instead of std::function in indexeddb code to avoid copying.
+
+ * Modules/indexeddb/IDBFactory.cpp:
+ (WebCore::IDBFactory::getAllDatabaseNames):
+ * Modules/indexeddb/IDBFactory.h:
+ * Modules/indexeddb/client/IDBConnectionProxy.cpp:
+ (WebCore::IDBClient::IDBConnectionProxy::getAllDatabaseNames):
+ * Modules/indexeddb/client/IDBConnectionProxy.h:
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
+ * Modules/indexeddb/client/IDBConnectionToServer.h:
+ * Modules/indexeddb/client/TransactionOperation.h:
+ (WebCore::IDBClient::TransactionOperation::doComplete):
+ * Modules/indexeddb/server/IDBServer.cpp:
+ (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
+ (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesForOrigins):
+ * Modules/indexeddb/server/IDBServer.h:
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
+ (WebCore::IDBServer::UniqueIDBDatabase::createObjectStore):
+ (WebCore::IDBServer::UniqueIDBDatabase::deleteObjectStore):
+ (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
+ (WebCore::IDBServer::UniqueIDBDatabase::clearObjectStore):
+ (WebCore::IDBServer::UniqueIDBDatabase::createIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::putOrAdd):
+ (WebCore::IDBServer::UniqueIDBDatabase::getRecord):
+ (WebCore::IDBServer::UniqueIDBDatabase::getAllRecords):
+ (WebCore::IDBServer::UniqueIDBDatabase::getCount):
+ (WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
+ (WebCore::IDBServer::UniqueIDBDatabase::openCursor):
+ (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
+ (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
+ (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
+ (WebCore::IDBServer::UniqueIDBDatabase::activateTransactionInBackingStore):
+ * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
2017-06-09 Dan Bernstein <[email protected]>
Tried to fix the build when targrting macOS 10.12 using the macOS 10.13 developer beta SDK.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -134,9 +134,9 @@
return first->compare(second.get());
}
-void IDBFactory::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)> callback)
+void IDBFactory::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
{
- m_connectionProxy->getAllDatabaseNames(mainFrameOrigin, openingOrigin, callback);
+ m_connectionProxy->getAllDatabaseNames(mainFrameOrigin, openingOrigin, WTFMove(callback));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -28,7 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
#include "ExceptionOr.h"
-#include <functional>
+#include <wtf/Function.h>
#include <wtf/Forward.h>
#include <wtf/Ref.h>
#include <wtf/ThreadSafeRefCounted.h>
@@ -59,7 +59,7 @@
ExceptionOr<short> cmp(JSC::ExecState&, JSC::JSValue first, JSC::JSValue second);
- WEBCORE_EXPORT void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)>);
+ WEBCORE_EXPORT void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
private:
explicit IDBFactory(IDBClient::IDBConnectionProxy&);
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -484,12 +484,12 @@
task->performTask();
}
-void IDBConnectionProxy::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)> callback)
+void IDBConnectionProxy::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
{
// This method is only meant to be called by the web inspector on the main thread.
RELEASE_ASSERT(isMainThread());
- m_connectionToServer.getAllDatabaseNames(mainFrameOrigin, openingOrigin, callback);
+ m_connectionToServer.getAllDatabaseNames(mainFrameOrigin, openingOrigin, WTFMove(callback));
}
void IDBConnectionProxy::registerDatabaseConnection(IDBDatabase& database)
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -30,9 +30,9 @@
#include "IDBConnectionToServer.h"
#include "IDBResourceIdentifier.h"
#include "TransactionOperation.h"
-#include <functional>
#include <wtf/CrossThreadQueue.h>
#include <wtf/CrossThreadTask.h>
+#include <wtf/Function.h>
#include <wtf/HashMap.h>
#include <wtf/MainThread.h>
#include <wtf/RefPtr.h>
@@ -114,7 +114,7 @@
void ref();
void deref();
- void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)>);
+ void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
void registerDatabaseConnection(IDBDatabase&);
void unregisterDatabaseConnection(IDBDatabase&);
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -423,7 +423,7 @@
m_delegate->abortOpenAndUpgradeNeeded(databaseConnectionIdentifier, transactionIdentifier);
}
-void IDBConnectionToServer::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)> callback)
+void IDBConnectionToServer::getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, Function<void (const Vector<String>&)>&& callback)
{
static uint64_t callbackID = 0;
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -30,6 +30,7 @@
#include "IDBConnectionProxy.h"
#include "IDBConnectionToServerDelegate.h"
#include "IDBResourceIdentifier.h"
+#include <wtf/Function.h>
#include <wtf/HashMap.h>
#include <wtf/Ref.h>
#include <wtf/ThreadSafeRefCounted.h>
@@ -136,7 +137,7 @@
// versionchange transaction, but the page is already torn down.
void abortOpenAndUpgradeNeeded(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& transactionIdentifier);
- void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, std::function<void (const Vector<String>&)>);
+ void getAllDatabaseNames(const SecurityOrigin& mainFrameOrigin, const SecurityOrigin& openingOrigin, WTF::Function<void (const Vector<String>&)>&&);
WEBCORE_EXPORT void didGetAllDatabaseNames(uint64_t callbackID, const Vector<String>& databaseNames);
private:
@@ -144,7 +145,7 @@
Ref<IDBConnectionToServerDelegate> m_delegate;
- HashMap<uint64_t, std::function<void (const Vector<String>&)>> m_getAllDatabaseNamesCallbacks;
+ HashMap<uint64_t, WTF::Function<void (const Vector<String>&)>> m_getAllDatabaseNamesCallbacks;
std::unique_ptr<IDBConnectionProxy> m_proxy;
};
Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -32,6 +32,7 @@
#include "IDBResourceIdentifier.h"
#include "IDBResultData.h"
#include "IDBTransaction.h"
+#include <wtf/Function.h>
#include <wtf/MainThread.h>
#include <wtf/Threading.h>
@@ -95,7 +96,7 @@
// 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.
- std::function<void (const IDBResultData&)> oldCompleteFunction;
+ WTF::Function<void (const IDBResultData&)> oldCompleteFunction;
std::swap(m_completeFunction, oldCompleteFunction);
}
@@ -123,8 +124,8 @@
uint64_t m_indexIdentifier { 0 };
std::unique_ptr<IDBResourceIdentifier> m_cursorIdentifier;
IndexedDB::IndexRecordType m_indexRecordType;
- std::function<void ()> m_performFunction;
- std::function<void (const IDBResultData&)> m_completeFunction;
+ WTF::Function<void ()> m_performFunction;
+ WTF::Function<void (const IDBResultData&)> m_completeFunction;
private:
IDBResourceIdentifier transactionIdentifier() const { return m_transaction->info().identifier(); }
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -536,7 +536,7 @@
return ++currentID;
}
-void IDBServer::closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point modificationTime, std::function<void ()> completionHandler)
+void IDBServer::closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point modificationTime, Function<void ()>&& completionHandler)
{
uint64_t callbackID = generateDeleteCallbackID();
auto addResult = m_deleteDatabaseCompletionHandlers.add(callbackID, WTFMove(completionHandler));
@@ -558,7 +558,7 @@
postDatabaseTask(createCrossThreadTask(*this, &IDBServer::performCloseAndDeleteDatabasesModifiedSince, modificationTime, callbackID));
}
-void IDBServer::closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>& origins, std::function<void ()> completionHandler)
+void IDBServer::closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>& origins, Function<void ()>&& completionHandler)
{
uint64_t callbackID = generateDeleteCallbackID();
auto addResult = m_deleteDatabaseCompletionHandlers.add(callbackID, WTFMove(completionHandler));
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -102,8 +102,8 @@
std::unique_ptr<IDBBackingStore> createBackingStore(const IDBDatabaseIdentifier&);
- WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, std::function<void ()> completionHandler);
- WEBCORE_EXPORT void closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, std::function<void ()> completionHandler);
+ WEBCORE_EXPORT void closeAndDeleteDatabasesModifiedSince(std::chrono::system_clock::time_point, Function<void ()>&& completionHandler);
+ WEBCORE_EXPORT void closeAndDeleteDatabasesForOrigins(const Vector<SecurityOriginData>&, Function<void ()>&& completionHandler);
private:
IDBServer(IDBBackingStoreTemporaryFileHandler&);
@@ -136,7 +136,7 @@
HashMap<uint64_t, UniqueIDBDatabaseConnection*> m_databaseConnections;
HashMap<IDBResourceIdentifier, UniqueIDBDatabaseTransaction*> m_transactions;
- HashMap<uint64_t, std::function<void ()>> m_deleteDatabaseCompletionHandlers;
+ HashMap<uint64_t, Function<void ()>> m_deleteDatabaseCompletionHandlers;
String m_databaseDirectoryPath;
IDBBackingStoreTemporaryFileHandler& m_backingStoreTemporaryFileHandler;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -383,7 +383,7 @@
return ++currentID;
}
-uint64_t UniqueIDBDatabase::storeCallbackOrFireError(ErrorCallback callback)
+uint64_t UniqueIDBDatabase::storeCallbackOrFireError(ErrorCallback&& callback)
{
if (m_hardClosedForUserDelete) {
callback(IDBError::userDeleteError());
@@ -392,11 +392,11 @@
uint64_t identifier = generateUniqueCallbackIdentifier();
ASSERT(!m_errorCallbacks.contains(identifier));
- m_errorCallbacks.add(identifier, callback);
+ m_errorCallbacks.add(identifier, WTFMove(callback));
return identifier;
}
-uint64_t UniqueIDBDatabase::storeCallbackOrFireError(KeyDataCallback callback)
+uint64_t UniqueIDBDatabase::storeCallbackOrFireError(KeyDataCallback&& callback)
{
if (m_hardClosedForUserDelete) {
callback(IDBError::userDeleteError(), { });
@@ -405,11 +405,11 @@
uint64_t identifier = generateUniqueCallbackIdentifier();
ASSERT(!m_keyDataCallbacks.contains(identifier));
- m_keyDataCallbacks.add(identifier, callback);
+ m_keyDataCallbacks.add(identifier, WTFMove(callback));
return identifier;
}
-uint64_t UniqueIDBDatabase::storeCallbackOrFireError(GetResultCallback callback)
+uint64_t UniqueIDBDatabase::storeCallbackOrFireError(GetResultCallback&& callback)
{
if (m_hardClosedForUserDelete) {
callback(IDBError::userDeleteError(), { });
@@ -418,11 +418,11 @@
uint64_t identifier = generateUniqueCallbackIdentifier();
ASSERT(!m_getResultCallbacks.contains(identifier));
- m_getResultCallbacks.add(identifier, callback);
+ m_getResultCallbacks.add(identifier, WTFMove(callback));
return identifier;
}
-uint64_t UniqueIDBDatabase::storeCallbackOrFireError(GetAllResultsCallback callback)
+uint64_t UniqueIDBDatabase::storeCallbackOrFireError(GetAllResultsCallback&& callback)
{
if (m_hardClosedForUserDelete) {
callback(IDBError::userDeleteError(), { });
@@ -431,11 +431,11 @@
uint64_t identifier = generateUniqueCallbackIdentifier();
ASSERT(!m_getAllResultsCallbacks.contains(identifier));
- m_getAllResultsCallbacks.add(identifier, callback);
+ m_getAllResultsCallbacks.add(identifier, WTFMove(callback));
return identifier;
}
-uint64_t UniqueIDBDatabase::storeCallbackOrFireError(CountCallback callback)
+uint64_t UniqueIDBDatabase::storeCallbackOrFireError(CountCallback&& callback)
{
if (m_hardClosedForUserDelete) {
callback(IDBError::userDeleteError(), 0);
@@ -444,7 +444,7 @@
uint64_t identifier = generateUniqueCallbackIdentifier();
ASSERT(!m_countCallbacks.contains(identifier));
- m_countCallbacks.add(identifier, callback);
+ m_countCallbacks.add(identifier, WTFMove(callback));
return identifier;
}
@@ -616,7 +616,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::createObjectStore");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -651,7 +651,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteObjectStore");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -692,7 +692,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::renameObjectStore");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -733,7 +733,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::clearObjectStore");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performClearObjectStore, callbackID, transaction.info().identifier(), objectStoreIdentifier));
@@ -764,7 +764,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::createIndex");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performCreateIndex, callbackID, transaction.info().identifier(), info));
@@ -801,7 +801,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteIndex");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -851,7 +851,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::renameIndex");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -905,7 +905,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::putOrAdd");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPutOrAdd, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyData, value, overwriteMode));
@@ -1045,7 +1045,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::getRecord");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -1060,7 +1060,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::getAllRecords");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -1127,7 +1127,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::getCount");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performGetCount, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), requestData.indexIdentifier(), range));
@@ -1160,7 +1160,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteRecord");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteRecord, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyRangeData));
@@ -1189,7 +1189,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::openCursor");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performOpenCursor, callbackID, requestData.transactionIdentifier(), info));
@@ -1219,7 +1219,7 @@
ASSERT(isMainThread());
LOG(IndexedDB, "(main) UniqueIDBDatabase::iterateCursor");
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performIterateCursor, callbackID, requestData.transactionIdentifier(), requestData.cursorIdentifier(), data));
@@ -1283,7 +1283,7 @@
ASSERT(&transaction.databaseConnection().database() == this);
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -1327,7 +1327,7 @@
ASSERT(&transaction.databaseConnection().database() == this);
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
@@ -1570,11 +1570,11 @@
RefPtr<UniqueIDBDatabase> protectedThis(this);
RefPtr<UniqueIDBDatabaseTransaction> refTransaction(&transaction);
- auto callback = [protectedThis, refTransaction](const IDBError& error) {
+ ErrorCallback callback = [protectedThis, refTransaction](const IDBError& error) {
refTransaction->didActivateInBackingStore(error);
};
- uint64_t callbackID = storeCallbackOrFireError(callback);
+ uint64_t callbackID = storeCallbackOrFireError(WTFMove(callback));
if (!callbackID)
return;
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performActivateTransactionInBackingStore, callbackID, transaction.info()));
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (218047 => 218048)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2017-06-10 05:24:39 UTC (rev 218048)
@@ -40,6 +40,7 @@
#include <wtf/CrossThreadQueue.h>
#include <wtf/CrossThreadTask.h>
#include <wtf/Deque.h>
+#include <wtf/Function.h>
#include <wtf/HashCountedSet.h>
#include <wtf/HashSet.h>
#include <wtf/ListHashSet.h>
@@ -68,11 +69,11 @@
class IDBConnectionToClient;
class IDBServer;
-typedef std::function<void(const IDBError&)> ErrorCallback;
-typedef std::function<void(const IDBError&, const IDBKeyData&)> KeyDataCallback;
-typedef std::function<void(const IDBError&, const IDBGetResult&)> GetResultCallback;
-typedef std::function<void(const IDBError&, const IDBGetAllResult&)> GetAllResultsCallback;
-typedef std::function<void(const IDBError&, uint64_t)> CountCallback;
+typedef Function<void(const IDBError&)> ErrorCallback;
+typedef Function<void(const IDBError&, const IDBKeyData&)> KeyDataCallback;
+typedef Function<void(const IDBError&, const IDBGetResult&)> GetResultCallback;
+typedef Function<void(const IDBError&, const IDBGetAllResult&)> GetAllResultsCallback;
+typedef Function<void(const IDBError&, uint64_t)> CountCallback;
class UniqueIDBDatabase : public ThreadSafeRefCounted<UniqueIDBDatabase> {
public:
@@ -192,11 +193,11 @@
void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&);
void didPerformUnconditionalDeleteBackingStore();
- uint64_t storeCallbackOrFireError(ErrorCallback);
- uint64_t storeCallbackOrFireError(KeyDataCallback);
- uint64_t storeCallbackOrFireError(GetAllResultsCallback);
- uint64_t storeCallbackOrFireError(GetResultCallback);
- uint64_t storeCallbackOrFireError(CountCallback);
+ uint64_t storeCallbackOrFireError(ErrorCallback&&);
+ uint64_t storeCallbackOrFireError(KeyDataCallback&&);
+ uint64_t storeCallbackOrFireError(GetAllResultsCallback&&);
+ uint64_t storeCallbackOrFireError(GetResultCallback&&);
+ uint64_t storeCallbackOrFireError(CountCallback&&);
void performErrorCallback(uint64_t callbackIdentifier, const IDBError&);
void performKeyDataCallback(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&);
Modified: trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp (218047 => 218048)
--- trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2017-06-10 05:19:32 UTC (rev 218047)
+++ trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp 2017-06-10 05:24:39 UTC (rev 218048)
@@ -581,8 +581,7 @@
if (!idbFactory)
return;
- RefPtr<RequestDatabaseNamesCallback> callback = WTFMove(requestCallback);
- idbFactory->getAllDatabaseNames(topOrigin, openingOrigin, [callback](auto& databaseNames) {
+ idbFactory->getAllDatabaseNames(topOrigin, openingOrigin, [callback = WTFMove(requestCallback)](auto& databaseNames) {
if (!callback->isActive())
return;