OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
930 // TODO(mbelshe): The keepalive property is really a property of | 930 // TODO(mbelshe): The keepalive property is really a property of |
931 // the stream. No need to compute it here just to pass back | 931 // the stream. No need to compute it here just to pass back |
932 // to the stream's Close function. | 932 // to the stream's Close function. |
933 if (stream_->CanFindEndOfResponse()) | 933 if (stream_->CanFindEndOfResponse()) |
934 keep_alive = GetResponseHeaders()->IsKeepAlive(); | 934 keep_alive = GetResponseHeaders()->IsKeepAlive(); |
935 } | 935 } |
936 | 936 |
937 // Clean up connection if we are done. | 937 // Clean up connection if we are done. |
938 if (done) { | 938 if (done) { |
939 LogTransactionMetrics(); | 939 LogTransactionMetrics(); |
940 LogNumRttVsBytesMetrics(); | |
940 stream_->Close(!keep_alive); | 941 stream_->Close(!keep_alive); |
941 // Note: we don't reset the stream here. We've closed it, but we still | 942 // Note: we don't reset the stream here. We've closed it, but we still |
942 // need it around so that callers can call methods such as | 943 // need it around so that callers can call methods such as |
943 // GetUploadProgress() and have them be meaningful. | 944 // GetUploadProgress() and have them be meaningful. |
944 // TODO(mbelshe): This means we closed the stream here, and we close it | 945 // TODO(mbelshe): This means we closed the stream here, and we close it |
945 // again in ~HttpNetworkTransaction. Clean that up. | 946 // again in ~HttpNetworkTransaction. Clean that up. |
946 | 947 |
947 // The next Read call will return 0 (EOF). | 948 // The next Read call will return 0 (EOF). |
948 } | 949 } |
949 | 950 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 base::TimeDelta::FromMilliseconds(1), | 1077 base::TimeDelta::FromMilliseconds(1), |
1077 base::TimeDelta::FromMinutes(10), 100); | 1078 base::TimeDelta::FromMinutes(10), 100); |
1078 if (!stream_->IsConnectionReused()) { | 1079 if (!stream_->IsConnectionReused()) { |
1079 UMA_HISTOGRAM_CLIPPED_TIMES( | 1080 UMA_HISTOGRAM_CLIPPED_TIMES( |
1080 "Net.Transaction_Latency_Total_New_Connection_Under_10", | 1081 "Net.Transaction_Latency_Total_New_Connection_Under_10", |
1081 total_duration, base::TimeDelta::FromMilliseconds(1), | 1082 total_duration, base::TimeDelta::FromMilliseconds(1), |
1082 base::TimeDelta::FromMinutes(10), 100); | 1083 base::TimeDelta::FromMinutes(10), 100); |
1083 } | 1084 } |
1084 } | 1085 } |
1085 | 1086 |
1087 void HttpNetworkTransaction::LogNumRttVsBytesMetrics() const { | |
willchan no longer on Chromium
2011/06/09 15:08:54
Does this really need to be a function?
Gagan
2011/06/09 19:49:26
removed
| |
1088 stream_->LogNumRttVsBytesMetrics(); | |
1089 } | |
1090 | |
1086 int HttpNetworkTransaction::HandleCertificateRequest(int error) { | 1091 int HttpNetworkTransaction::HandleCertificateRequest(int error) { |
1087 // There are two paths through which the server can request a certificate | 1092 // There are two paths through which the server can request a certificate |
1088 // from us. The first is during the initial handshake, the second is | 1093 // from us. The first is during the initial handshake, the second is |
1089 // during SSL renegotiation. | 1094 // during SSL renegotiation. |
1090 // | 1095 // |
1091 // In both cases, we want to close the connection before proceeding. | 1096 // In both cases, we want to close the connection before proceeding. |
1092 // We do this for two reasons: | 1097 // We do this for two reasons: |
1093 // First, we don't want to keep the connection to the server hung for a | 1098 // First, we don't want to keep the connection to the server hung for a |
1094 // long time while the user selects a certificate. | 1099 // long time while the user selects a certificate. |
1095 // Second, even if we did keep the connection open, NSS has a bug where | 1100 // Second, even if we did keep the connection open, NSS has a bug where |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1341 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1346 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1342 state); | 1347 state); |
1343 break; | 1348 break; |
1344 } | 1349 } |
1345 return description; | 1350 return description; |
1346 } | 1351 } |
1347 | 1352 |
1348 #undef STATE_CASE | 1353 #undef STATE_CASE |
1349 | 1354 |
1350 } // namespace net | 1355 } // namespace net |
OLD | NEW |