Commit graph

34 commits

Author SHA1 Message Date
Taym Haddadi
a24e92778a
fix: add error handling to BaseAudioContext::new_inherited (#33023)
* fix: add error handling to BaseAudioContext::new_inherited

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update servo-media

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>

* Update test expectations

Signed-off-by: Taym <haddadi.taym@gmail.com>

* Update servo-media

Signed-off-by: Taym <haddadi.taym@gmail.com>

---------

Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Taym <haddadi.taym@gmail.com>
2024-08-18 13:58:43 +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
Pi-Cla
160c7c0b0f
Fix some clippy warnings in components/gfx and components/script (#32215)
* clippy: Squish warnings and errors in gfx

warning: redundant closure (gfx/font.rs:415:18)

warning: useless conversion to the same type (gfx/font.rs:534:9)

warning: the following explicit lifetimes could be elided: 'a (gfx/font.rs:619:16)

error: this loop never actually loops (gfx/font_cache_thread.rs:112:9)

warning: this expression creates a reference which is immediately dereferenced by the compiler  (gfx/font_cache_thread.rs:229:51)

warning: redundant closure (gfx/font_cache_thread.rs:551:18)

3 instances of:
warning: casting integer literal to `f64` is unnecessary (gfx/platform/freetype/font_list.rs:271-273)

* clippy: methods called `from_*` usually take no `self`

It reports that by standard convention, from_* methods should not take any `&self` parameter

* clippy: you should consider adding a `Default` implementation

It reports that public types with a pub fn new() -> Self should have a Default implementation since they can be constructed without arguments

* clippy: casting to the same type is unnecessary (`f32` -> `f32`)

* clippy: use of `unwrap_or_else` to construct default value

* clippy: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self`

* clippy: manual `!RangeInclusive::contains` implementation

contains expresses the intent better and has less failure modes (such as fencepost errors or using || instead of &&)

* clippy: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`

* clippy: Fix some new warnings

warning: this `if` statement can be collapsed (gfx/font.rs:468:130)

warning: this lifetime isn't used in the impl (gfx/platform/freetype/font.rs:341:6)

warning: field assignment outside of initializer for an instance created with Default::default() (compositor.rs:881:17)
2024-05-02 20:02:21 +00:00
Azhar Ismagulova
f183170786
clippy: Fix all errors in components/script (#31911)
* clippy: Fix errors in components/script/dom

* clippy: fixed remaining errors in components/script
2024-03-28 09:03:18 +00:00
Oluwatobi Sofela
02a0cdd6fa
clippy: Fix dereferenced warnings (#31770) 2024-03-20 08:07:22 +00:00
Samson
604979e367
Replace script_plugins with a clippy like rustc driver (named crown) (#30508)
* Remove script_plugins

* Use crown instead of script_plugins

* crown_is_not_used

* Use crown in command base

* bootstrap crown

* tidy happy

* disable sccache

* Bring crown in tree

* Install crown from tree

* fix windows ci

* fix warning

* fix mac

libscript_plugins.dylib is not available anymore

* Update components/script/lib.rs

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

* Update for nightly-2023-03-18

Mostly just based off https://github.com/servo/servo/pull/30630

* Always install crown

it's slow only when there is new version

* Run crown test with `mach test-unit`

* Small fixups; better trace_in_no_trace tests

* Better doc

* crown in config.toml

* Fix tidy for real

* no sccache on rustc_wrapper

* document rustc overrides

* fixup of compiletest

* Make a few minor comment adjustments

* Fix a typo in python/servo/platform/base.py

Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>

* Proper test types

* Ignore tidy on crown/tests

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-12-01 15:50:52 +00:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +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
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Josh Matthews
fca5833e21 Remove global argument from Promise::new_in_current_realm. 2023-05-20 11:05:09 -04:00
yvt
41b3726271 feat: shorten thread names
The Linux kernel imposes a 15-byte limit on thread names[1]. This means
information that does not fit in this limit, e.g., the pipeline ID of
layout and script threads, is lost in a debugger and profiler (see the
first column of the table below).

This commit shortens the thread names used in Servo to maximize the
amount of information conveyed. It also rectifies some inconsistencies
in the names.

|       Before      |       After       |
|-------------------|-------------------|
| `BluetoothThread` | `Bluetooth`       |
| `CanvasThread`    | `Canvas`          |
| `display alert d` | `AlertDialog`     |
| `FontCacheThread` | `FontCache`       |
| `GLPlayerThread`  | `GLPlayer`        |
| `HTML Parser`     | `Parse:www.examp` |
| `LayoutThread Pi` | `Layout(1,1)`     |
| `Memory profiler` | `MemoryProfiler`  |
| `Memory profiler` | `MemoryProfTimer` |
| `OfflineAudioCon` | `OfflineACResolv` |
| `PullTimelineMar` | `PullTimelineDat` |
| `ScriptThread Pi` | `Script(1,1)`     |
| `WebWorker for h` | `WW:www.example.` |
| `ServiceWorker f` | `SW:www.example.` |
| `ServiceWorkerMa` | `SvcWorkerManage` |
| `Time profiler t` | `TimeProfTimer`   |
| `Time profiler`   | `TimeProfiler`    |
| `WebGL thread`    | `WebGL`           |
| `Choose a device` | `DevicePicker`    |
| `Pick a file`     | `FilePicker`      |
| `Pick files`      | `FilePicker`      |

[1]: https://stackoverflow.com/questions/5026531/thread-name-longer-than-15-chars
2021-07-19 00:57:48 +09:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Josh Matthews
f02e516f32 Remove unnecessary Option. 2020-02-24 15:58:58 -05:00
Kunal Mohan
5a3e1b8e69
rename compartment to realm 2020-01-24 20:52:36 +05:30
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
Fernando Jiménez Moreno
51ed44c77d Register pipeline instead of browsing contexts for media instances 2019-09-19 17:48:54 +02:00
Fernando Jiménez Moreno
8e0160fa71 Update servo media to include global mute support 2019-07-05 11:01:19 +02:00
Bastien Orivel
292d468cd1 Use the newly added inCompartments option everywhere it can be 2019-05-25 17:28:07 +02:00
Aron Zwaan
e2e6e2ac94 Pass InCompartment by value 2019-04-25 11:37:35 +02:00
Aron Zwaan
1b6949d4cf Add proof parameter to Promise::new_in_current_compartment 2019-04-24 19:46:10 +02:00
Aron Zwaan
782b58587a Rename Promise::new to Promise::new_in_current_compartment 2019-04-03 20:45:30 +02:00
Manish Goregaokar
611dc4bc70 Remove now-unnecessary must_root and allow(unrooted_must_root) annotations 2019-01-04 15:05:07 -08:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Agustin Chiappe Berrini
75eb94afca Unify the task source and task canceller API
I moved away from the `Window` struct all the logic to handle task
sources, into a new struct called `TaskManager`. In a happy world, I'd
be able to just have there two functions, of the types:

```rust
fn task_source<T: TaskSource>(&self, name: TaskSourceName) -> Box<T>
fn task_source_with_canceller<T: TaskSource>(&self, name: TaskSourceName)
  -> (Box<T>, TaskSourceCanceller)
```

And not so much duplicated code. However, because TaskSource can't be a
trait object (because it has generic type parameters), that's not
possible. Instead, I decided to reduce duplicated logic through macros.

For reasons[1], I have to pass both the name of the function with
canceller and the name of the function without, as I'm not able to
concatenate them in the macro itself. I could probably use
`concat_idents` to create both types already defined and reduce the
amount of arguments by one, but that macro is nightly only. At the same
time, not being able to declare macros inside `impl` forces me to pass
`self` as an argument.

All this makes this solution more verbose than it would be ideally. It
does reduce duplication, but it doesn't reduce the size of the file.

[1](https://github.com/rust-lang/rust/issues/29599)
2018-11-14 06:36:44 -05:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
Manish Goregaokar
ceb2cd2279 Handle case when OfflineAudioContext doesn't receive all the buffers 2018-10-10 16:29:43 -07:00
Fernando Jiménez Moreno
13b5774017 Check constraints in both overloaded OfflineAudioContext constructors 2018-09-20 15:46:47 +02:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Fernando Jiménez Moreno
f423ede07f Add support for multichannel decoded audio 2018-09-11 10:38:56 +02:00
Fernando Jiménez Moreno
3b8cb83e04 Make OfflineAudioContextOptions spec compliant 2018-07-30 18:50:36 +02:00
Fernando Jiménez Moreno
6aaf5806b1 OfflineAudioContext 2018-07-30 14:23:48 +02:00