From 0ee7a3bc23a95b316f82b3f558a0d74f5067dae9 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Tue, 9 Nov 2010 06:13:40 +0000 Subject: Reland r63578 - Release ChromeURLRequestContextGetters' references on IO thread shutdown." Should be safe to reland after r65479. BUG=58859 TEST=none Review URL: http://codereview.chromium.org/4672005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65504 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/io_thread.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'chrome/browser/io_thread.h') diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 09f4df4..99cb281 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_IO_THREAD_H_ #pragma once +#include #include - #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" @@ -17,6 +17,7 @@ #include "net/base/network_change_notifier.h" class ChromeNetLog; +class ChromeURLRequestContextGetter; class ListValue; class URLRequestContext; @@ -66,6 +67,21 @@ class IOThread : public BrowserProcessSubThread { ListValue* referral_list, bool preconnect_enabled); + // Registers |url_request_context_getter| into the IO thread. During + // IOThread::CleanUp(), IOThread will iterate through known getters and + // release their URLRequestContexts. Only called on the IO thread. It does + // not acquire a refcount for |url_request_context_getter|. If + // |url_request_context_getter| is being deleted before IOThread::CleanUp() is + // invoked, then this needs to be balanced with a call to + // UnregisterURLRequestContextGetter(). + void RegisterURLRequestContextGetter( + ChromeURLRequestContextGetter* url_request_context_getter); + + // Unregisters |url_request_context_getter| from the IO thread. Only called + // on the IO thread. + void UnregisterURLRequestContextGetter( + ChromeURLRequestContextGetter* url_request_context_getter); + // Handles changing to On The Record mode. Posts a task for this onto the // IOThread's message loop. void ChangedToOnTheRecord(); @@ -131,6 +147,11 @@ class IOThread : public BrowserProcessSubThread { // List of live ProxyScriptFetchers. ProxyScriptFetchers fetchers_; + // Keeps track of all live ChromeURLRequestContextGetters, so the + // ChromeURLRequestContexts can be released during + // IOThread::CleanUpAfterMessageLoopDestruction(). + std::list url_request_context_getters_; + DISALLOW_COPY_AND_ASSIGN(IOThread); }; -- cgit v1.1