| 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_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 class HttpServerPropertiesImplPeer { | 24 class HttpServerPropertiesImplPeer { |
| 25 public: | 25 public: |
| 26 static void AddBrokenAlternativeServiceWithExpirationTime( | 26 static void AddBrokenAlternativeServiceWithExpirationTime( |
| 27 HttpServerPropertiesImpl& impl, | 27 HttpServerPropertiesImpl& impl, |
| 28 AlternativeService alternative_service, | 28 AlternativeService alternative_service, |
| 29 base::TimeTicks when) { | 29 base::TimeTicks when) { |
| 30 impl.broken_alternative_services_.insert( | 30 impl.broken_alternative_services_.insert( |
| 31 std::make_pair(alternative_service, when)); | 31 std::make_pair(alternative_service, when)); |
| 32 ++impl.recently_broken_alternative_services_[alternative_service]; | 32 auto it = |
| 33 impl.recently_broken_alternative_services_.Get(alternative_service); |
| 34 if (it == impl.recently_broken_alternative_services_.end()) { |
| 35 impl.recently_broken_alternative_services_.Put(alternative_service, 1); |
| 36 } else { |
| 37 it->second++; |
| 38 } |
| 33 } | 39 } |
| 34 | 40 |
| 35 static void ExpireBrokenAlternateProtocolMappings( | 41 static void ExpireBrokenAlternateProtocolMappings( |
| 36 HttpServerPropertiesImpl& impl) { | 42 HttpServerPropertiesImpl& impl) { |
| 37 impl.ExpireBrokenAlternateProtocolMappings(); | 43 impl.ExpireBrokenAlternateProtocolMappings(); |
| 38 } | 44 } |
| 39 }; | 45 }; |
| 40 | 46 |
| 41 void PrintTo(const AlternativeService& alternative_service, std::ostream* os) { | 47 void PrintTo(const AlternativeService& alternative_service, std::ostream* os) { |
| 42 *os << alternative_service.ToString(); | 48 *os << alternative_service.ToString(); |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); | 1228 EXPECT_EQ(quic_server_info1, *(impl_.GetQuicServerInfo(quic_server_id))); |
| 1223 | 1229 |
| 1224 impl_.Clear(); | 1230 impl_.Clear(); |
| 1225 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); | 1231 EXPECT_EQ(0u, impl_.quic_server_info_map().size()); |
| 1226 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); | 1232 EXPECT_EQ(nullptr, impl_.GetQuicServerInfo(quic_server_id)); |
| 1227 } | 1233 } |
| 1228 | 1234 |
| 1229 } // namespace | 1235 } // namespace |
| 1230 | 1236 |
| 1231 } // namespace net | 1237 } // namespace net |
| OLD | NEW |