<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom">
  <title>Serenity feed</title>
  <id>https://dabdab.org/stream/72c972c6-cc71-49c8-b062-ebc3064e3d80</id>
  <updated>2023-08-16T23:03:54Z</updated>
  <link href="https://dabdab.org/stream/72c972c6-cc71-49c8-b062-ebc3064e3d80"></link>
  <author>
    <name>a8073722-214c-46df-88c8-18ae1f22ef1f</name>
    <email>undisclosed</email>
  </author>
  <entry>
    <title>A message by @can3p at Thu, 17 Aug 2023 00:52:43 +0000</title>
    <updated>2023-08-17T00:52:43Z</updated>
    <id>tag:dabdab.org,2023-08-17:/message/1349d88e-8f3c-4b81-adf1-e47bf93edf10</id>
    <link href="https://dabdab.org/message/1349d88e-8f3c-4b81-adf1-e47bf93edf10" rel="alternate"></link>
    <summary type="html">&lt;p&gt;And this is why it&#39;s probably very different now since everything runs in it&#39;s own process etc. I&#39;ve made a brief attempt to go through this part, here are the findings.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;All serenity apps work on a client/server architecture and there is always a split with interprocess communication in between&lt;/li&gt;&#xA;&lt;li&gt;Qt::WebContentView pokes LibWebviewImplementation which pokes WebContentClient for repaint. This client in turn asynchronously notifies the the other process and the call lands in WebContent::ConnectionFromClient, which registers repaint request and those are processed every so often in the &lt;code&gt;flush_pending_paint_requests&lt;/code&gt; function&lt;/li&gt;&#xA;&lt;li&gt;Actual rendering happens with WebContent::PageHost class that uses backing buffer (which I need to understand, it&#39;s some interprocess memory sharing mechanism probably). After rendering is done, the other side is pinged back&lt;/li&gt;&#xA;&lt;li&gt;We start unwinding - &lt;code&gt;WebContentClient::did_paint&lt;/code&gt; gets called and it calls &lt;code&gt;WebContentView::notify_server_did_paint&lt;/code&gt; which replaces the buffer on it&#39;s side and poke Qwidget to update and that one finally calls &lt;code&gt;paintEvent&lt;/code&gt; which takes the buffer and renders it as a QImage and that&#39;s what we see&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</summary>
  </entry>
  <entry>
    <title>A message by @can3p at Thu, 17 Aug 2023 00:28:40 +0000</title>
    <updated>2023-08-17T00:28:40Z</updated>
    <id>tag:dabdab.org,2023-08-17:/message/73ae1759-5f57-45d4-a23f-bd0115160b3c</id>
    <link href="https://dabdab.org/message/73ae1759-5f57-45d4-a23f-bd0115160b3c" rel="alternate"></link>
    <summary type="html">&lt;p&gt;One more interesting bit from the video, here is more or less the snippet:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Core::EventLoop event_loop;&#xA;&#xA;auto qt_event_loop_driver = Core::Timer::create_repeating(50, [&amp;amp;] {&#xA;    app-&amp;gt;process_events()&#xA;})&#xA;&#xA;qt_event_loop_driver-&amp;gt;start();&#xA;&#xA;return event_loop-&amp;gt;exec()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;There are multiple questions one may ask:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Why do we need to run serenity event loop as the main thing and not qt? I&#39;m sure it has it&#39;s own timer&lt;/li&gt;&#xA;&lt;li&gt;How is timer object connected to the event_loop var?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The answer to the second question is simple - there should be a global object somewhere and it&#39;s indeed there in form of &lt;code&gt;EventLoopManager&lt;/code&gt; class that&#39;s implemented as a singleton per system.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So the whole sequence goes as the following:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Timer -&amp;gt; EventReceiver -&amp;gt; EventLoopManager&lt;/p&gt;&#xA;&#xA;&lt;p&gt;when an event loop is run it actually calls &lt;code&gt;exec&lt;/code&gt; on EventLoopManager so even though it looks like you can have many event loops you actually cannot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And EventLoopManager does the actual things described in the &lt;a href=&#34;https://github.com/SerenityOS/serenity/blob/master/Documentation/EventLoop.md&#34;&gt;docs&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Getting back to the first question: it was done most probably because the initial implementation had only one process and that was the easiest way to make resource loading work - make qt take a back seat and invoke it only to draw the window every now and then&lt;/p&gt;&#xA;</summary>
  </entry>
  <entry>
    <title>A message by @can3p at Thu, 17 Aug 2023 00:12:13 +0000</title>
    <updated>2023-08-17T00:12:13Z</updated>
    <id>tag:dabdab.org,2023-08-17:/message/c7e17bb2-3307-42e6-86b7-24edc898b180</id>
    <link href="https://dabdab.org/message/c7e17bb2-3307-42e6-86b7-24edc898b180" rel="alternate"></link>
    <summary type="html">&lt;p&gt;Some hints in the first video on ladybird browser - https://www.youtube.com/watch?v=X38MTKHt3_I&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What web engine does is it generates a bitmap given the html it loaded and parsed given the view port dimensions and that&#39;s all to it. The rendering engine uses a layout tree that was built during the parsing phase to actually render content in the image.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, the rendered content has to be put in the window somehow and that has to be hooked up with QT. That works with Webview class inheriting from QAbstractScrollArea and that one in turn allows to right the behavior for all kinds of nice events including &lt;code&gt;paintEvent&lt;/code&gt; which is used to take the bitmap from the engine and render it on the window. How qt does that? No idea, most probably it has it&#39;s own render tree for all the widgets and this is where paintEvent stems from. Inside of it Andreas uses QPainter class and that one probably knows how to actually put stuff into graphics memory&lt;/p&gt;&#xA;</summary>
  </entry>
  <entry>
    <title>A message by @can3p at Wed, 16 Aug 2023 23:05:53 +0000</title>
    <updated>2023-08-16T23:05:53Z</updated>
    <id>tag:dabdab.org,2023-08-16:/message/8f058368-5f5f-468c-9da8-1e0444c69fda</id>
    <link href="https://dabdab.org/message/8f058368-5f5f-468c-9da8-1e0444c69fda" rel="alternate"></link>
    <summary type="html">&lt;p&gt;I&#39;m watching Andreas&#39; hacking session and I&#39;m apparently lacking something essential:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I don&#39;t understand how the actual rendering works and that&#39;s the most important&lt;/li&gt;&#xA;&lt;li&gt;I don&#39;t understand how events are connected between host operating system and browser itself&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</summary>
  </entry>
</feed>