mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
task -> thread
This commit is contained in:
parent
f00532bab0
commit
1f02c4ebbb
119 changed files with 1209 additions and 1207 deletions
|
@ -5,15 +5,15 @@
|
|||
use CompositorMsg as ConstellationMsg;
|
||||
use app_units::Au;
|
||||
use compositor_layer::{CompositorData, CompositorLayer, RcCompositorLayer, WantsScrollEventsFlag};
|
||||
use compositor_task::{CompositorEventListener, CompositorProxy};
|
||||
use compositor_task::{CompositorReceiver, InitialCompositorState, Msg};
|
||||
use compositor_thread::{CompositorEventListener, CompositorProxy};
|
||||
use compositor_thread::{CompositorReceiver, InitialCompositorState, Msg};
|
||||
use constellation::SendableFrameTree;
|
||||
use euclid::point::TypedPoint2D;
|
||||
use euclid::rect::TypedRect;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
use euclid::{Matrix4, Point2D, Rect, Size2D};
|
||||
use gfx::paint_task::{ChromeToPaintMsg, PaintRequest};
|
||||
use gfx::paint_thread::{ChromeToPaintMsg, PaintRequest};
|
||||
use gfx_traits::{color, LayerId, LayerKind, LayerProperties, ScrollPolicy};
|
||||
use gleam::gl;
|
||||
use gleam::gl::types::{GLint, GLsizei};
|
||||
|
@ -375,13 +375,13 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
pub fn finish_shutting_down(&mut self) {
|
||||
debug!("Compositor received message that constellation shutdown is complete");
|
||||
|
||||
// Clear out the compositor layers so that painting tasks can destroy the buffers.
|
||||
// Clear out the compositor layers so that painting threads can destroy the buffers.
|
||||
if let Some(ref root_layer) = self.scene.root {
|
||||
root_layer.forget_all_tiles();
|
||||
}
|
||||
|
||||
// Drain compositor port, sometimes messages contain channels that are blocking
|
||||
// another task from finishing (i.e. SetFrameTree).
|
||||
// another thread from finishing (i.e. SetFrameTree).
|
||||
while self.port.try_recv_compositor_msg().is_some() {}
|
||||
|
||||
// Tell the profiler, memory profiler, and scrolling timer to shut down.
|
||||
|
@ -546,7 +546,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
reply.send(img).unwrap();
|
||||
}
|
||||
|
||||
(Msg::PaintTaskExited(pipeline_id), ShutdownState::NotShuttingDown) => {
|
||||
(Msg::PaintThreadExited(pipeline_id), ShutdownState::NotShuttingDown) => {
|
||||
self.remove_pipeline_root_layer(pipeline_id);
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
|
||||
(Msg::CollectMemoryReports(reports_chan), ShutdownState::NotShuttingDown) => {
|
||||
let name = "compositor-task";
|
||||
let name = "compositor-thread";
|
||||
// These are both `ExplicitUnknownLocationSize` because the memory might be in the
|
||||
// GPU or on the heap.
|
||||
let reports = vec![mem::Report {
|
||||
|
@ -975,7 +975,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
epoch: Epoch,
|
||||
frame_tree_id: FrameTreeId) {
|
||||
// If the frame tree id has changed since this paint request was sent,
|
||||
// reject the buffers and send them back to the paint task. If this isn't handled
|
||||
// reject the buffers and send them back to the paint thread. If this isn't handled
|
||||
// correctly, the content_age in the tile grid can get out of sync when iframes are
|
||||
// loaded and the frame tree changes. This can result in the compositor thinking it
|
||||
// has already drawn the most recently painted buffer, and missing a frame.
|
||||
|
@ -1470,7 +1470,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
};
|
||||
|
||||
// All the BufferRequests are in layer/device coordinates, but the paint task
|
||||
// All the BufferRequests are in layer/device coordinates, but the paint thread
|
||||
// wants to know the page coordinates. We scale them before sending them.
|
||||
for request in &mut layer_requests {
|
||||
request.page_rect = request.page_rect / scale.get();
|
||||
|
@ -1568,7 +1568,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
// If a layer has sent a request for the current epoch, but it hasn't
|
||||
// arrived yet then this layer is waiting for a paint message.
|
||||
//
|
||||
// Also don't check the root layer, because the paint task won't paint
|
||||
// Also don't check the root layer, because the paint thread won't paint
|
||||
// anything for it after first layout.
|
||||
if layer_data.id != LayerId::null() &&
|
||||
layer_data.requested_epoch == current_epoch &&
|
||||
|
@ -1587,7 +1587,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
/// Query the constellation to see if the current compositor
|
||||
/// output matches the current frame tree output, and if the
|
||||
/// associated script tasks are idle.
|
||||
/// associated script threads are idle.
|
||||
fn is_ready_to_paint_image_output(&mut self) -> Result<(), NotReadyToPaint> {
|
||||
match self.ready_to_save_state {
|
||||
ReadyState::Unknown => {
|
||||
|
@ -2001,7 +2001,7 @@ fn find_layer_with_pipeline_and_layer_id_for_layer(layer: Rc<Layer<CompositorDat
|
|||
|
||||
impl<Window> CompositorEventListener for IOCompositor<Window> where Window: WindowMethods {
|
||||
fn handle_events(&mut self, messages: Vec<WindowEvent>) -> bool {
|
||||
// Check for new messages coming from the other tasks in the system.
|
||||
// Check for new messages coming from the other threads in the system.
|
||||
while let Some(msg) = self.port.try_recv_compositor_msg() {
|
||||
if !self.handle_browser_message(msg) {
|
||||
break
|
||||
|
|
|
@ -97,17 +97,17 @@ pub trait CompositorLayer {
|
|||
|
||||
/// Removes the root layer (and any children) for a given pipeline from the
|
||||
/// compositor. Buffers that the compositor is holding are returned to the
|
||||
/// owning paint task.
|
||||
/// owning paint thread.
|
||||
fn remove_root_layer_with_pipeline_id<Window>(&self,
|
||||
compositor: &mut IOCompositor<Window>,
|
||||
pipeline_id: PipelineId)
|
||||
where Window: WindowMethods;
|
||||
|
||||
/// Destroys all tiles of all layers, including children, *without* sending them back to the
|
||||
/// painter. You must call this only when the paint task is destined to be going down;
|
||||
/// painter. You must call this only when the paint thread is destined to be going down;
|
||||
/// otherwise, you will leak tiles.
|
||||
///
|
||||
/// This is used during shutdown, when we know the paint task is going away.
|
||||
/// This is used during shutdown, when we know the paint thread is going away.
|
||||
fn forget_all_tiles(&self);
|
||||
|
||||
/// Move the layer's descendants that don't want scroll events and scroll by a relative
|
||||
|
@ -280,7 +280,7 @@ impl CompositorLayer for Layer<CompositorData> {
|
|||
|
||||
match index {
|
||||
Some(index) => {
|
||||
// Remove the root layer, and return buffers to the paint task
|
||||
// Remove the root layer, and return buffers to the paint thread
|
||||
let child = self.children().remove(index);
|
||||
child.clear_all_tiles(compositor);
|
||||
}
|
||||
|
@ -294,10 +294,10 @@ impl CompositorLayer for Layer<CompositorData> {
|
|||
}
|
||||
|
||||
/// Destroys all tiles of all layers, including children, *without* sending them back to the
|
||||
/// painter. You must call this only when the paint task is destined to be going down;
|
||||
/// painter. You must call this only when the paint thread is destined to be going down;
|
||||
/// otherwise, you will leak tiles.
|
||||
///
|
||||
/// This is used during shutdown, when we know the paint task is going away.
|
||||
/// This is used during shutdown, when we know the paint thread is going away.
|
||||
fn forget_all_tiles(&self) {
|
||||
let tiles = self.collect_buffers();
|
||||
for tile in tiles {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Communication with the compositor task.
|
||||
//! Communication with the compositor thread.
|
||||
|
||||
use CompositorMsg as ConstellationMsg;
|
||||
use compositor;
|
||||
|
@ -107,10 +107,10 @@ impl PaintListener for Box<CompositorProxy + 'static + Send> {
|
|||
fn native_display(&mut self) -> Option<NativeDisplay> {
|
||||
let (chan, port) = channel();
|
||||
self.send(Msg::GetNativeDisplay(chan));
|
||||
// If the compositor is shutting down when a paint task
|
||||
// If the compositor is shutting down when a paint thread
|
||||
// is being created, the compositor won't respond to
|
||||
// this message, resulting in an eventual panic. Instead,
|
||||
// just return None in this case, since the paint task
|
||||
// just return None in this case, since the paint thread
|
||||
// will exit shortly and never actually be requested
|
||||
// to paint buffers by the compositor.
|
||||
port.recv().unwrap_or(None)
|
||||
|
@ -146,12 +146,12 @@ impl PaintListener for Box<CompositorProxy + 'static + Send> {
|
|||
self.send(Msg::InitializeLayersForPipeline(pipeline_id, epoch, properties));
|
||||
}
|
||||
|
||||
fn notify_paint_task_exiting(&mut self, pipeline_id: PipelineId) {
|
||||
self.send(Msg::PaintTaskExited(pipeline_id))
|
||||
fn notify_paint_thread_exiting(&mut self, pipeline_id: PipelineId) {
|
||||
self.send(Msg::PaintThreadExited(pipeline_id))
|
||||
}
|
||||
}
|
||||
|
||||
/// Messages from the painting task and the constellation task to the compositor task.
|
||||
/// Messages from the painting thread and the constellation thread to the compositor thread.
|
||||
pub enum Msg {
|
||||
/// Requests that the compositor shut down.
|
||||
Exit(IpcSender<()>),
|
||||
|
@ -199,8 +199,8 @@ pub enum Msg {
|
|||
SetCursor(Cursor),
|
||||
/// Composite to a PNG file and return the Image over a passed channel.
|
||||
CreatePng(IpcSender<Option<Image>>),
|
||||
/// Informs the compositor that the paint task for the given pipeline has exited.
|
||||
PaintTaskExited(PipelineId),
|
||||
/// Informs the compositor that the paint thread for the given pipeline has exited.
|
||||
PaintThreadExited(PipelineId),
|
||||
/// Alerts the compositor that the viewport has been constrained in some manner
|
||||
ViewportConstrained(PipelineId, ViewportConstraints),
|
||||
/// A reply to the compositor asking if the output image is stable.
|
||||
|
@ -209,7 +209,7 @@ pub enum Msg {
|
|||
NewFavicon(Url),
|
||||
/// <head> tag finished parsing
|
||||
HeadParsed,
|
||||
/// Signal that the paint task ignored the paint requests that carried
|
||||
/// Signal that the paint thread ignored the paint requests that carried
|
||||
/// these native surfaces, so that they can be re-added to the surface cache.
|
||||
ReturnUnusedNativeSurfaces(Vec<NativeSurface>),
|
||||
/// Collect memory reports and send them back to the given mem::ReportsChan.
|
||||
|
@ -247,7 +247,7 @@ impl Debug for Msg {
|
|||
Msg::TouchEventProcessed(..) => write!(f, "TouchEventProcessed"),
|
||||
Msg::SetCursor(..) => write!(f, "SetCursor"),
|
||||
Msg::CreatePng(..) => write!(f, "CreatePng"),
|
||||
Msg::PaintTaskExited(..) => write!(f, "PaintTaskExited"),
|
||||
Msg::PaintThreadExited(..) => write!(f, "PaintThreadExited"),
|
||||
Msg::ViewportConstrained(..) => write!(f, "ViewportConstrained"),
|
||||
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
|
||||
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||
|
@ -263,9 +263,9 @@ impl Debug for Msg {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct CompositorTask;
|
||||
pub struct CompositorThread;
|
||||
|
||||
impl CompositorTask {
|
||||
impl CompositorThread {
|
||||
pub fn create<Window>(window: Option<Rc<Window>>,
|
||||
state: InitialCompositorState)
|
||||
-> Box<CompositorEventListener + 'static>
|
|
@ -6,26 +6,26 @@
|
|||
//!
|
||||
//! The primary duty of a `Constellation` is to mediate between the
|
||||
//! graphics compositor and the many `Pipeline`s in the browser's
|
||||
//! navigation context, each `Pipeline` encompassing a `ScriptTask`,
|
||||
//! `LayoutTask`, and `PaintTask`.
|
||||
//! navigation context, each `Pipeline` encompassing a `ScriptThread`,
|
||||
//! `LayoutThread`, and `PaintThread`.
|
||||
|
||||
use CompositorMsg as FromCompositorMsg;
|
||||
use canvas::canvas_paint_task::CanvasPaintTask;
|
||||
use canvas::webgl_paint_task::WebGLPaintTask;
|
||||
use canvas::canvas_paint_thread::CanvasPaintThread;
|
||||
use canvas::webgl_paint_thread::WebGLPaintThread;
|
||||
use canvas_traits::CanvasMsg;
|
||||
use clipboard::ClipboardContext;
|
||||
use compositor_task::CompositorProxy;
|
||||
use compositor_task::Msg as ToCompositorMsg;
|
||||
use compositor_thread::CompositorProxy;
|
||||
use compositor_thread::Msg as ToCompositorMsg;
|
||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::{Size2D, TypedSize2D};
|
||||
use gaol;
|
||||
use gaol::sandbox::{self, Sandbox, SandboxMethods};
|
||||
use gfx::font_cache_task::FontCacheTask;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx_traits::PaintMsg as FromPaintMsg;
|
||||
use ipc_channel::ipc::{self, IpcOneShotServer, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
|
||||
use layout_traits::{LayoutControlChan, LayoutThreadFactory};
|
||||
use msg::compositor_msg::Epoch;
|
||||
use msg::constellation_msg::AnimationState;
|
||||
use msg::constellation_msg::WebDriverCommandMsg;
|
||||
|
@ -36,16 +36,16 @@ use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId};
|
|||
use msg::constellation_msg::{SubpageId, WindowSizeData};
|
||||
use msg::constellation_msg::{self, ConstellationChan, Failure};
|
||||
use msg::webdriver_msg;
|
||||
use net_traits::image_cache_task::ImageCacheTask;
|
||||
use net_traits::storage_task::{StorageTask, StorageTaskMsg};
|
||||
use net_traits::{self, ResourceTask};
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use net_traits::storage_thread::{StorageThread, StorageThreadMsg};
|
||||
use net_traits::{self, ResourceThread};
|
||||
use offscreen_gl_context::GLContextAttributes;
|
||||
use pipeline::{CompositionPipeline, InitialPipelineState, Pipeline, UnprivilegedPipelineContent};
|
||||
use profile_traits::mem;
|
||||
use profile_traits::time;
|
||||
use sandboxing;
|
||||
use script_traits::{CompositorEvent, ConstellationControlMsg, LayoutControlMsg};
|
||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptTaskFactory};
|
||||
use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, ScriptThreadFactory};
|
||||
use script_traits::{TimerEventRequest};
|
||||
use std::borrow::ToOwned;
|
||||
use std::collections::HashMap;
|
||||
|
@ -60,7 +60,7 @@ use timer_scheduler::TimerScheduler;
|
|||
use url::Url;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::PagePx;
|
||||
use util::task::spawn_named;
|
||||
use util::thread::spawn_named;
|
||||
use util::{opts, prefs};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
|
@ -76,9 +76,9 @@ enum ReadyToSave {
|
|||
|
||||
/// Maintains the pipelines and navigation context and grants permission to composite.
|
||||
///
|
||||
/// It is parameterized over a `LayoutTaskFactory` and a
|
||||
/// `ScriptTaskFactory` (which in practice are implemented by
|
||||
/// `LayoutTask` in the `layout` crate, and `ScriptTask` in
|
||||
/// It is parameterized over a `LayoutThreadFactory` and a
|
||||
/// `ScriptThreadFactory` (which in practice are implemented by
|
||||
/// `LayoutThread` in the `layout` crate, and `ScriptThread` in
|
||||
/// the `script` crate).
|
||||
pub struct Constellation<LTF, STF> {
|
||||
/// A channel through which script messages can be sent to this object.
|
||||
|
@ -87,10 +87,10 @@ pub struct Constellation<LTF, STF> {
|
|||
/// A channel through which compositor messages can be sent to this object.
|
||||
pub compositor_sender: Sender<FromCompositorMsg>,
|
||||
|
||||
/// A channel through which layout task messages can be sent to this object.
|
||||
/// A channel through which layout thread messages can be sent to this object.
|
||||
pub layout_sender: ConstellationChan<FromLayoutMsg>,
|
||||
|
||||
/// A channel through which paint task messages can be sent to this object.
|
||||
/// A channel through which paint thread messages can be sent to this object.
|
||||
pub painter_sender: ConstellationChan<FromPaintMsg>,
|
||||
|
||||
/// Receives messages from scripts.
|
||||
|
@ -99,27 +99,27 @@ pub struct Constellation<LTF, STF> {
|
|||
/// Receives messages from the compositor
|
||||
pub compositor_receiver: Receiver<FromCompositorMsg>,
|
||||
|
||||
/// Receives messages from the layout task
|
||||
/// Receives messages from the layout thread
|
||||
pub layout_receiver: Receiver<FromLayoutMsg>,
|
||||
|
||||
/// Receives messages from paint task.
|
||||
/// Receives messages from paint thread.
|
||||
pub painter_receiver: Receiver<FromPaintMsg>,
|
||||
|
||||
/// A channel (the implementation of which is port-specific) through which messages can be sent
|
||||
/// to the compositor.
|
||||
pub compositor_proxy: Box<CompositorProxy>,
|
||||
|
||||
/// A channel through which messages can be sent to the resource task.
|
||||
pub resource_task: ResourceTask,
|
||||
/// A channel through which messages can be sent to the resource thread.
|
||||
pub resource_thread: ResourceThread,
|
||||
|
||||
/// A channel through which messages can be sent to the image cache task.
|
||||
pub image_cache_task: ImageCacheTask,
|
||||
/// A channel through which messages can be sent to the image cache thread.
|
||||
pub image_cache_thread: ImageCacheThread,
|
||||
|
||||
/// A channel through which messages can be sent to the developer tools.
|
||||
devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
|
||||
/// A channel through which messages can be sent to the storage task.
|
||||
storage_task: StorageTask,
|
||||
/// A channel through which messages can be sent to the storage thread.
|
||||
storage_thread: StorageThread,
|
||||
|
||||
/// A list of all the pipelines. (See the `pipeline` module for more details.)
|
||||
pipelines: HashMap<PipelineId, Pipeline>,
|
||||
|
@ -134,7 +134,7 @@ pub struct Constellation<LTF, STF> {
|
|||
subpage_map: HashMap<(PipelineId, SubpageId), PipelineId>,
|
||||
|
||||
/// A channel through which messages can be sent to the font cache.
|
||||
font_cache_task: FontCacheTask,
|
||||
font_cache_thread: FontCacheThread,
|
||||
|
||||
/// ID of the root frame.
|
||||
root_frame_id: Option<FrameId>,
|
||||
|
@ -167,11 +167,11 @@ pub struct Constellation<LTF, STF> {
|
|||
/// Bits of state used to interact with the webdriver implementation
|
||||
webdriver: WebDriverData,
|
||||
|
||||
/// A list of in-process senders to `CanvasPaintTask`s.
|
||||
canvas_paint_tasks: Vec<Sender<CanvasMsg>>,
|
||||
/// A list of in-process senders to `CanvasPaintThread`s.
|
||||
canvas_paint_threads: Vec<Sender<CanvasMsg>>,
|
||||
|
||||
/// A list of in-process senders to `WebGLPaintTask`s.
|
||||
webgl_paint_tasks: Vec<Sender<CanvasMsg>>,
|
||||
/// A list of in-process senders to `WebGLPaintThread`s.
|
||||
webgl_paint_threads: Vec<Sender<CanvasMsg>>,
|
||||
|
||||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
|
||||
|
@ -188,14 +188,14 @@ pub struct InitialConstellationState {
|
|||
pub compositor_proxy: Box<CompositorProxy + Send>,
|
||||
/// A channel to the developer tools, if applicable.
|
||||
pub devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
/// A channel to the image cache task.
|
||||
pub image_cache_task: ImageCacheTask,
|
||||
/// A channel to the font cache task.
|
||||
pub font_cache_task: FontCacheTask,
|
||||
/// A channel to the resource task.
|
||||
pub resource_task: ResourceTask,
|
||||
/// A channel to the storage task.
|
||||
pub storage_task: StorageTask,
|
||||
/// A channel to the image cache thread.
|
||||
pub image_cache_thread: ImageCacheThread,
|
||||
/// A channel to the font cache thread.
|
||||
pub font_cache_thread: FontCacheThread,
|
||||
/// A channel to the resource thread.
|
||||
pub resource_thread: ResourceThread,
|
||||
/// A channel to the storage thread.
|
||||
pub storage_thread: StorageThread,
|
||||
/// A channel to the time profiler thread.
|
||||
pub time_profiler_chan: time::ProfilerChan,
|
||||
/// A channel to the memory profiler thread.
|
||||
|
@ -288,7 +288,7 @@ enum ChildProcess {
|
|||
Unsandboxed(process::Child),
|
||||
}
|
||||
|
||||
impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||
impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF> {
|
||||
pub fn start(state: InitialConstellationState) -> Sender<FromCompositorMsg> {
|
||||
let (ipc_script_receiver, ipc_script_sender) = ConstellationChan::<FromScriptMsg>::new();
|
||||
let script_receiver = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_script_receiver);
|
||||
|
@ -310,10 +310,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
painter_receiver: painter_receiver,
|
||||
compositor_proxy: state.compositor_proxy,
|
||||
devtools_chan: state.devtools_chan,
|
||||
resource_task: state.resource_task,
|
||||
image_cache_task: state.image_cache_task,
|
||||
font_cache_task: state.font_cache_task,
|
||||
storage_task: state.storage_task,
|
||||
resource_thread: state.resource_thread,
|
||||
image_cache_thread: state.image_cache_thread,
|
||||
font_cache_thread: state.font_cache_thread,
|
||||
storage_thread: state.storage_thread,
|
||||
pipelines: HashMap::new(),
|
||||
frames: HashMap::new(),
|
||||
pipeline_to_frame_map: HashMap::new(),
|
||||
|
@ -340,8 +340,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
None
|
||||
},
|
||||
webdriver: WebDriverData::new(),
|
||||
canvas_paint_tasks: Vec::new(),
|
||||
webgl_paint_tasks: Vec::new(),
|
||||
canvas_paint_threads: Vec::new(),
|
||||
webgl_paint_threads: Vec::new(),
|
||||
scheduler_chan: TimerScheduler::start(),
|
||||
child_processes: Vec::new(),
|
||||
document_states: HashMap::new(),
|
||||
|
@ -386,10 +386,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
scheduler_chan: self.scheduler_chan.clone(),
|
||||
compositor_proxy: self.compositor_proxy.clone_compositor_proxy(),
|
||||
devtools_chan: self.devtools_chan.clone(),
|
||||
image_cache_task: self.image_cache_task.clone(),
|
||||
font_cache_task: self.font_cache_task.clone(),
|
||||
resource_task: self.resource_task.clone(),
|
||||
storage_task: self.storage_task.clone(),
|
||||
image_cache_thread: self.image_cache_thread.clone(),
|
||||
font_cache_thread: self.font_cache_thread.clone(),
|
||||
resource_thread: self.resource_thread.clone(),
|
||||
storage_thread: self.storage_thread.clone(),
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
mem_profiler_chan: self.mem_profiler_chan.clone(),
|
||||
window_size: initial_window_size,
|
||||
|
@ -400,7 +400,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
});
|
||||
|
||||
if spawning_paint_only {
|
||||
privileged_pipeline_content.start_paint_task();
|
||||
privileged_pipeline_content.start_paint_thread();
|
||||
} else {
|
||||
privileged_pipeline_content.start_all();
|
||||
|
||||
|
@ -681,13 +681,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
debug!("constellation got head parsed message");
|
||||
self.compositor_proxy.send(ToCompositorMsg::HeadParsed);
|
||||
}
|
||||
Request::Script(FromScriptMsg::CreateCanvasPaintTask(size, sender)) => {
|
||||
debug!("constellation got create-canvas-paint-task message");
|
||||
self.handle_create_canvas_paint_task_msg(&size, sender)
|
||||
Request::Script(FromScriptMsg::CreateCanvasPaintThread(size, sender)) => {
|
||||
debug!("constellation got create-canvas-paint-thread message");
|
||||
self.handle_create_canvas_paint_thread_msg(&size, sender)
|
||||
}
|
||||
Request::Script(FromScriptMsg::CreateWebGLPaintTask(size, attributes, sender)) => {
|
||||
debug!("constellation got create-WebGL-paint-task message");
|
||||
self.handle_create_webgl_paint_task_msg(&size, attributes, sender)
|
||||
Request::Script(FromScriptMsg::CreateWebGLPaintThread(size, attributes, sender)) => {
|
||||
debug!("constellation got create-WebGL-paint-thread message");
|
||||
self.handle_create_webgl_paint_thread_msg(&size, attributes, sender)
|
||||
}
|
||||
Request::Script(FromScriptMsg::NodeStatus(message)) => {
|
||||
debug!("constellation got NodeStatus message");
|
||||
|
@ -699,7 +699,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
|
||||
|
||||
// Messages from layout task
|
||||
// Messages from layout thread
|
||||
|
||||
Request::Layout(FromLayoutMsg::ChangeRunningAnimationsState(pipeline_id, animation_state)) => {
|
||||
self.handle_change_running_animations_state(pipeline_id, animation_state)
|
||||
|
@ -717,7 +717,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
|
||||
|
||||
// Messages from paint task
|
||||
// Messages from paint thread
|
||||
|
||||
|
||||
// Notification that painting has finished and is requesting permission to paint.
|
||||
|
@ -734,14 +734,14 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
for (_id, ref pipeline) in &self.pipelines {
|
||||
pipeline.exit();
|
||||
}
|
||||
self.image_cache_task.exit();
|
||||
self.resource_task.send(net_traits::ControlMsg::Exit).unwrap();
|
||||
self.image_cache_thread.exit();
|
||||
self.resource_thread.send(net_traits::ControlMsg::Exit).unwrap();
|
||||
self.devtools_chan.as_ref().map(|chan| {
|
||||
chan.send(DevtoolsControlMsg::FromChrome(
|
||||
ChromeToDevtoolsControlMsg::ServerExitMsg)).unwrap();
|
||||
});
|
||||
self.storage_task.send(StorageTaskMsg::Exit).unwrap();
|
||||
self.font_cache_task.exit();
|
||||
self.storage_thread.send(StorageThreadMsg::Exit).unwrap();
|
||||
self.font_cache_thread.exit();
|
||||
self.compositor_proxy.send(ToCompositorMsg::ShutdownComplete);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
pipeline_id: PipelineId,
|
||||
parent_info: Option<(PipelineId, SubpageId)>) {
|
||||
if opts::get().hard_fail {
|
||||
// It's quite difficult to make Servo exit cleanly if some tasks have failed.
|
||||
// It's quite difficult to make Servo exit cleanly if some threads have failed.
|
||||
// Hard fail exists for test runners so we crash and that's good enough.
|
||||
let mut stderr = io::stderr();
|
||||
stderr.write_all("Pipeline failed in hard-fail mode. Crashing!\n".as_bytes()).unwrap();
|
||||
|
@ -825,7 +825,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
parent_pipeline.script_chan.send(msg).unwrap();
|
||||
}
|
||||
|
||||
// The script task associated with pipeline_id has loaded a URL in an iframe via script. This
|
||||
// The script thread associated with pipeline_id has loaded a URL in an iframe via script. This
|
||||
// will result in a new pipeline being spawned and a frame tree being added to
|
||||
// containing_page_pipeline_id's frame tree's children. This message is never the result of a
|
||||
// page navigation.
|
||||
|
@ -842,7 +842,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
};
|
||||
|
||||
// Compare the pipeline's url to the new url. If the origin is the same,
|
||||
// then reuse the script task in creating the new pipeline
|
||||
// then reuse the script thread in creating the new pipeline
|
||||
let script_chan = {
|
||||
let source_pipeline = self.pipeline(load_info.containing_pipeline_id);
|
||||
|
||||
|
@ -853,7 +853,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
load_info.sandbox == IFrameSandboxState::IFrameUnsandboxed;
|
||||
|
||||
// FIXME(tkuehn): Need to follow the standardized spec for checking same-origin
|
||||
// Reuse the script task if the URL is same-origin
|
||||
// Reuse the script thread if the URL is same-origin
|
||||
if same_script {
|
||||
debug!("Constellation: loading same-origin iframe, \
|
||||
parent url {:?}, iframe url {:?}", source_url, new_url);
|
||||
|
@ -910,13 +910,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
|
||||
fn load_url(&mut self, source_id: PipelineId, load_data: LoadData) -> Option<PipelineId> {
|
||||
// If this load targets an iframe, its framing element may exist
|
||||
// in a separate script task than the framed document that initiated
|
||||
// in a separate script thread than the framed document that initiated
|
||||
// the new load. The framing element must be notified about the
|
||||
// requested change so it can update its internal state.
|
||||
match self.pipeline(source_id).parent_info {
|
||||
Some((parent_pipeline_id, subpage_id)) => {
|
||||
self.handle_load_start_msg(&source_id);
|
||||
// Message the constellation to find the script task for this iframe
|
||||
// Message the constellation to find the script thread for this iframe
|
||||
// and issue an iframe load through there.
|
||||
let parent_pipeline = self.pipeline(parent_pipeline_id);
|
||||
let script_channel = &parent_pipeline.script_chan;
|
||||
|
@ -944,7 +944,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
self.new_pipeline(new_pipeline_id, None, window_size, None, load_data);
|
||||
self.push_pending_frame(new_pipeline_id, Some(source_id));
|
||||
|
||||
// Send message to ScriptTask that will suspend all timers
|
||||
// Send message to ScriptThread that will suspend all timers
|
||||
let old_pipeline = self.pipelines.get(&source_id).unwrap();
|
||||
old_pipeline.freeze();
|
||||
Some(new_pipeline_id)
|
||||
|
@ -1111,7 +1111,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
assert!(prefs::get_pref("dom.mozbrowser.enabled").as_boolean().unwrap_or(false));
|
||||
|
||||
// Find the script channel for the given parent pipeline,
|
||||
// and pass the event to that script task.
|
||||
// and pass the event to that script thread.
|
||||
let pipeline = self.pipeline(containing_pipeline_id);
|
||||
pipeline.trigger_mozbrowser_event(subpage_id, event);
|
||||
}
|
||||
|
@ -1171,25 +1171,25 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_create_canvas_paint_task_msg(
|
||||
fn handle_create_canvas_paint_thread_msg(
|
||||
&mut self,
|
||||
size: &Size2D<i32>,
|
||||
response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) {
|
||||
let id = self.canvas_paint_tasks.len();
|
||||
let (out_of_process_sender, in_process_sender) = CanvasPaintTask::start(*size);
|
||||
self.canvas_paint_tasks.push(in_process_sender);
|
||||
let id = self.canvas_paint_threads.len();
|
||||
let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size);
|
||||
self.canvas_paint_threads.push(in_process_sender);
|
||||
response_sender.send((out_of_process_sender, id)).unwrap()
|
||||
}
|
||||
|
||||
fn handle_create_webgl_paint_task_msg(
|
||||
fn handle_create_webgl_paint_thread_msg(
|
||||
&mut self,
|
||||
size: &Size2D<i32>,
|
||||
attributes: GLContextAttributes,
|
||||
response_sender: IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>) {
|
||||
let response = match WebGLPaintTask::start(*size, attributes) {
|
||||
let response = match WebGLPaintThread::start(*size, attributes) {
|
||||
Ok((out_of_process_sender, in_process_sender)) => {
|
||||
let id = self.webgl_paint_tasks.len();
|
||||
self.webgl_paint_tasks.push(in_process_sender);
|
||||
let id = self.webgl_paint_threads.len();
|
||||
self.webgl_paint_threads.push(in_process_sender);
|
||||
Ok((out_of_process_sender, id))
|
||||
},
|
||||
Err(msg) => Err(msg.to_owned()),
|
||||
|
@ -1200,7 +1200,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
|
||||
fn handle_webdriver_msg(&mut self, msg: WebDriverCommandMsg) {
|
||||
// Find the script channel for the given parent pipeline,
|
||||
// and pass the event to that script task.
|
||||
// and pass the event to that script thread.
|
||||
match msg {
|
||||
WebDriverCommandMsg::LoadUrl(pipeline_id, load_data, reply) => {
|
||||
self.load_url_for_webdriver(pipeline_id, load_data, reply);
|
||||
|
@ -1404,7 +1404,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
|
||||
// Step through the current frame tree, checking that the script
|
||||
// task is idle, and that the current epoch of the layout task
|
||||
// thread is idle, and that the current epoch of the layout thread
|
||||
// matches what the compositor has painted. If all these conditions
|
||||
// are met, then the output image should not change and a reftest
|
||||
// screenshot can safely be written.
|
||||
|
@ -1441,7 +1441,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
if let Some(size) = pipeline.size {
|
||||
// If the rectangle for this pipeline is zero sized, it will
|
||||
// never be painted. In this case, don't query the layout
|
||||
// task as it won't contribute to the final output image.
|
||||
// thread as it won't contribute to the final output image.
|
||||
if size == Size2D::zero() {
|
||||
continue;
|
||||
}
|
||||
|
@ -1450,15 +1450,15 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let compositor_epoch = pipeline_states.get(&frame.current);
|
||||
match compositor_epoch {
|
||||
Some(compositor_epoch) => {
|
||||
// Synchronously query the layout task to see if the current
|
||||
// Synchronously query the layout thread to see if the current
|
||||
// epoch matches what the compositor has drawn. If they match
|
||||
// (and script is idle) then this pipeline won't change again
|
||||
// and can be considered stable.
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let LayoutControlChan(ref layout_chan) = pipeline.layout_chan;
|
||||
layout_chan.send(LayoutControlMsg::GetCurrentEpoch(sender)).unwrap();
|
||||
let layout_task_epoch = receiver.recv().unwrap();
|
||||
if layout_task_epoch != *compositor_epoch {
|
||||
let layout_thread_epoch = receiver.recv().unwrap();
|
||||
if layout_thread_epoch != *compositor_epoch {
|
||||
return ReadyToSave::EpochMismatch;
|
||||
}
|
||||
}
|
||||
|
@ -1471,7 +1471,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
}
|
||||
}
|
||||
|
||||
// All script tasks are idle and layout epochs match compositor, so output image!
|
||||
// All script threads are idle and layout epochs match compositor, so output image!
|
||||
ReadyToSave::Ready
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use CompositorMsg as ConstellationMsg;
|
||||
use compositor_task::{CompositorEventListener, CompositorReceiver};
|
||||
use compositor_task::{InitialCompositorState, Msg};
|
||||
use compositor_thread::{CompositorEventListener, CompositorReceiver};
|
||||
use compositor_thread::{InitialCompositorState, Msg};
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::{Point2D, Size2D};
|
||||
use msg::constellation_msg::AnimationState;
|
||||
|
@ -70,7 +70,7 @@ impl CompositorEventListener for NullCompositor {
|
|||
debug!("constellation completed shutdown");
|
||||
|
||||
// Drain compositor port, sometimes messages contain channels that are blocking
|
||||
// another task from finishing (i.e. SetIds)
|
||||
// another thread from finishing (i.e. SetIds)
|
||||
while self.port.try_recv_compositor_msg().is_some() {}
|
||||
|
||||
self.time_profiler_chan.send(time::ProfilerMsg::Exit);
|
||||
|
@ -123,7 +123,7 @@ impl CompositorEventListener for NullCompositor {
|
|||
Msg::SetCursor(..) |
|
||||
Msg::ViewportConstrained(..) => {}
|
||||
Msg::CreatePng(..) |
|
||||
Msg::PaintTaskExited(..) |
|
||||
Msg::PaintThreadExited(..) |
|
||||
Msg::MoveTo(..) |
|
||||
Msg::ResizeTo(..) |
|
||||
Msg::IsReadyToSaveImageReply(..) => {}
|
||||
|
|
|
@ -50,7 +50,7 @@ extern crate url;
|
|||
#[macro_use]
|
||||
extern crate util;
|
||||
|
||||
pub use compositor_task::{CompositorEventListener, CompositorProxy, CompositorTask};
|
||||
pub use compositor_thread::{CompositorEventListener, CompositorProxy, CompositorThread};
|
||||
pub use constellation::Constellation;
|
||||
use euclid::size::{Size2D};
|
||||
use ipc_channel::ipc::{IpcSender};
|
||||
|
@ -63,7 +63,7 @@ use url::Url;
|
|||
|
||||
mod compositor;
|
||||
mod compositor_layer;
|
||||
pub mod compositor_task;
|
||||
pub mod compositor_thread;
|
||||
pub mod constellation;
|
||||
mod headless;
|
||||
pub mod pipeline;
|
||||
|
|
|
@ -3,29 +3,29 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use CompositorProxy;
|
||||
use compositor_task;
|
||||
use compositor_task::Msg as CompositorMsg;
|
||||
use compositor_thread;
|
||||
use compositor_thread::Msg as CompositorMsg;
|
||||
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
use gfx::font_cache_task::FontCacheTask;
|
||||
use gfx::paint_task::{ChromeToPaintMsg, LayoutToPaintMsg, PaintTask};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx::paint_thread::{ChromeToPaintMsg, LayoutToPaintMsg, PaintThread};
|
||||
use gfx_traits::PaintMsg;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use layers::geometry::DevicePixel;
|
||||
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
|
||||
use layout_traits::{LayoutControlChan, LayoutThreadFactory};
|
||||
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
|
||||
use msg::constellation_msg::{LoadData, MozBrowserEvent, WindowSizeData};
|
||||
use msg::constellation_msg::{PipelineNamespaceId};
|
||||
use net_traits::ResourceTask;
|
||||
use net_traits::image_cache_task::ImageCacheTask;
|
||||
use net_traits::storage_task::StorageTask;
|
||||
use net_traits::ResourceThread;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use net_traits::storage_thread::StorageThread;
|
||||
use profile_traits::mem as profile_mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{ConstellationControlMsg, InitialScriptState};
|
||||
use script_traits::{LayoutControlMsg, LayoutMsg, NewLayoutInfo, ScriptMsg};
|
||||
use script_traits::{ScriptToCompositorMsg, ScriptTaskFactory, TimerEventRequest};
|
||||
use script_traits::{ScriptToCompositorMsg, ScriptThreadFactory, TimerEventRequest};
|
||||
use std::mem;
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
|
@ -36,7 +36,7 @@ use util::ipc::OptionalIpcSender;
|
|||
use util::opts::{self, Opts};
|
||||
use util::prefs;
|
||||
|
||||
/// A uniquely-identifiable pipeline of script task, layout task, and paint task.
|
||||
/// A uniquely-identifiable pipeline of script thread, layout thread, and paint thread.
|
||||
pub struct Pipeline {
|
||||
pub id: PipelineId,
|
||||
pub parent_info: Option<(PipelineId, SubpageId)>,
|
||||
|
@ -80,9 +80,9 @@ pub struct InitialPipelineState {
|
|||
pub parent_info: Option<(PipelineId, SubpageId)>,
|
||||
/// A channel to the associated constellation.
|
||||
pub constellation_chan: ConstellationChan<ScriptMsg>,
|
||||
/// A channel for the layout task to send messages to the constellation.
|
||||
/// A channel for the layout thread to send messages to the constellation.
|
||||
pub layout_to_constellation_chan: ConstellationChan<LayoutMsg>,
|
||||
/// A channel to the associated paint task.
|
||||
/// A channel to the associated paint thread.
|
||||
pub painter_chan: ConstellationChan<PaintMsg>,
|
||||
/// A channel to schedule timer events.
|
||||
pub scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
|
@ -90,14 +90,14 @@ pub struct InitialPipelineState {
|
|||
pub compositor_proxy: Box<CompositorProxy + 'static + Send>,
|
||||
/// A channel to the developer tools, if applicable.
|
||||
pub devtools_chan: Option<Sender<DevtoolsControlMsg>>,
|
||||
/// A channel to the image cache task.
|
||||
pub image_cache_task: ImageCacheTask,
|
||||
/// A channel to the font cache task.
|
||||
pub font_cache_task: FontCacheTask,
|
||||
/// A channel to the resource task.
|
||||
pub resource_task: ResourceTask,
|
||||
/// A channel to the storage task.
|
||||
pub storage_task: StorageTask,
|
||||
/// A channel to the image cache thread.
|
||||
pub image_cache_thread: ImageCacheThread,
|
||||
/// A channel to the font cache thread.
|
||||
pub font_cache_thread: FontCacheThread,
|
||||
/// A channel to the resource thread.
|
||||
pub resource_thread: ResourceThread,
|
||||
/// A channel to the storage thread.
|
||||
pub storage_thread: StorageThread,
|
||||
/// A channel to the time profiler thread.
|
||||
pub time_profiler_chan: time::ProfilerChan,
|
||||
/// A channel to the memory profiler thread.
|
||||
|
@ -116,11 +116,11 @@ pub struct InitialPipelineState {
|
|||
}
|
||||
|
||||
impl Pipeline {
|
||||
/// Starts a paint task, layout task, and possibly a script task.
|
||||
/// Starts a paint thread, layout thread, and possibly a script thread.
|
||||
/// Returns the channels wrapped in a struct.
|
||||
pub fn create<LTF, STF>(state: InitialPipelineState)
|
||||
-> (Pipeline, UnprivilegedPipelineContent, PrivilegedPipelineContent)
|
||||
where LTF: LayoutTaskFactory, STF: ScriptTaskFactory {
|
||||
where LTF: LayoutThreadFactory, STF: ScriptThreadFactory {
|
||||
let (layout_to_paint_chan, layout_to_paint_port) = util::ipc::optional_ipc_channel();
|
||||
let (chrome_to_paint_chan, chrome_to_paint_port) = channel();
|
||||
let (paint_shutdown_chan, paint_shutdown_port) = ipc::channel().unwrap();
|
||||
|
@ -202,10 +202,10 @@ impl Pipeline {
|
|||
constellation_chan: state.constellation_chan,
|
||||
scheduler_chan: state.scheduler_chan,
|
||||
devtools_chan: script_to_devtools_chan,
|
||||
image_cache_task: state.image_cache_task,
|
||||
font_cache_task: state.font_cache_task.clone(),
|
||||
resource_task: state.resource_task,
|
||||
storage_task: state.storage_task,
|
||||
image_cache_thread: state.image_cache_thread,
|
||||
font_cache_thread: state.font_cache_thread.clone(),
|
||||
resource_thread: state.resource_thread,
|
||||
storage_thread: state.storage_thread,
|
||||
time_profiler_chan: state.time_profiler_chan.clone(),
|
||||
mem_profiler_chan: state.mem_profiler_chan.clone(),
|
||||
window_size: window_size,
|
||||
|
@ -231,7 +231,7 @@ impl Pipeline {
|
|||
id: state.id,
|
||||
painter_chan: state.painter_chan,
|
||||
compositor_proxy: state.compositor_proxy,
|
||||
font_cache_task: state.font_cache_task,
|
||||
font_cache_thread: state.font_cache_thread,
|
||||
time_profiler_chan: state.time_profiler_chan,
|
||||
mem_profiler_chan: state.mem_profiler_chan,
|
||||
load_data: state.load_data,
|
||||
|
@ -286,13 +286,13 @@ impl Pipeline {
|
|||
pub fn exit(&self) {
|
||||
debug!("pipeline {:?} exiting", self.id);
|
||||
|
||||
// Script task handles shutting down layout, and layout handles shutting down the painter.
|
||||
// For now, if the script task has failed, we give up on clean shutdown.
|
||||
// Script thread handles shutting down layout, and layout handles shutting down the painter.
|
||||
// For now, if the script thread has failed, we give up on clean shutdown.
|
||||
if self.script_chan
|
||||
.send(ConstellationControlMsg::ExitPipeline(self.id))
|
||||
.is_ok() {
|
||||
// Wait until all slave tasks have terminated and run destructors
|
||||
// NOTE: We don't wait for script task as we don't always own it
|
||||
// Wait until all slave threads have terminated and run destructors
|
||||
// NOTE: We don't wait for script thread as we don't always own it
|
||||
let _ = self.paint_shutdown_port.recv();
|
||||
let _ = self.layout_shutdown_port.recv();
|
||||
}
|
||||
|
@ -355,10 +355,10 @@ pub struct UnprivilegedPipelineContent {
|
|||
scheduler_chan: IpcSender<TimerEventRequest>,
|
||||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
script_to_compositor_chan: IpcSender<ScriptToCompositorMsg>,
|
||||
image_cache_task: ImageCacheTask,
|
||||
font_cache_task: FontCacheTask,
|
||||
resource_task: ResourceTask,
|
||||
storage_task: StorageTask,
|
||||
image_cache_thread: ImageCacheThread,
|
||||
font_cache_thread: FontCacheThread,
|
||||
resource_thread: ResourceThread,
|
||||
storage_thread: StorageThread,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
window_size: Option<WindowSizeData>,
|
||||
|
@ -380,10 +380,10 @@ pub struct UnprivilegedPipelineContent {
|
|||
|
||||
impl UnprivilegedPipelineContent {
|
||||
pub fn start_all<LTF, STF>(mut self, wait_for_completion: bool)
|
||||
where LTF: LayoutTaskFactory, STF: ScriptTaskFactory {
|
||||
let layout_pair = ScriptTaskFactory::create_layout_channel(None::<&mut STF>);
|
||||
where LTF: LayoutThreadFactory, STF: ScriptThreadFactory {
|
||||
let layout_pair = ScriptThreadFactory::create_layout_channel(None::<&mut STF>);
|
||||
|
||||
ScriptTaskFactory::create(None::<&mut STF>, InitialScriptState {
|
||||
ScriptThreadFactory::create(None::<&mut STF>, InitialScriptState {
|
||||
id: self.id,
|
||||
parent_info: self.parent_info,
|
||||
compositor: self.script_to_compositor_chan,
|
||||
|
@ -393,9 +393,9 @@ impl UnprivilegedPipelineContent {
|
|||
layout_to_constellation_chan: self.layout_to_constellation_chan.clone(),
|
||||
scheduler_chan: self.scheduler_chan.clone(),
|
||||
failure_info: self.failure.clone(),
|
||||
resource_task: self.resource_task,
|
||||
storage_task: self.storage_task.clone(),
|
||||
image_cache_task: self.image_cache_task.clone(),
|
||||
resource_thread: self.resource_thread,
|
||||
storage_thread: self.storage_thread.clone(),
|
||||
image_cache_thread: self.image_cache_thread.clone(),
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
mem_profiler_chan: self.mem_profiler_chan.clone(),
|
||||
devtools_chan: self.devtools_chan,
|
||||
|
@ -404,7 +404,7 @@ impl UnprivilegedPipelineContent {
|
|||
content_process_shutdown_chan: self.script_content_process_shutdown_chan.clone(),
|
||||
}, &layout_pair, self.load_data.clone());
|
||||
|
||||
LayoutTaskFactory::create(None::<&mut LTF>,
|
||||
LayoutThreadFactory::create(None::<&mut LTF>,
|
||||
self.id,
|
||||
self.load_data.url.clone(),
|
||||
self.parent_info.is_some(),
|
||||
|
@ -414,8 +414,8 @@ impl UnprivilegedPipelineContent {
|
|||
self.failure,
|
||||
self.script_chan.clone(),
|
||||
self.layout_to_paint_chan.clone(),
|
||||
self.image_cache_task,
|
||||
self.font_cache_task,
|
||||
self.image_cache_thread,
|
||||
self.font_cache_thread,
|
||||
self.time_profiler_chan,
|
||||
self.mem_profiler_chan,
|
||||
self.layout_shutdown_chan,
|
||||
|
@ -437,7 +437,7 @@ pub struct PrivilegedPipelineContent {
|
|||
painter_chan: ConstellationChan<PaintMsg>,
|
||||
compositor_proxy: Box<CompositorProxy + Send + 'static>,
|
||||
script_to_compositor_port: IpcReceiver<ScriptToCompositorMsg>,
|
||||
font_cache_task: FontCacheTask,
|
||||
font_cache_thread: FontCacheThread,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
load_data: LoadData,
|
||||
|
@ -450,14 +450,14 @@ pub struct PrivilegedPipelineContent {
|
|||
|
||||
impl PrivilegedPipelineContent {
|
||||
pub fn start_all(self) {
|
||||
PaintTask::create(self.id,
|
||||
PaintThread::create(self.id,
|
||||
self.load_data.url,
|
||||
self.chrome_to_paint_chan,
|
||||
self.layout_to_paint_port,
|
||||
self.chrome_to_paint_port,
|
||||
self.compositor_proxy.clone_compositor_proxy(),
|
||||
self.painter_chan,
|
||||
self.font_cache_task,
|
||||
self.font_cache_thread,
|
||||
self.failure,
|
||||
self.time_profiler_chan,
|
||||
self.mem_profiler_chan,
|
||||
|
@ -467,21 +467,21 @@ impl PrivilegedPipelineContent {
|
|||
self.compositor_proxy.clone_compositor_proxy();
|
||||
let script_to_compositor_port = self.script_to_compositor_port;
|
||||
thread::spawn(move || {
|
||||
compositor_task::run_script_listener_thread(
|
||||
compositor_thread::run_script_listener_thread(
|
||||
compositor_proxy_for_script_listener_thread,
|
||||
script_to_compositor_port)
|
||||
});
|
||||
}
|
||||
|
||||
pub fn start_paint_task(self) {
|
||||
PaintTask::create(self.id,
|
||||
pub fn start_paint_thread(self) {
|
||||
PaintThread::create(self.id,
|
||||
self.load_data.url,
|
||||
self.chrome_to_paint_chan,
|
||||
self.layout_to_paint_port,
|
||||
self.chrome_to_paint_port,
|
||||
self.compositor_proxy,
|
||||
self.painter_chan,
|
||||
self.font_cache_task,
|
||||
self.font_cache_thread,
|
||||
self.failure,
|
||||
self.time_profiler_chan,
|
||||
self.mem_profiler_chan,
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! A timer thread that gives the painting task a little time to catch up when the user scrolls.
|
||||
//! A timer thread that gives the painting thread a little time to catch up when the user scrolls.
|
||||
|
||||
use compositor_task::{CompositorProxy, Msg};
|
||||
use compositor_thread::{CompositorProxy, Msg};
|
||||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread::{self, Builder};
|
||||
use time;
|
||||
|
|
|
@ -9,7 +9,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
|
|||
use std::hash::{Hash, Hasher};
|
||||
|
||||
/// This is a struct used to store surfaces when they are not in use.
|
||||
/// The paint task can quickly query for a particular size of surface when it
|
||||
/// The paint thread can quickly query for a particular size of surface when it
|
||||
/// needs it.
|
||||
pub struct SurfaceMap {
|
||||
/// A HashMap that stores the Buffers.
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::sync::atomic::{self, AtomicBool};
|
|||
use std::sync::mpsc::{channel, Receiver, Select};
|
||||
use std::thread::{self, spawn, Thread};
|
||||
use std::time::Duration;
|
||||
use util::task::spawn_named;
|
||||
use util::thread::spawn_named;
|
||||
|
||||
/// A quick hack to work around the removal of [`std::old_io::timer::Timer`](
|
||||
/// http://doc.rust-lang.org/1.0.0-beta/std/old_io/timer/struct.Timer.html )
|
||||
|
@ -129,8 +129,8 @@ impl TimerScheduler {
|
|||
}
|
||||
|
||||
fn run_event_loop(&self) {
|
||||
while let Some(task) = self.receive_next_task() {
|
||||
match task {
|
||||
while let Some(thread) = self.receive_next_task() {
|
||||
match thread {
|
||||
Task::HandleRequest(request) => self.handle_request(request),
|
||||
Task::DispatchDueEvents => self.dispatch_due_events(),
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! Abstract windowing methods. The concrete implementations of these can be found in `platform/`.
|
||||
|
||||
use compositor_task::{CompositorProxy, CompositorReceiver};
|
||||
use compositor_thread::{CompositorProxy, CompositorReceiver};
|
||||
use euclid::point::TypedPoint2D;
|
||||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
|
@ -41,7 +41,7 @@ pub enum WindowEvent {
|
|||
///
|
||||
/// FIXME(pcwalton): This is kind of ugly and may not work well with multiprocess Servo.
|
||||
/// It's possible that this should be something like
|
||||
/// `CompositorMessageWindowEvent(compositor_task::Msg)` instead.
|
||||
/// `CompositorMessageWindowEvent(compositor_thread::Msg)` instead.
|
||||
Idle,
|
||||
/// Sent when part of the window is marked dirty and needs to be redrawn. Before sending this
|
||||
/// message, the window must make the same GL context as in `PrepareRenderingEvent` current.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue