summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 00:01:41 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 00:01:41 +0000
commit2a92cd9469247921bda75f3d5a00a67f7bfd78eb (patch)
treecc54fa4a3805a540398f0b23c4f3597ec99b58f5
parent032dea757076b465d613314736095ce82c542c1b (diff)
downloadchromium_src-2a92cd9469247921bda75f3d5a00a67f7bfd78eb.zip
chromium_src-2a92cd9469247921bda75f3d5a00a67f7bfd78eb.tar.gz
chromium_src-2a92cd9469247921bda75f3d5a00a67f7bfd78eb.tar.bz2
Make sure the "cancel leaked host resolver requests shutdown hack" gets run before the message loop is destroyed.
BUG=41966 Review URL: http://codereview.chromium.org/1798001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45644 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/io_thread.cc15
-rw-r--r--chrome/browser/io_thread.h9
-rw-r--r--chrome/test/data/reliability/known_crashes.txt3
3 files changed, 22 insertions, 5 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 887d470..28824b5 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -144,7 +144,7 @@ void IOThread::Init() {
globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory());
}
-void IOThread::CleanUpAfterMessageLoopDestruction() {
+void IOThread::CleanUp() {
// Not initialized in Init(). May not be initialized.
if (dns_master_) {
DCHECK(prefetch_observer_);
@@ -170,6 +170,10 @@ void IOThread::CleanUpAfterMessageLoopDestruction() {
globals_->host_resolver.get()->GetAsHostResolverImpl()->Shutdown();
}
+ // We will delete the NetLog as part of CleanUpAfterMessageLoopDestruction()
+ // in case any of the message loop destruction observers try to access it.
+ deferred_net_log_to_delete_.reset(globals_->net_log.release());
+
delete globals_;
globals_ = NULL;
@@ -186,6 +190,15 @@ void IOThread::CleanUpAfterMessageLoopDestruction() {
base::LeakTracker<URLFetcher>::CheckForLeaks();
base::LeakTracker<URLRequest>::CheckForLeaks();
+ BrowserProcessSubThread::CleanUp();
+}
+
+void IOThread::CleanUpAfterMessageLoopDestruction() {
+ // TODO(eroman): get rid of this special case for 39723. If we could instead
+ // have a method that runs after the message loop destruction obsevers have
+ // run, but before the message loop itself is destroyed, we could safely
+ // combine the two cleanups.
+ deferred_net_log_to_delete_.reset();
BrowserProcessSubThread::CleanUpAfterMessageLoopDestruction();
}
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 3860690..a2860ac 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -61,6 +61,7 @@ class IOThread : public BrowserProcessSubThread {
protected:
virtual void Init();
+ virtual void CleanUp();
virtual void CleanUpAfterMessageLoopDestruction();
private:
@@ -78,13 +79,19 @@ class IOThread : public BrowserProcessSubThread {
// These member variables are basically global, but their lifetimes are tied
// to the IOThread. IOThread owns them all, despite not using scoped_ptr.
// This is because the destructor of IOThread runs on the wrong thread. All
- // member variables should be deleted in CleanUp().
+ // member variables should be deleted in CleanUp(), except ChromeNetLog
+ // which is deleted later in CleanUpAfterMessageLoopDestruction().
// These member variables are initialized in Init() and do not change for the
// lifetime of the IO thread.
Globals* globals_;
+ // This variable is only meaningful during shutdown. It is used to defer
+ // deletion of the NetLog to CleanUpAfterMessageLoopDestruction() even
+ // though |globals_| is reset by CleanUp().
+ scoped_ptr<ChromeNetLog> deferred_net_log_to_delete_;
+
// These member variables are initialized by a task posted to the IO thread,
// which gets posted by calling certain member functions of IOThread.
diff --git a/chrome/test/data/reliability/known_crashes.txt b/chrome/test/data/reliability/known_crashes.txt
index 42a1c41..67cd333 100644
--- a/chrome/test/data/reliability/known_crashes.txt
+++ b/chrome/test/data/reliability/known_crashes.txt
@@ -174,6 +174,3 @@ wtf::hashtable<webcore::atomicstring,std::pair<webcore::atomicstring,webcore::st
# 39734
SUBSTRING :
v8::internal::setproperty___v8::internal::runtime::setobjectproperty___v8::internal::setproperty___v8::object::sethiddenvalue___webcore::v8domwindowshell::installhiddenobjectprototype
-
-# 41966. Guessing corruption, but it's shown up 4 out of the last 10 runs, so adding it so it doesn't cause us to ignore other errors.
-PREFIX : lockimpl::lock___messageloop::posttask_helper___messageloop::posttask___net::hostresolverimpl::job::dolookup___`anonymous namespace'::workitemcallback