| Index: net/url_request/url_request.cc
|
| diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
| index 97308b585e39610fd01709b7825dce31b2eba49a..5438ca29cd34433ce56c6ef97fec26c3cd54a64f 100644
|
| --- a/net/url_request/url_request.cc
|
| +++ b/net/url_request/url_request.cc
|
| @@ -63,8 +63,8 @@ void StripPostSpecificHeaders(HttpRequestHeaders* headers) {
|
| uint64 g_next_url_request_identifier = 1;
|
|
|
| // This lock protects g_next_url_request_identifier.
|
| -base::LazyInstance<base::Lock>::Leaky
|
| - g_next_url_request_identifier_lock = LAZY_INSTANCE_INITIALIZER;
|
| +base::LazyInstance<base::Lock>::Leaky g_next_url_request_identifier_lock =
|
| + LAZY_INSTANCE_INITIALIZER;
|
|
|
| // Returns an prior unused identifier for URL requests.
|
| uint64 GenerateURLRequestIdentifier() {
|
| @@ -142,9 +142,9 @@ void ConvertRealLoadTimesToBlockingTimes(
|
|
|
| } // namespace
|
|
|
| -URLRequest::ProtocolFactory*
|
| -URLRequest::Deprecated::RegisterProtocolFactory(const std::string& scheme,
|
| - ProtocolFactory* factory) {
|
| +URLRequest::ProtocolFactory* URLRequest::Deprecated::RegisterProtocolFactory(
|
| + const std::string& scheme,
|
| + ProtocolFactory* factory) {
|
| return URLRequest::RegisterProtocolFactory(scheme, factory);
|
| }
|
|
|
| @@ -169,7 +169,8 @@ URLRequestJob* URLRequest::Interceptor::MaybeInterceptRedirect(
|
| }
|
|
|
| URLRequestJob* URLRequest::Interceptor::MaybeInterceptResponse(
|
| - URLRequest* request, NetworkDelegate* network_delegate) {
|
| + URLRequest* request,
|
| + NetworkDelegate* network_delegate) {
|
| return NULL;
|
| }
|
|
|
| @@ -247,7 +248,8 @@ URLRequest::~URLRequest() {
|
|
|
| // static
|
| URLRequest::ProtocolFactory* URLRequest::RegisterProtocolFactory(
|
| - const string& scheme, ProtocolFactory* factory) {
|
| + const string& scheme,
|
| + ProtocolFactory* factory) {
|
| return URLRequestJobManager::GetInstance()->RegisterProtocolFactory(scheme,
|
| factory);
|
| }
|
| @@ -281,9 +283,9 @@ void URLRequest::Init(const GURL& url,
|
| redirect_limit_ = kMaxRedirects;
|
| priority_ = priority;
|
| calling_delegate_ = false;
|
| - use_blocked_by_as_load_param_ =false;
|
| - before_request_callback_ = base::Bind(&URLRequest::BeforeRequestComplete,
|
| - base::Unretained(this));
|
| + use_blocked_by_as_load_param_ = false;
|
| + before_request_callback_ =
|
| + base::Bind(&URLRequest::BeforeRequestComplete, base::Unretained(this));
|
| has_notified_completion_ = false;
|
| received_response_content_length_ = 0;
|
| creation_time_ = base::TimeTicks::Now();
|
| @@ -334,7 +336,8 @@ bool URLRequest::has_upload() const {
|
| return upload_data_stream_.get() != NULL;
|
| }
|
|
|
| -void URLRequest::SetExtraRequestHeaderById(int id, const string& value,
|
| +void URLRequest::SetExtraRequestHeaderById(int id,
|
| + const string& value,
|
| bool overwrite) {
|
| DCHECK(!is_pending_ || is_redirecting_);
|
| NOTREACHED() << "implement me!";
|
| @@ -356,8 +359,7 @@ void URLRequest::RemoveRequestHeaderByName(const string& name) {
|
| extra_request_headers_.RemoveHeader(name);
|
| }
|
|
|
| -void URLRequest::SetExtraRequestHeaders(
|
| - const HttpRequestHeaders& headers) {
|
| +void URLRequest::SetExtraRequestHeaders(const HttpRequestHeaders& headers) {
|
| DCHECK(!is_pending_);
|
| extra_request_headers_ = headers;
|
|
|
| @@ -383,10 +385,10 @@ LoadStateWithParam URLRequest::GetLoadState() const {
|
| // The !blocked_by_.empty() check allows |this| to report it's blocked on a
|
| // delegate before it has been started.
|
| if (calling_delegate_ || !blocked_by_.empty()) {
|
| - return LoadStateWithParam(
|
| - LOAD_STATE_WAITING_FOR_DELEGATE,
|
| - use_blocked_by_as_load_param_ ? base::UTF8ToUTF16(blocked_by_) :
|
| - base::string16());
|
| + return LoadStateWithParam(LOAD_STATE_WAITING_FOR_DELEGATE,
|
| + use_blocked_by_as_load_param_
|
| + ? base::UTF8ToUTF16(blocked_by_)
|
| + : base::string16());
|
| }
|
| return LoadStateWithParam(job_.get() ? job_->GetLoadState() : LOAD_STATE_IDLE,
|
| base::string16());
|
| @@ -399,7 +401,8 @@ base::Value* URLRequest::GetStateAsValue() const {
|
| if (url_chain_.size() > 1) {
|
| base::ListValue* list = new base::ListValue();
|
| for (std::vector<GURL>::const_iterator url = url_chain_.begin();
|
| - url != url_chain_.end(); ++url) {
|
| + url != url_chain_.end();
|
| + ++url) {
|
| list->AppendString(url->possibly_invalid_spec());
|
| }
|
| dict->Set("url_chain", list);
|
| @@ -453,9 +456,8 @@ void URLRequest::LogBlockedBy(const char* blocked_by) {
|
| blocked_by_ = blocked_by;
|
| use_blocked_by_as_load_param_ = false;
|
|
|
| - net_log_.BeginEvent(
|
| - NetLog::TYPE_DELEGATE_INFO,
|
| - NetLog::StringCallback("delegate_info", &blocked_by_));
|
| + net_log_.BeginEvent(NetLog::TYPE_DELEGATE_INFO,
|
| + NetLog::StringCallback("delegate_info", &blocked_by_));
|
| }
|
|
|
| void URLRequest::LogAndReportBlockedBy(const char* source) {
|
| @@ -587,9 +589,8 @@ void URLRequest::set_method(const std::string& method) {
|
| }
|
|
|
| // static
|
| -std::string URLRequest::ComputeMethodForRedirect(
|
| - const std::string& method,
|
| - int http_status_code) {
|
| +std::string URLRequest::ComputeMethodForRedirect(const std::string& method,
|
| + int http_status_code) {
|
| // For 303 redirects, all request methods except HEAD are converted to GET,
|
| // as per the latest httpbis draft. The draft also allows POST requests to
|
| // be converted to GETs when following 301/302 redirects, for historical
|
| @@ -597,7 +598,8 @@ std::string URLRequest::ComputeMethodForRedirect(
|
| // the httpbis draft say to prompt the user to confirm the generation of new
|
| // requests, other than GET and HEAD requests, but IE omits these prompts and
|
| // so shall we.
|
| - // See: https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-17#section-7.3
|
| + // See:
|
| + // https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-17#section-7.3
|
| if ((http_status_code == 303 && method != "HEAD") ||
|
| ((http_status_code == 301 || http_status_code == 302) &&
|
| method == "POST")) {
|
| @@ -652,8 +654,8 @@ void URLRequest::Start() {
|
| return;
|
| }
|
|
|
| - StartJob(URLRequestJobManager::GetInstance()->CreateJob(
|
| - this, network_delegate_));
|
| + StartJob(
|
| + URLRequestJobManager::GetInstance()->CreateJob(this, network_delegate_));
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| @@ -678,13 +680,16 @@ void URLRequest::BeforeRequestComplete(int error) {
|
| new_url.Swap(&delegate_redirect_url_);
|
|
|
| URLRequestRedirectJob* job = new URLRequestRedirectJob(
|
| - this, network_delegate_, new_url,
|
| + this,
|
| + network_delegate_,
|
| + new_url,
|
| // Use status code 307 to preserve the method, so POST requests work.
|
| - URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "Delegate");
|
| + URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT,
|
| + "Delegate");
|
| StartJob(job);
|
| } else {
|
| - StartJob(URLRequestJobManager::GetInstance()->CreateJob(
|
| - this, network_delegate_));
|
| + StartJob(URLRequestJobManager::GetInstance()->CreateJob(this,
|
| + network_delegate_));
|
| }
|
| }
|
|
|
| @@ -695,7 +700,10 @@ void URLRequest::StartJob(URLRequestJob* job) {
|
| net_log_.BeginEvent(
|
| NetLog::TYPE_URL_REQUEST_START_JOB,
|
| base::Bind(&NetLogURLRequestStartCallback,
|
| - &url(), &method_, load_flags_, priority_,
|
| + &url(),
|
| + &method_,
|
| + load_flags_,
|
| + priority_,
|
| upload_data_stream_ ? upload_data_stream_->identifier() : -1));
|
|
|
| job_ = job;
|
| @@ -738,7 +746,7 @@ void URLRequest::Restart() {
|
| URLRequestJobManager::GetInstance()->CreateJob(this, network_delegate_));
|
| }
|
|
|
| -void URLRequest::RestartWithJob(URLRequestJob *job) {
|
| +void URLRequest::RestartWithJob(URLRequestJob* job) {
|
| DCHECK(job->request() == this);
|
| PrepareToRestart();
|
| StartJob(job);
|
| @@ -1174,7 +1182,6 @@ bool URLRequest::CanEnablePrivacyMode() const {
|
| return !g_default_can_use_cookies;
|
| }
|
|
|
| -
|
| void URLRequest::NotifyReadCompleted(int bytes_read) {
|
| // Notify in case the entire URL Request has been finished.
|
| if (bytes_read <= 0)
|
|
|