mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Consistently use Dom
in native promise handlers (#37226)
Use `Dom` instead of `DomRoot` for fields of `TransmitBodyPromiseRejectionHandler` to reduce redundant work by GC, according to discussion in https://github.com/servo/servo/issues/33604#issuecomment-2931524400 Fixes: #33604 Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
This commit is contained in:
parent
8d086b9fe5
commit
56c0ad8420
1 changed files with 3 additions and 2 deletions
|
@ -249,7 +249,7 @@ impl TransmitBodyConnectHandler {
|
||||||
|
|
||||||
let rejection_handler = Box::new(TransmitBodyPromiseRejectionHandler {
|
let rejection_handler = Box::new(TransmitBodyPromiseRejectionHandler {
|
||||||
bytes_sender,
|
bytes_sender,
|
||||||
stream: rooted_stream,
|
stream: Dom::from_ref(&rooted_stream.clone()),
|
||||||
control_sender,
|
control_sender,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -321,11 +321,12 @@ impl Callback for TransmitBodyPromiseHandler {
|
||||||
/// The handler of read promises rejection of body streams used in
|
/// The handler of read promises rejection of body streams used in
|
||||||
/// <https://fetch.spec.whatwg.org/#concept-request-transmit-body>.
|
/// <https://fetch.spec.whatwg.org/#concept-request-transmit-body>.
|
||||||
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
#[derive(Clone, JSTraceable, MallocSizeOf)]
|
||||||
|
#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
|
||||||
struct TransmitBodyPromiseRejectionHandler {
|
struct TransmitBodyPromiseRejectionHandler {
|
||||||
#[ignore_malloc_size_of = "Channels are hard"]
|
#[ignore_malloc_size_of = "Channels are hard"]
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
bytes_sender: IpcSender<BodyChunkResponse>,
|
bytes_sender: IpcSender<BodyChunkResponse>,
|
||||||
stream: DomRoot<ReadableStream>,
|
stream: Dom<ReadableStream>,
|
||||||
#[ignore_malloc_size_of = "Channels are hard"]
|
#[ignore_malloc_size_of = "Channels are hard"]
|
||||||
#[no_trace]
|
#[no_trace]
|
||||||
control_sender: IpcSender<BodyChunkRequest>,
|
control_sender: IpcSender<BodyChunkRequest>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue