Release all DataSources before the main thread goes away.

BUG=70782
TEST=Valgrind no longer needs suppressions for AddDataSource

Review URL: http://codereview.chromium.org/6268014

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72638 0039d316-1c4b-4281-b951-d872f2087c98
parent 4176eee4
......@@ -255,6 +255,11 @@ void Shutdown() {
chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
}
#endif
// Clean up data sources before the UI thread is removed.
ChromeURLDataManager* data_manager = ChromeURLDataManager::GetInstance();
if (data_manager)
data_manager->RemoveAllDataSources();
}
void ReadLastShutdownFile(
......
......@@ -207,6 +207,15 @@ void ChromeURLDataManager::AddDataSource(scoped_refptr<DataSource> source) {
data_sources_[source->source_name()] = source;
}
void ChromeURLDataManager::RemoveAllDataSources() {
for (DataSourceMap::iterator i = data_sources_.begin();
i != data_sources_.end();
i = data_sources_.begin()) {
(*i).second = NULL; // Calls Release().
data_sources_.erase(i);
}
}
void ChromeURLDataManager::AddFileSource(const std::string& source_name,
const FilePath& file_path) {
DCHECK(file_sources_.count(source_name) == 0);
......
......@@ -115,6 +115,9 @@ class ChromeURLDataManager {
// InvokeLater.
void AddDataSource(scoped_refptr<DataSource> source);
// Called during shutdown, before destruction of |BrowserThread|.
void RemoveAllDataSources();
// Add/remove a path from the collection of file sources.
// A file source acts like a file:// URL to the specified path.
// Calling this from threads other the IO thread must be done via
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment