Index: chrome/browser/chromeos/login/users/avatar/user_image_loader.h |
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_loader.h b/chrome/browser/chromeos/login/users/avatar/user_image_loader.h |
index 10c7be458e2e89630835d0ca95f05666b40e3a52..2d00ba0df54dcef50a9c248fa18e77287fffefee 100644 |
--- a/chrome/browser/chromeos/login/users/avatar/user_image_loader.h |
+++ b/chrome/browser/chromeos/login/users/avatar/user_image_loader.h |
@@ -5,7 +5,7 @@ |
#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_LOADER_H_ |
#define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AVATAR_USER_IMAGE_LOADER_H_ |
-#include <map> |
+#include <queue> |
dcheng
2015/03/23 11:52:09
I think you can remove this #include.
Theresa
2015/03/23 17:33:09
Done.
|
#include <string> |
#include "base/callback.h" |
@@ -27,8 +27,7 @@ namespace chromeos { |
// Helper that reads, decodes and optionally resizes an image on a background |
// thread. Returns the image in the form of an SkBitmap. |
-class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>, |
- public ImageDecoder::Delegate { |
+class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader> { |
public: |
// Callback used to return the result of an image load operation. |
typedef base::Callback<void(const user_manager::UserImage& user_image)> |
@@ -67,9 +66,27 @@ class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>, |
const LoadedCallback loaded_cb; |
}; |
- typedef std::map<const ImageDecoder*, ImageInfo> ImageInfoMap; |
+ class UserImageRequest : public ImageDecoder::ImageRequest { |
+ public: |
+ UserImageRequest(const ImageInfo& image_info, |
+ const std::string& image_data, |
+ UserImageLoader* user_image_loader); |
- ~UserImageLoader() override; |
+ // ImageDecoder::ImageRequest implementation. These callbacks will only be |
+ // invoked |
dcheng
2015/03/23 11:52:08
This comment needs to be updated / rewrapped.
Theresa
2015/03/23 17:33:09
I rewrapped. I think the comment is still accurate
dcheng
2015/03/24 05:18:18
This class has no background_task_runner_ member i
Theresa
2015/03/24 23:51:42
Done.
|
+ // via the |background_task_runner_|. |
+ void OnImageDecoded(const SkBitmap& decoded_image) override; |
+ void OnDecodeImageFailed() override; |
+ |
+ const ImageInfo image_info_; |
dcheng
2015/03/23 11:52:08
Convention is to make these private and use access
Theresa
2015/03/23 17:33:09
Done.
|
+ std::vector<unsigned char> image_data_; |
dcheng
2015/03/23 11:52:08
Having to copy this is pretty sad. But I don't see
Theresa
2015/03/23 17:33:09
Acknowledged.
|
+ UserImageLoader* user_image_loader_; |
+ |
+ private: |
+ ~UserImageRequest() override; |
+ }; |
+ |
+ ~UserImageLoader(); |
// Reads the image from |image_info.file_path| and starts the decoding |
// process. This method may only be invoked via the |background_task_runner_|. |
@@ -80,12 +97,6 @@ class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>, |
void DecodeImage(const scoped_ptr<std::string> data, |
const ImageInfo& image_info); |
- // ImageDecoder::Delegate implementation. These callbacks will only be invoked |
- // via the |background_task_runner_|. |
- void OnImageDecoded(const ImageDecoder* decoder, |
- const SkBitmap& decoded_image) override; |
- void OnDecodeImageFailed(const ImageDecoder* decoder) override; |
- |
// The foreground task runner on which |this| is instantiated, Start() is |
// called and LoadedCallbacks are invoked. |
scoped_refptr<base::SequencedTaskRunner> foreground_task_runner_; |
@@ -97,10 +108,6 @@ class UserImageLoader : public base::RefCountedThreadSafe<UserImageLoader>, |
// Specify how the file should be decoded in the utility process. |
const ImageDecoder::ImageCodec image_codec_; |
- // Holds information about the images currently being decoded. Accessed via |
- // |background_task_runner_| only. |
- ImageInfoMap image_info_map_; |
- |
DISALLOW_COPY_AND_ASSIGN(UserImageLoader); |
}; |