Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
editor_idle_pump.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <atomic>
8#include <functional>
9
10namespace pulp::format {
11
18inline std::function<void()> make_editor_idle_pump(ViewBridge& bridge) {
19 auto* bridge_ptr = &bridge;
20 // The display link may already have dispatched a main-queue tick when host
21 // teardown begins. The liveness token makes that tick a no-op after the
22 // bridge is gone; adapters must still detach their host before close.
23 auto alive = bridge.alive_token();
24 return [bridge_ptr, alive]() {
25 if (!alive->load(std::memory_order_acquire)) return;
26 if (!bridge_ptr->owner_is_alive()) {
27 // The instance is gone; tell the tree once and pump nothing else.
28 bridge_ptr->notify_owner_released();
29 return;
30 }
31 bridge_ptr->pump_store_listeners();
32 if (bridge_ptr->poll_state_restore()) {
33 if (auto* v = bridge_ptr->view()) v->request_repaint();
34 }
35 if (bridge_ptr->poll_editor_reload()) {
36 if (auto* v = bridge_ptr->view()) v->request_repaint();
37 }
38 if (view::ScriptedEditorSession* session = bridge_ptr->scripted_ui()) {
39 session->poll();
40 }
41 };
42}
43
46inline std::function<void()> make_scripted_idle_pump(ViewBridge& bridge) {
47 return make_editor_idle_pump(bridge);
48}
49
50} // namespace pulp::format
Definition view_bridge.hpp:76
const std::shared_ptr< std::atomic< bool > > & alive_token() const
Cross-thread liveness token.
Definition view_bridge.hpp:306
ViewBridge(Processor &processor, state::StateStore &store)
The part of a scripted editor session that editor hosts drive: the frame pump, the content-first open...
Definition scripted_editor_session.hpp:19
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
std::function< void()> make_editor_idle_pump(ViewBridge &bridge)
Build the per-vsync idle pump for a bridge.
Definition editor_idle_pump.hpp:18
std::function< void()> make_scripted_idle_pump(ViewBridge &bridge)
Compatibility spelling retained for downstream adapter code.
Definition editor_idle_pump.hpp:46