Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 bool URLRequestHttpJob::HttpFilterContext::IsCachedContent() const { | 107 bool URLRequestHttpJob::HttpFilterContext::IsCachedContent() const { |
| 108 return job_->is_cached_content_; | 108 return job_->is_cached_content_; |
| 109 } | 109 } |
| 110 | 110 |
| 111 SdchManager::DictionarySet* | 111 SdchManager::DictionarySet* |
| 112 URLRequestHttpJob::HttpFilterContext::SdchDictionariesAdvertised() const { | 112 URLRequestHttpJob::HttpFilterContext::SdchDictionariesAdvertised() const { |
| 113 return job_->dictionaries_advertised_.get(); | 113 return job_->dictionaries_advertised_.get(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 int64 URLRequestHttpJob::HttpFilterContext::GetByteReadCount() const { | 116 int64 URLRequestHttpJob::HttpFilterContext::GetByteReadCount() const { |
| 117 return job_->filter_input_byte_count(); | 117 return job_->prefilter_bytes_read(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int URLRequestHttpJob::HttpFilterContext::GetResponseCode() const { | 120 int URLRequestHttpJob::HttpFilterContext::GetResponseCode() const { |
| 121 return job_->GetResponseCode(); | 121 return job_->GetResponseCode(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 const URLRequestContext* | 124 const URLRequestContext* |
| 125 URLRequestHttpJob::HttpFilterContext::GetURLRequestContext() const { | 125 URLRequestHttpJob::HttpFilterContext::GetURLRequestContext() const { |
| 126 return job_->request() ? job_->request()->context() : NULL; | 126 return job_->request() ? job_->request()->context() : NULL; |
| 127 } | 127 } |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 << "The timer was reset before it was recorded."; | 1385 << "The timer was reset before it was recorded."; |
| 1386 return; | 1386 return; |
| 1387 } | 1387 } |
| 1388 request_creation_time_ = base::Time::Now(); | 1388 request_creation_time_ = base::Time::Now(); |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 void URLRequestHttpJob::UpdatePacketReadTimes() { | 1391 void URLRequestHttpJob::UpdatePacketReadTimes() { |
| 1392 if (!packet_timing_enabled_) | 1392 if (!packet_timing_enabled_) |
| 1393 return; | 1393 return; |
| 1394 | 1394 |
| 1395 if (filter_input_byte_count() <= bytes_observed_in_packets_) { | 1395 DCHECK_GT(prefilter_bytes_read(), bytes_observed_in_packets_); |
|
mmenke
2015/04/10 21:48:02
We never call UpdatePacketReadTimes() when we didn
Randy Smith (Not in Mondays)
2015/04/10 22:03:57
Yeah, but it's part of the URLRequestJob -> subcla
mmenke
2015/04/10 22:36:49
Done.
| |
| 1396 DCHECK_EQ(filter_input_byte_count(), bytes_observed_in_packets_); | |
| 1397 return; // No new bytes have arrived. | |
| 1398 } | |
| 1399 | 1396 |
| 1400 base::Time now(base::Time::Now()); | 1397 base::Time now(base::Time::Now()); |
| 1401 if (!bytes_observed_in_packets_) | 1398 if (!bytes_observed_in_packets_) |
| 1402 request_time_snapshot_ = now; | 1399 request_time_snapshot_ = now; |
| 1403 final_packet_time_ = now; | 1400 final_packet_time_ = now; |
| 1404 | 1401 |
| 1405 bytes_observed_in_packets_ = filter_input_byte_count(); | 1402 bytes_observed_in_packets_ = prefilter_bytes_read(); |
| 1406 } | 1403 } |
| 1407 | 1404 |
| 1408 void URLRequestHttpJob::RecordPacketStats( | 1405 void URLRequestHttpJob::RecordPacketStats( |
| 1409 FilterContext::StatisticSelector statistic) const { | 1406 FilterContext::StatisticSelector statistic) const { |
| 1410 if (!packet_timing_enabled_ || (final_packet_time_ == base::Time())) | 1407 if (!packet_timing_enabled_ || (final_packet_time_ == base::Time())) |
| 1411 return; | 1408 return; |
| 1412 | 1409 |
| 1413 base::TimeDelta duration = final_packet_time_ - request_time_snapshot_; | 1410 base::TimeDelta duration = final_packet_time_ - request_time_snapshot_; |
| 1414 switch (statistic) { | 1411 switch (statistic) { |
| 1415 case FilterContext::SDCH_DECODE: { | 1412 case FilterContext::SDCH_DECODE: { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1487 return override_response_headers_.get() ? | 1484 return override_response_headers_.get() ? |
| 1488 override_response_headers_.get() : | 1485 override_response_headers_.get() : |
| 1489 transaction_->GetResponseInfo()->headers.get(); | 1486 transaction_->GetResponseInfo()->headers.get(); |
| 1490 } | 1487 } |
| 1491 | 1488 |
| 1492 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1489 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1493 awaiting_callback_ = false; | 1490 awaiting_callback_ = false; |
| 1494 } | 1491 } |
| 1495 | 1492 |
| 1496 } // namespace net | 1493 } // namespace net |
| OLD | NEW |