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_server_properties_impl.h" | 5 #include "net/http/http_server_properties_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/metrics/histogram_macros.h" | |
| 13 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 49 return; | 50 return; |
| 50 // Add the entries from persisted data. | 51 // Add the entries from persisted data. |
| 51 for (std::vector<std::string>::reverse_iterator it = spdy_servers->rbegin(); | 52 for (std::vector<std::string>::reverse_iterator it = spdy_servers->rbegin(); |
| 52 it != spdy_servers->rend(); ++it) { | 53 it != spdy_servers->rend(); ++it) { |
| 53 spdy_servers_map_.Put(*it, support_spdy); | 54 spdy_servers_map_.Put(*it, support_spdy); |
| 54 } | 55 } |
| 55 } | 56 } |
| 56 | 57 |
| 57 void HttpServerPropertiesImpl::InitializeAlternativeServiceServers( | 58 void HttpServerPropertiesImpl::InitializeAlternativeServiceServers( |
| 58 AlternativeServiceMap* alternative_service_map) { | 59 AlternativeServiceMap* alternative_service_map) { |
| 60 int32 size_diff = | |
| 61 alternative_service_map->size() - alternative_service_map_.size(); | |
| 62 if (size_diff > 0) { | |
| 63 UMA_HISTOGRAM_COUNTS("Net.AlternativeServiceServers.MorePrefsEntries", | |
| 64 size_diff); | |
| 65 } else { | |
|
Alexei Svitkine (slow)
2015/12/18 19:58:48
Should you check that size_diff isn't 0? It's fine
ramant (doing other things)
2015/12/18 21:34:55
Good point. Changed the histogram name and descrip
| |
| 66 UMA_HISTOGRAM_COUNTS("Net.AlternativeServiceServers.MoreCacheEntries", | |
| 67 -size_diff); | |
| 68 } | |
| 69 | |
| 59 // Add the entries from persisted data. | 70 // Add the entries from persisted data. |
| 60 for (AlternativeServiceMap::reverse_iterator input_it = | 71 for (AlternativeServiceMap::reverse_iterator input_it = |
| 61 alternative_service_map->rbegin(); | 72 alternative_service_map->rbegin(); |
| 62 input_it != alternative_service_map->rend(); ++input_it) { | 73 input_it != alternative_service_map->rend(); ++input_it) { |
| 63 DCHECK(!input_it->second.empty()); | 74 DCHECK(!input_it->second.empty()); |
| 64 alternative_service_map_.Put(input_it->first, input_it->second); | 75 alternative_service_map_.Put(input_it->first, input_it->second); |
| 65 } | 76 } |
| 66 | 77 |
| 67 // Attempt to find canonical servers. | 78 // Attempt to find canonical servers. |
| 68 uint16 canonical_ports[] = { 80, 443 }; | 79 uint16 canonical_ports[] = { 80, 443 }; |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 718 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 729 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
| 719 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 730 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 720 FROM_HERE, | 731 FROM_HERE, |
| 721 base::Bind( | 732 base::Bind( |
| 722 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 733 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
| 723 weak_ptr_factory_.GetWeakPtr()), | 734 weak_ptr_factory_.GetWeakPtr()), |
| 724 delay); | 735 delay); |
| 725 } | 736 } |
| 726 | 737 |
| 727 } // namespace net | 738 } // namespace net |
| OLD | NEW |