mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make image cache per-document rather than global
This commit is contained in:
parent
9eb6bb78b0
commit
72d7ee613b
25 changed files with 448 additions and 649 deletions
|
@ -87,7 +87,6 @@ use msg::constellation_msg::{FrameId, FrameType, PipelineId};
|
|||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
|
||||
use net_traits::{self, IpcSend, ResourceThreads};
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use net_traits::pub_domains::reg_host;
|
||||
use net_traits::storage_thread::{StorageThreadMsg, StorageType};
|
||||
use offscreen_gl_context::{GLContextAttributes, GLLimits};
|
||||
|
@ -175,10 +174,6 @@ pub struct Constellation<Message, LTF, STF> {
|
|||
/// browsing.
|
||||
private_resource_threads: ResourceThreads,
|
||||
|
||||
/// A channel for the constellation to send messages to the image
|
||||
/// cache thread.
|
||||
image_cache_thread: ImageCacheThread,
|
||||
|
||||
/// A channel for the constellation to send messages to the font
|
||||
/// cache thread.
|
||||
font_cache_thread: FontCacheThread,
|
||||
|
@ -302,9 +297,6 @@ pub struct InitialConstellationState {
|
|||
/// A channel to the bluetooth thread.
|
||||
pub bluetooth_thread: IpcSender<BluetoothRequest>,
|
||||
|
||||
/// A channel to the image cache thread.
|
||||
pub image_cache_thread: ImageCacheThread,
|
||||
|
||||
/// A channel to the font cache thread.
|
||||
pub font_cache_thread: FontCacheThread,
|
||||
|
||||
|
@ -518,7 +510,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
bluetooth_thread: state.bluetooth_thread,
|
||||
public_resource_threads: state.public_resource_threads,
|
||||
private_resource_threads: state.private_resource_threads,
|
||||
image_cache_thread: state.image_cache_thread,
|
||||
font_cache_thread: state.font_cache_thread,
|
||||
swmanager_chan: None,
|
||||
swmanager_receiver: swmanager_receiver,
|
||||
|
@ -657,7 +648,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
devtools_chan: self.devtools_chan.clone(),
|
||||
bluetooth_thread: self.bluetooth_thread.clone(),
|
||||
swmanager_thread: self.swmanager_sender.clone(),
|
||||
image_cache_thread: self.image_cache_thread.clone(),
|
||||
font_cache_thread: self.font_cache_thread.clone(),
|
||||
resource_threads: resource_threads,
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
|
@ -1210,9 +1200,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
let (core_sender, core_receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
let (storage_sender, storage_receiver) = ipc::channel().expect("Failed to create IPC channel!");
|
||||
|
||||
debug!("Exiting image cache.");
|
||||
self.image_cache_thread.exit();
|
||||
|
||||
debug!("Exiting core resource threads.");
|
||||
if let Err(e) = self.public_resource_threads.send(net_traits::CoreResourceMsg::Exit(core_sender)) {
|
||||
warn!("Exit resource thread failed ({})", e);
|
||||
|
|
|
@ -17,7 +17,7 @@ use ipc_channel::router::ROUTER;
|
|||
use layout_traits::LayoutThreadFactory;
|
||||
use msg::constellation_msg::{FrameId, FrameType, PipelineId, PipelineNamespaceId};
|
||||
use net_traits::{IpcSend, ResourceThreads};
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile_traits::mem as profile_mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{ConstellationControlMsg, DevicePixel, DiscardBrowsingContext};
|
||||
|
@ -133,9 +133,6 @@ pub struct InitialPipelineState {
|
|||
/// A channel to the service worker manager thread
|
||||
pub swmanager_thread: IpcSender<SWManagerMsg>,
|
||||
|
||||
/// A channel to the image cache thread.
|
||||
pub image_cache_thread: ImageCacheThread,
|
||||
|
||||
/// A channel to the font cache thread.
|
||||
pub font_cache_thread: FontCacheThread,
|
||||
|
||||
|
@ -250,7 +247,6 @@ impl Pipeline {
|
|||
devtools_chan: script_to_devtools_chan,
|
||||
bluetooth_thread: state.bluetooth_thread,
|
||||
swmanager_thread: state.swmanager_thread,
|
||||
image_cache_thread: state.image_cache_thread,
|
||||
font_cache_thread: state.font_cache_thread,
|
||||
resource_threads: state.resource_threads,
|
||||
time_profiler_chan: state.time_profiler_chan,
|
||||
|
@ -451,7 +447,6 @@ pub struct UnprivilegedPipelineContent {
|
|||
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
|
||||
bluetooth_thread: IpcSender<BluetoothRequest>,
|
||||
swmanager_thread: IpcSender<SWManagerMsg>,
|
||||
image_cache_thread: ImageCacheThread,
|
||||
font_cache_thread: FontCacheThread,
|
||||
resource_threads: ResourceThreads,
|
||||
time_profiler_chan: time::ProfilerChan,
|
||||
|
@ -477,6 +472,7 @@ impl UnprivilegedPipelineContent {
|
|||
where LTF: LayoutThreadFactory<Message=Message>,
|
||||
STF: ScriptThreadFactory<Message=Message>
|
||||
{
|
||||
let image_cache = ImageCache::new(self.webrender_api_sender.create_api());
|
||||
let layout_pair = STF::create(InitialScriptState {
|
||||
id: self.id,
|
||||
frame_id: self.frame_id,
|
||||
|
@ -489,7 +485,7 @@ impl UnprivilegedPipelineContent {
|
|||
scheduler_chan: self.scheduler_chan,
|
||||
bluetooth_thread: self.bluetooth_thread,
|
||||
resource_threads: self.resource_threads,
|
||||
image_cache_thread: self.image_cache_thread.clone(),
|
||||
image_cache: image_cache.clone(),
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
mem_profiler_chan: self.mem_profiler_chan.clone(),
|
||||
devtools_chan: self.devtools_chan,
|
||||
|
@ -507,7 +503,7 @@ impl UnprivilegedPipelineContent {
|
|||
self.pipeline_port,
|
||||
self.layout_to_constellation_chan,
|
||||
self.script_chan,
|
||||
self.image_cache_thread,
|
||||
image_cache.clone(),
|
||||
self.font_cache_thread,
|
||||
self.time_profiler_chan,
|
||||
self.mem_profiler_chan,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue