Commit graph

68 commits

Author SHA1 Message Date
Alex Touchet
1aac377e62
Organize component Cargo.toml dependencies (#36224)
Signed-off-by: Alex Touchet <26315797+atouchet@users.noreply.github.com>
2025-03-30 19:03:54 +00:00
DK Liao
bcdd34e2aa
chore: Move unsafe operations in unsafe functions to unsafe blocks (#36017)
Signed-off-by: DK Liao <dklassic@gmail.com>
2025-03-18 06:19:35 +00:00
Simon Wülker
bb0d08432e
Migrate to the 2024 edition (#35755)
* Migrate to 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Allow unsafe_op_in_unsafe_fn lint

This lint warns by default in the 2024
edition, but is *way* too noisy for servo.

We might enable it in the future, but not now.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Compile using the 2024 edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-13 10:28:11 +00:00
Martin Robinson
4f58fa4d44
bhs: Remove direct link to liblzma (#35924)
This workaround doesn't seem to be necessary any longer.

Fixes #35914.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-03-12 10:20:51 +00:00
Simon Wülker
3d320fa96a
Update rustfmt to the 2024 style edition (#35764)
* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2025-03-03 11:26:53 +00:00
Josh Matthews
6b12499077
Only compile platform samplers when cargo feature enabled (#35312)
* background_hang_monitor: Only compile platform samplers when cargo feature enabled.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* background_hang_monitor: Make nix dependency optional.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-06 06:53:08 +00:00
Josh Matthews
cdd6660113
libservo: Make background hang monitor integration optional. (#35256)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2025-02-01 20:15:39 +00:00
Martin Robinson
9dbc942bee
libservo: Port desktop servoshell to use the new WebView API (#35183)
This removes all uses of `EmbedderEvent` in the desktop servoshell to
use the new `WebView` API -- filling it out when necessary.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
2025-01-28 14:57:57 +00:00
Martin Robinson
aa0029c11c
Add rust-version to all Cargo.toml files (#33483)
This is another step preparing for building Servo without `mach`.

Fixes #33430.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2024-09-17 16:39:07 +00:00
A. Wilcox
0e56241c1b
background_hang_monitor: Add musl compatibility (#33153)
musl does not have libunwind readily available; even if it did, it has
no concept of ucontext (needing an external lib).  Similar to ohos,
disable the background hang monitor and use the DummySampler.

Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
2024-08-21 21:38:28 +00:00
Jonathan Schwender
97c84b6127
ohos/android: Redirect stdout/stderr to log sink (#32858)
* ohos: redirect stdout/stderr to logging sink

Based on the existing android `redirect_stdout_to_logcat` implementation,
but using the safe abstractions from `nix` and dumping to the `log` sink,
instead of directly writing the log.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* android: Use new shared implementation for logcat redirection.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* servoshell: Register cfg(production)

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Update ports/servoshell/egl/log.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>

* Change info! to debug! to match original behavior on android

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-08-15 09:26:03 +00:00
Simon Wülker
c059bab6f4
Dont use lazy static to construct mutexes (#33047)
* Remove usage of lazy-static in background_hang_monitor

The lazy-static crate was only used to construct a mutex,
but since Mutex::new is const this can be done at compiletime
instead.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Remove usage of lazy-static in servoshell

Lazy-static was only used to construct a mutex, but
since Mutex::new is const this can simply be done at
compiletime.

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-08-14 13:42:01 +00:00
Jonathan Schwender
3aef023368
ohos: Fix x86_64-unknown-linux-ohos (#33029)
* ohos: Fix compilation for x86_64

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* ohos: Use the SDK compiler-wrapper

When compiling for x86_64-unknown-linux-ohos without the compiler
wrapper, for some reason mozjs_sys will be refercing a wrong mangled symbol
resulting in the following error when loading the .so at runtime:

```
_ZNSt3__111this_thread9sleep_forERKNS_6chrono8durationIxNS_5ratioILl1ELl1000000000EEEEE: symbol not found
```

This problem does not occur when compiling for aarch64 or when using the compiler wrapper.
In this case the correct symbol
`_ZNSt4__n111this_thread9sleep_forERKNS_6chrono8durationIxNS_5ratioILl1ELl1000000000EEEEE`
is referenced.
It's unclear why manually passing the flags via CFLAGS / CXXFLAGS does not work.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-08-14 01:30:04 +00:00
Jonathan Schwender
cd394af018
Bump duplicated nix to 0.29 (#32764)
Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-13 07:48:01 +00:00
Martin Robinson
4a7f3bac7c
Use workspace definitions for all crates and update to the 2021 edition (#32544) 2024-06-18 09:22:08 +00:00
Martin Robinson
e902d63732
deps: Switch from winapi to windows_sys in Servo code (#32516)
This is part of the switch from `winapi` to `windows-sys`. `windows-sys` is
maintained by Microsoft, so is more "official." More and more crates are
switching to it.
2024-06-17 08:27:50 +00:00
Martin Robinson
7982f0dc27
build: Fix build warnings on Windows (#32500)
Disable some code for Windows, which is causing build warnings. When it
cannot be easily disabled (mainly for the incomplete BHM and sandbox
feature), allow dead code.
2024-06-15 14:31:36 +00:00
Martin Robinson
3398fc017b
Move non-gfx things out of gfx_traits and create a base crate (#32296)
For a long time, `gfx_traits` has held a lot of things unrelated to graphics
and also unrelated to the `gfx` crate (which is mostly about fonts).
This is a cleanup which does a few things:

1. Move non `gfx` crate things out of `gfx_traits`. This is important in
   order to prevent dependency cycles with a different integration between
   layout, script, and fonts.
2. Rename the `msg` crate to `base`. It didn't really contain anything
   to do with messages and instead mostly holds ids, which are used
   across many different crates in Servo. This new crate will hold the
   *rare* data types that are widely used.

Details:

 - All BackgroundHangMonitor-related things from base to a new
   `background_hang_monitor_api` crate.
 - Moved `TraversalDirection` to `script_traits`
 - Moved `Epoch`-related things from `gfx_traits` to `base`.
 - Moved `PrintTree` to base. This should be widely useful in Servo.
 - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it
   to `WebRenderFontApi`.
2024-05-17 12:28:58 +00:00
Magnus Larsen
9acf2182cd
servoshell: Upgrade egui and many other dependencies (#31278)
* servoshell: Upgrade `egui` and many other dependencies

This upgrades:
 - `core-graphics`
 - `core-text`
 - `egui` and friends
 - `font-kit`
 - `glow` and friends
 - `harfbuzz-sys`
 - `jni`
 - `nix`
 - `raqote`
 - `raw-window-handle`
 - `winit`

* Downgrade jni until we can properly upgrade

* Update some test results

It's unclear why these are now passing, but they are.

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-05-02 16:21:07 +00:00
Ngo Iok Ui (Wu Yu Wei)
b1debf2068
fix: missing thread name when spawning (#31656)
* Add missing thread name when spawning

* Update namings
2024-03-14 10:40:58 +00:00
Mucha Naibei
4efebf1e62
Fix clippy warnings in components/third_party (#31623) 2024-03-12 17:17:23 +00:00
eri
3a5ca785d3
clippy: fix warnings in various modules in components (#31568)
* clippy: fix warnings in various modules in components

* fix: unit tests

* fix: build on android

* fix: all samplers use new_boxed
2024-03-08 14:28:04 +00:00
Rajesh Malviya
9d42602fe7
BHM: Support aarch64 for Mac sampler (#31298)
Replaced unmaintained `mach` crate with `mach2`, and added support for getting arm registers.
2024-02-09 13:55:28 +00:00
Mukilan Thiyagarajan
d7de206dbd
Preliminary Android build support (#31086)
* Android build

* Fixes
* More fixes
  - Still failing in the linking step
* More work on getting linking working

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: use mozjs with ndk r25c. loads servo.org

more android build fixes.

* fix ./mach run for android and make it follow logs

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* add experimental logic for compositor pause/resume

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* pass DPI from android to simpleservo

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* ci: add android workflow

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* switch to ANDROID_SDK_ROOT and ANDROID_NDK_ROOT vars

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade gradle to 4.10.1

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade to gradle 5.1.1

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade to gradle 8 and agp 8

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* make compositing work again with external present

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: improve mach support for non-NixOS and CI

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fix sampler compilation bug introduced in #30490

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* ci: add android build to main workflow

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* gradle: set MinSdk = targetSdk = 30

NDK requires we compile against the minSdk API level
which is 30 in our case.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* add instructions for android in README.md

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: move servosurface to servoview

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: uncomment the mediasession callbacks on MainActivity

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: fix crash on MainAtivity.onDestroy

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: drop VR, arm 5 and unused code

This commit drops:
* support for google, oculusvr
* support for arm5 architecture

and also removes
* fakeld scripts
* unused java code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* cleanup shell.nix

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: add FIXMEs for gstreamer code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* apk: remove commented code and debug logs

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* cleanup ServoView.java

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* mach: comment call to download gstreamer deps for android

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* disable bluetooth for jniapi as blurdroid is broken

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fixup! README.md

* fixup! remove change in Cargo.toml

* fixup! move shell variables together

* fixup! cleanup jniapi/Cargo.toml comments

* delete commented gstreamer related android code

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* remove unused config variable in servbuild

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: more cleanup

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* force no_static_freetype only for android

* use actions to manage sdk, ndk and java

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* rename embedder event names to be more clear.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* link to startup crash issue

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fix lint issues

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* upgrade env_logger to 0.10 with duplicate exception

libservo and android_logger can use env_logger 0.10
but quickcheck is still stuck on 0.8 and has not seen
any activity in the last 2 years. This commit adds
a duplicate exception until the quickcheck dependency
can be upgraded (or replaced)

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* android: fix comments

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* disable jemalloc on android

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>

* fixup! replace linux with android in cfg

---------

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-22 13:00:15 +00:00
Martin Robinson
bd052f536e
bhm: Fix a warning in the Linux sampler (#30924)
Use curly braces instead of an explicit drop to control the end of a
borrow.
2023-12-28 11:20:47 +00:00
Martin Robinson
df157dcc03
dependencies: Update to latest version of unwind-sys (#30923)
This allows us to remove the dependency on the git version of
`unwind-sys` necessary for allowing compilation on Fedora 39.
2023-12-23 15:56:09 +00:00
Martin Robinson
d007d265bd
Fix the unwind-sys build on latest Fedora (#30906)
The libunwind library version installed includes an rc number. The
latest released version of the `unwind-sys` crate doesn't handle this
properly, so rely on the latest commit in the upstream repository.
2023-12-21 14:37:00 +00:00
Martin Robinson
f4d3af296c Move *_traits and other shared types to shared
This is the start of the organization of types that are in their own
crates in order to break dependency cycles between other crates. The
idea here is that putting these packages into their own directory is the
first step toward cleaning them up. They have grown organically and it
is difficult to explain to new folks where to put new shared types. Many
of these crates contain more than traits or don't contain traits at all.

Notably, `script_traits` isn't touched because it is vendored from
Gecko. Eventually this will move to `third_party`.
2023-11-03 15:38:18 +00:00
Ngo Iok Ui (Wu Yu Wei)
a31e2ea576
Fix macOS's sameple isn't used in background_hang_monitor (#30490) 2023-10-04 06:59:45 +00:00
Fabrice Desré
c78533c1a8
Update version of nix, and ron (#30330)
* Bump ron to 0.8.1 to pickup more recent base64

* Remove dependency on nix 0.14

* Update libloading in simpleservo
2023-09-15 02:06:14 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Martin Robinson
2f4c47bfe7 Start the transition to workspace dependencies
This will ultimately make it simpler to update crate dependencies and
reduce duplicate when specifying requirements. Generally, this change
does not touch dependencies that are only used by a single crate. We
could consider moving them to workspace dependencies in the future.
2023-05-17 11:59:35 +02:00
yvt
602c02edd2 fix(bhm): deliver exit signal reliably (for real)
> However, as it turns out, `crossbeam-channel`'s channels don't drop
> remaining messages until all associated senders *and* receivers are
> dropped. This means the exit signal won't be delivered as long as
> there's at least one `HangMonitorRegister` or
> `BackgroundHangMonitorChan` maintaining a copy of the sender. To work
> around this and guarantee a rapid delivery of the exit signal, the
> sender is wrapped in `Arc`, and only the worker thread maintains a
> strong reference, thus ensuring both the sender and receiver are
> dropped as soon as the worker thread exits.
2021-06-21 00:07:26 +09:00
yvt
18c79cafac fix(bhm): deliver exit signal reliably when component registration and signal submission coincide
> There's a race condition between the reception of
> `BackgroundHangMonitorControlMsg::Exit` and `MonitoredComponentMsg::
> Register`. When the worker receives `Exit`, it stops receiving
> messages, and any remaining messages (including the
> `MonitoredComponentMsg::Register` we sent) in the channel are dropped.
> Wrapping `exit_signal` with this RAII wrapper ensures the exit signal
> is delivered even in such cases.

This should (hopefully) eliminate the intermittent hang-ups in the test
case `test_hang_monitoring_exit_signal` for good.
2021-06-20 13:09:26 +09:00
yvt
2eec1e69ea refactor(bhm): reduce item visibility 2021-06-20 00:04:20 +09:00
Josh Matthews
1a1590fd53
Disable intermittent unit tests on macos. 2021-05-26 19:32:30 -04:00
Josh Matthews
9e1f6ee332
Ignore warnings. 2021-03-14 22:24:48 -04:00
Josh Matthews
2e35fc5cb9
Disable hanging hang monitor tests on windows 2021-03-12 16:49:36 -05:00
Gregory Terzian
256167eff2 improve reliability of hang monitor tests 2020-07-07 12:45:14 +08:00
Gregory Terzian
44ebca72da ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
Simon Sapin
dbdc44215b Use UnsafeCell instead of static mut in background_hang_monitor/sampler_linux.rs 2020-06-05 00:11:37 +02:00
atouchet
ede15557ae Some Cargo.toml cleanups 2020-05-13 22:09:56 -07:00
Josh Matthews
3fd3c23e17 Update ipc-channel and crossbeam-channel. 2020-02-20 11:15:13 -05:00
Patrick Walton
a358bca766 Use surfman for managing GL surfaces
Co-authored-by: Alan Jeffrey <ajeffrey@mozilla.com>
Co-authored-by: Zakor Gyula <gyula.zakor@h-lab.eu>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2019-11-01 08:47:11 -05:00
Shotaro Yamada
b228d2700e Remove unused dependencies 2019-10-01 21:15:53 +09:00
Bastien Orivel
c8aae12ff4 Update and dedupe nix 2019-09-06 18:37:37 +02:00
Bastien Orivel
b6cddbebaa Deduplicate parking_lot and friends by updating it to 0.9 2019-09-05 10:47:39 +02:00
Bastien Orivel
92161ecfbc Update ipc-channel and related dependencies 2019-08-27 23:44:04 +02:00
Simon Sapin
b6bd2d7302 Remove uses of mem::uninitialized 2019-07-17 10:48:54 +02:00