mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
LibWeb+WebContent: Add abstraction layer for event loop and timers
Instead of using Core::EventLoop and Core::Timer directly, LibWeb now goes through a Web::Platform abstraction layer instead. This will allow us to plug in Qt's event loop (and QTimer) over in Ladybird, to avoid having to deal with multiple event loops.
This commit is contained in:
28
Userland/Libraries/LibWeb/Platform/EventLoopPlugin.cpp
Normal file
28
Userland/Libraries/LibWeb/Platform/EventLoopPlugin.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
|
||||
namespace Web::Platform {
|
||||
|
||||
EventLoopPlugin* s_the;
|
||||
|
||||
EventLoopPlugin& EventLoopPlugin::the()
|
||||
{
|
||||
VERIFY(s_the);
|
||||
return *s_the;
|
||||
}
|
||||
|
||||
void EventLoopPlugin::install(EventLoopPlugin& plugin)
|
||||
{
|
||||
VERIFY(!s_the);
|
||||
s_the = &plugin;
|
||||
}
|
||||
|
||||
EventLoopPlugin::~EventLoopPlugin() = default;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user