mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
libservo: Convert intercept_web_resource_load
into load_web_resource
(#35564)
Rework the `WebViewDelegate::intercept_web_resource_load` into `WebViewDelegate::load_web_resource` and clean up internal messaging. The main thing here is adding objects which manage the response to these delegate methods. Now we have `WebResourceLoad` and `InterceptedWebResourceLoad` which make it much harder to misuse the API. In addition, the internal messaging for this is cleaned up. Canceling and finishing the load are unrelated to the HTTP body so they are no longer subtypes of an HttpBodyData message. Processing of messages is made a bit more efficient by collecting all body chunks in a vector and only flattening the chunks at the end. Finally, "interceptor" is a much more common spelling than "intercepter" so I've gone ahead and made this change everywhere. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
f6e2e3d418
commit
cf2b93f18a
14 changed files with 245 additions and 208 deletions
|
@ -54,7 +54,7 @@ use crate::hsts::HstsList;
|
|||
use crate::http_cache::HttpCache;
|
||||
use crate::http_loader::{http_redirect_fetch, HttpState};
|
||||
use crate::protocols::ProtocolRegistry;
|
||||
use crate::request_intercepter::RequestIntercepter;
|
||||
use crate::request_interceptor::RequestInterceptor;
|
||||
use crate::storage_thread::StorageThreadFactory;
|
||||
use crate::websocket_loader;
|
||||
|
||||
|
@ -553,7 +553,7 @@ pub struct CoreResourceManager {
|
|||
devtools_sender: Option<Sender<DevtoolsControlMsg>>,
|
||||
sw_managers: HashMap<ImmutableOrigin, IpcSender<CustomResponseMediator>>,
|
||||
filemanager: FileManager,
|
||||
request_intercepter: RequestIntercepter,
|
||||
request_interceptor: RequestInterceptor,
|
||||
thread_pool: Arc<CoreResourceThreadPool>,
|
||||
ca_certificates: CACertificates,
|
||||
ignore_certificate_errors: bool,
|
||||
|
@ -706,7 +706,7 @@ impl CoreResourceManager {
|
|||
devtools_sender,
|
||||
sw_managers: Default::default(),
|
||||
filemanager: FileManager::new(embedder_proxy.clone(), Arc::downgrade(&pool_handle)),
|
||||
request_intercepter: RequestIntercepter::new(embedder_proxy),
|
||||
request_interceptor: RequestInterceptor::new(embedder_proxy),
|
||||
thread_pool: pool_handle,
|
||||
ca_certificates,
|
||||
ignore_certificate_errors,
|
||||
|
@ -749,7 +749,7 @@ impl CoreResourceManager {
|
|||
let ua = self.user_agent.clone();
|
||||
let dc = self.devtools_sender.clone();
|
||||
let filemanager = self.filemanager.clone();
|
||||
let request_intercepter = self.request_intercepter.clone();
|
||||
let request_interceptor = self.request_interceptor.clone();
|
||||
|
||||
let timing_type = match request_builder.destination {
|
||||
Destination::Document => ResourceTimingType::Navigation,
|
||||
|
@ -791,7 +791,7 @@ impl CoreResourceManager {
|
|||
devtools_chan: dc.map(|dc| Arc::new(Mutex::new(dc))),
|
||||
filemanager: Arc::new(Mutex::new(filemanager)),
|
||||
file_token,
|
||||
request_intercepter: Arc::new(Mutex::new(request_intercepter)),
|
||||
request_interceptor: Arc::new(Mutex::new(request_interceptor)),
|
||||
cancellation_listener,
|
||||
timing: ServoArc::new(Mutex::new(ResourceFetchTiming::new(request.timing_type()))),
|
||||
protocols,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue