Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/dhcpcsvc_init_win.h" | 5 #include "net/proxy/dhcpcsvc_init_win.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 #include <dhcpcsdk.h> | 10 #include <dhcpcsdk.h> |
| 11 #include <dhcpv6csdk.h> | 11 #include <dhcpv6csdk.h> |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class DhcpcsvcInitSingleton { | 15 class DhcpcsvcInitSingleton { |
| 16 public: | 16 public: |
| 17 DhcpcsvcInitSingleton() { | 17 DhcpcsvcInitSingleton() { |
| 18 DWORD version = 0; | 18 DWORD version = 0; |
| 19 DWORD err = DhcpCApiInitialize(&version); | 19 DWORD err = DhcpCApiInitialize(&version); |
| 20 DCHECK(err == ERROR_SUCCESS); // DCHECK_EQ complains of unsigned mismatch. | 20 DCHECK(err == ERROR_SUCCESS); // DCHECK_EQ complains of unsigned mismatch. |
| 21 } | 21 } |
| 22 | |
| 23 ~DhcpcsvcInitSingleton() { | |
|
gab
2016/04/26 11:53:18
Make the destructor private w/ a comment of why it
Patrick Monette
2016/04/26 19:05:28
The comment that explain that is Worker pool threa
Patrick Monette
2016/04/26 19:18:38
clear*
| |
| 24 // Worker pool threads that use the DHCP API may still be running, so skip | |
| 25 // cleanup. | |
| 26 } | |
| 27 }; | 22 }; |
| 28 | 23 |
| 29 static base::LazyInstance<DhcpcsvcInitSingleton> g_dhcpcsvc_init_singleton = | 24 // Worker pool threads that use the DHCP API may still be running. Leak instance |
|
robliao
2016/04/25 23:05:25
s/running/running at shutdown/
Patrick Monette
2016/04/26 19:05:27
Done.
| |
| 30 LAZY_INSTANCE_INITIALIZER; | 25 // and skip cleanup. |
| 26 static base::LazyInstance<DhcpcsvcInitSingleton>::Leaky | |
| 27 g_dhcpcsvc_init_singleton = LAZY_INSTANCE_INITIALIZER; | |
|
gab
2016/04/26 11:53:18
Is the change in this file required to land the ot
Patrick Monette
2016/04/26 19:05:27
Threads with CONTINUE_ON_SHUTDOWN behavior were ac
gab
2016/04/26 20:11:47
Ah I see, it wasn't obvious to me how the two were
| |
| 31 | 28 |
| 32 } // namespace | 29 } // namespace |
| 33 | 30 |
| 34 namespace net { | 31 namespace net { |
| 35 | 32 |
| 36 void EnsureDhcpcsvcInit() { | 33 void EnsureDhcpcsvcInit() { |
| 37 g_dhcpcsvc_init_singleton.Get(); | 34 g_dhcpcsvc_init_singleton.Get(); |
| 38 } | 35 } |
| 39 | 36 |
| 40 } // namespace net | 37 } // namespace net |
| OLD | NEW |