summaryrefslogtreecommitdiffstats
path: root/content/common/net
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 03:27:09 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 03:27:09 +0000
commitef2bf421b04de3134cd7c02aac40a5565ef24dd9 (patch)
tree5bf90cca0bd015c23e843614ebf2e9f99cb8cd99 /content/common/net
parent280e9b5d4b2fb0fe14824e526521710a658bce56 (diff)
downloadchromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.zip
chromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.tar.gz
chromium_src-ef2bf421b04de3134cd7c02aac40a5565ef24dd9.tar.bz2
Stop refcounting URLRequestContext.
While doing so, fix a few issues with the code like ordering of URLRequestContext to ensure correct destruction order. Also fix const correctness in some places. BUG=58859 TEST=none TBR=willchan Review URL: https://chromiumcodereview.appspot.com/10299002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/net')
-rw-r--r--content/common/net/url_fetcher_impl_unittest.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/content/common/net/url_fetcher_impl_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc
index ab4e870..33e6f34 100644
--- a/content/common/net/url_fetcher_impl_unittest.cc
+++ b/content/common/net/url_fetcher_impl_unittest.cc
@@ -59,13 +59,13 @@ class ThrottlingTestURLRequestContextGetter
}
virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE {
- return context_.get();
+ return context_;
}
protected:
virtual ~ThrottlingTestURLRequestContextGetter() {}
- scoped_refptr<TestURLRequestContext> context_;
+ TestURLRequestContext* const context_;
};
} // namespace
@@ -122,7 +122,7 @@ class URLFetcherTest : public testing::Test,
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
URLFetcherImpl* fetcher_;
- scoped_refptr<TestURLRequestContext> context_;
+ const scoped_ptr<TestURLRequestContext> context_;
};
void URLFetcherTest::CreateFetcher(const GURL& url) {
@@ -293,8 +293,8 @@ class CancelTestURLRequestContextGetter
throttle_for_url_(throttle_for_url) {
}
virtual TestURLRequestContext* GetURLRequestContext() OVERRIDE {
- if (!context_) {
- context_ = new CancelTestURLRequestContext();
+ if (!context_.get()) {
+ context_.reset(new CancelTestURLRequestContext());
DCHECK(context_->throttler_manager());
// Registers an entry for test url. The backoff time is calculated by:
@@ -310,7 +310,7 @@ class CancelTestURLRequestContextGetter
context_created_.Signal();
}
- return context_;
+ return context_.get();
}
virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
return io_message_loop_proxy_;
@@ -323,7 +323,7 @@ class CancelTestURLRequestContextGetter
virtual ~CancelTestURLRequestContextGetter() {}
private:
- scoped_refptr<ThrottlingTestURLRequestContext> context_;
+ scoped_ptr<TestURLRequestContext> context_;
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
base::WaitableEvent context_created_;
GURL throttle_for_url_;