diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-06 02:27:18 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-06 02:27:18 +0000 |
commit | 13ed17f87ebf33664331a0e56fefddbeb833891a (patch) | |
tree | 560115ee0ad43ec4dd78b175894d6ca8e9374400 /content | |
parent | 1f305b559be7437fbb6d6ca0ea31897a1013e466 (diff) | |
download | chromium_src-13ed17f87ebf33664331a0e56fefddbeb833891a.zip chromium_src-13ed17f87ebf33664331a0e56fefddbeb833891a.tar.gz chromium_src-13ed17f87ebf33664331a0e56fefddbeb833891a.tar.bz2 |
All classes that directly derive from net::URLRequestContextGetter should have "protected"
virtual destructors, not "public".
By having a public destructor, it becomes possible to stack
allocate the derived class. Stack allocating a RCTS is a
dangerous behaviour, since there may still be a caller who
holds a reference when the object goes out of scope.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/9958145
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131072 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/common/net/url_fetcher_impl_unittest.cc | 5 | ||||
-rw-r--r-- | content/shell/shell_url_request_context_getter.h | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/content/common/net/url_fetcher_impl_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc index c00e561..ac5efa9 100644 --- a/content/common/net/url_fetcher_impl_unittest.cc +++ b/content/common/net/url_fetcher_impl_unittest.cc @@ -257,9 +257,10 @@ class CancelTestURLRequestContextGetter : public net::URLRequestContextGetter { context_created_.Wait(); } - private: - ~CancelTestURLRequestContextGetter() {} + protected: + virtual ~CancelTestURLRequestContextGetter() {} + private: scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; base::WaitableEvent context_created_; scoped_refptr<net::URLRequestContext> context_; diff --git a/content/shell/shell_url_request_context_getter.h b/content/shell/shell_url_request_context_getter.h index 9f70dc6..4de8bb8 100644 --- a/content/shell/shell_url_request_context_getter.h +++ b/content/shell/shell_url_request_context_getter.h @@ -29,7 +29,6 @@ class ShellURLRequestContextGetter : public net::URLRequestContextGetter { const FilePath& base_path, MessageLoop* io_loop, MessageLoop* file_loop); - virtual ~ShellURLRequestContextGetter(); // net::URLRequestContextGetter implementation. virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; @@ -38,6 +37,9 @@ class ShellURLRequestContextGetter : public net::URLRequestContextGetter { net::HostResolver* host_resolver(); + protected: + virtual ~ShellURLRequestContextGetter(); + private: FilePath base_path_; MessageLoop* io_loop_; |