Chromium Code Reviews| Index: chrome/browser/themes/browser_theme_pack.cc |
| diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc |
| index a2672f77520aea90eed1443e661b2c4e71f8448e..46dd21f5e13635fa2d3a66e82293e67cc6e013b3 100644 |
| --- a/chrome/browser/themes/browser_theme_pack.cc |
| +++ b/chrome/browser/themes/browser_theme_pack.cc |
| @@ -436,11 +436,15 @@ scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromExtension( |
| pack->CreateImages(&pack->images_on_ui_thread_); |
| pack->CreateImages(&pack->images_on_file_thread_); |
| - // For M22, as it is not possible to easily determine which scale factors are |
| - // in use, assume that the 1x scale factor is in use. |
| - std::vector<ui::ScaleFactor> scale_factors_in_use; |
| - scale_factors_in_use.push_back(ui::SCALE_FACTOR_100P); |
| - pack->GenerateImageReps(scale_factors_in_use); |
| + // Make sure the images_on_file_thread_ has bitmaps for supported |
|
sky
2012/08/23 19:44:09
|s around images_on_file_thread_
oshima
2012/08/24 16:45:34
Done.
|
| + // scale factors before passing to FILE thread. |
| + for (ImageCache::iterator it = pack->images_on_file_thread_.begin(); |
| + it != pack->images_on_file_thread_.end(); ++it) { |
|
sky
2012/08/23 19:44:09
I still think this should copy off the images rath
|
| + gfx::ImageSkia* image_skia = |
| + const_cast<gfx::ImageSkia*>(it->second->ToImageSkia()); |
| + image_skia->EnsureRepsForSupportedScaleFactors(); |
| + image_skia->DeleteSource(); |
| + } |
| // The BrowserThemePack is now in a consistent state. |
| return pack; |
| @@ -1145,34 +1149,6 @@ void BrowserThemePack::RepackImages(const ImageCache& images, |
| } |
| } |
| -void BrowserThemePack::GenerateImageReps( |
| - const std::vector<ui::ScaleFactor>& scale_factors) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - for (ImageCache::const_iterator it = images_on_ui_thread_.begin(); |
| - it != images_on_ui_thread_.end(); |
| - ++it) { |
| - const gfx::ImageSkia* image1 = it->second->ToImageSkia(); |
| - const gfx::ImageSkia* image2 = |
| - images_on_file_thread_[it->first]->ToImageSkia(); |
| - |
| - // Ensure that image reps are generated and cached in |image1| by |
| - // calling GetRepresentation(). |
| - for (size_t i = 0; i < scale_factors.size(); ++i) |
| - image1->GetRepresentation(scale_factors[i]); |
| - |
| - // |image1| and |image2| have ImageSkiaSources which produce pixel |
| - // equivalent output. Instead of regenerating again, copy the image reps |
| - // which were generated for |image1| into |image2|. |
| - // Don't do a deep copy of the SkBitmaps as SkBitmap is thread safe. |
| - std::vector<gfx::ImageSkiaRep> image1_reps = image1->image_reps(); |
| - for (size_t i = 0; i < image1_reps.size(); ++i) { |
| - gfx::ImageSkiaRep image1_rep = image1_reps[i]; |
| - const_cast<gfx::ImageSkia*>(image2)->AddRepresentation(gfx::ImageSkiaRep( |
| - image1_rep.sk_bitmap(), image1_rep.scale_factor())); |
| - } |
| - } |
| -} |
| - |
| void BrowserThemePack::MergeImageCaches( |
| const ImageCache& source, ImageCache* destination) const { |
| for (ImageCache::const_iterator it = source.begin(); it != source.end(); |