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

Issue 371633002: LabelButton: cache the last computed preferred size (Closed)

Created:
6 years, 5 months ago by noms (inactive)
Modified:
6 years, 5 months ago
Reviewers:
msw, sky, Evan Stade
CC:
chromium-reviews, tfarina, Elliot Glaysher, Alexei Svitkine (slow)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

LabelButton: cache the last computed preferred size LabelButton's GetPreferredSize() gets called a lot, and it's pretty expensive (creates a temporary label every time). To make it less sucky, we should cache its last computed size and reuse that, just like Label does. BUG=373906 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285587

Patch Set 1 : #

Patch Set 2 : fix whitespace #

Total comments: 24

Patch Set 3 : rebase #

Total comments: 3

Patch Set 4 : rebase #

Patch Set 5 : msw comments #

Total comments: 6

Patch Set 6 : rebase #

Patch Set 7 : moar msw comments #

Patch Set 8 : rebase again. i'd really like happy bots #

Patch Set 9 : rebase #

Total comments: 13

Patch Set 10 : mike & scott comments #

Patch Set 11 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+84 lines, -34 lines) Patch
M ash/system/chromeos/session/logout_button_tray.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/autofill/autofill_dialog_views.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/content_setting_bubble_contents.cc View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/fullscreen_exit_bubble_views.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/location_bar/search_button.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/profiles/new_avatar_button.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/profiles/profile_chooser_view.cc View 1 2 3 4 5 6 4 chunks +4 lines, -4 lines 0 comments Download
M chrome/browser/ui/views/profiles/profile_reset_bubble_view.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/views/sync/one_click_signin_bubble_view.cc View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M ui/views/button_drag_utils.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/button/checkbox.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M ui/views/controls/button/label_button.h View 1 2 3 4 5 6 7 8 9 3 chunks +11 lines, -3 lines 0 comments Download
M ui/views/controls/button/label_button.cc View 1 2 3 4 5 6 7 8 9 8 chunks +28 lines, -3 lines 0 comments Download
M ui/views/controls/button/label_button_unittest.cc View 1 2 3 4 5 6 7 8 9 4 chunks +24 lines, -7 lines 0 comments Download
M ui/views/examples/button_example.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M ui/views/window/dialog_client_view.cc View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 37 (0 generated)
noms (inactive)
Hiya Mike & Scott, Here's a CL that makes LabelButton's GetPreferredSize() faster and hopefully does ...
6 years, 5 months ago (2014-07-04 14:30:50 UTC) #1
msw
I think we're trying to avoid caching preferred sizes, because it adds an error-prone layer ...
6 years, 5 months ago (2014-07-08 00:24:04 UTC) #2
Evan Stade
For the record, I agree with all of msw's review nits. I also agree caching ...
6 years, 5 months ago (2014-07-08 18:23:09 UTC) #3
sky
I agree with caching being tricky too. You don't mention why you are doing this. ...
6 years, 5 months ago (2014-07-09 20:34:23 UTC) #4
noms (inactive)
This CL fixes the Win 8 slowness in crbug.com/373906. The underlying problem is probably deeper ...
6 years, 5 months ago (2014-07-09 20:52:09 UTC) #5
Evan Stade
On 2014/07/09 20:52:09, Monica Dinculescu wrote: > This CL fixes the Win 8 slowness in ...
6 years, 5 months ago (2014-07-09 21:33:54 UTC) #6
noms (inactive)
Hmm, I could try reusing the same label, and do something smart where we don't ...
6 years, 5 months ago (2014-07-14 19:55:48 UTC) #7
noms (inactive)
Actually, I take that back. If we want to use the same Label and take ...
6 years, 5 months ago (2014-07-14 20:01:20 UTC) #8
Evan Stade
On 2014/07/14 20:01:20, Monica Dinculescu wrote: > Actually, I take that back. If we want ...
6 years, 5 months ago (2014-07-14 21:16:08 UTC) #9
noms (inactive)
Even if we don't use the temporary stack label in LabelButton's GetPreferredSize(), and just use ...
6 years, 5 months ago (2014-07-15 14:02:25 UTC) #10
Evan Stade
On 2014/07/15 14:02:25, Monica Dinculescu wrote: > Even if we don't use the temporary stack ...
6 years, 5 months ago (2014-07-15 19:10:07 UTC) #11
msw
Unfortunately, my WIP Label rewrite <https://codereview.chromium.org/23228004> alone may not have the dramatic performance improvement that ...
6 years, 5 months ago (2014-07-15 22:51:43 UTC) #12
noms (inactive)
I've addressed the missing/extraneous ResetCachedSize() calls from the first patch. The tl; dr of the ...
6 years, 5 months ago (2014-07-21 15:40:44 UTC) #13
msw
I'm actually okay with caching the size. https://codereview.chromium.org/371633002/diff/100001/ui/views/controls/button/label_button.cc File ui/views/controls/button/label_button.cc (right): https://codereview.chromium.org/371633002/diff/100001/ui/views/controls/button/label_button.cc#newcode181 ui/views/controls/button/label_button.cc:181: ResetCachedSize(); Call ...
6 years, 5 months ago (2014-07-21 16:28:26 UTC) #14
noms (inactive)
I'm working on getting the bots to run. They're not keen on applying the patch ...
6 years, 5 months ago (2014-07-21 17:18:51 UTC) #15
noms (inactive)
Ping! :)
6 years, 5 months ago (2014-07-23 18:57:31 UTC) #16
sky
I assume you're pinging msw on this and not the rest of us. On Wed, ...
6 years, 5 months ago (2014-07-23 19:19:35 UTC) #17
msw
lgtm with a nit and some thoughts for followup. https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.cc File ui/views/controls/button/label_button.cc (right): https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.cc#newcode92 ui/views/controls/button/label_button.cc:92: ...
6 years, 5 months ago (2014-07-23 19:20:16 UTC) #18
noms (inactive)
Scott: technically, I was pinging you too. :) Now that Mike has reviewed/stamped this (with ...
6 years, 5 months ago (2014-07-23 19:24:14 UTC) #19
sky
https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.h File ui/views/controls/button/label_button.h (right): https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.h#newcode148 ui/views/controls/button/label_button.h:148: void ResetCachedSize(); Is it possible to override ChildPreferredSizeChanged to ...
6 years, 5 months ago (2014-07-23 22:42:37 UTC) #20
noms (inactive)
I've added a test and addressed the other comments. Please take a look. https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.cc File ...
6 years, 5 months ago (2014-07-24 14:20:26 UTC) #21
sky
LGTM https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.h File ui/views/controls/button/label_button.h (right): https://codereview.chromium.org/371633002/diff/180001/ui/views/controls/button/label_button.h#newcode148 ui/views/controls/button/label_button.h:148: void ResetCachedSize(); On 2014/07/24 14:20:26, Monica Dinculescu wrote: ...
6 years, 5 months ago (2014-07-24 15:38:05 UTC) #22
msw
LGTM! More tests would be nice, but not strictly necessary.
6 years, 5 months ago (2014-07-24 17:56:38 UTC) #23
noms (inactive)
Mike: I'll talk to you offline about the other tests, and do them in a ...
6 years, 5 months ago (2014-07-24 18:04:42 UTC) #24
noms (inactive)
The CQ bit was checked by noms@chromium.org
6 years, 5 months ago (2014-07-24 18:04:48 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/noms@chromium.org/371633002/220001
6 years, 5 months ago (2014-07-24 18:08:09 UTC) #26
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_chromium_rel_swarming on tryserver.chromium ...
6 years, 5 months ago (2014-07-24 18:53:40 UTC) #27
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-24 19:28:21 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_swarming on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_rel_swarming/builds/1963)
6 years, 5 months ago (2014-07-24 19:28:22 UTC) #29
noms (inactive)
The CQ bit was checked by noms@chromium.org
6 years, 5 months ago (2014-07-24 19:36:11 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/noms@chromium.org/371633002/220001
6 years, 5 months ago (2014-07-24 19:38:17 UTC) #31
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: linux_chromium_rel_swarming on tryserver.chromium ...
6 years, 5 months ago (2014-07-24 20:16:06 UTC) #32
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-24 20:50:08 UTC) #33
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_swarming on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/linux_chromium_rel_swarming/builds/2025)
6 years, 5 months ago (2014-07-24 20:50:10 UTC) #34
noms (inactive)
The CQ bit was checked by noms@chromium.org
6 years, 5 months ago (2014-07-25 13:22:25 UTC) #35
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/noms@chromium.org/371633002/220001
6 years, 5 months ago (2014-07-25 13:23:14 UTC) #36
commit-bot: I haz the power
6 years, 5 months ago (2014-07-25 14:53:03 UTC) #37
Message was sent while issue was closed.
Change committed as 285587

Powered by Google App Engine
This is Rietveld 408576698