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

Unified Diff: net/url_request/url_request_test_util.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
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_test_util.cc
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc
index 7a1bc7ff276a0004a9a6e708c1c99504d3d32e7c..b81996c25bf6cf738213a6f3b1e95c8c0300db69 100644
--- a/net/url_request/url_request_test_util.cc
+++ b/net/url_request/url_request_test_util.cc
@@ -162,11 +162,14 @@ void TestURLRequestContext::Init() {
TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate)
- : net::URLRequest(url, delegate) {
- set_context(new TestURLRequestContext());
+ : net::URLRequest(url, delegate),
+ context_(new TestURLRequestContext) {
+ set_context(context_.get());
}
-TestURLRequest::~TestURLRequest() {}
+TestURLRequest::~TestURLRequest() {
+ set_context(NULL);
+}
TestURLRequestContextGetter::TestURLRequestContextGetter(
const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy)
@@ -177,8 +180,8 @@ TestURLRequestContextGetter::TestURLRequestContextGetter(
TestURLRequestContextGetter::~TestURLRequestContextGetter() {}
TestURLRequestContext* TestURLRequestContextGetter::GetURLRequestContext() {
- if (!context_)
- context_ = new TestURLRequestContext();
+ if (!context_.get())
+ context_.reset(new TestURLRequestContext);
return context_.get();
}
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698