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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 } | 378 } |
379 | 379 |
380 UploadProgress HttpNetworkTransaction::GetUploadProgress() const { | 380 UploadProgress HttpNetworkTransaction::GetUploadProgress() const { |
381 if (!stream_.get()) | 381 if (!stream_.get()) |
382 return UploadProgress(); | 382 return UploadProgress(); |
383 | 383 |
384 // TODO(bashi): This cast is temporary. Remove later. | 384 // TODO(bashi): This cast is temporary. Remove later. |
385 return static_cast<HttpStream*>(stream_.get())->GetUploadProgress(); | 385 return static_cast<HttpStream*>(stream_.get())->GetUploadProgress(); |
386 } | 386 } |
387 | 387 |
388 bool HttpNetworkTransaction::GetLoadTimingInfo( | |
mmenke
2013/03/12 18:40:22
Thanks for fixing my misplacement of this function
| |
389 LoadTimingInfo* load_timing_info) const { | |
390 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info)) | |
391 return false; | |
392 | |
393 load_timing_info->proxy_resolve_start = | |
394 proxy_info_.proxy_resolve_start_time(); | |
395 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time(); | |
396 load_timing_info->send_start = send_start_time_; | |
397 load_timing_info->send_end = send_end_time_; | |
398 load_timing_info->receive_headers_end = receive_headers_end_; | |
399 return true; | |
400 } | |
401 | |
402 void HttpNetworkTransaction::SetPriority(RequestPriority priority) { | |
403 net_log_.AddEvent(NetLog::TYPE_HTTP_TRANSACTION_SET_PRIORITY, | |
404 NetLog::IntegerCallback("priority", priority)); | |
mmenke
2013/03/12 18:40:22
I don't think this is an event worth logging.
Htt
akalin
2013/03/12 22:08:28
Okay. I think we should still keep the new one URL
mmenke
2013/03/12 22:58:26
I agree that we should keep the one in URLRequest.
| |
405 // TODO(akalin): Plumb this through to |stream_request_| and | |
406 // |stream_|. | |
407 } | |
408 | |
388 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, | 409 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, |
389 const ProxyInfo& used_proxy_info, | 410 const ProxyInfo& used_proxy_info, |
390 HttpStreamBase* stream) { | 411 HttpStreamBase* stream) { |
391 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 412 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
392 DCHECK(stream_request_.get()); | 413 DCHECK(stream_request_.get()); |
393 | 414 |
394 stream_.reset(stream); | 415 stream_.reset(stream); |
395 server_ssl_config_ = used_ssl_config; | 416 server_ssl_config_ = used_ssl_config; |
396 proxy_info_ = used_proxy_info; | 417 proxy_info_ = used_proxy_info; |
397 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); | 418 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
475 | 496 |
476 headers_valid_ = true; | 497 headers_valid_ = true; |
477 response_ = response_info; | 498 response_ = response_info; |
478 server_ssl_config_ = used_ssl_config; | 499 server_ssl_config_ = used_ssl_config; |
479 proxy_info_ = used_proxy_info; | 500 proxy_info_ = used_proxy_info; |
480 stream_.reset(stream); | 501 stream_.reset(stream); |
481 stream_request_.reset(); // we're done with the stream request | 502 stream_request_.reset(); // we're done with the stream request |
482 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 503 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
483 } | 504 } |
484 | 505 |
485 bool HttpNetworkTransaction::GetLoadTimingInfo( | |
486 LoadTimingInfo* load_timing_info) const { | |
487 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info)) | |
488 return false; | |
489 | |
490 load_timing_info->proxy_resolve_start = | |
491 proxy_info_.proxy_resolve_start_time(); | |
492 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time(); | |
493 load_timing_info->send_start = send_start_time_; | |
494 load_timing_info->send_end = send_end_time_; | |
495 load_timing_info->receive_headers_end = receive_headers_end_; | |
496 return true; | |
497 } | |
498 | |
499 bool HttpNetworkTransaction::is_https_request() const { | 506 bool HttpNetworkTransaction::is_https_request() const { |
500 return request_->url.SchemeIs("https"); | 507 return request_->url.SchemeIs("https"); |
501 } | 508 } |
502 | 509 |
503 void HttpNetworkTransaction::DoCallback(int rv) { | 510 void HttpNetworkTransaction::DoCallback(int rv) { |
504 DCHECK_NE(rv, ERR_IO_PENDING); | 511 DCHECK_NE(rv, ERR_IO_PENDING); |
505 DCHECK(!callback_.is_null()); | 512 DCHECK(!callback_.is_null()); |
506 | 513 |
507 // Since Run may result in Read being called, clear user_callback_ up front. | 514 // Since Run may result in Read being called, clear user_callback_ up front. |
508 CompletionCallback c = callback_; | 515 CompletionCallback c = callback_; |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1454 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1461 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1455 state); | 1462 state); |
1456 break; | 1463 break; |
1457 } | 1464 } |
1458 return description; | 1465 return description; |
1459 } | 1466 } |
1460 | 1467 |
1461 #undef STATE_CASE | 1468 #undef STATE_CASE |
1462 | 1469 |
1463 } // namespace net | 1470 } // namespace net |
OLD | NEW |