Commit Graph

1076 Commits

Author SHA1 Message Date
Andrew Kaster
bd97442771 Meta: Add vulkan and vulkan-headers to vcpkg dependencies
Also require a specific ICU version to not run into unexpected problems.
2024-07-06 01:44:58 +02:00
Alex Studer
cdd91f4b48 Ladybird+LibCore+Meta: Update font paths and names for Android
We also disable fontconfig, because it doesn't have support for Android.
2024-07-05 14:27:25 -06:00
Salem Yaslem
ab82fc8993 LibCore: Support IPv6 for TCP and UDP connection 2024-07-05 14:26:22 -06:00
Aliaksandr Kalenik
e713de115c LibWeb+LibCore: Use Vulkan backend for Skia on Linux
Skia now uses GPU-accelerated painting on Linux if Vulkan is available.
Most of the performance gain is currently negated by reading the GPU
backend back into RAM to pass it to the Browser process. In the future,
this could be improved by sharing GPU-allocated memory across the
Browser and WebContent processes.
2024-07-05 07:13:13 +02:00
doctortheemh
5f06594bbd LibCore: Include full definition for LocalSocket
clang 19 (git) complains that LocalSocket is an incomplete type
and errors out. Including the full definition fixes the build.
2024-07-02 10:27:45 +02:00
Andrew Kaster
4cc3d598f9 LibWebView+LibCore: Manage process lifecycle using a SIGCHLD handler
This large commit also refactors LibWebView's process handling to use
a top-level Application class that uses a new WebView::Process class to
encapsulate the IPC-centric nature of each helper process.
2024-07-01 18:10:56 +02:00
Aliaksandr Kalenik
79acb998e1 LibCore+LibWeb: Use Metal backend for Skia painter on macOS
If Metal context and IOSurface are available, Skia painter will use
Ganesh GPU backend on macOS, which is noticeably faster than the default
CPU backend.

Painting pipeline:
1. (WebContent) Allocate IOSurface for backing store
2. (WebContent) Allocate MTLTexture that wraps IOSurface
3. (WebContent) Paint into MTLTexture using Skia
4. (Browser) Wrap IOSurface into Gfx::Painter and use
   QPainter/CoreGraphics to blit backing store into viewport.

Things we should improve in the future:
1. Upload textures for images in advance instead of doing that before
   every repaint.
2. Teach AppKit client to read directly from IOSurface instead of
   copying.
2024-06-28 14:25:34 +02:00
Aliaksandr Kalenik
c62cc915df Everywhere: Pass backing store into Navigable::paint()
...instead of Gfx::Bitmap, which makes it possible to access and
directly paint into IOSurface on macOS.
2024-06-28 14:25:34 +02:00
Ali Mohammad Pur
3214f2c5bf LibCore: Handle destroyed owner when unregistering timers and notifiers
Cherry-picked from 9f4f319277
2024-06-27 14:32:48 -06:00
Timothy Flynn
672a555f98 LibCore+LibJS+LibUnicode: Port retrieving time zone offsets to ICU
The changes to tests are due to LibTimeZone incorrectly interpreting
time stamps in the TZDB. The TZDB will list zone transitions in either
UTC or the zone's local time (which is then subject to DST offsets).
LibTimeZone did not handle the latter at all.

For example:

The following rule is in effect until November 18, 6PM UTC.

    America/Chicago -5:50:36 - LMT 1883 Nov 18 18:00u

The following rule is in effect until March 1, 2AM in Chicago time. But
at that time, a DST transition occurs, so the local time is actually
3AM.

    America/Chicago -6:00 Chicago C%sT 1936 Mar 1 2:00
2024-06-26 10:14:02 +02:00
Timothy Flynn
4fc0fba646 LibCore+LibJS+LibUnicode: Port retrieving available time zones to ICU
This required updating some LibJS spec steps to their latest versions,
as the data expected by the old steps does not quite match the APIs that
are available with the ICU. The new spec steps are much more aligned.
2024-06-26 10:14:02 +02:00
Ali Mohammad Pur
920f470735 LibCore: Fix some thread-related memory/object leaks 2024-06-26 05:47:16 +02:00
Aliaksandr Kalenik
c92f8ab1ea Everywhere: Use IOSurface as backing store on macOS
Using mmap-allocated memory for backing stores does not allow us to
benefit from using GPU-accelerated painting, because all the performance
increase we get is mostly negated by reading the GPU-allocated texture
back into RAM, so it can be shared with the browser process.

With IOSurface, we get a framebuffer that is both shareable between
processes and can be used as underlying memory for an OpenGL/Metal
texture.

This change does not yet benefit from using IOSurface and merely wraps
them into Gfx::Bitmap to be used by the CPU painter.
2024-06-24 13:09:08 +02:00
Aliaksandr Kalenik
e37071ae05 LibCore: Add a wrapper for IOSurface
Going to be used for backing store in upcoming changes.
2024-06-24 13:09:08 +02:00
Timothy Flynn
c9d9e1bb1f Meta: Exclude LibCore, LibUnicode, and LibURL from the lagom-tools build
We only need LibCoreMinimal for the lagom-tools build. In particular, by
removing LibUnicode, we remove the lagom-tools dependence on the system
ICU package, as we do not have vcpkg hooked into this build. (We could
probably add vcpkg here, but since this libraries aren't even needed, we
don't need to bother).
2024-06-23 19:52:45 +02:00
Timothy Flynn
546f740772 LibCore: Reduce the size of LibCoreMinimal slightly
A couple of files no longer needed after forking from Serenity and
removing a bunch of code generators.
2024-06-23 19:52:45 +02:00
Andreas Kling
7141319a7c LibGfx: Remove DDS image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling
4b4254c3d0 LibGfx: Remove QOI image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Daniel Bertalan
bf1f631f25 Everywhere: Write dtors for types with incomplete members out-of-line
These are rejected by Clang (19) trunk as a result of
https://github.com/llvm/llvm-project/pull/77753.
2024-06-16 07:19:56 -04:00
Andreas Kling
e636851481 LibHTTP+RequestServer: Add HTTP::HeaderMap and use for response headers
Instead of using a HashMap<ByteString, ByteString, CaseInsensitive...>
everywhere, we now encapsulate this in a class.

Even better, the new class also allows keeping track of multiple headers
with the same name! This will make it possible for HTTP responses to
actually retain all their headers on the perilous journey from
RequestServer to LibWeb.
2024-06-09 15:34:02 +02:00
Andrew Kaster
f98e28912a LibCore: Only include BeepInstruction in System.cpp on Serenity
It remains to be seen whether we actually need this on serenity either..
2024-06-06 12:51:14 -06:00
Andrew Kaster
2770b7eecd LibCore: Null-check struct addrinfo to avoid freeaddrinfo(NULL)
On some C libraries, like NetBSD and musl-libc, this under-specified
edge case results in a crash rather than silently ignoring the null
pointer.
2024-06-06 12:48:58 -06:00
Andrew Kaster
405ce6e5f5 LibCore: Be more BSD-friendly in Core::Environment
FreeBSD and NetBSD don't have secure_getenv(3), same as macOS.
FreeBSD 13 and lower also don't allow setting environ pointers to null.

Co-Authored-By: Robert Clausecker <fuz@FreeBSD.org>
2024-06-06 12:48:58 -06:00
easrng
f058939f1b LibCore: Get font directories from XDG_DATA_DIRS 2024-06-06 10:42:55 -06:00
Timothy Flynn
d61770c457 LibCore: Remove now-unused singleton process utilities 2024-06-06 11:27:03 -04:00
Timothy Flynn
edb527e04d Libraries: Remove some Serenity-only interface implementations 2024-06-04 07:45:42 +02:00
Timothy Flynn
126cbce632 Meta: Remove empty LibSystem library and references 2024-06-04 07:45:42 +02:00
Andrew Kaster
a9fdd819c3 LibCore: Don't leak EventLoopImplementationUnix's ThreadData
The ThreadData still has a lifetime a longer than the thread it was
created for, but at least now it's not leaked at process exit.
2024-05-31 15:24:46 -06:00
Romain Chardiny
892da127d0 LibCore: Add wrapper for fsync() 2024-05-31 13:49:34 +01:00
Matthew Olsson
a98ad191c7 Userland: Add ESCAPING annotations to a bunch of places
This isn't comprehensive; just a result of a simple grep search.
2024-05-22 21:55:34 -06:00
Dan Klishch
5a85067b49 Revert "LibCore: Add Core::deferred_invoke_if(F, Condition)"
This reverts commit a362c37c8b.

The commit tried to add an unused function that continued our tradition
of not properly waiting for things but instead flooding event loop with
condition checks that delay firing of the event. I think this is a
fundamentally flawed approach. See also checks for
`fire_when_not_visible` in LibCore/EventLoopImplementationUnix.cpp.
2024-05-21 23:32:54 +02:00
Ali Mohammad Pur
57714fbb38 RequestServer: Handle IPC requests on multiple threads concurrently
Previously RS handled all the requests in an event loop, leading to
issues with connections being started in the middle of other connections
being started (and potentially blowing up the stack), ultimately causing
requests to be delayed because of other requests.
This commit reworks the way we handle these (specifically starting
connections) by first serialising the requests, and then performing them
in multiple threads concurrently; which yields a significant loading
performance and reliability increase.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
e003c0bf06 LibCore: Remove the spammy "too late for a reloading timer" debug log 2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
96c7e83345 LibCore: Make Timers and Notifiers aware of threads
Previously sharing a Timer/Notifier between threads (or just handing
its ownership to another thread) lead to a crash as they are
thread-specific.
This commit makes it so we can handle mutation (i.e. just deletion
or unregistering) in a thread-safe and lockfree manner.
2024-05-20 08:03:35 +02:00
Ali Mohammad Pur
a362c37c8b LibCore: Add Core::deferred_invoke_if(F, Condition)
This will invoke the function F only if the provided Condition is met,
otherwise the execution of the function F will be further deferred.
2024-05-20 08:03:35 +02:00
Liav A
7e8dfe758c LibCore: Add a small library with only ArgsParser for DynamicLoader
This will be used in the DynamicLoader code, as it can't do syscalls via
LibCore code.
Because we can't use most of the LibCore code, we convert the versioning
code in Version.cpp to use LibC uname() function.
2024-05-14 15:42:42 -06:00
implicitfield
4574a8c334 Kernel+LibC+LibCore: Implement mknodat(2) 2024-05-14 22:30:39 +02:00
Sergey Bugaev
9d2d78c57c LibCore: Make MachPort build on GNU Mach 2024-05-02 07:46:53 -06:00
Andrew Kaster
05731f93b6 LibCore: Don't use designated initializers for struct cmsghdr
This can cause issues with older versions of glibc warning when not
initializing the flexible array member for CMSG_DATA. Such as glibc
shipped with Ubuntu 20.04.
2024-05-01 06:33:00 +02:00
Andrew Kaster
12a9702acb LibCore: Make singleton process helpers public 2024-04-27 20:32:12 -04:00
Andrew Kaster
70149079e4 LibCore: Add initializer for LocalServer from already connected socket 2024-04-27 20:32:12 -04:00
Timothy Flynn
207f3f1cb4 LibCore: Remove unnecessary lifetime extension from ProcessSpawnOptions
We don't need `file_actions` to be a constant-reference. It's created
in-place by its one user (HackStudio). Because it is currently a const-
ref, if we try to create a ProcessSpawnOptions like so:

    Core::ProcessSpawnOptions options { .name = "foo"sv };

We get the following error with clang 18:

    lifetime extension of temporary created by aggregate initialization
    using a default member initializer is not yet supported; lifetime of
    temporary will end at the end of the full-expression
2024-04-27 15:17:31 +02:00
Timothy Flynn
1560d6ad62 LibCore: Remove the now-obsolete SingletonProcess helper files 2024-04-24 15:51:58 -06:00
Timothy Flynn
c723fc9611 LibCore: Support launching a singleton process with an IPC connection
This largely adapts the code from SingletonProcess.cpp to work a bit
closer with Core::Process. Ideally, we'll move the daemonizing feature
into Core::Process::disown() eventually.
2024-04-24 15:51:58 -06:00
Timothy Flynn
8448897f14 LibCore: Implement a move operator for Core::Process
We implement the move constructor already. A future commit will have
code of the form:

    process = move(other_process);

which there is no reason to forbid.
2024-04-24 15:51:58 -06:00
Timothy Flynn
9986350e97 LibCore: Support launching a process with an IPC connection
Much of the code here is adapted from Ladybird. But rather than doing a
manual fork, we use Core::Process to spawn the underlying process.
2024-04-24 15:51:58 -06:00
Timothy Flynn
dc52404aec LibCore: Add a Core::Process action to close a file after spawning 2024-04-24 15:51:58 -06:00
Timothy Flynn
76af4503c1 LibCore: Return the singleton process's PID along with its IPC client
The PID will be used for Ladybird's task manager.
2024-04-22 14:46:10 -06:00
Timothy Flynn
bf50881e61 LibCore+LibSQL+LibWebView: Move launching a singleton process to LibCore
This just moves the code to launch a single process such as SQLServer to
LibCore. This will allow re-using this feature for other processes, and
will allow moving the launching of SQLServer to Ladybird.
2024-04-22 14:46:10 -06:00
Timothy Flynn
5dd3b91f0e LibCore+LibWebView: Move process statistics to LibCore
This will be needed to collect statistics from processes that do not
have anything to do with LibWebView. The ProcessInfo structure must be
virtual to allow callers to add application-specific information.
2024-04-22 14:46:10 -06:00