mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
script: Move navigation fetching to the ScriptThread
(#34919)
This allows reusing the asynchrnous fetch mechanism that we use for page resources and is likely a step toward removing the `FetchThread`. Benefits: - Reduces IPC traffic during navigation. Now instead of bouncing between the constellation and the `ScriptThread` responses are sent directly to the `ScriptThread`. - Allows cancelling loads after redirects, which was not possible before. There is the question of what to do when a redirect is cross-origin (#23037). This currently isn't handled properly as the `Constellation` sends data to the same `Pipeline` that initiated the load. This change doesn't fix this issue, but does make it more possible for the `ScriptThread` to shut down the pipeline and ask the `Constellation` to replace it with a new one. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
73c0701c83
commit
fbd77b4524
16 changed files with 420 additions and 460 deletions
|
@ -47,7 +47,7 @@ use media::WindowGLContext;
|
|||
use net_traits::image_cache::ImageCache;
|
||||
use net_traits::request::{Referrer, RequestBody};
|
||||
use net_traits::storage_thread::StorageType;
|
||||
use net_traits::{FetchResponseMsg, ReferrerPolicy, ResourceThreads};
|
||||
use net_traits::{ReferrerPolicy, ResourceThreads};
|
||||
use pixels::{Image, PixelFormat};
|
||||
use profile_traits::{mem, time as profile_time};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
@ -286,16 +286,12 @@ pub enum UpdatePipelineIdReason {
|
|||
|
||||
/// Messages sent from the constellation or layout to the script thread.
|
||||
// FIXME: https://github.com/servo/servo/issues/34591
|
||||
#[expect(clippy::large_enum_variant)]
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub enum ConstellationControlMsg {
|
||||
/// Takes the associated window proxy out of "delaying-load-events-mode",
|
||||
/// used if a scheduled navigated was refused by the embedder.
|
||||
/// <https://html.spec.whatwg.org/multipage/#delaying-load-events-mode>
|
||||
StopDelayingLoadEventsMode(PipelineId),
|
||||
/// Sends the final response to script thread for fetching after all redirections
|
||||
/// have been resolved
|
||||
NavigationResponse(PipelineId, FetchResponseMsg),
|
||||
/// Gives a channel and ID to a layout, as well as the ID of that layout's parent
|
||||
AttachLayout(NewLayoutInfo),
|
||||
/// Window resized. Sends a DOM event eventually, but first we combine events.
|
||||
|
@ -413,7 +409,6 @@ impl fmt::Debug for ConstellationControlMsg {
|
|||
use self::ConstellationControlMsg::*;
|
||||
let variant = match *self {
|
||||
StopDelayingLoadEventsMode(..) => "StopDelayingLoadsEventMode",
|
||||
NavigationResponse(..) => "NavigationResponse",
|
||||
AttachLayout(..) => "AttachLayout",
|
||||
Resize(..) => "Resize",
|
||||
ThemeChange(..) => "ThemeChange",
|
||||
|
|
|
@ -17,7 +17,6 @@ use embedder_traits::{EmbedderMsg, MediaSessionEvent};
|
|||
use euclid::default::Size2D as UntypedSize2D;
|
||||
use euclid::Size2D;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use net_traits::request::RequestBuilder;
|
||||
use net_traits::storage_thread::StorageType;
|
||||
use net_traits::CoreResourceMsg;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -128,9 +127,6 @@ pub enum ScriptMsg {
|
|||
ScheduleBroadcast(BroadcastChannelRouterId, BroadcastMsg),
|
||||
/// Forward a message to the embedder.
|
||||
ForwardToEmbedder(EmbedderMsg),
|
||||
/// Requests are sent to constellation and fetches are checked manually
|
||||
/// for cross-origin loads
|
||||
InitiateNavigateRequest(RequestBuilder, /* cancellation_chan */ IpcReceiver<()>),
|
||||
/// Broadcast a storage event to every same-origin pipeline.
|
||||
/// The strings are key, old value and new value.
|
||||
BroadcastStorageEvent(
|
||||
|
@ -271,7 +267,6 @@ impl fmt::Debug for ScriptMsg {
|
|||
NewBroadcastChannelNameInRouter(..) => "NewBroadcastChannelNameInRouter",
|
||||
ScheduleBroadcast(..) => "ScheduleBroadcast",
|
||||
ForwardToEmbedder(..) => "ForwardToEmbedder",
|
||||
InitiateNavigateRequest(..) => "InitiateNavigateRequest",
|
||||
BroadcastStorageEvent(..) => "BroadcastStorageEvent",
|
||||
ChangeRunningAnimationsState(..) => "ChangeRunningAnimationsState",
|
||||
CreateCanvasPaintThread(..) => "CreateCanvasPaintThread",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue