Files
servo/components/script/Cargo.toml
Martin Robinson bfde51c0db script: Have FetchResponseListener::process_response_eof consume the listener (#40556)
The goal of this change is to prevent having to copy so much data out of
listeners when a fetch completes, which will be particularly important
for off-the-main thread parsing of CSS (see #22478). This change has
pros and cons:

Pros:
- This makes the design of the `FetchResponseListener` a great deal
simpler.
They no longer individually store a dummy `ResourceFetchTiming` that is
   only replaced right before `process_response_eof`.
 - The creation of the `Arc<Mutex<FetchResponseListener>>` in the
   `NetworkListener` is abstracted away from clients and now they just
   pass the `FetchResponseListener` to the fetch methods in the global.

Cons:
 - Now each `FetchResponseListener` must explicitly call `submit_timing`
   instead of having the `NetworkListener` do it. This is arguably a bit
   easier to follow in the code.
 - Since the internal data of the `NetworkListener` is now an
   `Arc<Mutex<Option<FetchResponseListener>>>`, when the fetching code
   needs to share state with the `NetworkListener` it either needs to
   share an `Option` or some sort of internal state. In one case I've
   stored the `Option` and in another case, I've stored a new inner
   shared value.

Testing: This should not change observable behavior and is thus covered
by existing tests.
Fixes: #22550

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
2025-11-11 22:30:40 +00:00

162 lines
5.2 KiB
TOML

[package]
name = "script"
build = "build.rs"
version.workspace = true
authors.workspace = true
license.workspace = true
edition.workspace = true
publish.workspace = true
rust-version.workspace = true
[lib]
name = "script"
path = "lib.rs"
[features]
bluetooth = ['bluetooth_traits', 'script_bindings/bluetooth']
crown = ['js/crown']
debugmozjs = ['js/debugmozjs']
jitspew = ['js/jitspew']
js_backtrace = []
profilemozjs = ['js/profilemozjs']
refcell_backtrace = ["accountable-refcell"]
testbinding = ["script_bindings/testbinding"]
tracing = ["dep:tracing", "script_bindings/tracing"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
webgpu = ["script_bindings/webgpu", "script_traits/webgpu"]
webxr = ["webxr-api", "script_bindings/webxr"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(crown)'] }
[dependencies]
accountable-refcell = { workspace = true, optional = true }
aes = { workspace = true }
aes-gcm = { workspace = true }
aes-kw = { workspace = true }
app_units = { workspace = true }
arrayvec = { workspace = true }
atomic_refcell = { workspace = true }
aws-lc-rs = { workspace = true }
background_hang_monitor_api = { workspace = true }
backtrace = { workspace = true }
base = { workspace = true }
base64 = { workspace = true }
base64ct = { workspace = true }
bincode = { workspace = true }
bitflags = { workspace = true }
bluetooth_traits = { workspace = true, optional = true }
canvas_traits = { workspace = true }
cbc = { workspace = true }
chrono = { workspace = true }
cipher = { workspace = true }
compositing_traits = { workspace = true }
constellation_traits = { workspace = true }
content-security-policy = { workspace = true }
cookie = { workspace = true }
crossbeam-channel = { workspace = true }
cssparser = { workspace = true }
ctr = { workspace = true }
data-url = { workspace = true }
deny_public_fields = { path = "../deny_public_fields" }
devtools_traits = { workspace = true }
digest = { workspace = true }
dom_struct = { path = "../dom_struct" }
domobject_derive = { path = "../domobject_derive" }
ecdsa = { workspace = true }
elliptic-curve = { workspace = true }
embedder_traits = { workspace = true }
encoding_rs = { workspace = true }
euclid = { workspace = true }
flate2 = { workspace = true }
fonts = { path = "../fonts" }
fonts_traits = { workspace = true }
glow = { workspace = true }
headers = { workspace = true }
html5ever = { workspace = true }
http = { workspace = true }
hyper_serde = { workspace = true }
image = { workspace = true }
indexmap = { workspace = true }
ipc-channel = { workspace = true }
itertools = { workspace = true }
js = { workspace = true }
jstraceable_derive = { path = "../jstraceable_derive" }
keyboard-types = { workspace = true }
kurbo = { workspace = true }
layout_api = { workspace = true }
libc = { workspace = true }
log = { workspace = true }
malloc_size_of = { workspace = true }
malloc_size_of_derive = { workspace = true }
markup5ever = { workspace = true }
media = { path = "../media" }
metrics = { path = "../metrics" }
mime = { workspace = true }
mime_guess = { workspace = true }
net_traits = { workspace = true }
nom = { workspace = true }
nom-rfc8288 = { workspace = true }
num-traits = { workspace = true }
num_cpus = { workspace = true }
p256 = { workspace = true }
p384 = { workspace = true }
p521 = { workspace = true }
parking_lot = { workspace = true }
percent-encoding = { workspace = true }
phf = "0.13"
pixels = { path = "../pixels" }
pkcs8 = { workspace = true }
profile_traits = { workspace = true }
rand = { workspace = true }
range = { path = "../range" }
regex = { workspace = true }
rustc-hash = { workspace = true }
script_bindings = { path = "../script_bindings" }
script_traits = { workspace = true }
sec1 = { workspace = true }
selectors = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
servo-media = { workspace = true }
servo_arc = { workspace = true }
servo_config = { path = "../config" }
servo_geometry = { path = "../geometry" }
servo_url = { path = "../url" }
sha1 = { workspace = true }
sha2 = { workspace = true }
smallvec = { workspace = true }
storage_traits = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
stylo = { workspace = true }
stylo_atoms = { workspace = true }
stylo_dom = { workspace = true }
stylo_malloc_size_of = { workspace = true }
stylo_traits = { workspace = true }
swapper = "0.1"
tempfile = "3"
tendril = { version = "0.4.1", features = ["encoding_rs"] }
time = { workspace = true }
timers = { path = "../timers" }
tracing = { workspace = true, optional = true }
unicode-bidi = { workspace = true }
unicode-script = { workspace = true }
unicode-segmentation = { workspace = true }
url = { workspace = true }
urlpattern = { workspace = true }
utf-8 = { workspace = true }
uuid = { workspace = true, features = ["serde"] }
webdriver = { workspace = true }
webgpu_traits = { workspace = true }
webrender_api = { workspace = true }
webxr-api = { workspace = true, features = ["ipc"], optional = true }
wgpu-core = { workspace = true }
wgpu-types = { workspace = true }
x25519-dalek = { workspace = true }
xml5ever = { workspace = true }
xpath = { workspace = true }
[target.'cfg(not(target_os = "ios"))'.dependencies]
mozangle = { workspace = true }