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 { |
| 66 UMA_HISTOGRAM_COUNTS( |
| 67 "Net.AlternativeServiceServers.MoreOrEqualCacheEntries", -size_diff); |
| 68 } |
| 69 |
59 AlternativeServiceMap new_alternative_service_map( | 70 AlternativeServiceMap new_alternative_service_map( |
60 AlternativeServiceMap::NO_AUTO_EVICT); | 71 AlternativeServiceMap::NO_AUTO_EVICT); |
61 // Add the entries from persisted data. | 72 // Add the entries from persisted data. |
62 for (AlternativeServiceMap::reverse_iterator input_it = | 73 for (AlternativeServiceMap::reverse_iterator input_it = |
63 alternative_service_map->rbegin(); | 74 alternative_service_map->rbegin(); |
64 input_it != alternative_service_map->rend(); ++input_it) { | 75 input_it != alternative_service_map->rend(); ++input_it) { |
65 DCHECK(!input_it->second.empty()); | 76 DCHECK(!input_it->second.empty()); |
66 new_alternative_service_map.Put(input_it->first, input_it->second); | 77 new_alternative_service_map.Put(input_it->first, input_it->second); |
67 } | 78 } |
68 | 79 |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); | 781 base::TimeDelta delay = when > now ? when - now : base::TimeDelta(); |
771 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 782 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
772 FROM_HERE, | 783 FROM_HERE, |
773 base::Bind( | 784 base::Bind( |
774 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, | 785 &HttpServerPropertiesImpl::ExpireBrokenAlternateProtocolMappings, |
775 weak_ptr_factory_.GetWeakPtr()), | 786 weak_ptr_factory_.GetWeakPtr()), |
776 delay); | 787 delay); |
777 } | 788 } |
778 | 789 |
779 } // namespace net | 790 } // namespace net |
OLD | NEW |