mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibCore: Add a hook for custom construction of EventLoopImplementation
This commit is contained in:
parent
16c47ccff6
commit
31289a8d57
3 changed files with 7 additions and 1 deletions
|
@ -30,8 +30,10 @@ bool has_event_loop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function<NonnullOwnPtr<EventLoopImplementation>()> EventLoop::make_implementation = EventLoopImplementationUnix::create;
|
||||||
|
|
||||||
EventLoop::EventLoop()
|
EventLoop::EventLoop()
|
||||||
: m_impl(make<EventLoopImplementationUnix>())
|
: m_impl(make_implementation())
|
||||||
{
|
{
|
||||||
if (event_loop_stack().is_empty()) {
|
if (event_loop_stack().is_empty()) {
|
||||||
event_loop_stack().append(*this);
|
event_loop_stack().append(*this);
|
||||||
|
|
|
@ -93,6 +93,8 @@ public:
|
||||||
|
|
||||||
static EventLoop& current();
|
static EventLoop& current();
|
||||||
|
|
||||||
|
static Function<NonnullOwnPtr<EventLoopImplementation>()> make_implementation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void wait_for_event(WaitMode);
|
void wait_for_event(WaitMode);
|
||||||
Optional<Time> get_next_timer_expiration();
|
Optional<Time> get_next_timer_expiration();
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace Core {
|
||||||
|
|
||||||
class EventLoopImplementationUnix final : public EventLoopImplementation {
|
class EventLoopImplementationUnix final : public EventLoopImplementation {
|
||||||
public:
|
public:
|
||||||
|
static NonnullOwnPtr<EventLoopImplementationUnix> create() { return make<EventLoopImplementationUnix>(); }
|
||||||
|
|
||||||
EventLoopImplementationUnix();
|
EventLoopImplementationUnix();
|
||||||
virtual ~EventLoopImplementationUnix();
|
virtual ~EventLoopImplementationUnix();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue