summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_process_sub_thread.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-17 19:26:58 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-17 19:26:58 +0000
commitaf6699372a232fce9d6f8484d64d128150392f66 (patch)
tree159fb9e8f4c9449da9e8293f52fbd00f2a2b8019 /content/browser/browser_process_sub_thread.cc
parentb52a3f33699d38c121e59b4f01338e4c8e592f02 (diff)
downloadchromium_src-af6699372a232fce9d6f8484d64d128150392f66.zip
chromium_src-af6699372a232fce9d6f8484d64d128150392f66.tar.gz
chromium_src-af6699372a232fce9d6f8484d64d128150392f66.tar.bz2
Move cleanup that happens on IO thread destruction to content, so that not every embedder has to know to do it. This also allows us to hide some of these functions from embedders.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9221008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_process_sub_thread.cc')
-rw-r--r--content/browser/browser_process_sub_thread.cc37
1 files changed, 34 insertions, 3 deletions
diff --git a/content/browser/browser_process_sub_thread.cc b/content/browser/browser_process_sub_thread.cc
index 08fd712..35566f0 100644
--- a/content/browser/browser_process_sub_thread.cc
+++ b/content/browser/browser_process_sub_thread.cc
@@ -4,13 +4,18 @@
#include "content/browser/browser_process_sub_thread.h"
-#include "build/build_config.h"
-#include "content/browser/notification_service_impl.h"
-
#if defined(OS_WIN)
#include <Objbase.h>
#endif
+#include "base/debug/leak_tracker.h"
+#include "build/build_config.h"
+#include "content/browser/browser_child_process_host.h"
+#include "content/browser/in_process_webkit/indexed_db_key_utility_client.h"
+#include "content/browser/notification_service_impl.h"
+#include "content/public/common/url_fetcher.h"
+#include "net/url_request/url_request.h"
+
namespace content {
BrowserProcessSubThread::BrowserProcessSubThread(BrowserThread::ID identifier)
@@ -34,8 +39,14 @@ void BrowserProcessSubThread::Init() {
}
void BrowserProcessSubThread::CleanUp() {
+ if (BrowserThread::CurrentlyOn(BrowserThread::IO))
+ IOThreadPreCleanUp();
+
BrowserThreadImpl::CleanUp();
+ if (BrowserThread::CurrentlyOn(BrowserThread::IO))
+ IOThreadPostCleanUp();
+
delete notification_service_;
notification_service_ = NULL;
@@ -46,4 +57,24 @@ void BrowserProcessSubThread::CleanUp() {
#endif
}
+void BrowserProcessSubThread::IOThreadPreCleanUp() {
+ // Kill all things that might be holding onto
+ // net::URLRequest/net::URLRequestContexts.
+
+ // Destroy all URLRequests started by URLFetchers.
+ content::URLFetcher::CancelAll();
+
+ IndexedDBKeyUtilityClient::Shutdown();
+
+ // If any child processes are still running, terminate them and
+ // and delete the BrowserChildProcessHost instances to release whatever
+ // IO thread only resources they are referencing.
+ BrowserChildProcessHost::TerminateAll();
+}
+
+void BrowserProcessSubThread::IOThreadPostCleanUp() {
+ // net::URLRequest instances must NOT outlive the IO thread.
+ base::debug::LeakTracker<net::URLRequest>::CheckForLeaks();
+}
+
} // namespace content