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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 UploadProgress HttpNetworkTransaction::GetUploadProgress() const { | 382 UploadProgress HttpNetworkTransaction::GetUploadProgress() const { |
383 if (!stream_.get()) | 383 if (!stream_.get()) |
384 return UploadProgress(); | 384 return UploadProgress(); |
385 | 385 |
386 // TODO(bashi): This cast is temporary. Remove later. | 386 // TODO(bashi): This cast is temporary. Remove later. |
387 return static_cast<HttpStream*>(stream_.get())->GetUploadProgress(); | 387 return static_cast<HttpStream*>(stream_.get())->GetUploadProgress(); |
388 } | 388 } |
389 | 389 |
| 390 bool HttpNetworkTransaction::GetLoadTimingInfo( |
| 391 LoadTimingInfo* load_timing_info) const { |
| 392 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info)) |
| 393 return false; |
| 394 |
| 395 load_timing_info->proxy_resolve_start = |
| 396 proxy_info_.proxy_resolve_start_time(); |
| 397 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time(); |
| 398 load_timing_info->send_start = send_start_time_; |
| 399 load_timing_info->send_end = send_end_time_; |
| 400 load_timing_info->receive_headers_end = receive_headers_end_; |
| 401 return true; |
| 402 } |
| 403 |
| 404 void HttpNetworkTransaction::SetPriority(RequestPriority priority) { |
| 405 priority_ = priority; |
| 406 // TODO(akalin): Plumb this through to |stream_request_| and |
| 407 // |stream_|. |
| 408 } |
| 409 |
390 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, | 410 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, |
391 const ProxyInfo& used_proxy_info, | 411 const ProxyInfo& used_proxy_info, |
392 HttpStreamBase* stream) { | 412 HttpStreamBase* stream) { |
393 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); | 413 DCHECK_EQ(STATE_CREATE_STREAM_COMPLETE, next_state_); |
394 DCHECK(stream_request_.get()); | 414 DCHECK(stream_request_.get()); |
395 | 415 |
396 stream_.reset(stream); | 416 stream_.reset(stream); |
397 server_ssl_config_ = used_ssl_config; | 417 server_ssl_config_ = used_ssl_config; |
398 proxy_info_ = used_proxy_info; | 418 proxy_info_ = used_proxy_info; |
399 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); | 419 response_.was_npn_negotiated = stream_request_->was_npn_negotiated(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 497 |
478 headers_valid_ = true; | 498 headers_valid_ = true; |
479 response_ = response_info; | 499 response_ = response_info; |
480 server_ssl_config_ = used_ssl_config; | 500 server_ssl_config_ = used_ssl_config; |
481 proxy_info_ = used_proxy_info; | 501 proxy_info_ = used_proxy_info; |
482 stream_.reset(stream); | 502 stream_.reset(stream); |
483 stream_request_.reset(); // we're done with the stream request | 503 stream_request_.reset(); // we're done with the stream request |
484 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); | 504 OnIOComplete(ERR_HTTPS_PROXY_TUNNEL_RESPONSE); |
485 } | 505 } |
486 | 506 |
487 bool HttpNetworkTransaction::GetLoadTimingInfo( | |
488 LoadTimingInfo* load_timing_info) const { | |
489 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info)) | |
490 return false; | |
491 | |
492 load_timing_info->proxy_resolve_start = | |
493 proxy_info_.proxy_resolve_start_time(); | |
494 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time(); | |
495 load_timing_info->send_start = send_start_time_; | |
496 load_timing_info->send_end = send_end_time_; | |
497 load_timing_info->receive_headers_end = receive_headers_end_; | |
498 return true; | |
499 } | |
500 | |
501 bool HttpNetworkTransaction::is_https_request() const { | 507 bool HttpNetworkTransaction::is_https_request() const { |
502 return request_->url.SchemeIs("https"); | 508 return request_->url.SchemeIs("https"); |
503 } | 509 } |
504 | 510 |
505 void HttpNetworkTransaction::DoCallback(int rv) { | 511 void HttpNetworkTransaction::DoCallback(int rv) { |
506 DCHECK_NE(rv, ERR_IO_PENDING); | 512 DCHECK_NE(rv, ERR_IO_PENDING); |
507 DCHECK(!callback_.is_null()); | 513 DCHECK(!callback_.is_null()); |
508 | 514 |
509 // Since Run may result in Read being called, clear user_callback_ up front. | 515 // Since Run may result in Read being called, clear user_callback_ up front. |
510 CompletionCallback c = callback_; | 516 CompletionCallback c = callback_; |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1463 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1458 state); | 1464 state); |
1459 break; | 1465 break; |
1460 } | 1466 } |
1461 return description; | 1467 return description; |
1462 } | 1468 } |
1463 | 1469 |
1464 #undef STATE_CASE | 1470 #undef STATE_CASE |
1465 | 1471 |
1466 } // namespace net | 1472 } // namespace net |
OLD | NEW |