mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
layout: Make the LocalImageCache
on_image_available
callback not use
`@`. This is one small step toward parallel layout.
This commit is contained in:
parent
0d15310db1
commit
7eb4097dc9
2 changed files with 6 additions and 6 deletions
|
@ -675,15 +675,15 @@ impl LayoutTask {
|
|||
// to the script task, and ultimately cause the image to be
|
||||
// re-requested. We probably don't need to go all the way back to
|
||||
// the script task for this.
|
||||
fn make_on_image_available_cb(&self) -> @ImageResponder {
|
||||
fn make_on_image_available_cb(&self) -> ~ImageResponder:Send {
|
||||
// This has a crazy signature because the image cache needs to
|
||||
// make multiple copies of the callback, and the dom event
|
||||
// channel is not a copyable type, so this is actually a
|
||||
// little factory to produce callbacks
|
||||
@LayoutImageResponder {
|
||||
~LayoutImageResponder {
|
||||
id: self.id.clone(),
|
||||
script_chan: self.script_chan.clone(),
|
||||
} as @ImageResponder
|
||||
} as ~ImageResponder:Send
|
||||
}
|
||||
|
||||
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* task
|
||||
|
|
|
@ -33,7 +33,7 @@ pub fn LocalImageCache(image_cache_task: ImageCacheTask) -> LocalImageCache {
|
|||
pub struct LocalImageCache {
|
||||
priv image_cache_task: ImageCacheTask,
|
||||
priv round_number: uint,
|
||||
priv on_image_available: Option<@ImageResponder>,
|
||||
priv on_image_available: Option<~ImageResponder:Send>,
|
||||
priv state_map: UrlMap<@mut ImageState>
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct ImageState {
|
|||
impl LocalImageCache {
|
||||
/// The local cache will only do a single remote request for a given
|
||||
/// URL in each 'round'. Layout should call this each time it begins
|
||||
pub fn next_round(&mut self, on_image_available: @ImageResponder) {
|
||||
pub fn next_round(&mut self, on_image_available: ~ImageResponder:Send) {
|
||||
self.round_number += 1;
|
||||
self.on_image_available = Some(on_image_available);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ impl LocalImageCache {
|
|||
// on the image to load and triggering layout
|
||||
let image_cache_task = self.image_cache_task.clone();
|
||||
assert!(self.on_image_available.is_some());
|
||||
let on_image_available = self.on_image_available.unwrap().respond();
|
||||
let on_image_available = self.on_image_available.as_ref().unwrap().respond();
|
||||
let url = (*url).clone();
|
||||
do task::spawn {
|
||||
let (response_port, response_chan) = comm::stream();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue