Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Issue 69863006: Address races in UserImageManagerImpl (Closed)

Created:
7 years, 1 month ago by bartfab (slow)
Modified:
7 years, 1 month ago
Reviewers:
Nikita (slow)
CC:
chromium-reviews, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, oshima+watch_chromium.org, nkostylev+watch_chromium.org
Visibility:
Public.

Description

Address races in UserImageManagerImpl UserImageManagerImpl uses background threads and delayed tasks to load images, save images and schedule downloads. There are races in this implementation so that an earlier operation can complete after a later operation, clobbering its result. Delayed tasks using base::Unretained() may cause crashes on shutdown if the unretained object no longer exists. Some of the races were partially worked around with global state variables that do not account for the fact that operations for multiple users may be going on in parallel. This CL is an almost complete rewrite of the UserImageManagerImpl that addresses the races and thread safety issues. Pending tasks are encapsulated by a Job class with at most one Job running per user at a time. Migration of old user images is simplified by this CL: There used to be a delay between user login and migration, postponing the I/O-heavy operation until after login is complete. However, the implementation was wrong and migration of PNG images was actually carried out immediately. Only for users who had selected one of the default images was the migration delayed, which is unnecessary as it does not involve any file I/O or transcoding. Since there have been no complaints about the performance impact of migration during login, this CL removes the delay altogether. The CL also updates the UserImageManagerImpl browser test, re-enabling the previously flaky NonJPEGImageFromFile. BUG=152957, 152959, 257009 TEST=Updated browser tests; manual tests with chromeos=1 and VM Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=235645

Patch Set 1 #

Total comments: 12

Patch Set 2 : Comments addressed. #

Patch Set 3 : Commit changes to UserManagerImpl that I accidentally missed. #

Patch Set 4 : Fix WallpaperManager browser tests now that UserImageLoader contains a DCHECK(success). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+737 lines, -627 lines) Patch
M chrome/browser/chromeos/login/fake_user_manager.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/chromeos/login/fake_user_manager.cc View 1 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/mock_user_manager.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/chromeos/login/user_image_loader.cc View 1 1 chunk +3 lines, -1 line 0 comments Download
M chrome/browser/chromeos/login/user_image_manager.h View 1 chunk +8 lines, -8 lines 0 comments Download
M chrome/browser/chromeos/login/user_image_manager_browsertest.cc View 9 chunks +21 lines, -44 lines 0 comments Download
M chrome/browser/chromeos/login/user_image_manager_impl.h View 5 chunks +108 lines, -102 lines 0 comments Download
M chrome/browser/chromeos/login/user_image_manager_impl.cc View 1 15 chunks +563 lines, -452 lines 0 comments Download
M chrome/browser/chromeos/login/user_manager.h View 1 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/user_manager_impl.h View 1 2 2 chunks +1 line, -5 lines 0 comments Download
M chrome/browser/chromeos/login/user_manager_impl.cc View 1 2 2 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc View 1 2 3 6 chunks +15 lines, -8 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
bartfab (slow)
Hi Nikita, Could you take a look please? https://codereview.chromium.org/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc File chrome/browser/chromeos/login/user_image_manager_impl.cc (left): https://codereview.chromium.org/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc#oldcode63 chrome/browser/chromeos/login/user_image_manager_impl.cc:63: const ...
7 years, 1 month ago (2013-11-13 23:12:09 UTC) #1
Nikita (slow)
lgtm https://codereview.chromium.org/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc File chrome/browser/chromeos/login/user_image_manager_impl.cc (right): https://codereview.chromium.org/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc#newcode298 chrome/browser/chromeos/login/user_image_manager_impl.cc:298: parent_->image_loader_->Start(image_path_.value(), DCHECK that image_path is not empty. https://codereview.chromium.org/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc#newcode343 ...
7 years, 1 month ago (2013-11-14 15:17:13 UTC) #2
bartfab (slow)
https://chromiumcodereview.appspot.com/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc File chrome/browser/chromeos/login/user_image_manager_impl.cc (right): https://chromiumcodereview.appspot.com/69863006/diff/1/chrome/browser/chromeos/login/user_image_manager_impl.cc#newcode298 chrome/browser/chromeos/login/user_image_manager_impl.cc:298: parent_->image_loader_->Start(image_path_.value(), On 2013/11/14 15:17:13, Nikita Kostylev wrote: > DCHECK ...
7 years, 1 month ago (2013-11-14 15:55:10 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/60001
7 years, 1 month ago (2013-11-14 16:04:23 UTC) #4
commit-bot: I haz the power
Failed to trigger a try job on linux_chromeos_clang HTTP Error 400: Bad Request
7 years, 1 month ago (2013-11-14 16:41:43 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/320001
7 years, 1 month ago (2013-11-14 16:42:00 UTC) #6
commit-bot: I haz the power
Retried try job too often on linux_chromeos for step(s) interactive_ui_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chromeos&number=175052
7 years, 1 month ago (2013-11-14 18:26:10 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/320001
7 years, 1 month ago (2013-11-15 11:06:53 UTC) #8
commit-bot: I haz the power
Retried try job too often on linux_chromeos for step(s) interactive_ui_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chromeos&number=175345
7 years, 1 month ago (2013-11-15 12:26:10 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/610001
7 years, 1 month ago (2013-11-15 13:20:17 UTC) #10
commit-bot: I haz the power
Retried try job too often on win_rel for step(s) nacl_integration http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_rel&number=225152
7 years, 1 month ago (2013-11-15 16:59:36 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/610001
7 years, 1 month ago (2013-11-15 17:14:28 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/610001
7 years, 1 month ago (2013-11-15 22:17:16 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/69863006/610001
7 years, 1 month ago (2013-11-16 00:50:25 UTC) #14
commit-bot: I haz the power
7 years, 1 month ago (2013-11-18 07:47:21 UTC) #15
Message was sent while issue was closed.
Change committed as 235645

Powered by Google App Engine
This is Rietveld 408576698