From a98ad191c715a5fd310f59b248c673984f88962e Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Fri, 17 May 2024 17:14:06 -0700 Subject: [PATCH] Userland: Add ESCAPING annotations to a bunch of places This isn't comprehensive; just a result of a simple grep search. --- Tests/LibCore/TestLibCoreDeferredInvoke.cpp | 2 +- Tests/LibCore/TestLibCorePromise.cpp | 2 +- ...bCoreSharedSingleProducerCircularQueue.cpp | 6 +++--- Tests/LibThreading/TestThread.cpp | 4 ++-- Userland/Applications/ThemeEditor/main.cpp | 6 +++--- Userland/Libraries/LibCore/EventLoop.h | 6 +++--- .../Libraries/LibJS/Runtime/NativeFunction.h | 4 ++-- Userland/Libraries/LibJS/Runtime/Object.h | 4 ++-- .../Libraries/LibThreading/BackgroundAction.h | 7 ++++--- Userland/Libraries/LibThreading/Thread.h | 6 +++--- Userland/Libraries/LibWeb/CSS/StyleComputer.h | 4 ++-- Userland/Libraries/LibWeb/DOM/AbortSignal.h | 2 +- .../Libraries/LibWeb/DOM/HTMLCollection.h | 4 ++-- .../LibWeb/DOM/HTMLFormControlsCollection.h | 4 ++-- Userland/Libraries/LibWeb/DOM/LiveNodeList.h | 4 ++-- Userland/Libraries/LibWeb/DOM/RadioNodeList.h | 4 ++-- .../Libraries/LibWeb/HTML/HTMLAllCollection.h | 4 ++-- .../Libraries/LibWeb/HTML/HTMLMediaElement.h | 2 +- .../LibWeb/HTML/HTMLOptionsCollection.h | 4 ++-- .../LibWeb/HTML/TraversableNavigable.h | 4 ++-- Userland/Libraries/LibWeb/HTML/Window.cpp | 2 +- .../LibWeb/Layout/BlockFormattingContext.h | 2 +- .../Libraries/LibWeb/Loader/FileRequest.h | 2 +- .../LibWeb/Platform/EventLoopPlugin.h | 2 +- .../LibWeb/Platform/ImageCodecPlugin.h | 2 +- Userland/Services/EchoServer/main.cpp | 2 +- Userland/Services/TelnetServer/main.cpp | 2 +- .../WebContent/ImageCodecPluginSerenity.h | 2 +- Userland/Utilities/test-pthread.cpp | 20 +++++++++---------- 29 files changed, 60 insertions(+), 59 deletions(-) diff --git a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp index 097d22ab5e42fdb27fa41106159bca8454f072b8..7e6e9001ed17ee2c4ad02d5f9701889a3e01e4b1 100644 --- a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp +++ b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp @@ -11,7 +11,7 @@ TEST_CASE(deferred_invoke) { - Core::EventLoop event_loop; + IGNORE_USE_IN_ESCAPING_LAMBDA Core::EventLoop event_loop; auto reaper = Core::Timer::create_single_shot(250, [] { warnln("I waited for the deferred_invoke to happen, but it never did!"); VERIFY_NOT_REACHED(); diff --git a/Tests/LibCore/TestLibCorePromise.cpp b/Tests/LibCore/TestLibCorePromise.cpp index 286e6c50414f6f4c035c6d2aae7a2d07db2bf9e3..3f8e25996018d48599b32320006e05850840f497 100644 --- a/Tests/LibCore/TestLibCorePromise.cpp +++ b/Tests/LibCore/TestLibCorePromise.cpp @@ -155,7 +155,7 @@ TEST_CASE(threaded_promise_resolved_later) { Core::EventLoop loop; - bool unblock_thread = false; + IGNORE_USE_IN_ESCAPING_LAMBDA bool unblock_thread = false; bool resolved = false; bool rejected = true; Optional thread_id; diff --git a/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp b/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp index b30be886c9025d7e420ca50234278c5721bcbeb1..49139cb957a8ca32da233ea89ee8f0a91ac0e214 100644 --- a/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp +++ b/Tests/LibCore/TestLibCoreSharedSingleProducerCircularQueue.cpp @@ -43,7 +43,7 @@ TEST_CASE(simple_dequeue) // There is one parallel consumer, but nobody is producing at the same time. TEST_CASE(simple_multithread) { - auto queue = MUST(TestQueue::create()); + IGNORE_USE_IN_ESCAPING_LAMBDA auto queue = MUST(TestQueue::create()); auto const test_count = 10; for (int i = 0; i < test_count; ++i) @@ -73,11 +73,11 @@ TEST_CASE(simple_multithread) // There is one parallel consumer and one parallel producer. TEST_CASE(producer_consumer_multithread) { - auto queue = MUST(TestQueue::create()); + IGNORE_USE_IN_ESCAPING_LAMBDA auto queue = MUST(TestQueue::create()); // Ensure that we have the possibility of filling the queue up. auto const test_count = queue.size() * 4; - Atomic other_thread_running { false }; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic other_thread_running { false }; auto second_thread = Threading::Thread::construct([&queue, &other_thread_running]() { auto copied_queue = queue; diff --git a/Tests/LibThreading/TestThread.cpp b/Tests/LibThreading/TestThread.cpp index c5a483c42b89decedc1ee050f9858d9e70c31b42..38396056a385eb58b24dd121a50aae7b96e92fd7 100644 --- a/Tests/LibThreading/TestThread.cpp +++ b/Tests/LibThreading/TestThread.cpp @@ -27,7 +27,7 @@ static void sleep_until_thread_exits(Threading::Thread const& thread) TEST_CASE(threads_can_detach) { - Atomic should_be_42 = 0; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic should_be_42 = 0; auto thread = Threading::Thread::construct([&should_be_42]() { usleep(10 * 1000); @@ -43,7 +43,7 @@ TEST_CASE(threads_can_detach) TEST_CASE(detached_threads_do_not_need_to_be_joined) { - Atomic should_exit { false }; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic should_exit { false }; auto thread = Threading::Thread::construct([&]() { while (!should_exit.load()) usleep(10 * 1000); diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index d4a228802e20bd126094ddcc6ae0cc480dcd0db3..70afa4e33b8119546a436bef3b7023c737e9949c 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -37,7 +37,7 @@ ErrorOr serenity_main(Main::Arguments arguments) parser.add_positional_argument(file_to_edit, "Theme file to edit", "file", Core::ArgsParser::Required::No); parser.parse(arguments); - Optional path = {}; + IGNORE_USE_IN_ESCAPING_LAMBDA Optional path = {}; if (auto error_or_path = FileSystem::absolute_path(file_to_edit); !file_to_edit.is_empty() && !error_or_path.is_error()) path = error_or_path.release_value(); @@ -48,9 +48,9 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto app_icon = GUI::Icon::default_icon("app-theme-editor"sv); - auto window = GUI::Window::construct(); + IGNORE_USE_IN_ESCAPING_LAMBDA auto window = GUI::Window::construct(); - auto main_widget = TRY(ThemeEditor::MainWidget::try_create()); + IGNORE_USE_IN_ESCAPING_LAMBDA auto main_widget = TRY(ThemeEditor::MainWidget::try_create()); window->set_main_widget(main_widget); if (path.has_value()) { diff --git a/Userland/Libraries/LibCore/EventLoop.h b/Userland/Libraries/LibCore/EventLoop.h index bdca1565200a548a3dd1230405406133af92fb34..61cbfafcf9e52840680fe3d797b19102d0bdb72a 100644 --- a/Userland/Libraries/LibCore/EventLoop.h +++ b/Userland/Libraries/LibCore/EventLoop.h @@ -67,7 +67,7 @@ public: void add_job(NonnullRefPtr>> job_promise); - void deferred_invoke(Function); + void deferred_invoke(ESCAPING Function); void wake(); @@ -82,7 +82,7 @@ public: static void register_notifier(Badge, Notifier&); static void unregister_notifier(Badge, Notifier&); - static int register_signal(int signo, Function handler); + static int register_signal(int signo, ESCAPING Function handler); static void unregister_signal(int handler_id); // Note: Boost uses Parent/Child/Prepare, but we don't really have anything @@ -101,6 +101,6 @@ private: NonnullOwnPtr m_impl; }; -void deferred_invoke(Function); +void deferred_invoke(ESCAPING Function); } diff --git a/Userland/Libraries/LibJS/Runtime/NativeFunction.h b/Userland/Libraries/LibJS/Runtime/NativeFunction.h index 338dc272dce7f4ca2e262d6c1951385a6c4efac5..afa4f8063d573e7bfdf5efc2d7198a5538dbe8d3 100644 --- a/Userland/Libraries/LibJS/Runtime/NativeFunction.h +++ b/Userland/Libraries/LibJS/Runtime/NativeFunction.h @@ -21,8 +21,8 @@ class NativeFunction : public FunctionObject { JS_DECLARE_ALLOCATOR(NativeFunction); public: - static NonnullGCPtr create(Realm&, Function(VM&)> behaviour, i32 length, PropertyKey const& name, Optional = {}, Optional prototype = {}, Optional const& prefix = {}); - static NonnullGCPtr create(Realm&, DeprecatedFlyString const& name, Function(VM&)>); + static NonnullGCPtr create(Realm&, ESCAPING Function(VM&)> behaviour, i32 length, PropertyKey const& name, Optional = {}, Optional prototype = {}, Optional const& prefix = {}); + static NonnullGCPtr create(Realm&, DeprecatedFlyString const& name, ESCAPING Function(VM&)>); virtual ~NativeFunction() override = default; diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 86a2818a7fbc843c1e7de9f5623f07631f5c59e4..138edb0e5e50794860ceeda0e98ecca41c514c01 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -187,8 +187,8 @@ public: using IntrinsicAccessor = Value (*)(Realm&); void define_intrinsic_accessor(PropertyKey const&, PropertyAttributes attributes, IntrinsicAccessor accessor); - void define_native_function(Realm&, PropertyKey const&, Function(VM&)>, i32 length, PropertyAttributes attributes, Optional builtin = {}); - void define_native_accessor(Realm&, PropertyKey const&, Function(VM&)> getter, Function(VM&)> setter, PropertyAttributes attributes); + void define_native_function(Realm&, PropertyKey const&, ESCAPING Function(VM&)>, i32 length, PropertyAttributes attributes, Optional builtin = {}); + void define_native_accessor(Realm&, PropertyKey const&, ESCAPING Function(VM&)> getter, ESCAPING Function(VM&)> setter, PropertyAttributes attributes); virtual bool is_dom_node() const { return false; } virtual bool is_function() const { return false; } diff --git a/Userland/Libraries/LibThreading/BackgroundAction.h b/Userland/Libraries/LibThreading/BackgroundAction.h index 97b1c2fccf46620e8cee0e66f441fbea8f80f177..7d25b2f4a9f2a68733a5c9f500a15a13b075fbe7 100644 --- a/Userland/Libraries/LibThreading/BackgroundAction.h +++ b/Userland/Libraries/LibThreading/BackgroundAction.h @@ -30,12 +30,13 @@ class BackgroundActionBase { private: BackgroundActionBase() = default; - static void enqueue_work(Function); + static void enqueue_work(ESCAPING Function); static Thread& background_thread(); }; template -class BackgroundAction final : public Core::EventReceiver +class BackgroundAction final + : public Core::EventReceiver , private BackgroundActionBase { C_OBJECT(BackgroundAction); @@ -54,7 +55,7 @@ public: bool is_canceled() const { return m_canceled; } private: - BackgroundAction(Function(BackgroundAction&)> action, Function(Result)> on_complete, Optional> on_error = {}) + BackgroundAction(ESCAPING Function(BackgroundAction&)> action, ESCAPING Function(Result)> on_complete, ESCAPING Optional> on_error = {}) : m_promise(Promise::try_create().release_value_but_fixme_should_propagate_errors()) , m_action(move(action)) , m_on_complete(move(on_complete)) diff --git a/Userland/Libraries/LibThreading/Thread.h b/Userland/Libraries/LibThreading/Thread.h index 87a649ab6ab6eb3b08a10968414c5c70dd4f72a6..10fce0c81032c286dce624792ec8923a2870f6dc 100644 --- a/Userland/Libraries/LibThreading/Thread.h +++ b/Userland/Libraries/LibThreading/Thread.h @@ -46,11 +46,11 @@ class Thread final : public AtomicRefCounted , public Weakable { public: - static NonnullRefPtr construct(Function action, StringView thread_name = {}) + static NonnullRefPtr construct(ESCAPING Function action, StringView thread_name = {}) { return adopt_ref(*new Thread(move(action), thread_name)); } - static ErrorOr> try_create(Function action, StringView thread_name = {}) + static ErrorOr> try_create(ESCAPING Function action, StringView thread_name = {}) { return adopt_nonnull_ref_or_enomem(new (nothrow) Thread(move(action), thread_name)); } @@ -77,7 +77,7 @@ public: bool has_exited() const; private: - explicit Thread(Function action, StringView thread_name = {}); + explicit Thread(ESCAPING Function action, StringView thread_name = {}); Function m_action; pthread_t m_tid { 0 }; ByteString m_thread_name; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.h b/Userland/Libraries/LibWeb/CSS/StyleComputer.h index 359308fa610dea570fc703eaeb612b32d90cd1d6..f34a597656a06ba8f0336b19c9bc84c78d643965 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.h @@ -138,7 +138,7 @@ public: void did_load_font(FlyString const& family_name); - Optional load_font_face(ParsedFontFace const&, Function on_load = {}, Function on_fail = {}); + Optional load_font_face(ParsedFontFace const&, ESCAPING Function on_load = {}, ESCAPING Function on_fail = {}); void load_fonts_from_sheet(CSSStyleSheet const&); @@ -232,7 +232,7 @@ private: class FontLoader : public ResourceClient { public: - FontLoader(StyleComputer& style_computer, FlyString family_name, Vector unicode_ranges, Vector urls, Function on_load = {}, Function on_fail = {}); + FontLoader(StyleComputer& style_computer, FlyString family_name, Vector unicode_ranges, Vector urls, ESCAPING Function on_load = {}, ESCAPING Function on_fail = {}); virtual ~FontLoader() override; diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h index 125f482952bfcfc6b93e33706fa1b7a00ce57b21..1c60eef1ed21639484a7ab6f173cc7f20699c467 100644 --- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h +++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h @@ -26,7 +26,7 @@ public: virtual ~AbortSignal() override = default; - void add_abort_algorithm(Function); + void add_abort_algorithm(ESCAPING Function); // https://dom.spec.whatwg.org/#dom-abortsignal-aborted // An AbortSignal object is aborted when its abort reason is not undefined. diff --git a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h index aab5f24918c85cfd8cf5063f8010937b34d5d943..844323a200e157b096b30ff91ffcc305c5910056 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLCollection.h +++ b/Userland/Libraries/LibWeb/DOM/HTMLCollection.h @@ -30,7 +30,7 @@ public: Children, Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, ESCAPING Function filter); virtual ~HTMLCollection() override; @@ -46,7 +46,7 @@ public: virtual bool is_supported_property_index(u32) const override; protected: - HTMLCollection(ParentNode& root, Scope, Function filter); + HTMLCollection(ParentNode& root, Scope, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; diff --git a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h index e20ee229c01a2fa1402ca7a726f0b3a140be70b2..809bbff42387b0f446d6ee7105be5caae31e0868 100644 --- a/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h +++ b/Userland/Libraries/LibWeb/DOM/HTMLFormControlsCollection.h @@ -16,7 +16,7 @@ class HTMLFormControlsCollection : public HTMLCollection { JS_DECLARE_ALLOCATOR(HTMLFormControlsCollection); public: - [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(ParentNode& root, Scope, ESCAPING Function filter); virtual ~HTMLFormControlsCollection() override; @@ -28,7 +28,7 @@ protected: virtual WebIDL::ExceptionOr named_item_value(FlyString const& name) const final; private: - HTMLFormControlsCollection(ParentNode& root, Scope, Function filter); + HTMLFormControlsCollection(ParentNode& root, Scope, ESCAPING Function filter); }; } diff --git a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h index 4084c16a5ebaa61d78c92b88411896a67b618ae3..aa40045ff1c0481829c163637792ad90818da425 100644 --- a/Userland/Libraries/LibWeb/DOM/LiveNodeList.h +++ b/Userland/Libraries/LibWeb/DOM/LiveNodeList.h @@ -24,7 +24,7 @@ public: Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, Node const& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, Node const& root, Scope, ESCAPING Function filter); virtual ~LiveNodeList() override; virtual u32 length() const override; @@ -33,7 +33,7 @@ public: virtual bool is_supported_property_index(u32) const override; protected: - LiveNodeList(JS::Realm&, Node const& root, Scope, Function filter); + LiveNodeList(JS::Realm&, Node const& root, Scope, ESCAPING Function filter); Node* first_matching(Function const& filter) const; diff --git a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h index ab7ecf548b4cda0600fe4834f1d1f6f1507c375a..0e5c52909e0d2ec37f2ea49d569f8b4800691883 100644 --- a/Userland/Libraries/LibWeb/DOM/RadioNodeList.h +++ b/Userland/Libraries/LibWeb/DOM/RadioNodeList.h @@ -16,7 +16,7 @@ class RadioNodeList : public LiveNodeList { JS_DECLARE_ALLOCATOR(RadioNodeList); public: - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm& realm, Node const& root, Scope scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function filter); virtual ~RadioNodeList() override; @@ -27,7 +27,7 @@ protected: virtual void initialize(JS::Realm&) override; private: - explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, Function filter); + explicit RadioNodeList(JS::Realm& realm, Node const& root, Scope scope, ESCAPING Function filter); }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h index b5dc52d7e920a6f29ea0372f7147d55afa675683..e866863f6f4624719c5d93962c5f732e998034a8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAllCollection.h @@ -24,7 +24,7 @@ public: Children, Descendants, }; - [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, Scope, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, Scope, ESCAPING Function filter); virtual ~HTMLAllCollection() override; @@ -40,7 +40,7 @@ public: virtual bool is_supported_property_index(u32) const override; protected: - HTMLAllCollection(DOM::ParentNode& root, Scope, Function filter); + HTMLAllCollection(DOM::ParentNode& root, Scope, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index dfd1539fbc45f993b7cc2915b2fe7144c6c9513c..858af8d3dcf6065fbe4bd3af0486928298852179 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -162,7 +162,7 @@ private: Task::Source media_element_event_task_source() const { return m_media_element_event_task_source.source; } WebIDL::ExceptionOr load_element(); - WebIDL::ExceptionOr fetch_resource(URL::URL const&, Function failure_callback); + WebIDL::ExceptionOr fetch_resource(URL::URL const&, ESCAPING Function failure_callback); static bool verify_response(JS::NonnullGCPtr, ByteRange const&); WebIDL::ExceptionOr process_media_data(Function failure_callback); WebIDL::ExceptionOr handle_media_source_failure(Span> promises, String error_message); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index abb8b46435e88d05f7bab9984d7f499d851ad321..68b97dde8e4b571f59b4e1702f9df3d05361b356 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h @@ -21,7 +21,7 @@ class HTMLOptionsCollection final : public DOM::HTMLCollection { JS_DECLARE_ALLOCATOR(HTMLOptionsCollection); public: - [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, Function filter); + [[nodiscard]] static JS::NonnullGCPtr create(DOM::ParentNode& root, ESCAPING Function filter); virtual ~HTMLOptionsCollection() override; WebIDL::ExceptionOr set_length(WebIDL::UnsignedLong); @@ -34,7 +34,7 @@ public: void set_selected_index(WebIDL::Long); private: - HTMLOptionsCollection(DOM::ParentNode& root, Function filter); + HTMLOptionsCollection(DOM::ParentNode& root, ESCAPING Function filter); virtual void initialize(JS::Realm&) override; }; diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h index f27513dd77748adc5dd14d3577a0abb5d262de4a..e254026aa293c049b92c7d07d87a6db504a71e1f 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h @@ -69,12 +69,12 @@ public: void close_top_level_traversable(); void destroy_top_level_traversable(); - void append_session_history_traversal_steps(Function steps) + void append_session_history_traversal_steps(ESCAPING Function steps) { m_session_history_traversal_queue->append(move(steps)); } - void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr target_navigable, Function steps) + void append_session_history_synchronous_navigation_steps(JS::NonnullGCPtr target_navigable, ESCAPING Function steps) { m_session_history_traversal_queue->append_sync(move(steps), target_navigable); } diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 2461ce010517dee1d4800532ee816987292e6ac9..7850264d83d8eaafe8b2b76fa8cf26d687c7fd3a 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -83,7 +83,7 @@ void run_animation_frame_callbacks(DOM::Document& document, double now) class IdleCallback : public RefCounted { public: - explicit IdleCallback(Function)> handler, u32 handle) + explicit IdleCallback(ESCAPING Function)> handler, u32 handle) : m_handler(move(handler)) , m_handle(handle) { diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h index 08045edde6d6827371453ca48af52d4a4afe07e7..99b979ca32e2724b6cc8c681771e83a130152c30 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.h @@ -135,7 +135,7 @@ private: current_collapsible_margins.append(margin); } - void register_block_container_y_position_update_callback(Function callback) + void register_block_container_y_position_update_callback(ESCAPING Function callback) { block_container_y_position_update_callback = move(callback); } diff --git a/Userland/Libraries/LibWeb/Loader/FileRequest.h b/Userland/Libraries/LibWeb/Loader/FileRequest.h index f898228ff7776284fa6d23aeb5f088f45d231a9b..05f862dafb71af78c5c5ff6e6d68a10cb87e1568 100644 --- a/Userland/Libraries/LibWeb/Loader/FileRequest.h +++ b/Userland/Libraries/LibWeb/Loader/FileRequest.h @@ -14,7 +14,7 @@ namespace Web { class FileRequest { public: - FileRequest(ByteString path, Function)> on_file_request_finish); + FileRequest(ByteString path, ESCAPING Function)> on_file_request_finish); ByteString path() const; diff --git a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h index 6101a1728f8f1685fd5eeb01215192c174f308db..6bf58719446ab971e11537d461d496f837b0716f 100644 --- a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h +++ b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h @@ -20,7 +20,7 @@ public: virtual ~EventLoopPlugin(); virtual void spin_until(JS::SafeFunction goal_condition) = 0; - virtual void deferred_invoke(JS::SafeFunction) = 0; + virtual void deferred_invoke(ESCAPING JS::SafeFunction) = 0; virtual NonnullRefPtr create_timer() = 0; virtual void quit() = 0; }; diff --git a/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h b/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h index 477915d486c5677bcfe3d100045d39dbb228f678..b2ba33ea6c3d0ea9da0acf0b601a6bbb3f20f1fe 100644 --- a/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h +++ b/Userland/Libraries/LibWeb/Platform/ImageCodecPlugin.h @@ -32,7 +32,7 @@ public: virtual ~ImageCodecPlugin(); - virtual NonnullRefPtr> decode_image(ReadonlyBytes, Function(DecodedImage&)> on_resolved, Function on_rejected) = 0; + virtual NonnullRefPtr> decode_image(ReadonlyBytes, ESCAPING Function(DecodedImage&)> on_resolved, ESCAPING Function on_rejected) = 0; }; } diff --git a/Userland/Services/EchoServer/main.cpp b/Userland/Services/EchoServer/main.cpp index 7bd22eadc69374939b3dbf01f2dff7fb9fb85f44..fd86c998bab046675c77ecbb6ccc2d576edead65 100644 --- a/Userland/Services/EchoServer/main.cpp +++ b/Userland/Services/EchoServer/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto server = TRY(Core::TCPServer::try_create()); TRY(server->listen({}, port)); - HashMap> clients; + IGNORE_USE_IN_ESCAPING_LAMBDA HashMap> clients; int next_id = 0; server->on_ready_to_accept = [&next_id, &clients, &server] { diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp index 379bc43ca55f3cfbfca0389270ad51c6e32593fb..c9beb12e85ca1d58d456d0787c98c940a52f68d3 100644 --- a/Userland/Services/TelnetServer/main.cpp +++ b/Userland/Services/TelnetServer/main.cpp @@ -102,7 +102,7 @@ ErrorOr serenity_main(Main::Arguments arguments) auto server = TRY(Core::TCPServer::try_create()); TRY(server->listen({}, port)); - HashMap> clients; + IGNORE_USE_IN_ESCAPING_LAMBDA HashMap> clients; int next_id = 0; server->on_ready_to_accept = [&next_id, &clients, &server, command] { diff --git a/Userland/Services/WebContent/ImageCodecPluginSerenity.h b/Userland/Services/WebContent/ImageCodecPluginSerenity.h index c065234cefbf2d2e023ac644547c1b1a54930dd5..a5e6c43adce6cda53b66b674f504f1b770264d1c 100644 --- a/Userland/Services/WebContent/ImageCodecPluginSerenity.h +++ b/Userland/Services/WebContent/ImageCodecPluginSerenity.h @@ -21,7 +21,7 @@ public: ImageCodecPluginSerenity(); virtual ~ImageCodecPluginSerenity() override; - virtual NonnullRefPtr> decode_image(ReadonlyBytes, Function(Web::Platform::DecodedImage&)> on_resolved, Function on_rejected) override; + virtual NonnullRefPtr> decode_image(ReadonlyBytes, ESCAPING Function(Web::Platform::DecodedImage&)> on_resolved, ESCAPING Function on_rejected) override; private: RefPtr m_client; diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp index 77fc3ec56b393629ce2895f1ab9878073d8fe122..1f24913564a56c949409364624e56440eea5221f 100644 --- a/Userland/Utilities/test-pthread.cpp +++ b/Userland/Utilities/test-pthread.cpp @@ -18,7 +18,7 @@ static ErrorOr test_once() static Vector v; v.clear(); - pthread_once_t once = PTHREAD_ONCE_INIT; + IGNORE_USE_IN_ESCAPING_LAMBDA pthread_once_t once = PTHREAD_ONCE_INIT; Vector, threads_count> threads; for (size_t i = 0; i < threads_count; i++) { @@ -44,9 +44,9 @@ static ErrorOr test_mutex() constexpr size_t threads_count = 10; constexpr size_t num_times = 100; - Vector v; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector v; Vector, threads_count> threads; - pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + IGNORE_USE_IN_ESCAPING_LAMBDA pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; for (size_t i = 0; i < threads_count; i++) { threads.unchecked_append(TRY(Threading::Thread::try_create([&] { @@ -77,9 +77,9 @@ static ErrorOr test_semaphore_as_lock() constexpr size_t threads_count = 10; constexpr size_t num_times = 100; - Vector v; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector v; Vector, threads_count> threads; - sem_t semaphore; + IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore; sem_init(&semaphore, 0, 1); for (size_t i = 0; i < threads_count; i++) { @@ -109,8 +109,8 @@ static ErrorOr test_semaphore_as_lock() static ErrorOr test_semaphore_as_event() { - Vector v; - sem_t semaphore; + IGNORE_USE_IN_ESCAPING_LAMBDA Vector v; + IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore; sem_init(&semaphore, 0, 0); auto reader = TRY(Threading::Thread::try_create([&] { @@ -144,11 +144,11 @@ static ErrorOr test_semaphore_nonbinary() constexpr size_t num_times = 100; Vector, threads_count> threads; - sem_t semaphore; + IGNORE_USE_IN_ESCAPING_LAMBDA sem_t semaphore; sem_init(&semaphore, 0, num); - Atomic value = 0; - Atomic seen_more_than_two = false; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic value = 0; + IGNORE_USE_IN_ESCAPING_LAMBDA Atomic seen_more_than_two = false; for (size_t i = 0; i < threads_count; i++) { threads.unchecked_append(TRY(Threading::Thread::try_create([&] {