diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 20:59:12 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 20:59:12 +0000 |
commit | 122b468219ee9368a185609e37f67858dbbc761b (patch) | |
tree | c5508b9d4054739a76f50aab81242ee984886938 /chrome | |
parent | 9658b007bee63a6602e2f38934a641481401b56c (diff) | |
download | chromium_src-122b468219ee9368a185609e37f67858dbbc761b.zip chromium_src-122b468219ee9368a185609e37f67858dbbc761b.tar.gz chromium_src-122b468219ee9368a185609e37f67858dbbc761b.tar.bz2 |
Remove static caching of default favicon in CustomHomePagesTableModel
This fixes an assertion failure when trying to use this class on the Mac due to SkBitmap destruction happening during process exit handling.
BUG=None
TEST=Custom startup page list should still show default favicons.
Review URL: http://codereview.chromium.org/3028030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/custom_home_pages_table_model.cc | 20 | ||||
-rw-r--r-- | chrome/browser/custom_home_pages_table_model.h | 4 |
2 files changed, 6 insertions, 18 deletions
diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index 446aea5..6095afe 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -19,13 +19,12 @@ #include "grit/generated_resources.h" #include "net/base/net_util.h" -// static -SkBitmap CustomHomePagesTableModel::default_favicon_; - CustomHomePagesTableModel::CustomHomePagesTableModel(Profile* profile) - : profile_(profile), + : default_favicon_(NULL), + profile_(profile), observer_(NULL) { - InitClass(); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + default_favicon_ = rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); } void CustomHomePagesTableModel::SetURLs(const std::vector<GURL>& urls) { @@ -109,7 +108,7 @@ std::wstring CustomHomePagesTableModel::GetText(int row, int column_id) { SkBitmap CustomHomePagesTableModel::GetIcon(int row) { DCHECK(row >= 0 && row < RowCount()); - return entries_[row].icon.isNull() ? default_favicon_ : entries_[row].icon; + return entries_[row].icon.isNull() ? *default_favicon_ : entries_[row].icon; } std::wstring CustomHomePagesTableModel::GetTooltip(int row) { @@ -122,15 +121,6 @@ void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) { observer_ = observer; } -void CustomHomePagesTableModel::InitClass() { - static bool initialized = false; - if (!initialized) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); - initialized = true; - } -} - void CustomHomePagesTableModel::LoadTitleAndFavIcon(Entry* entry) { HistoryService* history_service = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); diff --git a/chrome/browser/custom_home_pages_table_model.h b/chrome/browser/custom_home_pages_table_model.h index 0b095e4..639d480 100644 --- a/chrome/browser/custom_home_pages_table_model.h +++ b/chrome/browser/custom_home_pages_table_model.h @@ -71,8 +71,6 @@ class CustomHomePagesTableModel : public TableModel { FaviconService::Handle fav_icon_handle; }; - static void InitClass(); - // Loads the title and favicon for the specified entry. void LoadTitleAndFavIcon(Entry* entry); @@ -109,7 +107,7 @@ class CustomHomePagesTableModel : public TableModel { std::vector<Entry> entries_; // Default icon to show when one can't be found for the URL. - static SkBitmap default_favicon_; + SkBitmap* default_favicon_; // Profile used to load titles and icons. Profile* profile_; |