summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:38:54 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 21:38:54 +0000
commit48ca901238509dd4c5f7bb30c66ef36f5dafc828 (patch)
tree34a2d3976009fd351aa91e9257dd6522907928dd /net
parent51e9e931b1d9c36605c6336a3002fda22f023b36 (diff)
downloadchromium_src-48ca901238509dd4c5f7bb30c66ef36f5dafc828.zip
chromium_src-48ca901238509dd4c5f7bb30c66ef36f5dafc828.tar.gz
chromium_src-48ca901238509dd4c5f7bb30c66ef36f5dafc828.tar.bz2
Add checks to DEBUG mode that no instance of URLRequest or URLFetcher survives the destruction of the IO thread.
This checking is done by introducing a new helper class to base called LeakTracker. Classes that you want to check for leaks just need to extend LeakTracker. The reason I am picking on URLFetcher / URLRequest, is I believe we have a bug that is making an instance of URLFetcher to outlive the IO thread. This causes various sorts of badness. For example: If URLFetcher survives the IO thread, then URLRequestContext remains referenced and therefore also survives IO thread. In turn HostResolverImpl survives the IO thread, so any outstanding resolve requests are NOT cancelled before the IO thread is decomissioned. So now, when the worker thread doing the DNS resolve finally finishes (assuming it finishes before the rogue URLRequest is destroyed), it post the result to a defunct message loop. KAB00m! (http://crbug.com/15513) Moreover, I believe we hit this same problem sporadically in AutomationProxyTest.AutocompleteGetSetText -- the test is flaky on the buildbots, and I've seen DCHECKs which suggest it is related to this issue. BUG=http://crbug.com/18372 Review URL: http://codereview.chromium.org/160447 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/url_request/url_request.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index e9539cb..5a97fc6 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/leak_tracker.h"
#include "base/linked_ptr.h"
#include "base/logging.h"
#include "base/ref_counted.h"
@@ -592,6 +593,8 @@ class URLRequest {
// this to determine which URLRequest to allocate sockets to first.
int priority_;
+ base::LeakTracker<URLRequest> leak_tracker_;
+
DISALLOW_COPY_AND_ASSIGN(URLRequest);
};