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( |
| 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 // TODO(akalin): Plumb this through to |stream_request_| and |
| 404 // |stream_|. |
| 405 } |
| 406 |
388 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, | 407 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, |
389 const ProxyInfo& used_proxy_info, | 408 const ProxyInfo& used_proxy_info, |
390 HttpStreamBase* stream) { | 409 HttpStreamBase* stream) { |
391 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 410 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
392 DCHECK(stream_request_.get()); | 411 DCHECK(stream_request_.get()); |
393 | 412 |
394 stream_.reset(stream); | 413 stream_.reset(stream); |
395 server_ssl_config_ = used_ssl_config; | 414 server_ssl_config_ = used_ssl_config; |
396 proxy_info_ = used_proxy_info; | 415 proxy_info_ = used_proxy_info; |
397 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); | 416 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 494 |
476 headers_valid_ = true; | 495 headers_valid_ = true; |
477 response_ = response_info; | 496 response_ = response_info; |
478 server_ssl_config_ = used_ssl_config; | 497 server_ssl_config_ = used_ssl_config; |
479 proxy_info_ = used_proxy_info; | 498 proxy_info_ = used_proxy_info; |
480 stream_.reset(stream); | 499 stream_.reset(stream); |
481 stream_request_.reset(); // we're done with the stream request | 500 stream_request_.reset(); // we're done with the stream request |
482 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 501 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
483 } | 502 } |
484 | 503 |
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 { | 504 bool HttpNetworkTransaction::is_https_request() const { |
500 return request_->url.SchemeIs("https"); | 505 return request_->url.SchemeIs("https"); |
501 } | 506 } |
502 | 507 |
503 void HttpNetworkTransaction::DoCallback(int rv) { | 508 void HttpNetworkTransaction::DoCallback(int rv) { |
504 DCHECK_NE(rv, ERR_IO_PENDING); | 509 DCHECK_NE(rv, ERR_IO_PENDING); |
505 DCHECK(!callback_.is_null()); | 510 DCHECK(!callback_.is_null()); |
506 | 511 |
507 // Since Run may result in Read being called, clear user_callback_ up front. | 512 // Since Run may result in Read being called, clear user_callback_ up front. |
508 CompletionCallback c = callback_; | 513 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, | 1459 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1455 state); | 1460 state); |
1456 break; | 1461 break; |
1457 } | 1462 } |
1458 return description; | 1463 return description; |
1459 } | 1464 } |
1460 | 1465 |
1461 #undef STATE_CASE | 1466 #undef STATE_CASE |
1462 | 1467 |
1463 } // namespace net | 1468 } // namespace net |
OLD | NEW |