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

Side by Side Diff: net/url_request/url_request.cc

Issue 10825073: Stop using ScopedAllowIO in content::ResourceDispatcherHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove const Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 network_delegate_(context->network_delegate()), 142 network_delegate_(context->network_delegate()),
143 net_log_(BoundNetLog::Make(context->net_log(), 143 net_log_(BoundNetLog::Make(context->net_log(),
144 NetLog::SOURCE_URL_REQUEST)), 144 NetLog::SOURCE_URL_REQUEST)),
145 url_chain_(1, url), 145 url_chain_(1, url),
146 method_("GET"), 146 method_("GET"),
147 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 147 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
148 load_flags_(LOAD_NORMAL), 148 load_flags_(LOAD_NORMAL),
149 delegate_(delegate), 149 delegate_(delegate),
150 is_pending_(false), 150 is_pending_(false),
151 redirect_limit_(kMaxRedirects), 151 redirect_limit_(kMaxRedirects),
152 final_upload_progress_(0),
153 priority_(LOWEST), 152 priority_(LOWEST),
154 identifier_(GenerateURLRequestIdentifier()), 153 identifier_(GenerateURLRequestIdentifier()),
155 blocked_on_delegate_(false), 154 blocked_on_delegate_(false),
156 ALLOW_THIS_IN_INITIALIZER_LIST(before_request_callback_( 155 ALLOW_THIS_IN_INITIALIZER_LIST(before_request_callback_(
157 base::Bind(&URLRequest::BeforeRequestComplete, 156 base::Bind(&URLRequest::BeforeRequestComplete,
158 base::Unretained(this)))), 157 base::Unretained(this)))),
159 has_notified_completion_(false), 158 has_notified_completion_(false),
160 creation_time_(base::TimeTicks::Now()) { 159 creation_time_(base::TimeTicks::Now()) {
161 SIMPLE_STATS_COUNTER("URLRequestCount"); 160 SIMPLE_STATS_COUNTER("URLRequestCount");
162 161
(...skipping 17 matching lines...) Expand all
180 network_delegate_(network_delegate), 179 network_delegate_(network_delegate),
181 net_log_(BoundNetLog::Make(context->net_log(), 180 net_log_(BoundNetLog::Make(context->net_log(),
182 NetLog::SOURCE_URL_REQUEST)), 181 NetLog::SOURCE_URL_REQUEST)),
183 url_chain_(1, url), 182 url_chain_(1, url),
184 method_("GET"), 183 method_("GET"),
185 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE), 184 referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
186 load_flags_(LOAD_NORMAL), 185 load_flags_(LOAD_NORMAL),
187 delegate_(delegate), 186 delegate_(delegate),
188 is_pending_(false), 187 is_pending_(false),
189 redirect_limit_(kMaxRedirects), 188 redirect_limit_(kMaxRedirects),
190 final_upload_progress_(0),
191 priority_(LOWEST), 189 priority_(LOWEST),
192 identifier_(GenerateURLRequestIdentifier()), 190 identifier_(GenerateURLRequestIdentifier()),
193 blocked_on_delegate_(false), 191 blocked_on_delegate_(false),
194 ALLOW_THIS_IN_INITIALIZER_LIST(before_request_callback_( 192 ALLOW_THIS_IN_INITIALIZER_LIST(before_request_callback_(
195 base::Bind(&URLRequest::BeforeRequestComplete, 193 base::Bind(&URLRequest::BeforeRequestComplete,
196 base::Unretained(this)))), 194 base::Unretained(this)))),
197 has_notified_completion_(false), 195 has_notified_completion_(false),
198 creation_time_(base::TimeTicks::Now()) { 196 creation_time_(base::TimeTicks::Now()) {
199 SIMPLE_STATS_COUNTER("URLRequestCount"); 197 SIMPLE_STATS_COUNTER("URLRequestCount");
200 198
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 318
321 LoadStateWithParam URLRequest::GetLoadState() const { 319 LoadStateWithParam URLRequest::GetLoadState() const {
322 if (blocked_on_delegate_) { 320 if (blocked_on_delegate_) {
323 return LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE, 321 return LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE,
324 load_state_param_); 322 load_state_param_);
325 } 323 }
326 return LoadStateWithParam(job_ ? job_->GetLoadState() : LOAD_STATE_IDLE, 324 return LoadStateWithParam(job_ ? job_->GetLoadState() : LOAD_STATE_IDLE,
327 string16()); 325 string16());
328 } 326 }
329 327
330 uint64 URLRequest::GetUploadProgress() const { 328 UploadProgress URLRequest::GetUploadProgress() const {
331 if (!job_) { 329 if (!job_) {
332 // We haven't started or the request was cancelled 330 // We haven't started or the request was cancelled
333 return 0; 331 return UploadProgress();
334 } 332 }
335 if (final_upload_progress_) { 333 if (final_upload_progress_.position()) {
336 // The first job completed and none of the subsequent series of 334 // The first job completed and none of the subsequent series of
337 // GETs when following redirects will upload anything, so we return the 335 // GETs when following redirects will upload anything, so we return the
338 // cached results from the initial job, the POST. 336 // cached results from the initial job, the POST.
339 return final_upload_progress_; 337 return final_upload_progress_;
340 } 338 }
341 return job_->GetUploadProgress(); 339 return job_->GetUploadProgress();
342 } 340 }
343 341
344 void URLRequest::GetResponseHeaderById(int id, string* value) { 342 void URLRequest::GetResponseHeaderById(int id, string* value) {
345 DCHECK(job_); 343 DCHECK(job_);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 // Suppress the referrer if we're redirecting out of https. 784 // Suppress the referrer if we're redirecting out of https.
787 if (referrer_policy_ == 785 if (referrer_policy_ ==
788 CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE && 786 CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE &&
789 GURL(referrer_).SchemeIsSecure() && !location.SchemeIsSecure()) { 787 GURL(referrer_).SchemeIsSecure() && !location.SchemeIsSecure()) {
790 referrer_.clear(); 788 referrer_.clear();
791 } 789 }
792 790
793 url_chain_.push_back(location); 791 url_chain_.push_back(location);
794 --redirect_limit_; 792 --redirect_limit_;
795 793
796 if (!final_upload_progress_) 794 if (!final_upload_progress_.position())
797 final_upload_progress_ = job_->GetUploadProgress(); 795 final_upload_progress_ = job_->GetUploadProgress();
798 796
799 PrepareToRestart(); 797 PrepareToRestart();
800 Start(); 798 Start();
801 return OK; 799 return OK;
802 } 800 }
803 801
804 const URLRequestContext* URLRequest::context() const { 802 const URLRequestContext* URLRequest::context() const {
805 return context_; 803 return context_;
806 } 804 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 new base::debug::StackTrace(NULL, 0); 966 new base::debug::StackTrace(NULL, 0);
969 *stack_trace_copy = stack_trace; 967 *stack_trace_copy = stack_trace;
970 stack_trace_.reset(stack_trace_copy); 968 stack_trace_.reset(stack_trace_copy);
971 } 969 }
972 970
973 const base::debug::StackTrace* URLRequest::stack_trace() const { 971 const base::debug::StackTrace* URLRequest::stack_trace() const {
974 return stack_trace_.get(); 972 return stack_trace_.get();
975 } 973 }
976 974
977 } // namespace net 975 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698