Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <certt.h> | 9 #include <certt.h> |
| 10 #include <keyt.h> | 10 #include <keyt.h> |
| 11 #include <nspr.h> | 11 #include <nspr.h> |
| 12 #include <nss.h> | 12 #include <nss.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
| 18 #include "base/synchronization/lock.h" | |
| 19 #include "base/threading/platform_thread.h" | |
| 18 #include "base/time.h" | 20 #include "base/time.h" |
| 19 #include "base/timer.h" | 21 #include "base/timer.h" |
| 20 #include "net/base/cert_verify_result.h" | 22 #include "net/base/cert_verify_result.h" |
| 21 #include "net/base/completion_callback.h" | 23 #include "net/base/completion_callback.h" |
| 22 #include "net/base/host_port_pair.h" | 24 #include "net/base/host_port_pair.h" |
| 23 #include "net/base/net_log.h" | 25 #include "net/base/net_log.h" |
| 24 #include "net/base/nss_memio.h" | 26 #include "net/base/nss_memio.h" |
| 25 #include "net/base/ssl_config_service.h" | 27 #include "net/base/ssl_config_service.h" |
| 26 #include "net/base/x509_certificate.h" | 28 #include "net/base/x509_certificate.h" |
| 27 #include "net/socket/ssl_client_socket.h" | 29 #include "net/socket/ssl_client_socket.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 static SECStatus ClientAuthHandler(void* arg, | 160 static SECStatus ClientAuthHandler(void* arg, |
| 159 PRFileDesc* socket, | 161 PRFileDesc* socket, |
| 160 CERTDistNames* ca_names, | 162 CERTDistNames* ca_names, |
| 161 CERTCertificate** result_certificate, | 163 CERTCertificate** result_certificate, |
| 162 SECKEYPrivateKey** result_private_key); | 164 SECKEYPrivateKey** result_private_key); |
| 163 #endif | 165 #endif |
| 164 // NSS calls this when handshake is completed. We pass 'this' as the second | 166 // NSS calls this when handshake is completed. We pass 'this' as the second |
| 165 // argument. | 167 // argument. |
| 166 static void HandshakeCallback(PRFileDesc* socket, void* arg); | 168 static void HandshakeCallback(PRFileDesc* socket, void* arg); |
| 167 | 169 |
| 170 // The following three methods are for debugging 65948. Will remove this code | |
| 171 // after fixing 65948. | |
| 172 void EnsureThreadIdAssigned() const; | |
| 173 bool CalledOnValidThread() const; | |
| 174 void DetachFromThread(); | |
| 175 | |
| 168 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; | 176 CompletionCallbackImpl<SSLClientSocketNSS> buffer_send_callback_; |
| 169 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; | 177 CompletionCallbackImpl<SSLClientSocketNSS> buffer_recv_callback_; |
| 170 bool transport_send_busy_; | 178 bool transport_send_busy_; |
| 171 bool transport_recv_busy_; | 179 bool transport_recv_busy_; |
| 172 // corked_ is true if we are currently suspending writes to the network. This | 180 // corked_ is true if we are currently suspending writes to the network. This |
| 173 // is named after the similar kernel flag, TCP_CORK. | 181 // is named after the similar kernel flag, TCP_CORK. |
| 174 bool corked_; | 182 bool corked_; |
| 175 // uncork_timer_ is used to limit the amount of time that we'll delay the | 183 // uncork_timer_ is used to limit the amount of time that we'll delay the |
| 176 // Finished message while waiting for a Write. | 184 // Finished message while waiting for a Write. |
| 177 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; | 185 base::OneShotTimer<SSLClientSocketNSS> uncork_timer_; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 // the last NPN protocol used is serialised in |ssl_host_info_| | 263 // the last NPN protocol used is serialised in |ssl_host_info_| |
| 256 // and kept in these fields: | 264 // and kept in these fields: |
| 257 SSLClientSocket::NextProtoStatus predicted_npn_status_; | 265 SSLClientSocket::NextProtoStatus predicted_npn_status_; |
| 258 std::string predicted_npn_proto_; | 266 std::string predicted_npn_proto_; |
| 259 bool predicted_npn_proto_used_; | 267 bool predicted_npn_proto_used_; |
| 260 | 268 |
| 261 base::TimeTicks start_cert_verification_time_; | 269 base::TimeTicks start_cert_verification_time_; |
| 262 | 270 |
| 263 scoped_ptr<SSLHostInfo> ssl_host_info_; | 271 scoped_ptr<SSLHostInfo> ssl_host_info_; |
| 264 DnsCertProvenanceChecker* const dns_cert_checker_; | 272 DnsCertProvenanceChecker* const dns_cert_checker_; |
| 273 | |
| 274 // The following two variables are added for debugging 65948. Will remove this | |
| 275 // code after fixing 65948. | |
|
wtc
2011/02/11 22:43:50
Nit: please say "bug 65948" or http://crbug.com/65
ramant (doing other things)
2011/02/11 23:42:41
Done.
| |
| 276 // Added the following code Debugging in release mode. | |
| 277 mutable base::Lock lock_; | |
| 278 // This is mutable so that CalledOnValidThread can set it. | |
| 279 // It's guarded by |lock_|. | |
| 280 mutable base::PlatformThreadId valid_thread_id_; | |
| 265 }; | 281 }; |
| 266 | 282 |
| 267 } // namespace net | 283 } // namespace net |
| 268 | 284 |
| 269 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ | 285 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_NSS_H_ |
| OLD | NEW |