Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: content/common/net/url_fetcher_impl_unittest.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/net/url_fetcher_impl_unittest.cc
diff --git a/content/common/net/url_fetcher_impl_unittest.cc b/content/common/net/url_fetcher_impl_unittest.cc
index ab4e87098151566ec0ae65e88dc31806c2a1cac6..33e6f34e403e53ad172f5f095497868f20cca115 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_;
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_unittest.cc ('k') | content/shell/shell_url_request_context_getter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698