From 13e4f3427f8b0f458cfedd9512785d8e44e5b16c Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Sat, 14 Jun 2014 07:19:43 +0000 Subject: Revert 277160 "Make SdchManager per-profile." On LSan, SdchManagerTest.CanUseMultipleDictionaries fails (leaks): http://build.chromium.org/p/chromium.memory/builders/Linux%20ASan%20LSan%20Tests%20%281%29/builds/3073/steps/net_unittests/logs/stdio E.g.: Indirect leak of 34 byte(s) in 1 object(s) allocated from: #0 0x512b7b in operator new(unsigned long) /usr/local/google/work/chromium/src/third_party/llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:55 #1 0x7f4730122739 in __gnu_cxx::new_allocator::allocate(unsigned long, void const*) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/ext/new_allocator.h:92 #2 0x7f4730121d2c in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator const&) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:609 #3 0x7f4730121f04 in std::string::_Rep::_M_clone(std::allocator const&, unsigned long) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:631 #4 0x7f473011ec48 in std::string::reserve(unsigned long) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:512 #5 0x7f473011f391 in std::string::append(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:290 #6 0x7f473011eaeb in std::string::resize(unsigned long, char) /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:647 #7 0x31d6642 in resize /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_string.h:749 #8 0x31d6642 in base::Base64Encode(base::BasicStringPiece const&, std::string*) base/base64.cc:13 #9 0x34a1d05 in net::SdchManager::UrlSafeBase64Encode(std::string const&, std::string*) net/base/sdch_manager.cc:541 #10 0x34a1124 in net::SdchManager::GenerateHash(std::string const&, std::string*, std::string*) net/base/sdch_manager.cc:508 #11 0x349facb in net::SdchManager::AddSdchDictionary(std::string const&, GURL const&) net/base/sdch_manager.cc:363 #12 0x803e06 in net::SdchManagerTest_CanUseMultipleDictionaries_Test::TestBody() net/base/sdch_manager_unittest.cc:403 [...] > Make SdchManager per-profile. > > This will both allow SDCH dictionaries to be cached (as they can use the > cache associated with the profile) and will provide privacy protection > between different profiles (the existing of a dictionary in one profile > will not be leaked to another profile). > > BUG=374914 > R=jar@chromium.org > > Review URL: https://codereview.chromium.org/298063006 TBR=rdsmith@chromium.org Review URL: https://codereview.chromium.org/331023002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277185 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser_process_impl.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'chrome/browser/browser_process_impl.cc') diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index eac76f2..01e0d30 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -49,6 +49,7 @@ #include "chrome/browser/metrics/thread_watcher.h" #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/net/crl_set_fetcher.h" +#include "chrome/browser/net/sdch_dictionary_fetcher.h" #include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/plugins/chrome_plugin_service_filter.h" #include "chrome/browser/plugins/plugin_finder.h" @@ -217,6 +218,13 @@ BrowserProcessImpl::~BrowserProcessImpl() { void BrowserProcessImpl::StartTearDown() { TRACE_EVENT0("shutdown", "BrowserProcessImpl::StartTearDown"); + // We need to shutdown the SdchDictionaryFetcher as it regularly holds + // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do + // a PostDelayedTask onto the IO thread. This shutdown call will both discard + // any pending URLFetchers, and avoid creating any more. + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(&SdchDictionaryFetcher::Shutdown)); + // We need to destroy the MetricsServicesManager, IntranetRedirectDetector, // PromoResourceService, and SafeBrowsing ClientSideDetectionService (owned by // the SafeBrowsingService) before the io_thread_ gets destroyed, since their -- cgit v1.1