Remove all unnecessary heap allocation of gfx::Image.
gfx::Image is a thin wrapper around a refcounted smart pointer, so
there is seldom need to allocate one on the heap.
This CL removes most (but not all) unique_ptr and many raw pointer
references to objects of type gfx::Image.
Bug: 953845
Change-Id: I0c2c38ea37b83ebafaee39b5caa6fa7cd37fd0ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575026
Commit-Queue: Dana Fried <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#652797}
diff --git a/chrome/browser/profiles/profile_attributes_storage.h b/chrome/browser/profiles/profile_attributes_storage.h
index 4084eaa..25c17e4 100644
--- a/chrome/browser/profiles/profile_attributes_storage.h
+++ b/chrome/browser/profiles/profile_attributes_storage.h
@@ -134,7 +134,7 @@
// profile pictures and the ProfileAvatarDownloader that is used to download
// the high res avatars.
void SaveAvatarImageAtPath(const base::FilePath& profile_path,
- const gfx::Image* image,
+ gfx::Image image,
const std::string& key,
const base::FilePath& image_path);
@@ -147,8 +147,7 @@
// A cache of gaia/high res avatar profile pictures. This cache is updated
// lazily so it needs to be mutable.
- mutable std::unordered_map<std::string, std::unique_ptr<gfx::Image>>
- cached_avatar_images_;
+ mutable std::unordered_map<std::string, gfx::Image> cached_avatar_images_;
// Marks a profile picture as loading from disk. This prevents a picture from
// loading multiple times.