diff options
author | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-28 23:32:32 +0000 |
---|---|---|
committer | rtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-28 23:32:32 +0000 |
commit | 03b1e3e69e1c6f09a9550e3b354e2e698ab35845 (patch) | |
tree | baea56240d09b3dbf4ebd3fa29a3cc6d8f6e6996 /net | |
parent | dd95a33519efb72a82dbe4ec16cc6cd90c8c8850 (diff) | |
download | chromium_src-03b1e3e69e1c6f09a9550e3b354e2e698ab35845.zip chromium_src-03b1e3e69e1c6f09a9550e3b354e2e698ab35845.tar.gz chromium_src-03b1e3e69e1c6f09a9550e3b354e2e698ab35845.tar.bz2 |
QUIC - Use weak_ptr of QuicCryptoClientStream with IOComplete callback while calling disk cache's WaitForDataReady. This handles deletion of QuicCryptoClientStream with an outstanding callback.
BUG=347476
Review URL: https://codereview.chromium.org/180153004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/quic/quic_crypto_client_stream.cc | 5 | ||||
-rw-r--r-- | net/quic/quic_crypto_client_stream.h | 3 |
2 files changed, 6 insertions, 2 deletions
diff --git a/net/quic/quic_crypto_client_stream.cc b/net/quic/quic_crypto_client_stream.cc index 689b5d6..237c1d3 100644 --- a/net/quic/quic_crypto_client_stream.cc +++ b/net/quic/quic_crypto_client_stream.cc @@ -76,7 +76,8 @@ QuicCryptoClientStream::QuicCryptoClientStream( server_hostname_(server_hostname), generation_counter_(0), proof_verify_callback_(NULL), - disk_cache_load_result_(ERR_UNEXPECTED) { + disk_cache_load_result_(ERR_UNEXPECTED), + weak_factory_(this) { } QuicCryptoClientStream::~QuicCryptoClientStream() { @@ -434,7 +435,7 @@ int QuicCryptoClientStream::DoLoadQuicServerInfo( // |cached| config from the cached state for a canonical hostname. int rv = quic_server_info->WaitForDataReady( base::Bind(&QuicCryptoClientStream::OnIOComplete, - base::Unretained(this))); + weak_factory_.GetWeakPtr())); if (rv != ERR_IO_PENDING) { disk_cache_load_result_ = rv; diff --git a/net/quic/quic_crypto_client_stream.h b/net/quic/quic_crypto_client_stream.h index c945acf..b191193 100644 --- a/net/quic/quic_crypto_client_stream.h +++ b/net/quic/quic_crypto_client_stream.h @@ -7,6 +7,7 @@ #include <string> +#include "base/memory/weak_ptr.h" #include "net/cert/cert_verify_result.h" #include "net/cert/x509_certificate.h" #include "net/quic/crypto/proof_verifier.h" @@ -134,6 +135,8 @@ class NET_EXPORT_PRIVATE QuicCryptoClientStream : public QuicCryptoStream { // It must not be used after STATE_LOAD_QUIC_SERVER_INFO_COMPLETE. int disk_cache_load_result_; + base::WeakPtrFactory<QuicCryptoClientStream> weak_factory_; + DISALLOW_COPY_AND_ASSIGN(QuicCryptoClientStream); }; |