Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: net/base/net_util_win.cc

Issue 940133002: Instrumenting QUIC code to find jank in GetConnectionDescriptionString (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/quic_connection_logger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <iphlpapi.h> 7 #include <iphlpapi.h>
8 #include <wlanapi.h> 8 #include <wlanapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/lazy_instance.h" 13 #include "base/lazy_instance.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/profiler/scoped_tracker.h"
15 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
16 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
17 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
18 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
19 #include "base/threading/thread_restrictions.h" 20 #include "base/threading/thread_restrictions.h"
20 #include "base/win/scoped_handle.h" 21 #include "base/win/scoped_handle.h"
21 #include "base/win/windows_version.h" 22 #include "base/win/windows_version.h"
22 #include "net/base/escape.h" 23 #include "net/base/escape.h"
23 #include "net/base/ip_endpoint.h" 24 #include "net/base/ip_endpoint.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapters, &len); 194 result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapters, &len);
194 if (result != NO_ERROR) { 195 if (result != NO_ERROR) {
195 LOG(ERROR) << "GetAdaptersAddresses failed: " << result; 196 LOG(ERROR) << "GetAdaptersAddresses failed: " << result;
196 return false; 197 return false;
197 } 198 }
198 199
199 return internal::GetNetworkListImpl(networks, policy, is_xp, adapters); 200 return internal::GetNetworkListImpl(networks, policy, is_xp, adapters);
200 } 201 }
201 202
202 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() { 203 WifiPHYLayerProtocol GetWifiPHYLayerProtocol() {
204 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
205 tracked_objects::ScopedTracker tracking_profile1(
206 FROM_HERE_WITH_EXPLICIT_FUNCTION(
207 "422516 net_util_win::GetWifiPHYLayerProtocol1"));
203 const internal::WlanApi& wlanapi = internal::WlanApi::GetInstance(); 208 const internal::WlanApi& wlanapi = internal::WlanApi::GetInstance();
204 if (!wlanapi.initialized) 209 if (!wlanapi.initialized)
205 return WIFI_PHY_LAYER_PROTOCOL_NONE; 210 return WIFI_PHY_LAYER_PROTOCOL_NONE;
206 211
207 internal::WlanHandle client; 212 internal::WlanHandle client;
208 DWORD cur_version = 0; 213 DWORD cur_version = 0;
209 const DWORD kMaxClientVersion = 2; 214 const DWORD kMaxClientVersion = 2;
215 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
216 tracked_objects::ScopedTracker tracking_profile2(
217 FROM_HERE_WITH_EXPLICIT_FUNCTION(
218 "422516 net_util_win::GetWifiPHYLayerProtocol2"));
210 DWORD result = wlanapi.OpenHandle(kMaxClientVersion, &cur_version, &client); 219 DWORD result = wlanapi.OpenHandle(kMaxClientVersion, &cur_version, &client);
211 if (result != ERROR_SUCCESS) 220 if (result != ERROR_SUCCESS)
212 return WIFI_PHY_LAYER_PROTOCOL_NONE; 221 return WIFI_PHY_LAYER_PROTOCOL_NONE;
213 222
223 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
224 tracked_objects::ScopedTracker tracking_profile3(
225 FROM_HERE_WITH_EXPLICIT_FUNCTION(
226 "422516 net_util_win::GetWifiPHYLayerProtocol3"));
214 WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL; 227 WLAN_INTERFACE_INFO_LIST* interface_list_ptr = NULL;
215 result = wlanapi.enum_interfaces_func(client.Get(), NULL, 228 result = wlanapi.enum_interfaces_func(client.Get(), NULL,
216 &interface_list_ptr); 229 &interface_list_ptr);
217 if (result != ERROR_SUCCESS) 230 if (result != ERROR_SUCCESS)
218 return WIFI_PHY_LAYER_PROTOCOL_NONE; 231 return WIFI_PHY_LAYER_PROTOCOL_NONE;
219 scoped_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> interface_list( 232 scoped_ptr<WLAN_INTERFACE_INFO_LIST, internal::WlanApiDeleter> interface_list(
220 interface_list_ptr); 233 interface_list_ptr);
221 234
235 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
236 tracked_objects::ScopedTracker tracking_profile4(
237 FROM_HERE_WITH_EXPLICIT_FUNCTION(
238 "422516 net_util_win::GetWifiPHYLayerProtocol4"));
222 // Assume at most one connected wifi interface. 239 // Assume at most one connected wifi interface.
223 WLAN_INTERFACE_INFO* info = NULL; 240 WLAN_INTERFACE_INFO* info = NULL;
224 for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) { 241 for (unsigned i = 0; i < interface_list->dwNumberOfItems; ++i) {
225 if (interface_list->InterfaceInfo[i].isState == 242 if (interface_list->InterfaceInfo[i].isState ==
226 wlan_interface_state_connected) { 243 wlan_interface_state_connected) {
227 info = &interface_list->InterfaceInfo[i]; 244 info = &interface_list->InterfaceInfo[i];
228 break; 245 break;
229 } 246 }
230 } 247 }
231 248
232 if (info == NULL) 249 if (info == NULL)
233 return WIFI_PHY_LAYER_PROTOCOL_NONE; 250 return WIFI_PHY_LAYER_PROTOCOL_NONE;
234 251
235 WLAN_CONNECTION_ATTRIBUTES* conn_info_ptr; 252 WLAN_CONNECTION_ATTRIBUTES* conn_info_ptr;
236 DWORD conn_info_size = 0; 253 DWORD conn_info_size = 0;
237 WLAN_OPCODE_VALUE_TYPE op_code; 254 WLAN_OPCODE_VALUE_TYPE op_code;
255 // TODO(rtenneti): Remove ScopedTracker below once crbug.com/422516 is fixed.
256 tracked_objects::ScopedTracker tracking_profile5(
257 FROM_HERE_WITH_EXPLICIT_FUNCTION(
258 "422516 net_util_win::GetWifiPHYLayerProtocol5"));
238 result = wlanapi.query_interface_func( 259 result = wlanapi.query_interface_func(
239 client.Get(), &info->InterfaceGuid, wlan_intf_opcode_current_connection, 260 client.Get(), &info->InterfaceGuid, wlan_intf_opcode_current_connection,
240 NULL, &conn_info_size, reinterpret_cast<VOID**>(&conn_info_ptr), 261 NULL, &conn_info_size, reinterpret_cast<VOID**>(&conn_info_ptr),
241 &op_code); 262 &op_code);
242 if (result != ERROR_SUCCESS) 263 if (result != ERROR_SUCCESS)
243 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN; 264 return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN;
244 scoped_ptr<WLAN_CONNECTION_ATTRIBUTES, internal::WlanApiDeleter> conn_info( 265 scoped_ptr<WLAN_CONNECTION_ATTRIBUTES, internal::WlanApiDeleter> conn_info(
245 conn_info_ptr); 266 conn_info_ptr);
246 267
247 switch (conn_info->wlanAssociationAttributes.dot11PhyType) { 268 switch (conn_info->wlanAssociationAttributes.dot11PhyType) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 scoped_ptr<ScopedWifiOptions> SetWifiOptions(int options) { 340 scoped_ptr<ScopedWifiOptions> SetWifiOptions(int options) {
320 return scoped_ptr<ScopedWifiOptions>(new WifiOptionSetter(options)); 341 return scoped_ptr<ScopedWifiOptions>(new WifiOptionSetter(options));
321 } 342 }
322 343
323 std::string GetWifiSSID() { 344 std::string GetWifiSSID() {
324 NOTIMPLEMENTED(); 345 NOTIMPLEMENTED();
325 return ""; 346 return "";
326 } 347 }
327 348
328 } // namespace net 349 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_connection_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698