summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 06:48:44 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-26 06:48:44 +0000
commitd98261678787d9f149316e3049b56b278f6c5c8c (patch)
treee88a135bdfc438c2e2e6cb5b99fc56485c05a9ce /chrome/browser/io_thread.h
parent5fc549f0469b301169a17a28b725c8ea20d80673 (diff)
downloadchromium_src-d98261678787d9f149316e3049b56b278f6c5c8c.zip
chromium_src-d98261678787d9f149316e3049b56b278f6c5c8c.tar.gz
chromium_src-d98261678787d9f149316e3049b56b278f6c5c8c.tar.bz2
Make Profile own ProfileIOData.
Notably this makes ChromeURLRequestContextGetter not own its ChromeURLRequestContext, and instead it keeps a base::WeakPtr. If anything is holding onto a ChromeURLRequestContextGetter longer than it should, and tries to use it, then it will crash. Currently no tests fail with this assumption, so hopefully this will prevent regressions. All ChromeURLRequestContextGetters should not outlive the Profile to which they belong. Note that this will cause problems if there are any URLRequests which outlive the Profile to which they belong, as they will reference URLRequestContexts which point to deleted memory. AFAICT this never happens, and I will enforce this later on by making URLRequests acquire weak pointers to URLRequestContexts. After that, I can stop refcounting URLRequestContext. I'm hopeful this changelist will fix a large number of leaks in browser_tests. Removing the refcounting of ProfileIOData will bring sanity to the lifecycle management of ProfileIOData and a large number of objects it owns. I've used base::WeakPtr in a number of places in order to prevent use-after-free bugs and force them to be NULL dereferences (crashes). In previous changelists, I've flushed out bugs revealed by this behavior. So currently, this changelist is clean on the trybots, although it's possible new code paths will be discovered via crash reports. Next steps: * URLRequests use base::WeakPtr<URLRequestContext> * Fix all other URLRequestContextGetters not to acquire references to URLRequestContext. * Stop refcounting URLRequestContext. BUG=none TEST=none Review URL: http://codereview.chromium.org/7432002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94047 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.h')
-rw-r--r--chrome/browser/io_thread.h21
1 files changed, 0 insertions, 21 deletions
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 6bdd01b..779f4d4 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_IO_THREAD_H_
#pragma once
-#include <list>
#include <string>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
@@ -117,21 +116,6 @@ class IOThread : public BrowserProcessSubThread {
base::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, discarding confidential data.
void ChangedToOnTheRecord();
@@ -234,11 +218,6 @@ class IOThread : public BrowserProcessSubThread {
scoped_refptr<net::URLRequestContextGetter>
system_url_request_context_getter_;
- // Keeps track of all live ChromeURLRequestContextGetters, so the
- // ChromeURLRequestContexts can be released during
- // IOThread::CleanUp().
- std::list<ChromeURLRequestContextGetter*> url_request_context_getters_;
-
ScopedRunnableMethodFactory<IOThread> method_factory_;
DISALLOW_COPY_AND_ASSIGN(IOThread);