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

Side by Side Diff: net/base/winsock_init.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/base/test_root_certs_win.cc ('k') | net/base/x509_certificate.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <winsock2.h> 5 #include <winsock2.h>
6 6
7 #include "net/base/winsock_init.h" 7 #include "net/base/winsock_init.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 19 matching lines...) Expand all
30 WSAGetLastError(); 30 WSAGetLastError();
31 } 31 }
32 } 32 }
33 33
34 ~WinsockInitSingleton() { 34 ~WinsockInitSingleton() {
35 // Don't call WSACleanup() since the worker pool threads can continue to 35 // Don't call WSACleanup() since the worker pool threads can continue to
36 // call getaddrinfo() after Winsock has shutdown, which can lead to crashes. 36 // call getaddrinfo() after Winsock has shutdown, which can lead to crashes.
37 } 37 }
38 }; 38 };
39 39
40 static base::LazyInstance<WinsockInitSingleton> g_winsock_init_singleton( 40 static base::LazyInstance<WinsockInitSingleton> g_winsock_init_singleton =
41 base::LINKER_INITIALIZED); 41 LAZY_INSTANCE_INITIALIZER;
42 42
43 } // namespace 43 } // namespace
44 44
45 namespace net { 45 namespace net {
46 46
47 void EnsureWinsockInit() { 47 void EnsureWinsockInit() {
48 g_winsock_init_singleton.Get(); 48 g_winsock_init_singleton.Get();
49 } 49 }
50 50
51 } // namespace net 51 } // namespace net
OLDNEW
« no previous file with comments | « net/base/test_root_certs_win.cc ('k') | net/base/x509_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698