summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/quic/quic_crypto_client_stream.cc5
-rw-r--r--net/quic/quic_crypto_client_stream.h3
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);
};