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/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 while (!all_sessions_.empty()) { | 919 while (!all_sessions_.empty()) { |
920 size_t initial_size = all_sessions_.size(); | 920 size_t initial_size = all_sessions_.size(); |
921 all_sessions_.begin()->first->CloseSessionOnError(error, | 921 all_sessions_.begin()->first->CloseSessionOnError(error, |
922 QUIC_INTERNAL_ERROR); | 922 QUIC_INTERNAL_ERROR); |
923 DCHECK_NE(initial_size, all_sessions_.size()); | 923 DCHECK_NE(initial_size, all_sessions_.size()); |
924 } | 924 } |
925 DCHECK(all_sessions_.empty()); | 925 DCHECK(all_sessions_.empty()); |
926 } | 926 } |
927 | 927 |
928 base::Value* QuicStreamFactory::QuicStreamFactoryInfoToValue() const { | 928 scoped_ptr<base::Value> QuicStreamFactory::QuicStreamFactoryInfoToValue() |
929 base::ListValue* list = new base::ListValue(); | 929 const { |
| 930 scoped_ptr<base::ListValue> list(new base::ListValue()); |
930 | 931 |
931 for (SessionMap::const_iterator it = active_sessions_.begin(); | 932 for (SessionMap::const_iterator it = active_sessions_.begin(); |
932 it != active_sessions_.end(); ++it) { | 933 it != active_sessions_.end(); ++it) { |
933 const QuicServerId& server_id = it->first; | 934 const QuicServerId& server_id = it->first; |
934 QuicClientSession* session = it->second; | 935 QuicClientSession* session = it->second; |
935 const AliasSet& aliases = session_aliases_.find(session)->second; | 936 const AliasSet& aliases = session_aliases_.find(session)->second; |
936 // Only add a session to the list once. | 937 // Only add a session to the list once. |
937 if (server_id == *aliases.begin()) { | 938 if (server_id == *aliases.begin()) { |
938 std::set<HostPortPair> hosts; | 939 std::set<HostPortPair> hosts; |
939 for (AliasSet::const_iterator alias_it = aliases.begin(); | 940 for (AliasSet::const_iterator alias_it = aliases.begin(); |
940 alias_it != aliases.end(); ++alias_it) { | 941 alias_it != aliases.end(); ++alias_it) { |
941 hosts.insert(alias_it->host_port_pair()); | 942 hosts.insert(alias_it->host_port_pair()); |
942 } | 943 } |
943 list->Append(session->GetInfoAsValue(hosts)); | 944 list->Append(session->GetInfoAsValue(hosts)); |
944 } | 945 } |
945 } | 946 } |
946 return list; | 947 return list.Pass(); |
947 } | 948 } |
948 | 949 |
949 void QuicStreamFactory::ClearCachedStatesInCryptoConfig() { | 950 void QuicStreamFactory::ClearCachedStatesInCryptoConfig() { |
950 crypto_config_.ClearCachedStates(); | 951 crypto_config_.ClearCachedStates(); |
951 } | 952 } |
952 | 953 |
953 void QuicStreamFactory::OnIPAddressChanged() { | 954 void QuicStreamFactory::OnIPAddressChanged() { |
954 CloseAllSessions(ERR_NETWORK_CHANGED); | 955 CloseAllSessions(ERR_NETWORK_CHANGED); |
955 set_require_confirmation(true); | 956 set_require_confirmation(true); |
956 } | 957 } |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 // Since the session was active, there's no longer an | 1240 // Since the session was active, there's no longer an |
1240 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1241 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
1241 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1242 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
1242 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1243 // it as recently broken, which means that 0-RTT will be disabled but we'll |
1243 // still race. | 1244 // still race. |
1244 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1245 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
1245 alternative_service); | 1246 alternative_service); |
1246 } | 1247 } |
1247 | 1248 |
1248 } // namespace net | 1249 } // namespace net |
OLD | NEW |