Chromium Code Reviews| Index: components/wallpaper/wallpaper_resizer.cc |
| diff --git a/components/wallpaper/wallpaper_resizer.cc b/components/wallpaper/wallpaper_resizer.cc |
| index e5f7f9680a1472ad8039ebd038cd3fa1725eff45..e6a7eac4a2e7f9dfeb48089ca04f7a51633b40d3 100644 |
| --- a/components/wallpaper/wallpaper_resizer.cc |
| +++ b/components/wallpaper/wallpaper_resizer.cc |
| @@ -26,12 +26,17 @@ int RoundPositive(double x) { |
| // Resizes |orig_bitmap| to |target_size| using |layout| and stores the |
|
xdai1
2017/05/02 18:23:07
nit: update |orig_bitmap| to |image|
bruthig
2017/05/02 18:29:56
Done.
|
| // resulting bitmap at |resized_bitmap_out|. |
| -void Resize(SkBitmap orig_bitmap, |
| +// |
| +// NOTE: |image| is intentionally a copy to ensure it exists for the duration of |
| +// the function. |
| +void Resize(const gfx::ImageSkia image, |
| const gfx::Size& target_size, |
| WallpaperLayout layout, |
| SkBitmap* resized_bitmap_out, |
| base::TaskRunner* task_runner) { |
| DCHECK(task_runner->RunsTasksOnCurrentThread()); |
| + |
| + SkBitmap orig_bitmap = *image.bitmap(); |
| SkBitmap new_bitmap = orig_bitmap; |
| const int orig_width = orig_bitmap.width(); |
| @@ -127,8 +132,8 @@ void WallpaperResizer::StartResize() { |
| SkBitmap* resized_bitmap = new SkBitmap; |
| if (!task_runner_->PostTaskAndReply( |
| FROM_HERE, |
| - base::Bind(&Resize, *image_.bitmap(), target_size_, layout_, |
| - resized_bitmap, base::RetainedRef(task_runner_)), |
| + base::Bind(&Resize, image_, target_size_, layout_, resized_bitmap, |
| + base::RetainedRef(task_runner_)), |
| base::Bind(&WallpaperResizer::OnResizeFinished, |
| weak_ptr_factory_.GetWeakPtr(), |
| base::Owned(resized_bitmap)))) { |