OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 DCHECK(factory); | 167 DCHECK(factory); |
168 } | 168 } |
169 | 169 |
170 ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {} | 170 ChromeURLRequestContextGetter::~ChromeURLRequestContextGetter() {} |
171 | 171 |
172 // Lazily create a ChromeURLRequestContext using our factory. | 172 // Lazily create a ChromeURLRequestContext using our factory. |
173 ChromeURLRequestContext* | 173 ChromeURLRequestContext* |
174 ChromeURLRequestContextGetter::GetURLRequestContext() { | 174 ChromeURLRequestContextGetter::GetURLRequestContext() { |
175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
176 | 176 |
177 if (!url_request_context_) { | 177 if (!url_request_context_.get()) { |
178 DCHECK(factory_.get()); | 178 DCHECK(factory_.get()); |
179 url_request_context_ = factory_->Create()->GetWeakPtr(); | 179 url_request_context_ = factory_->Create()->GetWeakPtr(); |
180 factory_.reset(); | 180 factory_.reset(); |
181 } | 181 } |
182 | 182 |
183 // Should not be NULL, unless we're trying to use the URLRequestContextGetter | 183 // Should not be NULL, unless we're trying to use the URLRequestContextGetter |
184 // after the Profile has already been deleted. | 184 // after the Profile has already been deleted. |
185 CHECK(url_request_context_.get()); | 185 CHECK(url_request_context_.get()); |
186 | 186 |
187 return url_request_context_.get(); | 187 return url_request_context_.get(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
310 if (load_time_stats_) | 310 if (load_time_stats_) |
311 load_time_stats_->UnregisterURLRequestContext(this); | 311 load_time_stats_->UnregisterURLRequestContext(this); |
312 } | 312 } |
313 | 313 |
314 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { | 314 void ChromeURLRequestContext::CopyFrom(ChromeURLRequestContext* other) { |
315 URLRequestContext::CopyFrom(other); | 315 URLRequestContext::CopyFrom(other); |
316 | 316 |
317 // Copy ChromeURLRequestContext parameters. | 317 // Copy ChromeURLRequestContext parameters. |
318 } | 318 } |
OLD | NEW |