From 59619572d6877f703157648ae37a41fa23d4b77d Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Mon, 1 Nov 2021 23:39:10 +0100 Subject: [PATCH] LibThreading: Remove redundant method --- Userland/Applications/Assistant/Providers.cpp | 4 ++-- Userland/Applications/DisplaySettings/MonitorWidget.cpp | 2 +- Userland/Applications/SystemMonitor/ThreadStackWidget.cpp | 2 +- Userland/Libraries/LibGUI/FileSystemModel.cpp | 2 +- Userland/Libraries/LibThreading/BackgroundAction.h | 7 ------- Userland/Services/WindowServer/Compositor.cpp | 2 +- 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index c7f695bdc25..b7bc9735748 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -132,7 +132,7 @@ void FileProvider::query(const String& query, Functioncancel(); - m_fuzzy_match_work = Threading::BackgroundAction>::create( + m_fuzzy_match_work = Threading::BackgroundAction>::construct( [this, query](auto& task) { NonnullRefPtrVector results; @@ -163,7 +163,7 @@ void FileProvider::build_filesystem_cache() m_building_cache = true; m_work_queue.enqueue("/"); - Threading::BackgroundAction::create( + Threading::BackgroundAction::construct( [this](auto&) { String slash = "/"; auto timer = Core::ElapsedTimer::start_new(); diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index 5a853ccf799..858a82df755 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -30,7 +30,7 @@ bool MonitorWidget::set_wallpaper(String path) if (!is_different_to_current_wallpaper_path(path)) return false; - Threading::BackgroundAction>::create( + Threading::BackgroundAction>::construct( [path](auto&) { RefPtr bmp; if (!path.is_empty()) diff --git a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp index edb56e31af1..906e2bc08b2 100644 --- a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp +++ b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp @@ -113,7 +113,7 @@ private: void ThreadStackWidget::refresh() { - Threading::BackgroundAction>::create( + Threading::BackgroundAction>::construct( [pid = m_pid, tid = m_tid](auto&) { return Symbolication::symbolicate_thread(pid, tid, Symbolication::IncludeSourcePosition::No); }, diff --git a/Userland/Libraries/LibGUI/FileSystemModel.cpp b/Userland/Libraries/LibGUI/FileSystemModel.cpp index bede6e23ecb..744adef088a 100644 --- a/Userland/Libraries/LibGUI/FileSystemModel.cpp +++ b/Userland/Libraries/LibGUI/FileSystemModel.cpp @@ -652,7 +652,7 @@ bool FileSystemModel::fetch_thumbnail_for(Node const& node) auto weak_this = make_weak_ptr(); - Threading::BackgroundAction>::create( + Threading::BackgroundAction>::construct( [path](auto&) { return render_thumbnail(path); }, diff --git a/Userland/Libraries/LibThreading/BackgroundAction.h b/Userland/Libraries/LibThreading/BackgroundAction.h index fa186270483..64d9338cc97 100644 --- a/Userland/Libraries/LibThreading/BackgroundAction.h +++ b/Userland/Libraries/LibThreading/BackgroundAction.h @@ -38,13 +38,6 @@ class BackgroundAction final : public Core::Object C_OBJECT(BackgroundAction); public: - static NonnullRefPtr> create( - Function action, - Function on_complete = nullptr) - { - return adopt_ref(*new BackgroundAction(move(action), move(on_complete))); - } - void cancel() { m_cancelled = true; diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index fb753efe731..f66bda27f54 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -807,7 +807,7 @@ bool Compositor::set_wallpaper_mode(const String& mode) bool Compositor::set_wallpaper(const String& path, Function&& callback) { - Threading::BackgroundAction>::create( + Threading::BackgroundAction>::construct( [path](auto&) { return Gfx::Bitmap::try_load_from_file(path); },