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

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

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_ftp_job.cc ('k') | net/url_request/url_request_job.cc » ('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_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/debug/alias.h" 12 #include "base/debug/alias.h"
13 #include "base/debug/dump_without_crashing.h"
13 #include "base/file_version_info.h" 14 #include "base/file_version_info.h"
14 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
15 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
16 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
17 #include "base/profiler/scoped_tracker.h" 18 #include "base/profiler/scoped_tracker.h"
18 #include "base/rand_util.h" 19 #include "base/rand_util.h"
19 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
20 #include "base/time/time.h" 21 #include "base/time/time.h"
21 #include "net/base/host_port_pair.h" 22 #include "net/base/host_port_pair.h"
22 #include "net/base/load_flags.h" 23 #include "net/base/load_flags.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 request_info_.extra_headers.SetHeaderIfMissing( 283 request_info_.extra_headers.SetHeaderIfMissing(
283 HttpRequestHeaders::kUserAgent, 284 HttpRequestHeaders::kUserAgent,
284 http_user_agent_settings_ ? 285 http_user_agent_settings_ ?
285 http_user_agent_settings_->GetUserAgent() : std::string()); 286 http_user_agent_settings_->GetUserAgent() : std::string());
286 287
287 AddExtraHeaders(); 288 AddExtraHeaders();
288 AddCookieHeaderAndStart(); 289 AddCookieHeaderAndStart();
289 } 290 }
290 291
291 void URLRequestHttpJob::Kill() { 292 void URLRequestHttpJob::Kill() {
293 if (awaiting_callback_) {
294 // TODO(battre) crbug.com/289715
295 // Simulate a crash to see who kills the job while it is waiting for a
296 // callback. This should not happen, see URLRequest::OrphanJob().
297 base::debug::DumpWithoutCrashing();
298 }
292 if (!transaction_.get()) 299 if (!transaction_.get())
293 return; 300 return;
294 301
295 weak_factory_.InvalidateWeakPtrs(); 302 weak_factory_.InvalidateWeakPtrs();
296 DestroyTransaction(); 303 DestroyTransaction();
297 URLRequestJob::Kill(); 304 URLRequestJob::Kill();
298 } 305 }
299 306
300 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback( 307 void URLRequestHttpJob::NotifyBeforeSendProxyHeadersCallback(
301 const ProxyInfo& proxy_info, 308 const ProxyInfo& proxy_info,
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 request_info_.upload_data_stream = upload; 1020 request_info_.upload_data_stream = upload;
1014 } 1021 }
1015 1022
1016 void URLRequestHttpJob::SetExtraRequestHeaders( 1023 void URLRequestHttpJob::SetExtraRequestHeaders(
1017 const HttpRequestHeaders& headers) { 1024 const HttpRequestHeaders& headers) {
1018 DCHECK(!transaction_.get()) << "cannot change once started"; 1025 DCHECK(!transaction_.get()) << "cannot change once started";
1019 request_info_.extra_headers.CopyFrom(headers); 1026 request_info_.extra_headers.CopyFrom(headers);
1020 } 1027 }
1021 1028
1022 LoadState URLRequestHttpJob::GetLoadState() const { 1029 LoadState URLRequestHttpJob::GetLoadState() const {
1030 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is
1031 // fixed.
1032 tracked_objects::ScopedTracker tracking_profile(
1033 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1034 "455952 URLRequestHttpJob::GetLoadState"));
1023 return transaction_.get() ? 1035 return transaction_.get() ?
1024 transaction_->GetLoadState() : LOAD_STATE_IDLE; 1036 transaction_->GetLoadState() : LOAD_STATE_IDLE;
1025 } 1037 }
1026 1038
1027 UploadProgress URLRequestHttpJob::GetUploadProgress() const { 1039 UploadProgress URLRequestHttpJob::GetUploadProgress() const {
1028 return transaction_.get() ? 1040 return transaction_.get() ?
1029 transaction_->GetUploadProgress() : UploadProgress(); 1041 transaction_->GetUploadProgress() : UploadProgress();
1030 } 1042 }
1031 1043
1032 bool URLRequestHttpJob::GetMimeType(std::string* mime_type) const { 1044 bool URLRequestHttpJob::GetMimeType(std::string* mime_type) const {
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 return override_response_headers_.get() ? 1610 return override_response_headers_.get() ?
1599 override_response_headers_.get() : 1611 override_response_headers_.get() :
1600 transaction_->GetResponseInfo()->headers.get(); 1612 transaction_->GetResponseInfo()->headers.get();
1601 } 1613 }
1602 1614
1603 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1615 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1604 awaiting_callback_ = false; 1616 awaiting_callback_ = false;
1605 } 1617 }
1606 1618
1607 } // namespace net 1619 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_ftp_job.cc ('k') | net/url_request/url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698