In https://codereview.chromium.org/1748423005/ hashimoto@ pointed out that UserImage should have DISALLOW_COPY_AND_ASSIGN and we should eliminate unnecessary copies of the image data bytes.
We should also remove other code which are copying image bytes.
For example, by doing:
Make UserImageRequest non-copyable.
Remove a ctor from UserImage which copies image bytes.
Remove a ctor from UserImageRequest which copies image bytes.
There is still one unnecessary data copy.
Currently, user_image_loader.cc performs two data copies: one in UserImageRequest ctor and one done by std::string version ImageDecoder::StartWithOptions().
As long as we keep both ImageSkia and image bytes in UserImage, it's impossible to remove both data copies, but at least we can get rid of one of them, either by using RefCountedBytes::TakeVector() in UserImageRequest ctor, or using std::vector version ImageDecoder::StartWithOptions().
Comment 1 by bugdroid1@chromium.org
, Mar 14 2016