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

Unified Diff: net/url_request/url_request_job.cc

Issue 10534100: Decouple URLRequestJob from URLRequestContext; access NetworkDelegate as a contructor parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest sync Created 8 years, 6 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_job.h ('k') | net/url_request/url_request_job_factory_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_job.cc
diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc
index 255e90d42be55efd95f285f5acc8d3e5c94af572..91dc5ba9a905bce5e03dd1d8aa7b50862736ad21 100644
--- a/net/url_request/url_request_job.cc
+++ b/net/url_request/url_request_job.cc
@@ -17,11 +17,11 @@
#include "net/base/network_delegate.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_context.h"
namespace net {
-URLRequestJob::URLRequestJob(URLRequest* request)
+URLRequestJob::URLRequestJob(URLRequest* request,
+ NetworkDelegate* network_delegate)
: request_(request),
done_(false),
prefilter_bytes_read_(0),
@@ -32,6 +32,7 @@ URLRequestJob::URLRequestJob(URLRequest* request)
has_handled_response_(false),
expected_content_size_(-1),
deferred_redirect_status_code_(-1),
+ network_delegate_(network_delegate),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
base::SystemMonitor* system_monitor = base::SystemMonitor::Get();
if (system_monitor)
@@ -692,9 +693,8 @@ void URLRequestJob::RecordBytesRead(int bytes_read) {
<< " pre total = " << prefilter_bytes_read_
<< " post total = " << postfilter_bytes_read_;
UpdatePacketReadTimes(); // Facilitate stats recording if it is active.
- const URLRequestContext* context = request_->context();
- if (context && context->network_delegate())
- context->network_delegate()->NotifyRawBytesRead(*request_, bytes_read);
+ if (network_delegate_)
+ network_delegate_->NotifyRawBytesRead(*request_, bytes_read);
}
bool URLRequestJob::FilterHasData() {
« no previous file with comments | « net/url_request/url_request_job.h ('k') | net/url_request/url_request_job_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698