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

Unified Diff: net/socket/ssl_client_socket_nss.cc

Issue 6474027: In Dev build, we would like to see if SSLClientSocketNSS object... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« net/socket/ssl_client_socket_nss.h ('K') | « net/socket/ssl_client_socket_nss.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_nss.cc
===================================================================
--- net/socket/ssl_client_socket_nss.cc (revision 74087)
+++ net/socket/ssl_client_socket_nss.cc (working copy)
@@ -479,7 +479,8 @@
predicted_npn_status_(kNextProtoUnsupported),
predicted_npn_proto_used_(false),
ssl_host_info_(ssl_host_info),
- dns_cert_checker_(dns_ctx) {
+ dns_cert_checker_(dns_ctx),
+ valid_thread_id_(base::kInvalidThreadId) {
EnterFunction("");
}
@@ -590,6 +591,8 @@
DCHECK(!user_write_buf_);
DCHECK(!pseudo_connected_);
+ EnsureThreadIdAssigned();
+
net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL);
int rv = Init();
@@ -639,17 +642,19 @@
void SSLClientSocketNSS::Disconnect() {
EnterFunction("");
+ // Shut down anything that may call us back (through buffer_send_callback_,
+ // buffer_recv_callback, or handshake_io_callback_).
+ verifier_.reset();
+ transport_->socket()->Disconnect();
+
+ CHECK(CalledOnValidThread());
+
// TODO(wtc): Send SSL close_notify alert.
if (nss_fd_ != NULL) {
PR_Close(nss_fd_);
nss_fd_ = NULL;
}
- // Shut down anything that may call us back (through buffer_send_callback_,
- // buffer_recv_callback, or handshake_io_callback_).
- verifier_.reset();
- transport_->socket()->Disconnect();
-
// Reset object state
transport_send_busy_ = false;
transport_recv_busy_ = false;
@@ -2498,4 +2503,22 @@
that->UpdateConnectionStatus();
}
+void SSLClientSocketNSS::EnsureThreadIdAssigned() const {
+ base::AutoLock auto_lock(lock_);
+ if (valid_thread_id_ != base::kInvalidThreadId)
+ return;
+ valid_thread_id_ = base::PlatformThread::CurrentId();
+}
+
+bool SSLClientSocketNSS::CalledOnValidThread() const {
+ EnsureThreadIdAssigned();
+ base::AutoLock auto_lock(lock_);
+ return valid_thread_id_ == base::PlatformThread::CurrentId();
+}
+
+void SSLClientSocketNSS::DetachFromThread() {
+ base::AutoLock auto_lock(lock_);
+ valid_thread_id_ = base::kInvalidThreadId;
+}
+
} // namespace net
« net/socket/ssl_client_socket_nss.h ('K') | « net/socket/ssl_client_socket_nss.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698