UserImage::CreateAndEncode() is an expensive function (converting a bitmap into JPEG format) thus should not be used on the UI thread.
For instance, the following code is to convert the profile image downloaded from the server (512x512 pixels for me) to JPEG format, on UI thread.
void UserImageManagerImpl::SaveUserImageFromProfileImage() {
if (IsUserImageManaged())
return;
// Use the profile image if it has been downloaded already. Otherwise, use a
// stub image (gray avatar).
job_.reset(new Job(this));
job_->SetToImage(user_manager::User::USER_IMAGE_PROFILE,
downloaded_profile_image_.isNull()
? user_manager::UserImage()
: user_manager::UserImage::CreateAndEncode(
downloaded_profile_image_));
I haven't done a benchmark but it'd probably take like a millisecond on slow devices.
Comment 1 by satorux@chromium.org
, Mar 2 2016