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

Issue 918533005: Mac: Optimize TabView drawing. (Closed)

Created:
5 years, 10 months ago by Andre
Modified:
5 years, 10 months ago
Reviewers:
Robert Sesek, Nico
CC:
chromium-reviews, miu+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Mac: Optimize TabView drawing. This change speeds up -[TabView drawFill:] by about 2x. Previously each tab had to regenerate a new CGImage for setting the context's mask every time the tab size changed. This is expensive. Instead, just fill without the mask and then use NSCompositeDestinationIn to erase the fill outside the tab's shape. We also save some memory from not having each tab cache a mask image. Factor out three part image drawing to a separate class to simplify the code, and to cache the tab images since we ask for it a lot and ResourceBundle's cache lookup is not particularly fast. BUG=453996 Committed: https://crrev.com/15439381be5c6b93dfc80ff0fec4a9d98823dba8 Cr-Commit-Position: refs/heads/master@{#316161}

Patch Set 1 : #

Total comments: 2

Patch Set 2 : Split ThreePartImage #

Total comments: 6

Patch Set 3 : Fix for rsesek #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -171 lines) Patch
M chrome/browser/ui/cocoa/tabs/tab_view.h View 1 chunk +0 lines, -6 lines 0 comments Download
M chrome/browser/ui/cocoa/tabs/tab_view.mm View 1 8 chunks +59 lines, -164 lines 1 comment Download
M chrome/browser/ui/cocoa/tabs/tab_view_unittest.mm View 1 chunk +2 lines, -1 line 0 comments Download
M ui/base/BUILD.gn View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
A ui/base/cocoa/three_part_image.h View 1 2 1 chunk +53 lines, -0 lines 0 comments Download
A ui/base/cocoa/three_part_image.mm View 1 1 chunk +82 lines, -0 lines 0 comments Download
A ui/base/cocoa/three_part_image_unittest.mm View 1 2 1 chunk +54 lines, -0 lines 0 comments Download
M ui/base/ui_base.gyp View 1 1 chunk +2 lines, -0 lines 0 comments Download
M ui/base/ui_base_tests.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 23 (8 generated)
Andre
Robert, PTAL and let me know what you think.
5 years, 10 months ago (2015-02-12 05:26:26 UTC) #3
Robert Sesek
I like it. My only major comment is if ThreePartImage should be split out into ...
5 years, 10 months ago (2015-02-12 17:16:47 UTC) #4
Andre
Thanks. I will move ThreePartImage out and write some tests. I may break this into ...
5 years, 10 months ago (2015-02-12 17:23:01 UTC) #5
Andre
Robert, please review patch #2.
5 years, 10 months ago (2015-02-12 21:47:10 UTC) #8
Robert Sesek
https://codereview.chromium.org/918533005/diff/80001/ui/base/cocoa/three_part_image.h File ui/base/cocoa/three_part_image.h (right): https://codereview.chromium.org/918533005/diff/80001/ui/base/cocoa/three_part_image.h#newcode15 ui/base/cocoa/three_part_image.h:15: // A wrapper around NSDrawThreePartImage that caches the images. ...
5 years, 10 months ago (2015-02-12 21:56:38 UTC) #9
Andre
Robert, PTAL at patchset 3. I also fixed missing commas in BUILD.gn. https://codereview.chromium.org/918533005/diff/80001/ui/base/cocoa/three_part_image.h File ui/base/cocoa/three_part_image.h ...
5 years, 10 months ago (2015-02-12 22:10:38 UTC) #10
Robert Sesek
LGTM
5 years, 10 months ago (2015-02-12 22:13:34 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/918533005/100001
5 years, 10 months ago (2015-02-12 23:39:25 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/42454)
5 years, 10 months ago (2015-02-12 23:48:25 UTC) #15
Andre
Looks like I still need an owner for gyp and gn. Nico, PTAL.
5 years, 10 months ago (2015-02-12 23:58:34 UTC) #17
Nico
gyp/gn lgtm The work on the linked bug is awesome! https://codereview.chromium.org/918533005/diff/100001/chrome/browser/ui/cocoa/tabs/tab_view.mm File chrome/browser/ui/cocoa/tabs/tab_view.mm (right): https://codereview.chromium.org/918533005/diff/100001/chrome/browser/ui/cocoa/tabs/tab_view.mm#newcode51 ...
5 years, 10 months ago (2015-02-13 04:17:28 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/918533005/100001
5 years, 10 months ago (2015-02-13 04:18:26 UTC) #20
commit-bot: I haz the power
Committed patchset #3 (id:100001)
5 years, 10 months ago (2015-02-13 04:22:07 UTC) #21
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/15439381be5c6b93dfc80ff0fec4a9d98823dba8 Cr-Commit-Position: refs/heads/master@{#316161}
5 years, 10 months ago (2015-02-13 04:22:59 UTC) #22
Andre
5 years, 10 months ago (2015-02-13 18:28:16 UTC) #23
Message was sent while issue was closed.
On 2015/02/13 04:17:28, Nico wrote:
> gyp/gn lgtm
> 
> The work on the linked bug is awesome!
> 
>
https://codereview.chromium.org/918533005/diff/100001/chrome/browser/ui/cocoa...
> File chrome/browser/ui/cocoa/tabs/tab_view.mm (right):
> 
>
https://codereview.chromium.org/918533005/diff/100001/chrome/browser/ui/cocoa...
> chrome/browser/ui/cocoa/tabs/tab_view.mm:51: new
> ui::ThreePartImage(IDR_TAB_ALPHA_LEFT, 0, IDR_TAB_ALPHA_RIGHT);
> nit: We have CR_DEFINE_STATIC_LOCAL for this (also for the next function)

Thanks Nico.
I've uploaded a follow-up CL, https://codereview.chromium.org/922223003/

Powered by Google App Engine
This is Rietveld 408576698