New issue
Advanced search Search tips

Issue 593251 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Make user_manager::UserImage non-copyable and eliminate unnecessary data copies

Project Member Reported by satorux@chromium.org, Mar 9 2016

Issue description

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.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Mar 14 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bc660067f6322d4ad1383336cb5afaae7d70fc91

commit bc660067f6322d4ad1383336cb5afaae7d70fc91
Author: satorux <satorux@chromium.org>
Date: Mon Mar 14 06:09:14 2016

Get rid of UserImageManagerImpl::Job::user_image_

There is no need to copy UserImage to the member variable.

BUG=593251
TEST=the user image stuff works as before

Review URL: https://codereview.chromium.org/1778413004

Cr-Commit-Position: refs/heads/master@{#380935}

[modify] https://crrev.com/bc660067f6322d4ad1383336cb5afaae7d70fc91/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc

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.
Good catches. So many copies...
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 4 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/40e5476f77c26efab0a63f05e8498ec8968565de

commit 40e5476f77c26efab0a63f05e8498ec8968565de
Author: satorux <satorux@chromium.org>
Date: Mon Apr 04 05:38:17 2016

Make user_manager::UserImage non-copyable

The class contains |image_bytes_| member for JPEG data
bytes that can be very large for wallpapers, thus is
expensive to copy. This patch makes the class non-copyable
and eliminates some instances of object copies.

BUG=593251
TEST=user image and wallpaper stuff works as before

Review URL: https://codereview.chromium.org/1794323003

Cr-Commit-Position: refs/heads/master@{#384848}

[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/mock_user_image_manager.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/user_image_loader.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/user_image_loader.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/user_image_manager.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/fake_chrome_user_manager.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/chrome/browser/ui/webui/chromeos/image_source.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/user_manager/user.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/user_manager/user.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/user_manager/user_image/user_image.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/user_manager/user_image/user_image.h
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/wallpaper/wallpaper_manager_base.cc
[modify] https://crrev.com/40e5476f77c26efab0a63f05e8498ec8968565de/components/wallpaper/wallpaper_manager_base.h

Project Member

Comment 5 by bugdroid1@chromium.org, Apr 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/066dd98581b307fcef741bb3b09a2003001121c5

commit 066dd98581b307fcef741bb3b09a2003001121c5
Author: satorux <satorux@chromium.org>
Date: Wed Apr 06 01:27:27 2016

Remove image_bytes parameter from ResizeCustomizedDefaultWallpaper()

The parameter was unused. This also eliminates a data copy.

BUG=593251
TEST=the code builds as before

Review URL: https://codereview.chromium.org/1857683002

Cr-Commit-Position: refs/heads/master@{#385364}

[modify] https://crrev.com/066dd98581b307fcef741bb3b09a2003001121c5/components/wallpaper/wallpaper_manager_base.cc
[modify] https://crrev.com/066dd98581b307fcef741bb3b09a2003001121c5/components/wallpaper/wallpaper_manager_base.h

Project Member

Comment 6 by bugdroid1@chromium.org, Nov 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/191042a3113a57ad07f89f0501a351bb5e01a1cd

commit 191042a3113a57ad07f89f0501a351bb5e01a1cd
Author: satorux <satorux@chromium.org>
Date: Tue Nov 29 06:41:48 2016

Remove an irrelevant comment in WallpaperManagerBase

The comment is irrelevant as this function does nothing to do
with Bytes. ResizeCustomizedDefaultWallpaper() used to take
UserImage::Bytes but that parameter was removed in crrev.com/385364

BUG=593251

Review-Url: https://codereview.chromium.org/2517413002
Cr-Commit-Position: refs/heads/master@{#434914}

[modify] https://crrev.com/191042a3113a57ad07f89f0501a351bb5e01a1cd/components/wallpaper/wallpaper_manager_base.cc

Components: UI>Shell>StartScreen
Can we mark this fixed?
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().
Labels: Hotlist-auth-cleanup

Sign in to add a comment