aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/image_cache_thread.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2017-01-05 21:57:20 -0500
committerJosh Matthews <josh@joshmatthews.net>2017-02-22 14:19:35 -0500
commit0d2ec852ac63f3513394df7937bddb72daed8005 (patch)
tree8806a03207181a29bf2dbe7deef91671e5f9c94f /components/net/image_cache_thread.rs
parent21118f0a8aad3999882f488cae23c7e402c0ad25 (diff)
downloadservo-0d2ec852ac63f3513394df7937bddb72daed8005.tar.gz
servo-0d2ec852ac63f3513394df7937bddb72daed8005.zip
Send response for image requests progressively to image cache.
Diffstat (limited to 'components/net/image_cache_thread.rs')
-rw-r--r--components/net/image_cache_thread.rs24
1 files changed, 6 insertions, 18 deletions
diff --git a/components/net/image_cache_thread.rs b/components/net/image_cache_thread.rs
index d9948514989..798c2ba0f61 100644
--- a/components/net/image_cache_thread.rs
+++ b/components/net/image_cache_thread.rs
@@ -396,8 +396,11 @@ impl ImageCache {
// TODO(#15501): look for opportunities to clean up cache if this send fails.
let _ = consumer.send(result);
}
- ImageCacheCommand::StoreDecodeImage(id, image_vector) => {
- self.store_decode_image(id, image_vector);
+ ImageCacheCommand::StoreDecodeImage(id, data) => {
+ self.handle_progress(ResourceLoadInfo {
+ action: data,
+ key: id
+ });
}
};
@@ -409,7 +412,7 @@ impl ImageCache {
match (msg.action, msg.key) {
(FetchResponseMsg::ProcessRequestBody, _) |
(FetchResponseMsg::ProcessRequestEOF, _) => return,
- (FetchResponseMsg::ProcessResponse(_), _) => {}
+ (FetchResponseMsg::ProcessResponse(_response), _) => {}
(FetchResponseMsg::ProcessResponseChunk(data), _) => {
let pending_load = self.pending_loads.get_by_key_mut(&msg.key).unwrap();
pending_load.bytes.extend_from_slice(&data);
@@ -581,21 +584,6 @@ impl ImageCache {
None => Err(ImageState::LoadError),
}
}
-
- fn store_decode_image(&mut self,
- id: PendingImageId,
- loaded_bytes: Vec<u8>) {
- let action = FetchResponseMsg::ProcessResponseChunk(loaded_bytes);
- self.handle_progress(ResourceLoadInfo {
- action: action,
- key: id,
- });
- let action = FetchResponseMsg::ProcessResponseEOF(Ok(()));
- self.handle_progress(ResourceLoadInfo {
- action: action,
- key: id,
- });
- }
}
/// Create a new image cache.