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 "content/renderer/p2p/ipc_network_manager.h" | 5 #include "content/renderer/p2p/ipc_network_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 talk_base::Network* network = new talk_base::Network( | 98 talk_base::Network* network = new talk_base::Network( |
99 it->name, it->name, ip6_addr, 64, | 99 it->name, it->name, ip6_addr, 64, |
100 ConvertConnectionTypeToAdapterType(it->type)); | 100 ConvertConnectionTypeToAdapterType(it->type)); |
101 network->AddIP(ip6_addr); | 101 network->AddIP(ip6_addr); |
102 networks.push_back(network); | 102 networks.push_back(network); |
103 ++ipv6_interfaces; | 103 ++ipv6_interfaces; |
104 } | 104 } |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 if (ipv4_interfaces > 0) { | |
109 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv4Interfaces", | |
110 ipv4_interfaces); | |
111 } | |
112 | 108 |
113 if (ipv6_interfaces > 0) { | 109 // Send interface counts to UMA. |
114 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces", | 110 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv4Interfaces", |
115 ipv6_interfaces); | 111 ipv4_interfaces); |
116 } | 112 UMA_HISTOGRAM_COUNTS_100("WebRTC.PeerConnection.IPv6Interfaces", |
| 113 ipv6_interfaces); |
117 | 114 |
118 if (CommandLine::ForCurrentProcess()->HasSwitch( | 115 if (CommandLine::ForCurrentProcess()->HasSwitch( |
119 switches::kAllowLoopbackInPeerConnection)) { | 116 switches::kAllowLoopbackInPeerConnection)) { |
120 std::string name_v4("loopback_ipv4"); | 117 std::string name_v4("loopback_ipv4"); |
121 talk_base::IPAddress ip_address_v4(INADDR_LOOPBACK); | 118 talk_base::IPAddress ip_address_v4(INADDR_LOOPBACK); |
122 talk_base::Network* network_v4 = new talk_base::Network( | 119 talk_base::Network* network_v4 = new talk_base::Network( |
123 name_v4, name_v4, ip_address_v4, 32, talk_base::ADAPTER_TYPE_UNKNOWN); | 120 name_v4, name_v4, ip_address_v4, 32, talk_base::ADAPTER_TYPE_UNKNOWN); |
124 network_v4->AddIP(ip_address_v4); | 121 network_v4->AddIP(ip_address_v4); |
125 networks.push_back(network_v4); | 122 networks.push_back(network_v4); |
126 | 123 |
127 std::string name_v6("loopback_ipv6"); | 124 std::string name_v6("loopback_ipv6"); |
128 talk_base::IPAddress ip_address_v6(in6addr_loopback); | 125 talk_base::IPAddress ip_address_v6(in6addr_loopback); |
129 talk_base::Network* network_v6 = new talk_base::Network( | 126 talk_base::Network* network_v6 = new talk_base::Network( |
130 name_v6, name_v6, ip_address_v6, 64, talk_base::ADAPTER_TYPE_UNKNOWN); | 127 name_v6, name_v6, ip_address_v6, 64, talk_base::ADAPTER_TYPE_UNKNOWN); |
131 network_v6->AddIP(ip_address_v6); | 128 network_v6->AddIP(ip_address_v6); |
132 networks.push_back(network_v6); | 129 networks.push_back(network_v6); |
133 } | 130 } |
134 | 131 |
135 bool changed = false; | 132 bool changed = false; |
136 MergeNetworkList(networks, &changed); | 133 MergeNetworkList(networks, &changed); |
137 if (changed) | 134 if (changed) |
138 SignalNetworksChanged(); | 135 SignalNetworksChanged(); |
139 } | 136 } |
140 | 137 |
141 void IpcNetworkManager::SendNetworksChangedSignal() { | 138 void IpcNetworkManager::SendNetworksChangedSignal() { |
142 SignalNetworksChanged(); | 139 SignalNetworksChanged(); |
143 } | 140 } |
144 | 141 |
145 } // namespace content | 142 } // namespace content |
OLD | NEW |