瀏覽代碼

WebContent: Use Web::Platform::Timer instead of Core::Timer

This will allow WebContent to operate without a Core::EventLoop.
Andreas Kling 2 年之前
父節點
當前提交
f877782117

+ 1 - 1
Userland/Services/WebContent/ConnectionFromClient.cpp

@@ -40,7 +40,7 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSock
     : IPC::ConnectionFromClient<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1)
     , m_page_host(PageHost::create(*this))
 {
-    m_paint_flush_timer = Core::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); });
+    m_paint_flush_timer = Web::Platform::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); });
 }
 
 void ConnectionFromClient::die()

+ 2 - 1
Userland/Services/WebContent/ConnectionFromClient.h

@@ -14,6 +14,7 @@
 #include <LibWeb/Cookie/ParsedCookie.h>
 #include <LibWeb/Forward.h>
 #include <LibWeb/Loader/FileRequest.h>
+#include <LibWeb/Platform/Timer.h>
 #include <WebContent/Forward.h>
 #include <WebContent/WebContentClientEndpoint.h>
 #include <WebContent/WebContentConsoleClient.h>
@@ -91,7 +92,7 @@ private:
         i32 bitmap_id { -1 };
     };
     Vector<PaintRequest> m_pending_paint_requests;
-    RefPtr<Core::Timer> m_paint_flush_timer;
+    RefPtr<Web::Platform::Timer> m_paint_flush_timer;
 
     HashMap<i32, NonnullRefPtr<Gfx::Bitmap>> m_backing_stores;
 

+ 2 - 1
Userland/Services/WebContent/PageHost.cpp

@@ -13,6 +13,7 @@
 #include <LibWeb/HTML/BrowsingContext.h>
 #include <LibWeb/Layout/InitialContainingBlock.h>
 #include <LibWeb/Painting/PaintableBox.h>
+#include <LibWeb/Platform/Timer.h>
 #include <WebContent/WebContentClientEndpoint.h>
 
 namespace WebContent {
@@ -22,7 +23,7 @@ PageHost::PageHost(ConnectionFromClient& client)
     , m_page(make<Web::Page>(*this))
 {
     setup_palette();
-    m_invalidation_coalescing_timer = Core::Timer::create_single_shot(0, [this] {
+    m_invalidation_coalescing_timer = Web::Platform::Timer::create_single_shot(0, [this] {
         m_client.async_did_invalidate_content_rect(m_invalidation_rect);
         m_invalidation_rect = {};
     });

+ 1 - 1
Userland/Services/WebContent/PageHost.h

@@ -81,7 +81,7 @@ private:
     bool m_should_show_line_box_borders { false };
     bool m_has_focus { false };
 
-    RefPtr<Core::Timer> m_invalidation_coalescing_timer;
+    RefPtr<Web::Platform::Timer> m_invalidation_coalescing_timer;
     Gfx::IntRect m_invalidation_rect;
     Web::CSS::PreferredColorScheme m_preferred_color_scheme { Web::CSS::PreferredColorScheme::Auto };
 };