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

Unified Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 348003: Fix memory leaks in unit tests from my previous checkin. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/new_tab_ui.cc
===================================================================
--- chrome/browser/dom_ui/new_tab_ui.cc (revision 30401)
+++ chrome/browser/dom_ui/new_tab_ui.cc (working copy)
@@ -572,12 +572,14 @@
InitializeCSSCaches();
NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile());
- ChromeThread::PostTask(
+ bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
html_source));
+ if (!posted)
+ delete html_source; // Keep Valgrind happy in tests.
}
// Listen for theme installation.
@@ -614,12 +616,15 @@
}
void NewTabUI::InitializeCSSCaches() {
- ChromeThread::PostTask(
+ DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile());
+ bool posted = ChromeThread::PostTask(
ChromeThread::IO, FROM_HERE,
NewRunnableMethod(
&chrome_url_data_manager,
&ChromeURLDataManager::AddDataSource,
- new DOMUIThemeSource(GetProfile())));
+ theme));
+ if (!posted)
+ delete theme; // Keep Valgrind happy in tests.
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698