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

Issue 780203002: Fix threading bugs in product label UI. (Closed)

Created:
6 years ago by michaelpg
Modified:
5 years, 11 months ago
Reviewers:
stevenjb, satorux1, Dan Beam
CC:
chromium-reviews, stevenjb
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Fix threading bugs in product label UI. As mentioned in https://codereview.chromium.org/680393002/#msg6, the current code had some threading issues. BUG=438953 R=dbeam@chromium.org,satorux@chromium.org CC=stevenjb@chromium.org Committed: https://crrev.com/ec5c21a2672ecf15f25ce7020393df21976a2d35 Cr-Commit-Position: refs/heads/master@{#307640}

Patch Set 1 #

Patch Set 2 : File path and ImageSource changes #

Total comments: 6

Patch Set 3 : fix ImageSource #

Total comments: 12

Patch Set 4 : address stevenjb's comments #

Patch Set 5 : address satorux's comments #

Total comments: 10

Patch Set 6 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+76 lines, -62 lines) Patch
M chrome/browser/ui/webui/chromeos/image_source.h View 1 2 3 1 chunk +3 lines, -10 lines 0 comments Download
M chrome/browser/ui/webui/chromeos/image_source.cc View 1 2 3 4 5 3 chunks +46 lines, -37 lines 0 comments Download
M chrome/browser/ui/webui/help/help_handler.h View 1 2 3 4 5 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/help/help_handler.cc View 1 2 3 4 5 4 chunks +25 lines, -13 lines 0 comments Download

Messages

Total messages: 40 (12 generated)
michaelpg
6 years ago (2014-12-05 02:21:12 UTC) #1
Dan Beam
lgtm but you probably want satorux@ to review as well
6 years ago (2014-12-05 02:45:28 UTC) #2
michaelpg
@satorux: mind taking a look? It's basically what you suggested. The FILE thread is deprecated ...
6 years ago (2014-12-05 02:57:32 UTC) #5
satorux1
To construct a FilePath please do not pasd std::string to the constructor because it's not ...
6 years ago (2014-12-05 03:03:21 UTC) #6
michaelpg
I see. I've found other examples where we use an absolute path, but none of ...
6 years ago (2014-12-05 04:11:57 UTC) #7
satorux1
See also FILE_PATH_LITERAL. Sent from mobile. 2014/12/05 13:11 "Michael Giuffrida" <michaelpg@chromium.org>: > I see. I've ...
6 years ago (2014-12-05 04:54:44 UTC) #8
michaelpg
PTAL dbeam@ and satorux@. I've changed the way we load the chromeos-assets path and made ...
6 years ago (2014-12-05 09:44:43 UTC) #13
stevenjb
https://codereview.chromium.org/780203002/diff/80001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/80001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode46 chrome/browser/ui/webui/chromeos/image_source.cc:46: url_data_callback.Run(NULL); This invokes |url_data_callback| (which is just |callback| below, ...
6 years ago (2014-12-05 19:31:53 UTC) #15
michaelpg
PTAL. https://codereview.chromium.org/780203002/diff/80001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/80001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode46 chrome/browser/ui/webui/chromeos/image_source.cc:46: url_data_callback.Run(NULL); On 2014/12/05 19:31:53, stevenjb wrote: > This ...
6 years ago (2014-12-05 22:42:12 UTC) #16
stevenjb
https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode30 chrome/browser/ui/webui/chromeos/image_source.cc:30: // Returns true if the image is found and ...
6 years ago (2014-12-05 23:28:07 UTC) #17
satorux1
https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc File chrome/browser/ui/webui/help/help_handler.cc (right): https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc#newcode136 chrome/browser/ui/webui/help/help_handler.cc:136: if (PathService::Get(chromeos::DIR_SHARED_ASSETS, &shared_assets_dir) && Why not just use chrome::kChromeOSAssetPath? ...
6 years ago (2014-12-08 00:43:57 UTC) #18
michaelpg
https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode30 chrome/browser/ui/webui/chromeos/image_source.cc:30: // Returns true if the image is found and ...
6 years ago (2014-12-08 00:58:19 UTC) #19
satorux1
https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc File chrome/browser/ui/webui/help/help_handler.cc (right): https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc#newcode136 chrome/browser/ui/webui/help/help_handler.cc:136: if (PathService::Get(chromeos::DIR_SHARED_ASSETS, &shared_assets_dir) && On 2014/12/08 00:58:19, michaelpg wrote: ...
6 years ago (2014-12-08 01:12:28 UTC) #20
stevenjb
lgtm
6 years ago (2014-12-08 17:42:46 UTC) #21
michaelpg
PTAL satorux, thanks! https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc File chrome/browser/ui/webui/help/help_handler.cc (right): https://codereview.chromium.org/780203002/diff/100001/chrome/browser/ui/webui/help/help_handler.cc#newcode136 chrome/browser/ui/webui/help/help_handler.cc:136: if (PathService::Get(chromeos::DIR_SHARED_ASSETS, &shared_assets_dir) && On 2014/12/08 ...
6 years ago (2014-12-08 21:14:57 UTC) #23
satorux1
https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode49 chrome/browser/ui/webui/chromeos/image_source.cc:49: bool load_started) { maybe add a DCHECK to ensure ...
6 years ago (2014-12-09 05:56:41 UTC) #24
michaelpg
https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode49 chrome/browser/ui/webui/chromeos/image_source.cc:49: bool load_started) { On 2014/12/09 05:56:40, satorux1 wrote: > ...
6 years ago (2014-12-10 00:48:51 UTC) #26
satorux1
https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode105 chrome/browser/ui/webui/chromeos/image_source.cc:105: base::Bind(LoadImageAttempted, got_data_callback)); On 2014/12/10 00:48:51, michaelpg wrote: > On ...
6 years ago (2014-12-10 01:18:17 UTC) #27
michaelpg
On 2014/12/10 01:18:17, satorux1 wrote: > https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc > File chrome/browser/ui/webui/chromeos/image_source.cc (right): > > https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode105 > ...
6 years ago (2014-12-10 01:26:42 UTC) #28
michaelpg
https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc File chrome/browser/ui/webui/chromeos/image_source.cc (right): https://codereview.chromium.org/780203002/diff/160001/chrome/browser/ui/webui/chromeos/image_source.cc#newcode105 chrome/browser/ui/webui/chromeos/image_source.cc:105: base::Bind(LoadImageAttempted, got_data_callback)); On 2014/12/10 01:18:17, satorux1 wrote: > On ...
6 years ago (2014-12-10 01:45:11 UTC) #31
satorux1
LGTM. I think the complexity in image_source.cc comes from the (IMHO) weird API of UserImageLoader ...
6 years ago (2014-12-10 01:50:48 UTC) #32
satorux1
Hmm, I was wrong. you still need to call base::PathExists(image_path) in a blocking pool thread, ...
6 years ago (2014-12-10 01:54:11 UTC) #33
satorux1
But I guess UserImageLoader should be responsible to check if a file exists, and raises ...
6 years ago (2014-12-10 01:59:56 UTC) #34
michaelpg
Thanks. Yeah, I think all these things are true. I also added a TODO last ...
6 years ago (2014-12-10 02:33:59 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/780203002/240001
6 years ago (2014-12-10 02:35:05 UTC) #37
commit-bot: I haz the power
Committed patchset #6 (id:240001)
6 years ago (2014-12-10 04:24:48 UTC) #38
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/ec5c21a2672ecf15f25ce7020393df21976a2d35 Cr-Commit-Position: refs/heads/master@{#307640}
6 years ago (2014-12-10 04:25:29 UTC) #39
satorux1
5 years, 11 months ago (2015-01-05 05:48:08 UTC) #40
Message was sent while issue was closed.
FWIW correction for #32.

> I think the complexity in image_source.cc comes from the (IMHO) weird API of
> UserImageLoader where ::Start() should be called from a blocking pool thread,
> but the callback is run on the thread where the loader object is created.

This is not true. Start() can be called from the UI thread. The reason why this
is called from a blocking pool thread in the client code is that it has to call
base::PathExists() to see if a file exists.

As commented in #34, the existence check should probably be done in
UserImageLoader.

Powered by Google App Engine
This is Rietveld 408576698