diff options
author | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-16 11:38:32 +0000 |
---|---|---|
committer | mgiuca@chromium.org <mgiuca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-16 11:38:32 +0000 |
commit | 1ac8abbf74ebec04b018073d5f7dc04e91fe533b (patch) | |
tree | 342ac4fb3f87d832ce8fdd7f402398e51c11dba2 /ui | |
parent | a144e2076f64d7bb38162d06699298953a1a861f (diff) | |
download | chromium_src-1ac8abbf74ebec04b018073d5f7dc04e91fe533b.zip chromium_src-1ac8abbf74ebec04b018073d5f7dc04e91fe533b.tar.gz chromium_src-1ac8abbf74ebec04b018073d5f7dc04e91fe533b.tar.bz2 |
App list: TileItemView::SetAppListItem exits early if item already set.
This effectively caches the result of CalculateKMeanColorOfBitmap so it
does not have to be recomputed every time the start page view is reset.
Noticeable improvement in the time it takes to switch to the start page.
BUG=382795
Review URL: https://codereview.chromium.org/326023002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app_list/views/tile_item_view.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ui/app_list/views/tile_item_view.cc b/ui/app_list/views/tile_item_view.cc index c73f9e0..f587a0c 100644 --- a/ui/app_list/views/tile_item_view.cc +++ b/ui/app_list/views/tile_item_view.cc @@ -94,6 +94,10 @@ TileItemView::TileItemView() title_->SetFontList(rb.GetFontList(kItemTextFontStyle)); title_->SetHorizontalAlignment(gfx::ALIGN_CENTER); + // When |item_| is NULL, the tile is invisible. Calling SetAppListItem with a + // non-NULL item makes the tile visible. + SetVisible(false); + AddChildView(icon_); AddChildView(title_); } @@ -102,6 +106,12 @@ TileItemView::~TileItemView() { } void TileItemView::SetAppListItem(AppListItem* item) { + // TODO(calamity): This will not update if the contents of |item_| have + // changed since it was last assigned. Add an observer to refresh when the + // item changes. + if (item == item_) + return; + item_ = item; if (!item) { SetVisible(false); |