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/http/http_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 688 DCHECK(!network_trans_); | 688 DCHECK(!network_trans_); |
| 689 before_proxy_headers_sent_callback_ = callback; | 689 before_proxy_headers_sent_callback_ = callback; |
| 690 } | 690 } |
| 691 | 691 |
| 692 int HttpCache::Transaction::ResumeNetworkStart() { | 692 int HttpCache::Transaction::ResumeNetworkStart() { |
| 693 if (network_trans_) | 693 if (network_trans_) |
| 694 return network_trans_->ResumeNetworkStart(); | 694 return network_trans_->ResumeNetworkStart(); |
| 695 return ERR_UNEXPECTED; | 695 return ERR_UNEXPECTED; |
| 696 } | 696 } |
| 697 | 697 |
| 698 void HttpCache::Transaction::GetConnectionAttempts( | |
| 699 ConnectionAttempts* out) const { | |
| 700 ConnectionAttempts new_connection_attempts; | |
| 701 if (network_trans_) | |
| 702 network_trans_->GetConnectionAttempts(&new_connection_attempts); | |
| 703 | |
| 704 out->swap(new_connection_attempts); | |
| 705 out->insert(out->begin(), old_connection_attempts_.begin(), | |
| 706 old_connection_attempts_.end()); | |
| 707 } | |
| 708 | |
| 698 //----------------------------------------------------------------------------- | 709 //----------------------------------------------------------------------------- |
| 699 | 710 |
| 700 void HttpCache::Transaction::DoCallback(int rv) { | 711 void HttpCache::Transaction::DoCallback(int rv) { |
| 701 DCHECK(rv != ERR_IO_PENDING); | 712 DCHECK(rv != ERR_IO_PENDING); |
| 702 DCHECK(!callback_.is_null()); | 713 DCHECK(!callback_.is_null()); |
| 703 | 714 |
| 704 read_buf_ = NULL; // Release the buffer before invoking the callback. | 715 read_buf_ = NULL; // Release the buffer before invoking the callback. |
| 705 | 716 |
| 706 // Since Run may result in Read being called, clear callback_ up front. | 717 // Since Run may result in Read being called, clear callback_ up front. |
| 707 CompletionCallback c = callback_; | 718 CompletionCallback c = callback_; |
| (...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2904 } | 2915 } |
| 2905 } | 2916 } |
| 2906 | 2917 |
| 2907 void HttpCache::Transaction::ResetNetworkTransaction() { | 2918 void HttpCache::Transaction::ResetNetworkTransaction() { |
| 2908 DCHECK(!old_network_trans_load_timing_); | 2919 DCHECK(!old_network_trans_load_timing_); |
| 2909 DCHECK(network_trans_); | 2920 DCHECK(network_trans_); |
| 2910 LoadTimingInfo load_timing; | 2921 LoadTimingInfo load_timing; |
| 2911 if (network_trans_->GetLoadTimingInfo(&load_timing)) | 2922 if (network_trans_->GetLoadTimingInfo(&load_timing)) |
| 2912 old_network_trans_load_timing_.reset(new LoadTimingInfo(load_timing)); | 2923 old_network_trans_load_timing_.reset(new LoadTimingInfo(load_timing)); |
| 2913 total_received_bytes_ += network_trans_->GetTotalReceivedBytes(); | 2924 total_received_bytes_ += network_trans_->GetTotalReceivedBytes(); |
| 2925 ConnectionAttempts attempts; | |
| 2926 network_trans_->GetConnectionAttempts(&attempts); | |
| 2927 for (const auto& attempt : attempts) | |
| 2928 old_connection_attempts_.push_back(attempt); | |
|
Randy Smith (Not in Mondays)
2015/04/27 17:53:06
I find myself wondering if it might make sense to
| |
| 2914 network_trans_.reset(); | 2929 network_trans_.reset(); |
| 2915 } | 2930 } |
| 2916 | 2931 |
| 2917 // Histogram data from the end of 2010 show the following distribution of | 2932 // Histogram data from the end of 2010 show the following distribution of |
| 2918 // response headers: | 2933 // response headers: |
| 2919 // | 2934 // |
| 2920 // Content-Length............... 87% | 2935 // Content-Length............... 87% |
| 2921 // Date......................... 98% | 2936 // Date......................... 98% |
| 2922 // Last-Modified................ 49% | 2937 // Last-Modified................ 49% |
| 2923 // Etag......................... 19% | 2938 // Etag......................... 19% |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3031 default: | 3046 default: |
| 3032 NOTREACHED(); | 3047 NOTREACHED(); |
| 3033 } | 3048 } |
| 3034 } | 3049 } |
| 3035 | 3050 |
| 3036 void HttpCache::Transaction::OnIOComplete(int result) { | 3051 void HttpCache::Transaction::OnIOComplete(int result) { |
| 3037 DoLoop(result); | 3052 DoLoop(result); |
| 3038 } | 3053 } |
| 3039 | 3054 |
| 3040 } // namespace net | 3055 } // namespace net |
| OLD | NEW |