summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 17:34:19 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 17:34:19 +0000
commitf186c22c2f7d8ffed329d117cf18f533c89e3ff2 (patch)
tree2a9da7f30f5315a2d5d9ab485a4740b83eb6c5bc /chrome
parent289bd7f080fd876063b675e7958910c005db850b (diff)
downloadchromium_src-f186c22c2f7d8ffed329d117cf18f533c89e3ff2.zip
chromium_src-f186c22c2f7d8ffed329d117cf18f533c89e3ff2.tar.gz
chromium_src-f186c22c2f7d8ffed329d117cf18f533c89e3ff2.tar.bz2
Fix unit test memory leak introduced by my ChromeThread change.
BUG=26213 Review URL: http://codereview.chromium.org/346014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/most_visited_handler.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 0142c18..7aa82f8 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -56,16 +56,26 @@ DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) {
pinned_urls_ = dom_ui->GetProfile()->GetPrefs()->
GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs);
// Set up our sources for thumbnail and favicon data.
- ChromeThread::PostTask(
+ DOMUIThumbnailSource* thumbnail_src =
+ new DOMUIThumbnailSource(dom_ui->GetProfile());
+ bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- new DOMUIThumbnailSource(dom_ui->GetProfile())));
- ChromeThread::PostTask(
+ &ChromeURLDataManager::AddDataSource, thumbnail_src));
+ if (!posted) {
+ thumbnail_src->AddRef();
+ thumbnail_src->Release(); // Keep Valgrind happy in unit tests.
+ }
+
+ DOMUIFavIconSource* favicon_src = new DOMUIFavIconSource(dom_ui->GetProfile());
+ posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- new DOMUIFavIconSource(dom_ui->GetProfile())));
+ &ChromeURLDataManager::AddDataSource, favicon_src));
+ if (!posted) {
+ favicon_src->AddRef();
+ favicon_src->Release(); // Keep Valgrind happy in unit tests.
+ }
// Get notifications when history is cleared.
registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,