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/socket/ssl_client_socket_nss.cc

Issue 3872002: Thread IO safety: file_util annotated, IO thread blocked from doing IO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 10 years, 2 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
« no previous file with comments | « chrome/common/extensions/extension_resource.cc ('k') | net/url_request/url_request_file_job.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived 5 // This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
6 // from AuthCertificateCallback() in 6 // from AuthCertificateCallback() in
7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp. 7 // mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
8 8
9 /* ***** BEGIN LICENSE BLOCK ***** 9 /* ***** BEGIN LICENSE BLOCK *****
10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 10 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include <limits> 64 #include <limits>
65 65
66 #include "base/compiler_specific.h" 66 #include "base/compiler_specific.h"
67 #include "base/metrics/histogram.h" 67 #include "base/metrics/histogram.h"
68 #include "base/logging.h" 68 #include "base/logging.h"
69 #include "base/nss_util.h" 69 #include "base/nss_util.h"
70 #include "base/singleton.h" 70 #include "base/singleton.h"
71 #include "base/string_number_conversions.h" 71 #include "base/string_number_conversions.h"
72 #include "base/string_util.h" 72 #include "base/string_util.h"
73 #include "base/stringprintf.h" 73 #include "base/stringprintf.h"
74 #include "base/thread_restrictions.h"
74 #include "base/values.h" 75 #include "base/values.h"
75 #include "net/base/address_list.h" 76 #include "net/base/address_list.h"
76 #include "net/base/cert_status_flags.h" 77 #include "net/base/cert_status_flags.h"
77 #include "net/base/cert_verifier.h" 78 #include "net/base/cert_verifier.h"
78 #include "net/base/dns_util.h" 79 #include "net/base/dns_util.h"
79 #include "net/base/dnsrr_resolver.h" 80 #include "net/base/dnsrr_resolver.h"
80 #include "net/base/dnssec_chain_verifier.h" 81 #include "net/base/dnssec_chain_verifier.h"
81 #include "net/base/io_buffer.h" 82 #include "net/base/io_buffer.h"
82 #include "net/base/net_errors.h" 83 #include "net/base/net_errors.h"
83 #include "net/base/net_log.h" 84 #include "net/base/net_log.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. 170 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY.
170 SSL_ClearSessionCache(); 171 SSL_ClearSessionCache();
171 } 172 }
172 }; 173 };
173 174
174 // Initialize the NSS SSL library if it isn't already initialized. This must 175 // Initialize the NSS SSL library if it isn't already initialized. This must
175 // be called before any other NSS SSL functions. This function is 176 // be called before any other NSS SSL functions. This function is
176 // thread-safe, and the NSS SSL library will only ever be initialized once. 177 // thread-safe, and the NSS SSL library will only ever be initialized once.
177 // The NSS SSL library will be properly shut down on program exit. 178 // The NSS SSL library will be properly shut down on program exit.
178 void EnsureNSSSSLInit() { 179 void EnsureNSSSSLInit() {
180 // Initializing SSL causes us to do blocking IO.
181 // Temporarily allow it until we fix
182 // http://code.google.com/p/chromium/issues/detail?id=59847
183 base::ThreadRestrictions::ScopedAllowIO allow_io;
184
179 Singleton<NSSSSLInitSingleton>::get(); 185 Singleton<NSSSSLInitSingleton>::get();
180 } 186 }
181 187
182 // The default error mapping function. 188 // The default error mapping function.
183 // Maps an NSPR error code to a network error code. 189 // Maps an NSPR error code to a network error code.
184 int MapNSPRError(PRErrorCode err) { 190 int MapNSPRError(PRErrorCode err) {
185 // TODO(port): fill this out as we learn what's important 191 // TODO(port): fill this out as we learn what's important
186 switch (err) { 192 switch (err) {
187 case PR_WOULD_BLOCK_ERROR: 193 case PR_WOULD_BLOCK_ERROR:
188 return ERR_IO_PENDING; 194 return ERR_IO_PENDING;
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 return ERR_IO_PENDING; 2340 return ERR_IO_PENDING;
2335 } 2341 }
2336 LeaveFunction(""); 2342 LeaveFunction("");
2337 rv = MapNSPRError(prerr); 2343 rv = MapNSPRError(prerr);
2338 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, 2344 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR,
2339 new SSLErrorParams(rv, prerr)); 2345 new SSLErrorParams(rv, prerr));
2340 return rv; 2346 return rv;
2341 } 2347 }
2342 2348
2343 } // namespace net 2349 } // namespace net
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_resource.cc ('k') | net/url_request/url_request_file_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698