diff options
author | jgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 00:27:40 +0000 |
---|---|---|
committer | jgraettinger@chromium.org <jgraettinger@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-22 00:27:40 +0000 |
commit | 4245594927b83e0a97be5f34a5a1f5675c20c9b2 (patch) | |
tree | e6815c582bfc73430998127dbe82fc13e13aab13 /net/url_request | |
parent | 571a6711562cd1a8cbe1ba00f435aa227a012c3e (diff) | |
download | chromium_src-4245594927b83e0a97be5f34a5a1f5675c20c9b2.zip chromium_src-4245594927b83e0a97be5f34a5a1f5675c20c9b2.tar.gz chromium_src-4245594927b83e0a97be5f34a5a1f5675c20c9b2.tar.bz2 |
Add AssertNoURLRequests() to URLRequestContext subclass destructors.
BUG=377852
Review URL: https://codereview.chromium.org/379293002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_context.h | 3 | ||||
-rw-r--r-- | net/url_request/url_request_context_builder.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_test_util.cc | 1 | ||||
-rw-r--r-- | net/url_request/view_cache_helper_unittest.cc | 5 |
4 files changed, 11 insertions, 2 deletions
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 4242d72..fe4213a 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -199,6 +199,9 @@ class NET_EXPORT URLRequestContext return url_requests_.get(); } + // CHECKs that no URLRequests using this context remain. Subclasses should + // additionally call AssertNoURLRequests() within their own destructor, + // prior to implicit destruction of subclass-owned state. void AssertNoURLRequests() const; // Get the underlying |HttpUserAgentSettings| implementation that provides diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index b58a0da..0435159 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -165,7 +165,9 @@ class BasicURLRequestContext : public URLRequestContext { } protected: - virtual ~BasicURLRequestContext() {} + virtual ~BasicURLRequestContext() { + AssertNoURLRequests(); + } private: // Threads should be torn down last. diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index e4a7edd..d61b3c3 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc @@ -61,6 +61,7 @@ TestURLRequestContext::TestURLRequestContext(bool delay_initialization) TestURLRequestContext::~TestURLRequestContext() { DCHECK(initialized_); + AssertNoURLRequests(); } void TestURLRequestContext::Init() { diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc index 70bf201..31ad0ba 100644 --- a/net/url_request/view_cache_helper_unittest.cc +++ b/net/url_request/view_cache_helper_unittest.cc @@ -20,7 +20,10 @@ namespace { class TestURLRequestContext : public URLRequestContext { public: TestURLRequestContext(); - virtual ~TestURLRequestContext() {} + + virtual ~TestURLRequestContext() { + AssertNoURLRequests(); + } // Gets a pointer to the cache backend. disk_cache::Backend* GetBackend(); |