diff options
author | yhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 14:31:37 +0000 |
---|---|---|
committer | yhirano@chromium.org <yhirano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 14:31:37 +0000 |
commit | ca8cc70b2de822b939f87effc7c2b83bac280a44 (patch) | |
tree | 917008d0d3951700ae0cc84a04b67dadc5262fe8 /net/socket_stream/socket_stream.cc | |
parent | 12cac19b54cfe4dc6f20ae12ade7b4a05cbcb5fc (diff) | |
download | chromium_src-ca8cc70b2de822b939f87effc7c2b83bac280a44.zip chromium_src-ca8cc70b2de822b939f87effc7c2b83bac280a44.tar.gz chromium_src-ca8cc70b2de822b939f87effc7c2b83bac280a44.tar.bz2 |
Revert a workaround commit for a Use-After-Free crash.
Revert a workaround commit r20158 for a Use-After-Free issue (http://crbug.com/244746) because a cleaner CL r207218 is landed.
URLRequestContext does not inherit SupportsWeakPtr now.
R=mmenke
BUG=244746
Review URL: https://chromiumcodereview.appspot.com/16870008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream/socket_stream.cc')
-rw-r--r-- | net/socket_stream/socket_stream.cc | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 2060d8a..dcf0b0f 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -90,6 +90,7 @@ SocketStream::SocketStream(const GURL& url, Delegate* delegate) : delegate_(delegate), url_(url), max_pending_send_allowed_(kMaxPendingSendAllowed), + context_(NULL), next_state_(STATE_NONE), factory_(ClientSocketFactory::GetDefaultFactory()), proxy_mode_(kDirectConnection), @@ -130,13 +131,9 @@ bool SocketStream::is_secure() const { } void SocketStream::set_context(URLRequestContext* context) { - const URLRequestContext* prev_context = context_.get(); + const URLRequestContext* prev_context = context_; - if (context) { - context_ = context->AsWeakPtr(); - } else { - context_.reset(); - } + context_ = context; if (prev_context != context) { if (prev_context && pac_request_) { @@ -158,7 +155,7 @@ void SocketStream::set_context(URLRequestContext* context) { } void SocketStream::CheckPrivacyMode() { - if (context_.get() && context_->network_delegate()) { + if (context_ && context_->network_delegate()) { bool enable = context_->network_delegate()->CanEnablePrivacyMode(url_, url_); privacy_mode_ = enable ? kPrivacyModeEnabled : kPrivacyModeDisabled; @@ -173,7 +170,7 @@ void SocketStream::Connect() { << "The current base::MessageLoop must exist"; DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) << "The current base::MessageLoop must be TYPE_IO"; - if (context_.get()) { + if (context_) { context_->ssl_config_service()->GetSSLConfig(&server_ssl_config_); proxy_ssl_config_ = server_ssl_config_; } @@ -451,7 +448,7 @@ void SocketStream::OnWriteCompleted(int result) { void SocketStream::DoLoop(int result) { // If context was not set, close immediately. - if (!context_.get()) + if (!context_) next_state_ = STATE_CLOSE; if (next_state_ == STATE_NONE) @@ -577,10 +574,8 @@ void SocketStream::DoLoop(int result) { int SocketStream::DoBeforeConnect() { next_state_ = STATE_BEFORE_CONNECT_COMPLETE; - if (!context_.get() || !context_->network_delegate()) { - // TODO(yhirano): This should not be OK. + if (!context_ || !context_->network_delegate()) return OK; - } int result = context_->network_delegate()->NotifyBeforeSocketStreamConnect( this, io_callback_); @@ -1294,7 +1289,7 @@ int SocketStream::HandleCertificateError(int result) { SSLClientSocket* ssl_socket = static_cast<SSLClientSocket*>(socket_.get()); DCHECK(ssl_socket); - if (!context_.get()) + if (!context_) return result; if (SSLClientSocket::IgnoreCertError(result, LOAD_IGNORE_ALL_CERT_ERRORS)) { |