Index: extensions/browser/extension_icon_image.cc |
diff --git a/extensions/browser/extension_icon_image.cc b/extensions/browser/extension_icon_image.cc |
index 5ebc40017920f6190631bb21baf4fb5030308d28..632e389284826d3d7fa74f7ad6d5cd86c4aa701f 100644 |
--- a/extensions/browser/extension_icon_image.cc |
+++ b/extensions/browser/extension_icon_image.cc |
@@ -223,8 +223,18 @@ void IconImage::OnImageLoaded(float scale, const gfx::Image& image_in) { |
DCHECK(!rep.is_null()); |
DCHECK_EQ(scale, rep.scale()); |
- // Remove old representation if there is one. |
- image_skia_.RemoveRepresentation(scale); |
+ // Remove all old representations. This will ensure that stale image caches |
+ // are invalidated. |
+ // A better approach might be to set the |image_| member using the ImageSkia |
oshima
2015/03/24 01:19:05
can you add TODO(oshima): here?
ananta
2015/03/24 02:12:23
Done.
|
+ // copy from the image passed in and set the |image_skia_| member using |
+ // image_.ToImageSkia(). However that does not work correctly as the |
+ // ImageSkia from the image does not contain a source which breaks requests |
+ // for scaled images. |
+ std::vector<gfx::ImageSkiaRep> reps = image_skia_.image_reps(); |
+ for (size_t rep_index = 0; rep_index < reps.size(); ++rep_index) { |
oshima
2015/03/24 01:19:05
range based for-loop, and nuke {}
ananta
2015/03/24 02:12:23
Removed the loop and replaced with image_skia_ = g
|
+ image_skia_.RemoveRepresentation(reps[rep_index].scale()); |
+ } |
oshima
2015/03/24 01:22:22
actually, you should be able to do:
image_skia_ =
ananta
2015/03/24 02:12:23
Done.
|
+ |
image_skia_.AddRepresentation(rep); |
// Update the image to use the updated image skia. |