diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 17:01:05 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-10 17:01:05 +0000 |
commit | 1e714bba378dfa5e732d5dfe7bb76a22481c9a74 (patch) | |
tree | 325ef56e12cbc62964d42756669fc672b13bc68d /net | |
parent | b69ffcfa3ae6aa0891e023adc94b8742bfaba7c3 (diff) | |
download | chromium_src-1e714bba378dfa5e732d5dfe7bb76a22481c9a74.zip chromium_src-1e714bba378dfa5e732d5dfe7bb76a22481c9a74.tar.gz chromium_src-1e714bba378dfa5e732d5dfe7bb76a22481c9a74.tar.bz2 |
Expose a way to assert there are no URLRequests left.
I plan to use this to assert to slowly flush out the leaks in tests
and then with the production code (testing with canary channel). I'll
start with the system request context and then move into the less popular
profile-owned request contexts, and then do the main one last.
BUG=90971
TEST=none
Review URL: http://codereview.chromium.org/10020021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/url_request/url_request_context.cc | 6 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc index 51a6dbf..45b6f29 100644 --- a/net/url_request/url_request_context.cc +++ b/net/url_request/url_request_context.cc @@ -65,7 +65,7 @@ const std::string& URLRequestContext::GetUserAgent(const GURL& url) const { return EmptyString(); } -URLRequestContext::~URLRequestContext() { +void URLRequestContext::AssertNoURLRequests() const { int num_requests = url_requests_->size(); if (num_requests != 0) { // We're leaking URLRequests :( Dump the URL of the first one and record how @@ -79,4 +79,8 @@ URLRequestContext::~URLRequestContext() { } } +URLRequestContext::~URLRequestContext() { + AssertNoURLRequests(); +} + } // namespace net diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 1bdb772..c46ae12 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -197,6 +197,8 @@ class NET_EXPORT URLRequestContext return url_requests_.get(); } + void AssertNoURLRequests() const; + protected: friend class base::RefCountedThreadSafe<URLRequestContext>; |