You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/architecture/canvas.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,10 +53,10 @@ flowchart TB
53
53
54
54
As part of the HTML event loop, the script thread runs a task (parsing, script evaluating, callbacks, events, ...) and after that it [performs a microtask checkpoint](https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint) that drains the microtasks queue.
55
55
In the [window event loop](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop-processing-model:window-event-loop-3) we queue a global task to [update the rendering](https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering) if there is a [rendering opportunity](https://html.spec.whatwg.org/multipage/webappapis.html#rendering-opportunity) (usually driven by compositor based on hardware refresh rate).
56
-
In Servo we do not actually queue a task, but instead we [run `update the rendering` after any IPC messages in the ScriptThread](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1418) and then [perform a microtask checkpoint too](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1371) as the event loop would have done after a task is completed.
56
+
In Servo, we do not actually queue a task, but instead we [run `update the rendering` after any IPC messages in the ScriptThread](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1418) and then [perform a microtask checkpoint too](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1371) as the event loop would have done after a task is completed.
57
57
[Update the rendering](https://github.com/servo/servo/blob/d970584332a3761009f672f975bfffa917513b85/components/script/script_thread.rs#L1201) does various resize, scroll and animations steps (which also includes performing a microtask checkpoint to resolve outstanding promises) and then [run the animation frame callbacks](https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#run-the-animation-frame-callbacks) (callbacks added with [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame)).
58
58
At this point draw commands are issued to painters to create a new frame of animation.
59
-
Finally we trigger reflow (layout), which first updates the rendering of canvases (by flushing dirty canvases) and animated images, then traverses the DOM and its styles, builds a `DisplayList`, and sends that to WebRender for rendering.
59
+
Finally, we trigger reflow (layout), which first updates the rendering of canvases (by flushing dirty canvases) and animated images, then traverses the DOM and its styles, builds a `DisplayList`, and sends that to WebRender for rendering.
60
60
61
61
When canvas context creation is requested (`canvas.getContext('2d')`), the script thread blocks on the painter thread as it initializes and creates a new WebRender image (`CreateImage`), finally sending the associated `ImageKey` back to script.
Copy file name to clipboardExpand all lines: src/architecture/concurrency-and-parallelism.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,15 +34,15 @@ Here are some ways that we take advantage of both:
34
34
Decoding multiple images in parallel is straightforward.
35
35
*_Decoding of other resources_.
36
36
This is probably less important than image decoding, but anything that needs to be loaded by a page can be done in parallel, e.g. parsing entire style sheets or decoding videos.
37
-
*_GC JS concurrent with layout_ - Under most any design with concurrent JS and layout, JS is going to be waiting to query layout sometimes, perhaps often.
37
+
*_GC JS concurrent with layout_ - Under almost any design with concurrent JS and layout, JS is going to be waiting to query layout sometimes, perhaps often.
38
38
This will be the most opportune time to run the GC.
39
39
40
40
For information on the design of WebXR see the [in-tree documentation](./webxr.md).
41
41
42
42
## Challenges
43
43
44
44
*_Parallel-hostile libraries_.
45
-
Some third-party libraries we need don't play well in multi-threaded environments.
45
+
Some third-party libraries we need don't play well in multithreaded environments.
46
46
Fonts in particular have been difficult.
47
47
Even if libraries are technically thread-safe, often thread safety is achieved through a library-wide mutex lock, harming our opportunities for parallelism.
Copy file name to clipboardExpand all lines: src/architecture/further-reading.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@
4
4
5
5
## References
6
6
7
-
Important research and accumulated knowledge about browser implementation, parallel layout, etc:
7
+
Important research and accumulated knowledge about browser implementation, parallel layout, etc.:
8
8
9
9
*[How Browsers Work](http://ehsan.github.io/how-browsers-work/#1) - basic explanation of the common design of modern web browsers by long-time Gecko engineer Ehsan Akhgari
10
10
*[More how browsers work](http://taligarsiel.com/Projects/howbrowserswork1.htm) article that is dated, but has many more details
*[Fast and parallel web page layout (2010)](https://lmeyerov.github.io/projects/pbrowser/pubfiles/paper.pdf) - Leo Meyerovich's influential parallel selectors, layout, and fonts.
13
-
It advocates seperating parallel selectors from parallel cascade to improve memory usage.
13
+
It advocates separating parallel selectors from parallel cascade to improve memory usage.
14
14
See also the [2013 paper for automating layout](https://lmeyerov.github.io/projects/pbrowser/pubfiles/synthesizer2012.pdf) and the [2009 paper that touches on speculative lexing/parsing](http://lmeyerov.github.io/projects/pbrowser/hotpar09/paper.pdf).
15
15
*[Servo layout on mozilla wiki](https://wiki.mozilla.org/Servo/StyleUpdateOnDOMChange)
16
16
*[Robert O'Callahan's mega-presentation](http://robert.ocallahan.org/2012/04/korea.html) - Lots of information about browsers
Copy file name to clipboardExpand all lines: src/architecture/microtasks.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@
3
3
# Microtasks
4
4
5
5
According the HTML spec, a microtask is: "a colloquial way of referring to a task that was created via the queue a microtask algorithm"([source](https://html.spec.whatwg.org/multipage/#microtask-queue)).
6
-
Each [event-loop](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop)--meaning window, worker, or worklet--has it's own microtask queue.
7
-
The tasks queued on it are run as part of the [perform a microtask checkpoint](https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint) algorithm, which is called into from various places, the main one being [after running a task](https://html.spec.whatwg.org/multipage/#event-loop-processing-model:perform-a-microtask-checkpoint) from an task queue that isn't the microtask queue, and each call to this algorithm drains the microtask queue--running all tasks that have been enqueued up to that point([without re-entrancy](https://html.spec.whatwg.org/multipage/#performing-a-microtask-checkpoint)).
6
+
Each [event-loop](https://html.spec.whatwg.org/multipage/webappapis.html#event-loop)--meaning window, worker, or worklet--has its own microtask queue.
7
+
The tasks queued on it are run as part of the [perform a microtask checkpoint](https://html.spec.whatwg.org/multipage/#perform-a-microtask-checkpoint) algorithm, which is called into from various places, the main one being [after running a task](https://html.spec.whatwg.org/multipage/#event-loop-processing-model:perform-a-microtask-checkpoint) from a task queue that isn't the microtask queue, and each call to this algorithm drains the microtask queue--running all tasks that have been enqueued up to that point([without re-entrancy](https://html.spec.whatwg.org/multipage/#performing-a-microtask-checkpoint)).
8
8
9
9
## The microtask queue in Servo
10
10
@@ -18,7 +18,7 @@ Dedicated workers [use a child runtime](https://github.com/servo/servo/blob/4357
18
18
A task can be enqueued on the microtask queue from both Rust, and from the JS engine.
19
19
20
20
- From JS: the JS engine will call into [`enqueue_promise_job`](https://github.com/servo/servo/blob/7eac599aa1d6bcf8858c51d90763373f0dd5f289/components/script/script_runtime.rs#L196) whenever it needs to queue a microtask to call into promise handlers.
21
-
This callback mechanism is setup[once per runtime](https://github.com/servo/servo/blob/7eac599aa1d6bcf8858c51d90763373f0dd5f289/components/script/script_runtime.rs#L520).
21
+
This callback mechanism is set up[once per runtime](https://github.com/servo/servo/blob/7eac599aa1d6bcf8858c51d90763373f0dd5f289/components/script/script_runtime.rs#L520).
22
22
This means that resolving a promise, either [from Rust](https://github.com/servo/servo/blob/7eac599aa1d6bcf8858c51d90763373f0dd5f289/components/script/dom/promise.rs#L173) or from JS, will result in this callback being called into, and a microtask being enqueued.
23
23
Strictly speaking, the microtask is [still enqueued from Rust](https://github.com/servo/servo/blob/7eac599aa1d6bcf8858c51d90763373f0dd5f289/components/script/script_runtime.rs#L222).
24
24
- From Rust, there are various places from which microtask are explicitly enqueued by "native" Rust:
Copy file name to clipboardExpand all lines: src/architecture/web_api.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@
21
21
- Add an appropriate member to the struct(s) added at 4.
22
22
- If this requires defining other structs or enums, these should derive `JSTraceable` and `MallocSizeOf`([example](https://github.com/servo/servo/pull/34844/commits/7d73370b0c41a1b00f4b25b7e1b8bf9b67430708#diff-2e7f6e100fdbd73318de2dda9b3d3883700be9ebfd028d4412a207e93cb02892R53)).
23
23
- All `JSTraceable` structs added above that contain members that must be rooted because they are either [JS values](https://github.com/servo/mozjs/blob/87cabf4e9ddf9fafe19713a3d6bc8c5e6105544c/mozjs/src/gc/collections.rs#L94) or [DOM objects](https://github.com/servo/servo/blob/9887ad369d65eb362db21c778ae5f00aad74db6c/components/script/dom/bindings/root.rs#L5) should be marked with `#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]`. [Example](https://github.com/gterzian/servo/blob/b7688fe916d105ae9023cd2429068f16ecba3574/components/script/dom/readablestreamdefaultcontroller.rs#L120), where the lint is needed due to the presence of a `JSVal`.
24
-
- If such a struct is assigned to a variable, `impl js::gc::Rootable` for the and use `rooted!` to root the variable([example](https://github.com/servo/servo/pull/34844/commits/94867eec21e06d59c5479bdaa92ef422bc7b21f9)).
24
+
- If such a struct is assigned to a variable, `impl js::gc::Rootable` for the struct and use `rooted!` to root the variable([example](https://github.com/servo/servo/pull/34844/commits/94867eec21e06d59c5479bdaa92ef422bc7b21f9)).
25
25
- All of this can be changed later, so simply use your best judgement at this stage.
26
26
- Add methods for [construction](https://github.com/servo/servo/blob/4a5ff01e060293721d10289ec56dbd4c58a0969e/components/script/dom/mod.rs#L91)(not to be confused with a `Constructor` that is part of the Web API).
1. For each methods of the bindings trait referred to at 3 in Part 1:
30
+
1. For each method of the bindings trait referred to at 3 in Part 1:
31
31
- In general, follow the structure of the spec: if a method calls into another named algorithm, implement that named algorithm as a separate private method of your struct, that the trait methods calls into. If you later realize this private method can be used from other structs, make it `pub(crate)`.
Copy file name to clipboardExpand all lines: src/contributing.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ This is to prevent duplicated efforts from contributors on the same issue.
16
16
Sending the message "@servo-highfive assign me" will assign the issue to you.
17
17
18
18
Head over to [Servo Starters](https://starters.servo.org/) to find good tasks to start with.
19
-
If you find any unfamiliar words or jargon, please check the [the glossary](old/glossary.md) first.
19
+
If you find any unfamiliar words or jargon, please check [the glossary](old/glossary.md) first.
20
20
If there's no matching entry, please make a pull request to add one with the content `TODO` so we can correct that!
21
21
22
22
See [Hacking on Servo](hacking/mach.md) for more information on how to start working on Servo.
@@ -35,7 +35,7 @@ Contributions should adhere to the [style guide](style-guide.md).
35
35
- Commits should be accompanied by a [Developer Certificate of Origin](http://developercertificate.org) sign-off, which indicates that you (and your employer if applicable) agree to be bound by the terms of the [project license](https://github.com/servo/servo/blob/main/LICENSE).
36
36
In git, this is the `-s` option to `git commit`.
37
37
38
-
- If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review in [the Servo chat](https://servo.zulipchat.com/).
38
+
- If your patch is not getting reviewed, or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review in [the Servo chat](https://servo.zulipchat.com/).
39
39
40
40
- Add tests relevant to the fixed bug or new feature.
41
41
For a DOM change this will usually be a web platform test; for layout, a reftest.
0 commit comments