TaskTree: Rename TreeStorage<> -> Storage<>

This addresses the 20th point in the master task below.

Task-number: QTCREATORBUG-28741
Change-Id: I696beda87430fbe637abba8054012fb77516e220
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-11-19 14:50:55 +01:00
parent 9800f1bdc4
commit ce80a6dad5
48 changed files with 93 additions and 93 deletions

View File

@@ -59,7 +59,7 @@ private:
};
template <int Limit = 1>
using MultiBarrier = TreeStorage<SharedBarrier<Limit>>;
using MultiBarrier = Storage<SharedBarrier<Limit>>;
// Can't write: "MultiBarrier barrier;". Only "MultiBarrier<> barrier;" would work.
// Can't have one alias with default type in C++17, getting the following error:

View File

@@ -121,7 +121,7 @@ private:
QSharedPointer<StorageData> m_storageData;
template <typename StorageStruct> friend class TreeStorage;
template <typename StorageStruct> friend class Storage;
friend class ExecutionContextActivator;
friend class StorageData;
friend class TaskRuntimeContainer;
@@ -130,10 +130,10 @@ private:
};
template <typename StorageStruct>
class TreeStorage final : public StorageBase
class Storage final : public StorageBase
{
public:
TreeStorage() : StorageBase(TreeStorage::ctor(), TreeStorage::dtor()) {}
Storage() : StorageBase(Storage::ctor(), Storage::dtor()) {}
StorageStruct &operator*() const noexcept { return *activeStorage(); }
StorageStruct *operator->() const noexcept { return activeStorage(); }
StorageStruct *activeStorage() const {
@@ -491,7 +491,7 @@ public:
int progressValue() const; // all finished / skipped / stopped tasks, groups itself excluded
template <typename StorageStruct, typename Handler>
void onStorageSetup(const TreeStorage<StorageStruct> &storage, Handler &&handler) {
void onStorageSetup(const Storage<StorageStruct> &storage, Handler &&handler) {
static_assert(std::is_invocable_v<std::decay_t<Handler>, StorageStruct &>,
"Storage setup handler needs to take (Storage &) as an argument. "
"The passed handler doesn't fulfill this requirement.");
@@ -499,7 +499,7 @@ public:
wrapHandler<StorageStruct>(std::forward<Handler>(handler)), {});
}
template <typename StorageStruct, typename Handler>
void onStorageDone(const TreeStorage<StorageStruct> &storage, Handler &&handler) {
void onStorageDone(const Storage<StorageStruct> &storage, Handler &&handler) {
static_assert(std::is_invocable_v<std::decay_t<Handler>, const StorageStruct &>,
"Storage done handler needs to take (const Storage &) as an argument. "
"The passed handler doesn't fulfill this requirement.");

View File

@@ -323,7 +323,7 @@ static Group interDeviceTransferTask(const FilePath &source, const FilePath &des
{
struct TransferStorage { QPointer<FileStreamWriter> writer; };
SingleBarrier writerReadyBarrier;
TreeStorage<TransferStorage> storage;
Storage<TransferStorage> storage;
const auto onReaderSetup = [storage, source](FileStreamReader &reader) {
reader.setFilePath(source);

View File

@@ -104,7 +104,7 @@ void AndroidSdkDownloader::downloadAndExtractSdk()
using namespace Tasking;
TreeStorage<std::optional<FilePath>> storage;
Storage<std::optional<FilePath>> storage;
const auto onQuerySetup = [this](NetworkQuery &query) {
query.setRequest(QNetworkRequest(m_androidConfig.sdkToolsUrl()));

View File

@@ -351,7 +351,7 @@ void TestRunner::runTestsHelper()
for (ITestConfiguration *config : m_selectedTests) {
QTC_ASSERT(config, continue);
const TreeStorage<TestStorage> storage;
const Storage<TestStorage> storage;
const auto onSetup = [this, config] {
if (!config->project())

View File

@@ -175,8 +175,8 @@ static LocatorMatcherTask currentDocumentMatcher()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
TreeStorage<CurrentDocumentSymbolsData> resultStorage;
Storage<LocatorStorage> storage;
Storage<CurrentDocumentSymbolsData> resultStorage;
const auto onQuerySetup = [=](CurrentDocumentSymbolsRequest &request) {
Q_UNUSED(request)

View File

@@ -659,7 +659,7 @@ Group ClangTool::runRecipe(const RunSettings &runSettings,
QElapsedTimer m_timer;
std::function<void(qint64 elapsedTime)> m_elapsedHandler = {};
};
const TreeStorage<ClangStorage> storage;
const Storage<ClangStorage> storage;
std::shared_ptr<TemporaryDirectory> tempDir(new TemporaryDirectory("clangtools-XXXXXX"));
tempDir->setAutoRemove(qtcEnvironmentVariable("QTC_CLANG_DONT_DELETE_OUTPUT_FILES") != "1");

View File

@@ -119,7 +119,7 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
FilePath executable;
FilePath outputFilePath;
};
const TreeStorage<ClangToolStorage> storage;
const Storage<ClangToolStorage> storage;
const auto mainToolArguments = [=](const ClangToolStorage &data) {
QStringList result;

View File

@@ -27,7 +27,7 @@ static LocatorMatcherTasks cmakeMatchers(const BuildAcceptor &acceptor)
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, acceptor] {
const QString input = storage->input();

View File

@@ -178,7 +178,7 @@ LocatorMatcherTasks ActionsFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [this, storage](Async<void> &async) {
m_entries.clear();

View File

@@ -27,7 +27,7 @@ LocatorMatcherTasks CommandLocator::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, commands = m_commands] {
const QString input = storage->input();

View File

@@ -42,7 +42,7 @@ LocatorMatcherTasks ExecuteFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [=] {
const QString input = storage->input();

View File

@@ -29,7 +29,7 @@ LocatorMatcherTasks ExternalToolsFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage] {
const QString input = storage->input();

View File

@@ -308,7 +308,7 @@ LocatorMatcherTasks FileSystemFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, includeHidden = m_includeHidden, shortcut = shortcutString()]
(Async<void> &async) {

View File

@@ -429,7 +429,7 @@ void LocatorMatcher::start()
{
ResultsCollector *m_collector = nullptr;
};
TreeStorage<CollectorStorage> collectorStorage;
Storage<CollectorStorage> collectorStorage;
const int filterCount = d->m_tasks.size();
const auto onCollectorSetup = [this, filterCount, collectorStorage](ResultsCollector &collector) {
@@ -447,7 +447,7 @@ void LocatorMatcher::start()
QList<GroupItem> parallelTasks {parallelLimit(d->m_parallelLimit)};
const auto onSetup = [this, collectorStorage](const TreeStorage<LocatorStorage> &storage,
const auto onSetup = [this, collectorStorage](const Storage<LocatorStorage> &storage,
int index) {
return [this, collectorStorage, storage, index] {
ResultsCollector *collector = collectorStorage->m_collector;
@@ -1482,7 +1482,7 @@ static void filter(QPromise<LocatorFileCachePrivate> &promise, const LocatorStor
*/
LocatorMatcherTask LocatorFileCache::matcher() const
{
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
std::weak_ptr<LocatorFileCachePrivate> weak = d;
const auto onSetup = [storage, weak](Async<LocatorFileCachePrivate> &async) {

View File

@@ -142,7 +142,7 @@ public:
Tasking::GroupItem task = Tasking::Group{};
// When constructing the task, don't place the storage inside the task above.
Tasking::TreeStorage<LocatorStorage> storage;
Tasking::Storage<LocatorStorage> storage;
};
using LocatorMatcherTasks = QList<LocatorMatcherTask>;

View File

@@ -365,7 +365,7 @@ JavaScriptFilter::~JavaScriptFilter() = default;
LocatorMatcherTasks JavaScriptFilter::matchers()
{
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
if (!m_javaScriptEngine)
m_javaScriptEngine.reset(new JavaScriptEngine);
QPointer<JavaScriptEngine> engine = m_javaScriptEngine.get();

View File

@@ -28,7 +28,7 @@ LocatorMatcherTasks LocatorFiltersFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, icon = m_icon] {
if (!storage->input().isEmpty())

View File

@@ -72,7 +72,7 @@ static void matchEditors(QPromise<void> &promise, const LocatorStorage &storage,
LocatorMatcherTasks OpenDocumentsFilter::matchers()
{
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage](Async<void> &async) {
const QList<Entry> editorsData = Utils::transform(DocumentModel::entries(),

View File

@@ -180,7 +180,7 @@ LocatorMatcherTasks SpotlightLocatorFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage,
command = m_command,

View File

@@ -165,7 +165,7 @@ LocatorMatcherTasks UrlLocatorFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, urls = remoteUrls()] {
const QString input = storage->input();

View File

@@ -106,7 +106,7 @@ LocatorMatcherTask locatorMatcher(IndexItem::ItemType type, const EntryFromIndex
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [=](Async<void> &async) {
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());
@@ -304,7 +304,7 @@ LocatorMatcherTask currentDocumentMatcher()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [=](Async<void> &async) {
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());

View File

@@ -51,7 +51,7 @@ void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo,
struct UpdateStorage {
ProjectInfo::ConstPtr projectInfo = nullptr;
};
const TreeStorage<UpdateStorage> storage;
const Storage<UpdateStorage> storage;
const auto onInfoGeneratorSetup = [=](Async<ProjectInfo::ConstPtr> &async) {
async.setConcurrentCallData(infoGenerator);
async.setFutureSynchronizer(&m_futureSynchronizer);

View File

@@ -108,7 +108,7 @@ DiffFilesController::DiffFilesController(IDocument *document)
setDisplayName(Tr::tr("Diff"));
using namespace Tasking;
const TreeStorage<QList<std::optional<FileData>>> storage;
const Storage<QList<std::optional<FileData>>> storage;
const auto onTreeSetup = [this, storage](TaskTree &taskTree) {
QList<std::optional<FileData>> *outputList = storage.activeStorage();

View File

@@ -545,7 +545,7 @@ TaskTree *BranchView::onFastForwardMerge(const std::function<void()> &callback)
QString topRevision;
};
const TreeStorage<FastForwardStorage> storage;
const Storage<FastForwardStorage> storage;
const auto onMergeBaseSetup = [repository = m_repository, branch](Process &process) {
gitClient().setupCommand(process, repository, {"merge-base", "HEAD", branch});

View File

@@ -236,7 +236,7 @@ GitDiffEditorController::GitDiffEditorController(IDocument *document,
const QStringList &extraArgs)
: GitBaseDiffEditorController(document)
{
const TreeStorage<QString> diffInputStorage;
const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) {
process.setCodec(VcsBaseEditor::getCodec(workingDirectory(), {}));
@@ -299,8 +299,8 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
QString m_unstagedOutput;
};
const TreeStorage<DiffStorage> storage;
const TreeStorage<QString> diffInputStorage;
const Storage<DiffStorage> storage;
const Storage<QString> diffInputStorage;
const auto onStagedSetup = [this, stagedFiles](Process &process) {
if (stagedFiles.isEmpty())
@@ -371,8 +371,8 @@ ShowController::ShowController(IDocument *document, const QString &id)
QStringList m_follows;
};
const TreeStorage<ReloadStorage> storage;
const TreeStorage<QString> diffInputStorage;
const Storage<ReloadStorage> storage;
const Storage<QString> diffInputStorage;
const auto updateDescription = [this](const ReloadStorage &storage) {
QString desc = storage.m_header;

View File

@@ -83,7 +83,7 @@ static void matches(QPromise<QStringList> &promise, const LocatorStorage &storag
LocatorMatcherTasks HelpIndexFilter::matchers()
{
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [this, storage](Async<QStringList> &async) {
if (m_needsUpdate) {

View File

@@ -107,7 +107,7 @@ public:
private:
void cleanup();
Tasking::GroupItem runRecipe() final;
GroupItem runRecipe() final;
void updateDisplayNames();

View File

@@ -48,8 +48,8 @@ LocatorMatcherTask locatorMatcher(Client *client, int maxResultCount,
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
TreeStorage<QList<SymbolInformation>> resultStorage;
Storage<LocatorStorage> storage;
Storage<QList<SymbolInformation>> resultStorage;
const auto onQuerySetup = [storage, client, maxResultCount](ClientWorkspaceSymbolRequest &request) {
request.setClient(client);
@@ -119,8 +119,8 @@ LocatorMatcherTask currentDocumentMatcher()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
TreeStorage<CurrentDocumentSymbolsData> resultStorage;
Storage<LocatorStorage> storage;
Storage<CurrentDocumentSymbolsData> resultStorage;
const auto onQuerySetup = [](CurrentDocumentSymbolsRequest &request) {
Q_UNUSED(request)

View File

@@ -30,7 +30,7 @@ LocatorMatcherTasks MacroLocatorFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, icon = m_icon] {
const QString input = storage->input();

View File

@@ -53,7 +53,7 @@ MercurialDiffEditorController::MercurialDiffEditorController(IDocument *document
using namespace Tasking;
const TreeStorage<QString> diffInputStorage;
const Storage<QString> diffInputStorage;
const auto onDiffSetup = [=](Process &process) {
setupCommand(process, {addConfigurationArguments(args)});

View File

@@ -4179,7 +4179,7 @@ static LocatorMatcherTasks runConfigurationMatchers(const RunAcceptor &acceptor)
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, acceptor] {
const QString input = storage->input();

View File

@@ -78,7 +78,7 @@ LocatorMatcherTasks QmlJSFunctionsFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage, entries = m_data->entries()](Async<void> &async) {
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());

View File

@@ -64,15 +64,15 @@ public:
private:
GroupItem deployRecipe() final;
GroupItem mkdirTask(const TreeStorage<FilesToTransfer> &storage);
GroupItem transferTask(const TreeStorage<FilesToTransfer> &storage);
GroupItem mkdirTask(const Storage<FilesToTransfer> &storage);
GroupItem transferTask(const Storage<FilesToTransfer> &storage);
StringAspect flags{this};
BoolAspect ignoreMissingFiles{this};
SelectionAspect method{this};
};
GroupItem GenericDeployStep::mkdirTask(const TreeStorage<FilesToTransfer> &storage)
GroupItem GenericDeployStep::mkdirTask(const Storage<FilesToTransfer> &storage)
{
using ResultType = expected_str<void>;
@@ -133,7 +133,7 @@ static FileTransferMethod supportedTransferMethodFor(const FileToTransfer &fileT
return FileTransferMethod::GenericCopy;
}
GroupItem GenericDeployStep::transferTask(const TreeStorage<FilesToTransfer> &storage)
GroupItem GenericDeployStep::transferTask(const Storage<FilesToTransfer> &storage)
{
const auto onSetup = [this, storage](FileTransfer &transfer) {
FileTransferMethod preferredTransferMethod = FileTransferMethod::Rsync;
@@ -180,7 +180,7 @@ GroupItem GenericDeployStep::transferTask(const TreeStorage<FilesToTransfer> &st
GroupItem GenericDeployStep::deployRecipe()
{
const TreeStorage<FilesToTransfer> storage;
const Storage<FilesToTransfer> storage;
const auto onSetup = [this, storage] {
const QList<DeployableFile> deployableFiles = target()->deploymentData().allFiles();

View File

@@ -64,11 +64,11 @@ public:
= std::function<void(UploadStorage *, const DeployableFile &, const QDateTime &)>;
GroupItem statTask(UploadStorage *storage, const DeployableFile &file,
StatEndHandler statEndHandler);
GroupItem statTree(const TreeStorage<UploadStorage> &storage, FilesToStat filesToStat,
GroupItem statTree(const Storage<UploadStorage> &storage, FilesToStat filesToStat,
StatEndHandler statEndHandler);
GroupItem uploadTask(const TreeStorage<UploadStorage> &storage);
GroupItem uploadTask(const Storage<UploadStorage> &storage);
GroupItem chmodTask(const DeployableFile &file);
GroupItem chmodTree(const TreeStorage<UploadStorage> &storage);
GroupItem chmodTree(const Storage<UploadStorage> &storage);
BoolAspect incremental{this};
BoolAspect ignoreMissingFiles{this};
@@ -148,7 +148,7 @@ GroupItem GenericDirectUploadStep::statTask(UploadStorage *storage,
return ProcessTask(onSetup, onDone);
}
GroupItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &storage,
GroupItem GenericDirectUploadStep::statTree(const Storage<UploadStorage> &storage,
FilesToStat filesToStat, StatEndHandler statEndHandler)
{
const auto onSetup = [this, storage, filesToStat, statEndHandler](TaskTree &tree) {
@@ -164,7 +164,7 @@ GroupItem GenericDirectUploadStep::statTree(const TreeStorage<UploadStorage> &st
return TaskTreeTask(onSetup);
}
GroupItem GenericDirectUploadStep::uploadTask(const TreeStorage<UploadStorage> &storage)
GroupItem GenericDirectUploadStep::uploadTask(const Storage<UploadStorage> &storage)
{
const auto onSetup = [this, storage](FileTransfer &transfer) {
if (storage->filesToUpload.isEmpty()) {
@@ -223,7 +223,7 @@ GroupItem GenericDirectUploadStep::chmodTask(const DeployableFile &file)
return ProcessTask(onSetup, onError, CallDoneIf::Error);
}
GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &storage)
GroupItem GenericDirectUploadStep::chmodTree(const Storage<UploadStorage> &storage)
{
const auto onSetup = [this, storage](TaskTree &tree) {
QList<DeployableFile> filesToChmod;
@@ -243,7 +243,7 @@ GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &s
GroupItem GenericDirectUploadStep::deployRecipe()
{
const TreeStorage<UploadStorage> storage;
const Storage<UploadStorage> storage;
const auto setupHandler = [this, storage] {
const QList<DeployableFile> deployableFiles = target()->deploymentData().allFiles();

View File

@@ -38,7 +38,7 @@ public:
GroupItem unameTask() const;
GroupItem gathererTask() const;
GroupItem transferTask(FileTransferMethod method,
const TreeStorage<TransferStorage> &storage) const;
const Storage<TransferStorage> &storage) const;
GroupItem transferTasks() const;
GroupItem commandTask(const QString &commandName) const;
GroupItem commandTasks() const;
@@ -168,7 +168,7 @@ GroupItem GenericLinuxDeviceTesterPrivate::gathererTask() const
}
GroupItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod method,
const TreeStorage<TransferStorage> &storage) const
const Storage<TransferStorage> &storage) const
{
const auto onSetup = [this, method](FileTransfer &transfer) {
emit q->progressMessage(Tr::tr("Checking whether \"%1\" works...")
@@ -226,7 +226,7 @@ GroupItem GenericLinuxDeviceTesterPrivate::transferTask(FileTransferMethod metho
GroupItem GenericLinuxDeviceTesterPrivate::transferTasks() const
{
TreeStorage<TransferStorage> storage;
Storage<TransferStorage> storage;
return Group {
continueOnSuccess,
storage,

View File

@@ -163,7 +163,7 @@ SubversionDiffEditorController::SubversionDiffEditorController(IDocument *docume
using namespace Tasking;
const TreeStorage<QString> diffInputStorage;
const Storage<QString> diffInputStorage;
const auto onDescriptionSetup = [this](Process &process) {
if (m_changeNumber == 0)

View File

@@ -29,7 +29,7 @@ LocatorMatcherTasks BookmarkFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [=] { storage->reportOutput(match(storage->input())); };
return {{Sync(onSetup), storage}};

View File

@@ -27,7 +27,7 @@ LocatorMatcherTasks LineNumberFilter::matchers()
{
using namespace Tasking;
TreeStorage<LocatorStorage> storage;
Storage<LocatorStorage> storage;
const auto onSetup = [storage] {
const QStringList lineAndColumn = storage->input().split(':');

View File

@@ -127,7 +127,7 @@ Group ValgrindProcessPrivate::runRecipe() const
std::unique_ptr<QTcpSocket> m_xmlSocket;
};
TreeStorage<ValgrindStorage> storage;
Storage<ValgrindStorage> storage;
SingleBarrier xmlBarrier;
const auto onSetup = [this, storage, xmlBarrier] {

View File

@@ -38,7 +38,7 @@ VcsBaseDiffEditorController::~VcsBaseDiffEditorController()
delete d;
}
GroupItem VcsBaseDiffEditorController::postProcessTask(const TreeStorage<QString> &inputStorage)
GroupItem VcsBaseDiffEditorController::postProcessTask(const Storage<QString> &inputStorage)
{
const auto onSetup = [inputStorage](Async<QList<FileData>> &async) {
async.setFutureSynchronizer(ExtensionSystem::PluginManager::futureSynchronizer());

View File

@@ -26,7 +26,7 @@ public:
void setVcsBinary(const Utils::FilePath &path);
protected:
Tasking::GroupItem postProcessTask(const Tasking::TreeStorage<QString> &inputStorage);
Tasking::GroupItem postProcessTask(const Tasking::Storage<QString> &inputStorage);
void setupCommand(Utils::Process &process, const QStringList &args) const;

View File

@@ -42,7 +42,7 @@ private:
struct TestData
{
TreeStorage<bool> storage;
Storage<bool> storage;
Group root;
};
@@ -136,7 +136,7 @@ template <typename Function, typename ...Args,
typename ResultType = typename ConcurrentResultType<Function, Args...>::Type>
TestData createTestData(const QList<ResultType> &expectedResults, Function &&function, Args &&...args)
{
TreeStorage<bool> storage;
Storage<bool> storage;
const auto onSetup = [=](ConcurrentCall<ResultType> &task) {
task.setConcurrentCallData(function, args...);
@@ -197,8 +197,8 @@ void tst_ConcurrentCall::taskTree_data()
<< createTestData(reportNResult, &MyObject::member, &m_myObject, 2);
{
TreeStorage<bool> storage;
TreeStorage<int> internalStorage;
Storage<bool> storage;
Storage<int> internalStorage;
const auto onSetup = [internalStorage](ConcurrentCall<int> &task) {
task.setConcurrentCallData(multiplyBy2, *internalStorage);

View File

@@ -78,7 +78,7 @@ std::atomic_int CustomStorage::s_count = 0;
struct TestData
{
TreeStorage<CustomStorage> storage;
Storage<CustomStorage> storage;
Group root;
Log expectedLog;
int taskCount = 0;
@@ -258,7 +258,7 @@ void tst_Tasking::runtimeCheck()
QTest::ignoreMessage(QtDebugMsg, QRegularExpression("^SOFT ASSERT: "));
QTest::ignoreMessage(QtWarningMsg,
"Can't add the same storage into one Group twice, skipping...");
const TreeStorage<int> storage;
const Storage<int> storage;
Group {
storage,
@@ -270,7 +270,7 @@ void tst_Tasking::runtimeCheck()
QTest::ignoreMessage(QtDebugMsg, QRegularExpression("^SOFT ASSERT: "));
QTest::ignoreMessage(QtWarningMsg,
"Can't add the same storage into one Group twice, skipping...");
const TreeStorage<int> storage1;
const Storage<int> storage1;
const auto storage2 = storage1;
Group {
@@ -352,7 +352,7 @@ public:
using TickAndDoneTask = CustomTask<TickAndDoneTaskAdapter>;
template <typename SharedBarrierType>
GroupItem createBarrierAdvance(const TreeStorage<CustomStorage> &storage,
GroupItem createBarrierAdvance(const Storage<CustomStorage> &storage,
const SharedBarrierType &barrier, int taskId)
{
return TickAndDoneTask([storage, barrier, taskId](TickAndDone &tickAndDone) {
@@ -398,11 +398,11 @@ static TestData storageShadowingData()
{
// This test check if storage shadowing works OK.
const TreeStorage<CustomStorage> storage;
const Storage<CustomStorage> storage;
// This helper storage collect the pointers to storages created by shadowedStorage.
const TreeStorage<QHash<int, int *>> helperStorage; // One instance in this test.
const Storage<QHash<int, int *>> helperStorage; // One instance in this test.
// This storage is repeated in nested groups, the innermost storage will shadow outer ones.
const TreeStorage<int> shadowedStorage; // Three instances in this test.
const Storage<int> shadowedStorage; // Three instances in this test.
const auto groupSetupWithStorage = [storage, helperStorage, shadowedStorage](int taskId) {
return onGroupSetup([storage, helperStorage, shadowedStorage, taskId] {
@@ -473,7 +473,7 @@ static TestData storageShadowingData()
static TestData parallelData()
{
TreeStorage<CustomStorage> storage;
Storage<CustomStorage> storage;
const auto setupTask = [storage](int taskId, milliseconds timeout) {
return [storage, taskId, timeout](TaskObject &taskObject) {
@@ -539,7 +539,7 @@ void tst_Tasking::testTree_data()
{
QTest::addColumn<TestData>("testData");
TreeStorage<CustomStorage> storage;
Storage<CustomStorage> storage;
const auto setupTask = [storage](int taskId, milliseconds timeout) {
return [storage, taskId, timeout](TaskObject &taskObject) {
@@ -2746,7 +2746,7 @@ struct StorageIO
int value = 0;
};
static Group inputOutputRecipe(const TreeStorage<StorageIO> &storage)
static Group inputOutputRecipe(const Storage<StorageIO> &storage)
{
return Group {
storage,
@@ -2773,7 +2773,7 @@ void tst_Tasking::storageIO()
int actualOutput = 0;
const TreeStorage<StorageIO> storage;
const Storage<StorageIO> storage;
TaskTree taskTree(inputOutputRecipe(storage));
const auto setInput = [input](StorageIO &storage) { storage.value = input; };
@@ -2789,8 +2789,8 @@ void tst_Tasking::storageIO()
void tst_Tasking::storageOperators()
{
StorageBase storage1 = TreeStorage<CustomStorage>();
StorageBase storage2 = TreeStorage<CustomStorage>();
StorageBase storage1 = Storage<CustomStorage>();
StorageBase storage2 = Storage<CustomStorage>();
StorageBase storage3 = storage1;
QVERIFY(storage1 == storage3);
@@ -2814,7 +2814,7 @@ void tst_Tasking::storageDestructor()
};
QCOMPARE(CustomStorage::instanceCount(), 0);
{
TreeStorage<CustomStorage> storage;
Storage<CustomStorage> storage;
const auto setupSleepingTask = [](TaskObject &taskObject) {
taskObject = 1000ms;
};

View File

@@ -31,9 +31,9 @@ public:
static int sizeForIndex(int index) { return (index + 1) * s_sizeInterval; }
Group recipe(const Tasking::TreeStorage<ExternalData> &externalStorage)
Group recipe(const Storage<ExternalData> &externalStorage)
{
TreeStorage<InternalData> internalStorage;
Storage<InternalData> internalStorage;
const auto onDownloadSetup = [externalStorage](NetworkQuery &query) {
query.setNetworkAccessManager(externalStorage->inputNam);

View File

@@ -13,7 +13,7 @@
namespace Tasking {
class Group;
template <typename T>
class TreeStorage;
class Storage;
}
static const int s_sizeInterval = 10;
@@ -31,6 +31,6 @@ public:
std::optional<QString> outputError;
};
Tasking::Group recipe(const Tasking::TreeStorage<ExternalData> &externalStorage);
Tasking::Group recipe(const Tasking::Storage<ExternalData> &externalStorage);
#endif // RECIPE_H

View File

@@ -25,7 +25,7 @@ private:
QStatusBar *m_statusBar = nullptr;
QNetworkAccessManager m_nam;
const Tasking::TreeStorage<ExternalData> m_storage;
const Tasking::Storage<ExternalData> m_storage;
const Tasking::Group m_recipe;
std::unique_ptr<Tasking::TaskTree> m_taskTree;
};

View File

@@ -73,7 +73,7 @@ void Images::process()
int i = 0;
for (const QUrl &url : urls) {
TreeStorage<QByteArray> storage;
Storage<QByteArray> storage;
const auto onDownloadSetup = [this, url](NetworkQuery &query) {
query.setNetworkAccessManager(&qnam);