OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_manager.h" | 5 #include "net/http/http_server_properties_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 new AlternateProtocolMap(kMaxAlternateProtocolHostsToPersist); | 606 new AlternateProtocolMap(kMaxAlternateProtocolHostsToPersist); |
607 const AlternateProtocolMap& map = | 607 const AlternateProtocolMap& map = |
608 http_server_properties_impl_->alternate_protocol_map(); | 608 http_server_properties_impl_->alternate_protocol_map(); |
609 count = 0; | 609 count = 0; |
610 typedef std::map<std::string, bool> CanonicalHostPersistedMap; | 610 typedef std::map<std::string, bool> CanonicalHostPersistedMap; |
611 CanonicalHostPersistedMap persisted_map; | 611 CanonicalHostPersistedMap persisted_map; |
612 for (AlternateProtocolMap::const_iterator it = map.begin(); | 612 for (AlternateProtocolMap::const_iterator it = map.begin(); |
613 it != map.end() && count < kMaxAlternateProtocolHostsToPersist; ++it) { | 613 it != map.end() && count < kMaxAlternateProtocolHostsToPersist; ++it) { |
614 const HostPortPair& server = it->first; | 614 const HostPortPair& server = it->first; |
615 std::string canonical_suffix = | 615 std::string canonical_suffix = |
616 http_server_properties_impl_->GetCanonicalSuffix(server); | 616 http_server_properties_impl_->GetCanonicalSuffix(server.host()); |
617 if (!canonical_suffix.empty()) { | 617 if (!canonical_suffix.empty()) { |
618 if (persisted_map.find(canonical_suffix) != persisted_map.end()) | 618 if (persisted_map.find(canonical_suffix) != persisted_map.end()) |
619 continue; | 619 continue; |
620 persisted_map[canonical_suffix] = true; | 620 persisted_map[canonical_suffix] = true; |
621 } | 621 } |
622 alternate_protocol_map->Put(server, it->second); | 622 alternate_protocol_map->Put(server, it->second); |
623 ++count; | 623 ++count; |
624 } | 624 } |
625 | 625 |
626 SupportsQuicMap* supports_quic_map = new SupportsQuicMap(); | 626 SupportsQuicMap* supports_quic_map = new SupportsQuicMap(); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 completion.Run(); | 858 completion.Run(); |
859 } | 859 } |
860 | 860 |
861 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { | 861 void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() { |
862 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); | 862 DCHECK(pref_task_runner_->RunsTasksOnCurrentThread()); |
863 if (!setting_prefs_) | 863 if (!setting_prefs_) |
864 ScheduleUpdateCacheOnPrefThread(); | 864 ScheduleUpdateCacheOnPrefThread(); |
865 } | 865 } |
866 | 866 |
867 } // namespace net | 867 } // namespace net |
OLD | NEW |