summaryrefslogtreecommitdiffstats
path: root/chrome/browser/custom_home_pages_table_model.cc
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 20:59:12 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 20:59:12 +0000
commit122b468219ee9368a185609e37f67858dbbc761b (patch)
treec5508b9d4054739a76f50aab81242ee984886938 /chrome/browser/custom_home_pages_table_model.cc
parent9658b007bee63a6602e2f38934a641481401b56c (diff)
downloadchromium_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/browser/custom_home_pages_table_model.cc')
-rw-r--r--chrome/browser/custom_home_pages_table_model.cc20
1 files changed, 5 insertions, 15 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);