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

Side by Side Diff: net/proxy/dhcp_proxy_script_adapter_fetcher_win.cc

Issue 6975027: Add metrics for DHCP WPAD feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tracking of unhandled DHCP API errors. Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/proxy/dhcp_proxy_script_adapter_fetcher_win.h" 5 #include "net/proxy/dhcp_proxy_script_adapter_fetcher_win.h"
6 6
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "base/metrics/histogram.h"
8 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
9 #include "base/task.h" 10 #include "base/task.h"
10 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
11 #include "base/time.h" 12 #include "base/time.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 #include "net/proxy/dhcpcsvc_init_win.h" 14 #include "net/proxy/dhcpcsvc_init_win.h"
14 #include "net/proxy/proxy_script_fetcher_impl.h" 15 #include "net/proxy/proxy_script_fetcher_impl.h"
15 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
16 17
17 #include <windows.h> 18 #include <windows.h>
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 NULL, 263 NULL,
263 const_cast<LPWSTR>(adapter_name_wide.c_str()), 264 const_cast<LPWSTR>(adapter_name_wide.c_str()),
264 NULL, 265 NULL,
265 send_params, request_params, 266 send_params, request_params,
266 result_buffer.get(), &result_buffer_size, 267 result_buffer.get(), &result_buffer_size,
267 NULL); 268 NULL);
268 ++retry_count; 269 ++retry_count;
269 } while (res == ERROR_MORE_DATA && retry_count <= 3); 270 } while (res == ERROR_MORE_DATA && retry_count <= 3);
270 271
271 if (res != NO_ERROR) { 272 if (res != NO_ERROR) {
272 NOTREACHED(); 273 LOG(INFO) << "Error fetching PAC URL from DHCP: " << res;
274 UMA_HISTOGRAM_COUNTS("Net.DhcpWpadUnhandledDhcpError", 1);
273 } else if (wpad_params.nBytesData) { 275 } else if (wpad_params.nBytesData) {
274 // The result should be ASCII, not wide character. 276 // The result should be ASCII, not wide character.
275 DCHECK_EQ(strlen(reinterpret_cast<const char*>(wpad_params.Data)) + 1, 277 DCHECK_EQ(strlen(reinterpret_cast<const char*>(wpad_params.Data)) + 1,
276 wpad_params.nBytesData); 278 wpad_params.nBytesData);
277 // Return only up to the first null in case of embedded NULLs; if the 279 // Return only up to the first null in case of embedded NULLs; if the
278 // server is giving us back a buffer with embedded NULLs, something is 280 // server is giving us back a buffer with embedded NULLs, something is
279 // broken anyway. 281 // broken anyway.
280 return std::string(reinterpret_cast<const char *>(wpad_params.Data)); 282 return std::string(reinterpret_cast<const char *>(wpad_params.Data));
281 } 283 }
282 284
283 return ""; 285 return "";
284 } 286 }
285 287
286 } // namespace net 288 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698