mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Restructure ImageCache.get_image
This commit is contained in:
parent
d155daf5bf
commit
2fa203bc72
1 changed files with 9 additions and 7 deletions
|
@ -84,6 +84,14 @@ impl ImageCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*priv*/ fn get_image(url: url, response: chan<ImageResponseMsg>) {
|
/*priv*/ fn get_image(url: url, response: chan<ImageResponseMsg>) {
|
||||||
|
match self.image_map.find(url) {
|
||||||
|
some(image) => {
|
||||||
|
response.send(ImageReady(clone_arc(image)));
|
||||||
|
return
|
||||||
|
}
|
||||||
|
none => ()
|
||||||
|
}
|
||||||
|
|
||||||
match self.prefetch_map.find(url) {
|
match self.prefetch_map.find(url) {
|
||||||
some(prefetch_data) => {
|
some(prefetch_data) => {
|
||||||
|
|
||||||
|
@ -118,13 +126,7 @@ impl ImageCache {
|
||||||
response.send(ImageNotReady);
|
response.send(ImageNotReady);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
none => {
|
none => fail ~"got a request for image data without prefetch"
|
||||||
// FIXME: Probably faster to hit this map before the prefetch map
|
|
||||||
match self.image_map.find(url) {
|
|
||||||
some(image) => response.send(ImageReady(clone_arc(image))),
|
|
||||||
none => fail ~"got a request for image data without prefetch"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue