1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-07 14:48:14 -05:00

perf(ext/http): remove accept_encoding interior mutability (#15070)

This commit is contained in:
Divy Srivastava 2022-07-04 21:48:09 +05:30 committed by David Sherret
parent d9d86078b0
commit f62ce06263

View file

@ -307,7 +307,7 @@ pub struct HttpStreamResource {
conn: Rc<HttpConnResource>, conn: Rc<HttpConnResource>,
pub rd: AsyncRefCell<HttpRequestReader>, pub rd: AsyncRefCell<HttpRequestReader>,
wr: AsyncRefCell<HttpResponseWriter>, wr: AsyncRefCell<HttpResponseWriter>,
accept_encoding: RefCell<Encoding>, accept_encoding: Encoding,
cancel_handle: CancelHandle, cancel_handle: CancelHandle,
} }
@ -322,7 +322,7 @@ impl HttpStreamResource {
conn: conn.clone(), conn: conn.clone(),
rd: HttpRequestReader::Headers(request).into(), rd: HttpRequestReader::Headers(request).into(),
wr: HttpResponseWriter::Headers(response_tx).into(), wr: HttpResponseWriter::Headers(response_tx).into(),
accept_encoding: RefCell::new(accept_encoding), accept_encoding,
cancel_handle: CancelHandle::new(), cancel_handle: CancelHandle::new(),
} }
} }
@ -491,7 +491,7 @@ async fn op_http_write_headers(
.get::<HttpStreamResource>(rid)?; .get::<HttpStreamResource>(rid)?;
// Track supported encoding // Track supported encoding
let encoding = *stream.accept_encoding.borrow(); let encoding = stream.accept_encoding;
let mut builder = Response::builder(); let mut builder = Response::builder();
// SAFETY: can not fail, since a fresh Builder is non-errored // SAFETY: can not fail, since a fresh Builder is non-errored