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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 12328072: Remove some calls to URLRequestContext::network_delegate(). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make network_delegate_ a protected member of URLRequestJob. Created 7 years, 10 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: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 8dc1507b1f9f3bb64f95b8a4de6a89ee8b4a404d..2306ac2b1d94ff81593eea53f17eb78d6735fa8d 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -80,9 +80,10 @@ class URLRequestHttpJob::HttpFilterContext : public FilterContext {
class URLRequestHttpJob::HttpTransactionDelegateImpl
: public HttpTransactionDelegate {
public:
- explicit HttpTransactionDelegateImpl(URLRequest* request)
+ explicit HttpTransactionDelegateImpl(
mmenke 2013/03/07 15:45:39 nit: Explicit no longer needed.
+ URLRequest* request, NetworkDelegate* network_delegate)
: request_(request),
- network_delegate_(request->context()->network_delegate()),
+ network_delegate_(network_delegate),
cache_active_(false),
network_active_(false) {
}
@@ -257,7 +258,8 @@ URLRequestHttpJob::URLRequestHttpJob(
base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback,
base::Unretained(this)))),
awaiting_callback_(false),
- http_transaction_delegate_(new HttpTransactionDelegateImpl(request)),
+ http_transaction_delegate_(new HttpTransactionDelegateImpl(
+ request, network_delegate)),
http_user_agent_settings_(http_user_agent_settings) {
URLRequestThrottlerManager* manager = request->context()->throttler_manager();
if (manager)
@@ -335,8 +337,8 @@ void URLRequestHttpJob::DestroyTransaction() {
}
void URLRequestHttpJob::StartTransaction() {
- if (request_->context()->network_delegate()) {
- int rv = request_->context()->network_delegate()->NotifyBeforeSendHeaders(
+ if (network_delegate_) {
+ int rv = network_delegate_->NotifyBeforeSendHeaders(
request_, notify_before_headers_sent_callback_,
&request_info_.extra_headers);
// If an extension blocks the request, we rely on the callback to
@@ -380,10 +382,8 @@ void URLRequestHttpJob::StartTransactionInternal() {
int rv;
- if (request_->context()->network_delegate()) {
- request_->context()->network_delegate()->NotifySendHeaders(
- request_, request_info_.extra_headers);
- }
+ if (network_delegate_)
+ network_delegate_->NotifySendHeaders(request_, request_info_.extra_headers);
if (transaction_.get()) {
rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_);
@@ -762,13 +762,13 @@ void URLRequestHttpJob::OnStartCompleted(int result) {
if (result == OK) {
scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders();
- if (context->network_delegate()) {
+ if (network_delegate_) {
// Note that |this| may not be deleted until
// |on_headers_received_callback_| or
// |NetworkDelegate::URLRequestDestroyed()| has been called.
- int error = context->network_delegate()->
- NotifyHeadersReceived(request_, on_headers_received_callback_,
- headers, &override_response_headers_);
+ int error = network_delegate_->NotifyHeadersReceived(
+ request_, on_headers_received_callback_,
+ headers, &override_response_headers_);
if (error != net::OK) {
if (error == net::ERR_IO_PENDING) {
awaiting_callback_ = true;

Powered by Google App Engine
This is Rietveld 408576698