Index: net/proxy/dhcpcsvc_init_win.cc |
diff --git a/net/proxy/dhcpcsvc_init_win.cc b/net/proxy/dhcpcsvc_init_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3a0aa02ad25f170c566d719184374fba261e09ae |
--- /dev/null |
+++ b/net/proxy/dhcpcsvc_init_win.cc |
@@ -0,0 +1,40 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/proxy/dhcpcsvc_init_win.h" |
+ |
+#include "base/lazy_instance.h" |
+#include "base/logging.h" |
+ |
+#include <dhcpcsdk.h> |
+#include <dhcpv6csdk.h> |
+ |
+namespace { |
+ |
+class DhcpcsvcInitSingleton { |
+ public: |
+ DhcpcsvcInitSingleton() { |
+ DWORD version = 0; |
+ DWORD err = DhcpCApiInitialize(&version); |
+ DCHECK(err == ERROR_SUCCESS); // DCHECK_EQ complains of unsigned mismatch. |
+ } |
+ |
+ ~DhcpcsvcInitSingleton() { |
+ // Worker pool threads that use the DHCP API may still be running, so skip |
+ // cleanup. |
+ } |
+}; |
+ |
+static base::LazyInstance<DhcpcsvcInitSingleton> g_dhcpcsvc_init_singleton( |
+ base::LINKER_INITIALIZED); |
+ |
+} // namespace |
+ |
+namespace net { |
+ |
+void EnsureDhcpcsvcInit() { |
+ g_dhcpcsvc_init_singleton.Get(); |
+} |
+ |
+} // namespace net |