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

Side by Side Diff: net/socket/ssl_client_socket_nss.cc

Issue 3983005: Revert 63600 - Thread IO safety: annotate file_util, and block IO thread from... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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"
75 #include "base/values.h" 74 #include "base/values.h"
76 #include "net/base/address_list.h" 75 #include "net/base/address_list.h"
77 #include "net/base/cert_status_flags.h" 76 #include "net/base/cert_status_flags.h"
78 #include "net/base/cert_verifier.h" 77 #include "net/base/cert_verifier.h"
79 #include "net/base/dns_util.h" 78 #include "net/base/dns_util.h"
80 #include "net/base/dnsrr_resolver.h" 79 #include "net/base/dnsrr_resolver.h"
81 #include "net/base/dnssec_chain_verifier.h" 80 #include "net/base/dnssec_chain_verifier.h"
82 #include "net/base/io_buffer.h" 81 #include "net/base/io_buffer.h"
83 #include "net/base/net_errors.h" 82 #include "net/base/net_errors.h"
84 #include "net/base/net_log.h" 83 #include "net/base/net_log.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. 169 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY.
171 SSL_ClearSessionCache(); 170 SSL_ClearSessionCache();
172 } 171 }
173 }; 172 };
174 173
175 // Initialize the NSS SSL library if it isn't already initialized. This must 174 // Initialize the NSS SSL library if it isn't already initialized. This must
176 // be called before any other NSS SSL functions. This function is 175 // be called before any other NSS SSL functions. This function is
177 // thread-safe, and the NSS SSL library will only ever be initialized once. 176 // thread-safe, and the NSS SSL library will only ever be initialized once.
178 // The NSS SSL library will be properly shut down on program exit. 177 // The NSS SSL library will be properly shut down on program exit.
179 void EnsureNSSSSLInit() { 178 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
185 Singleton<NSSSSLInitSingleton>::get(); 179 Singleton<NSSSSLInitSingleton>::get();
186 } 180 }
187 181
188 // The default error mapping function. 182 // The default error mapping function.
189 // Maps an NSPR error code to a network error code. 183 // Maps an NSPR error code to a network error code.
190 int MapNSPRError(PRErrorCode err) { 184 int MapNSPRError(PRErrorCode err) {
191 // TODO(port): fill this out as we learn what's important 185 // TODO(port): fill this out as we learn what's important
192 switch (err) { 186 switch (err) {
193 case PR_WOULD_BLOCK_ERROR: 187 case PR_WOULD_BLOCK_ERROR:
194 return ERR_IO_PENDING; 188 return ERR_IO_PENDING;
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 return ERR_IO_PENDING; 2334 return ERR_IO_PENDING;
2341 } 2335 }
2342 LeaveFunction(""); 2336 LeaveFunction("");
2343 rv = MapNSPRError(prerr); 2337 rv = MapNSPRError(prerr);
2344 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, 2338 net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR,
2345 new SSLErrorParams(rv, prerr)); 2339 new SSLErrorParams(rv, prerr));
2346 return rv; 2340 return rv;
2347 } 2341 }
2348 2342
2349 } // namespace net 2343 } // 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