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

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

Issue 810883007: Add debug information for crbug.com/289715 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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_http_job.h ('k') | no next file » | 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/file_version_info.h" 13 #include "base/file_version_info.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
16 #include "base/profiler/scoped_tracker.h" 17 #include "base/profiler/scoped_tracker.h"
17 #include "base/rand_util.h" 18 #include "base/rand_util.h"
18 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
19 #include "base/time/time.h" 20 #include "base/time/time.h"
20 #include "net/base/host_port_pair.h" 21 #include "net/base/host_port_pair.h"
21 #include "net/base/load_flags.h" 22 #include "net/base/load_flags.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 done_(false), 201 done_(false),
201 bytes_observed_in_packets_(0), 202 bytes_observed_in_packets_(0),
202 request_time_snapshot_(), 203 request_time_snapshot_(),
203 final_packet_time_(), 204 final_packet_time_(),
204 filter_context_(new HttpFilterContext(this)), 205 filter_context_(new HttpFilterContext(this)),
205 on_headers_received_callback_( 206 on_headers_received_callback_(
206 base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback, 207 base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback,
207 base::Unretained(this))), 208 base::Unretained(this))),
208 awaiting_callback_(false), 209 awaiting_callback_(false),
209 http_user_agent_settings_(http_user_agent_settings), 210 http_user_agent_settings_(http_user_agent_settings),
211 destructor_was_called_(false),
212 transaction_state_(TRANSACTION_WAS_NOT_INITIALIZED),
210 weak_factory_(this) { 213 weak_factory_(this) {
211 URLRequestThrottlerManager* manager = request->context()->throttler_manager(); 214 URLRequestThrottlerManager* manager = request->context()->throttler_manager();
212 if (manager) 215 if (manager)
213 throttling_entry_ = manager->RegisterRequestUrl(request->url()); 216 throttling_entry_ = manager->RegisterRequestUrl(request->url());
214 217
215 ResetTimer(); 218 ResetTimer();
216 } 219 }
217 220
218 URLRequestHttpJob::~URLRequestHttpJob() { 221 URLRequestHttpJob::~URLRequestHttpJob() {
219 CHECK(!awaiting_callback_); 222 CHECK(!awaiting_callback_);
220 223
224 destructor_was_called_ = true;
225
221 DCHECK(!sdch_test_control_ || !sdch_test_activated_); 226 DCHECK(!sdch_test_control_ || !sdch_test_activated_);
222 if (!is_cached_content_) { 227 if (!is_cached_content_) {
223 if (sdch_test_control_) 228 if (sdch_test_control_)
224 RecordPacketStats(FilterContext::SDCH_EXPERIMENT_HOLDBACK); 229 RecordPacketStats(FilterContext::SDCH_EXPERIMENT_HOLDBACK);
225 if (sdch_test_activated_) 230 if (sdch_test_activated_)
226 RecordPacketStats(FilterContext::SDCH_EXPERIMENT_DECODE); 231 RecordPacketStats(FilterContext::SDCH_EXPERIMENT_DECODE);
227 } 232 }
228 // Make sure SDCH filters are told to emit histogram data while 233 // Make sure SDCH filters are told to emit histogram data while
229 // filter_context_ is still alive. 234 // filter_context_ is still alive.
230 DestroyFilters(); 235 DestroyFilters();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 void URLRequestHttpJob::NotifyDone(const URLRequestStatus& status) { 405 void URLRequestHttpJob::NotifyDone(const URLRequestStatus& status) {
401 DoneWithRequest(FINISHED); 406 DoneWithRequest(FINISHED);
402 URLRequestJob::NotifyDone(status); 407 URLRequestJob::NotifyDone(status);
403 } 408 }
404 409
405 void URLRequestHttpJob::DestroyTransaction() { 410 void URLRequestHttpJob::DestroyTransaction() {
406 DCHECK(transaction_.get()); 411 DCHECK(transaction_.get());
407 412
408 DoneWithRequest(ABORTED); 413 DoneWithRequest(ABORTED);
409 transaction_.reset(); 414 transaction_.reset();
415 transaction_state_ = TRANSACTION_WAS_DESTROYED;
410 response_info_ = NULL; 416 response_info_ = NULL;
411 receive_headers_end_ = base::TimeTicks(); 417 receive_headers_end_ = base::TimeTicks();
412 } 418 }
413 419
414 void URLRequestHttpJob::StartTransaction() { 420 void URLRequestHttpJob::StartTransaction() {
415 if (network_delegate()) { 421 if (network_delegate()) {
416 OnCallToDelegate(); 422 OnCallToDelegate();
417 int rv = network_delegate()->NotifyBeforeSendHeaders( 423 int rv = network_delegate()->NotifyBeforeSendHeaders(
418 request_, notify_before_headers_sent_callback_, 424 request_, notify_before_headers_sent_callback_,
419 &request_info_.extra_headers); 425 &request_info_.extra_headers);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 467 }
462 468
463 if (transaction_.get()) { 469 if (transaction_.get()) {
464 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_); 470 rv = transaction_->RestartWithAuth(auth_credentials_, start_callback_);
465 auth_credentials_ = AuthCredentials(); 471 auth_credentials_ = AuthCredentials();
466 } else { 472 } else {
467 DCHECK(request_->context()->http_transaction_factory()); 473 DCHECK(request_->context()->http_transaction_factory());
468 474
469 rv = request_->context()->http_transaction_factory()->CreateTransaction( 475 rv = request_->context()->http_transaction_factory()->CreateTransaction(
470 priority_, &transaction_); 476 priority_, &transaction_);
477 if (rv == OK) {
478 transaction_state_ = TRANSACTION_WAS_INITIALIZED;
479 }
471 480
472 if (rv == OK && request_info_.url.SchemeIsWSOrWSS()) { 481 if (rv == OK && request_info_.url.SchemeIsWSOrWSS()) {
473 base::SupportsUserData::Data* data = request_->GetUserData( 482 base::SupportsUserData::Data* data = request_->GetUserData(
474 WebSocketHandshakeStreamBase::CreateHelper::DataKey()); 483 WebSocketHandshakeStreamBase::CreateHelper::DataKey());
475 if (data) { 484 if (data) {
476 transaction_->SetWebSocketHandshakeStreamCreateHelper( 485 transaction_->SetWebSocketHandshakeStreamCreateHelper(
477 static_cast<WebSocketHandshakeStreamBase::CreateHelper*>(data)); 486 static_cast<WebSocketHandshakeStreamBase::CreateHelper*>(data));
478 } else { 487 } else {
479 rv = ERR_DISALLOWED_URL_SCHEME; 488 rv = ERR_DISALLOWED_URL_SCHEME;
480 } 489 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 OnCallToDelegateComplete(); 676 OnCallToDelegateComplete();
668 677
669 if (result != net::OK) { 678 if (result != net::OK) {
670 std::string source("delegate"); 679 std::string source("delegate");
671 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, 680 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED,
672 NetLog::StringCallback("source", &source)); 681 NetLog::StringCallback("source", &source));
673 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); 682 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result));
674 return; 683 return;
675 } 684 }
676 685
677 DCHECK(transaction_.get()); 686 // TODO(battre) crbug.com/289715
687 // Remove check for destructor_was_called_ and make CHECK(transaction_.get())
688 // a DCHECK again.
689 TransactionState state = transaction_state_;
690 base::debug::Alias(&state);
691 CHECK(!destructor_was_called_);
mmenke 2015/01/09 16:11:57 If the destructor was already called, what are the
battre 2015/01/09 16:46:14 Done.
692 CHECK(transaction_.get());
678 693
679 const HttpResponseInfo* response_info = transaction_->GetResponseInfo(); 694 const HttpResponseInfo* response_info = transaction_->GetResponseInfo();
680 DCHECK(response_info); 695 DCHECK(response_info);
681 696
682 response_cookies_.clear(); 697 response_cookies_.clear();
683 response_cookies_save_index_ = 0; 698 response_cookies_save_index_ = 0;
684 699
685 FetchResponseCookies(&response_cookies_); 700 FetchResponseCookies(&response_cookies_);
686 701
687 if (!GetResponseHeaders()->GetDateValue(&response_date_)) 702 if (!GetResponseHeaders()->GetDateValue(&response_date_))
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 return override_response_headers_.get() ? 1589 return override_response_headers_.get() ?
1575 override_response_headers_.get() : 1590 override_response_headers_.get() :
1576 transaction_->GetResponseInfo()->headers.get(); 1591 transaction_->GetResponseInfo()->headers.get();
1577 } 1592 }
1578 1593
1579 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1594 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1580 awaiting_callback_ = false; 1595 awaiting_callback_ = false;
1581 } 1596 }
1582 1597
1583 } // namespace net 1598 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698