23void InvokeTaskCallable(
void* user_data) {
24 (*
static_cast<Fn*
>(user_data))();
27void DeleteTaskCallable(
void* user_data) {
28 delete static_cast<Fn*
>(user_data);
314 virtual void PostTask(
void (*task)(
void* user_data),
void* user_data,
315 void (*destroy_user_data)(
void* user_data) =
nullptr)
340 virtual void PostDelayedTask(
double delay_ms,
void (*task)(
void* user_data),
void* user_data,
341 void (*destroy_user_data)(
void* user_data) =
nullptr)
362 template <
typename F,
typename = std::enable_if_t<std::is_invocable_v<std::decay_t<F>&>>>
364 using Fn = std::decay_t<F>;
365 auto* fn =
new Fn(std::forward<F>(callback));
366 PostTask(&detail::InvokeTaskCallable<Fn>, fn, &detail::DeleteTaskCallable<Fn>);
380 template <
typename F,
typename = std::enable_if_t<std::is_invocable_v<std::decay_t<F>&>>>
382 using Fn = std::decay_t<F>;
383 auto* fn =
new Fn(std::forward<F>(callback));
385 &detail::DeleteTaskCallable<Fn>);
405 [[deprecated(
"Use Render() instead.")]]
427#if UL_HAS(GC_LISTENER)
571 uint32_t button_count)
602#if UL_HAS(RENDER_TRACE)
638#if UL_HAS(GC_LISTENER)
735 virtual void SetMockScrollbarsEnabled(
bool enabled) = 0;
736 virtual void SetAllowAnySSLCertificate(
bool allow) = 0;
737 virtual String GetHeapDiagnostics() = 0;
738 virtual String DumpHeapSnapshot(
const String& path) = 0;
#define UExport
Definition Exports.h:22
User-defined interface to observe and control the Renderer's JavaScript garbage collections.
Definition GCListener.h:104
Event representing a change in gamepad axis state (eg, pressing a stick in a certain direction).
Definition GamepadEvent.h:54
Event representing a change in gamepad connection state.
Definition GamepadEvent.h:16
Interface for all ref-counted objects that will be managed using the RefPtr<> smart pointer.
Definition RefPtr.h:49
A nullable smart pointer.
Definition RefPtr.h:126
Core renderer singleton for the library, coordinates all library functions.
Definition Renderer.h:165
virtual void set_system_color_scheme(ColorScheme scheme)=0
Set the system color scheme that Views report to pages via the prefers-color-scheme CSS media feature...
virtual void CollectNow(CodeDropMode code, bool sync=true)=0
Collect the JavaScript heap now, leaving rendering and GPU caches intact.
virtual void PostTask(void(*task)(void *user_data), void *user_data, void(*destroy_user_data)(void *user_data)=nullptr)=0
Post a task to run on the Renderer's thread during a future call to Update().
virtual void FireGamepadAxisEvent(const GamepadAxisEvent &evt)=0
Fire a gamepad axis event (to be called when an axis value is changed).
virtual void FireGamepadEvent(const GamepadEvent &evt)=0
Fire a gamepad event (connection / disconnection).
virtual RefPtr< Session > default_session()=0
Get the default Session.
virtual void PostDelayedTask(double delay_ms, void(*task)(void *user_data), void *user_data, void(*destroy_user_data)(void *user_data)=nullptr)=0
Post a task to run on the Renderer's thread once a delay has elapsed.
virtual double display_refresh_rate(uint32_t display_id) const =0
Get the refresh rate declared for a display.
virtual void Update()=0
Update timers and dispatch callbacks.
virtual void RenderOnly(View **view_array, size_t view_array_len)=0
Render a subset of views to their respective surfaces and render targets.
virtual void SetGamepadDetails(uint32_t index, const String &id, uint32_t axis_count, uint32_t button_count)=0
Describe the details of a gamepad, to be used with FireGamepadEvent and related events below.
virtual void set_gc_listener(GCListener *listener)=0
Set a GCListener to observe and control the Renderer's JavaScript garbage collections.
virtual bool StartRemoteInspectorServer(const char *address, uint16_t port)=0
Start the remote inspector server.
void PostDelayedTask(double delay_ms, F &&callback)
Post a callable to run on the Renderer's thread once a delay has elapsed.
Definition Renderer.h:381
virtual ColorScheme system_color_scheme() const =0
The current system color scheme.
virtual bool BeginRenderTrace(const char *output_path, bool verbose=true)=0
Begin recording a render trace to the specified file path.
virtual RefPtr< View > CreateView(uint32_t width, uint32_t height, const ViewConfig &config, RefPtr< Session > session)=0
Create a new View to load and display web pages in.
virtual void RefreshDisplay(uint32_t display_id, double target_timestamp)=0
Notify the renderer that a display has refreshed, and when the resulting frame will be shown.
virtual void Recycle(RecycleMode mode=RecycleMode::Lightweight)=0
Recycle internal caches and reclaim memory.
virtual void EndRenderTrace()=0
End the current render trace.
virtual String GetMemoryUsage()=0
Get formatted memory usage statistics as a string.
virtual void SetDisplayUsesCustomClock(uint32_t display_id, bool uses_custom_clock)=0
Declare that a display's refresh timestamps are on your own timeline rather than the system clock.
virtual bool is_render_trace_active() const =0
Whether or not a render trace is currently being recorded.
virtual void RefreshDisplay(uint32_t display_id)=0
Notify the renderer that a display has refreshed.
virtual RefPtr< Session > CreateSession(bool is_persistent, const String &name)=0
Create a unique, named Session to store browsing data in (cookies, local storage, application cache,...
virtual bool display_uses_custom_clock(uint32_t display_id) const =0
Get whether a display was declared to use a custom clock.
virtual void PurgeMemory()=0
Attempt to release as much memory as possible.
virtual void SetDisplayRefreshRate(uint32_t display_id, double refresh_rate)=0
Declare a display's refresh rate.
virtual void Render()=0
Render all active views to their respective render-targets/surfaces.
virtual GCListener * gc_listener() const =0
Get the attached GCListener, if any.
virtual void LogMemoryUsage()=0
Print detailed memory usage statistics to the log.
void PostTask(F &&callback)
Post a callable to run on the Renderer's thread during a future call to Update().
Definition Renderer.h:363
virtual void FireGamepadButtonEvent(const GamepadButtonEvent &evt)=0
Fire a gamepad button event (to be called when a button value is changed).
virtual GCInfo gc_status() const =0
Get a snapshot of the current JS-heap reclamation state.
virtual void Recycle(RecycleMode mode, CodeDropMode code)=0
Reclaim memory, choosing how much compiled code to discard.
static RefPtr< Renderer > Create()
Create the core renderer singleton for the library.
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
Web-page container rendered to an offscreen surface.
Definition View.h:483
Root namespace for every public Ultralight type, function, and enumeration.
CodeDropMode
How much compiled JavaScript code a collection discards.
Definition GCListener.h:22
RecycleMode
Controls how aggressively Renderer::Recycle() reclaims memory.
Definition Renderer.h:37
@ Lightweight
A quick recycle, cheap enough to call every frame (the same work the automatic recycler does).
Definition Renderer.h:42
@ Full
A thorough recycle, for idle periods or transitions (eg, a loading screen).
Definition Renderer.h:48
ColorScheme
A page color scheme, as reported to pages via the prefers-color-scheme CSS media feature.
Definition View.h:78
A snapshot of the JavaScript heap's state (see Renderer::gc_status()).
Definition GCListener.h:32
View-specific configuration settings.
Definition View.h:100