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

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

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/socket/client_socket_factory.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) 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 22
23 ~DhcpcsvcInitSingleton() { 23 ~DhcpcsvcInitSingleton() {
24 // Worker pool threads that use the DHCP API may still be running, so skip 24 // Worker pool threads that use the DHCP API may still be running, so skip
25 // cleanup. 25 // cleanup.
26 } 26 }
27 }; 27 };
28 28
29 static base::LazyInstance<DhcpcsvcInitSingleton> g_dhcpcsvc_init_singleton( 29 static base::LazyInstance<DhcpcsvcInitSingleton> g_dhcpcsvc_init_singleton =
30 base::LINKER_INITIALIZED); 30 LAZY_INSTANCE_INITIALIZER;
31 31
32 } // namespace 32 } // namespace
33 33
34 namespace net { 34 namespace net {
35 35
36 void EnsureDhcpcsvcInit() { 36 void EnsureDhcpcsvcInit() {
37 g_dhcpcsvc_init_singleton.Get(); 37 g_dhcpcsvc_init_singleton.Get();
38 } 38 }
39 39
40 } // namespace net 40 } // namespace net
OLDNEW
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/socket/client_socket_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698