Index: net/quic/core/crypto/quic_crypto_server_config.h |
diff --git a/net/quic/core/crypto/quic_crypto_server_config.h b/net/quic/core/crypto/quic_crypto_server_config.h |
index 28f65f7564df000aa9aada7820a4ba14deb40150..a430b29e171ccc9ad53971caf123dbcf9b44abe7 100644 |
--- a/net/quic/core/crypto/quic_crypto_server_config.h |
+++ b/net/quic/core/crypto/quic_crypto_server_config.h |
@@ -14,7 +14,6 @@ |
#include <vector> |
#include "base/macros.h" |
-#include "base/memory/ref_counted.h" |
#include "base/strings/string_piece.h" |
#include "net/base/ip_address.h" |
#include "net/base/ip_endpoint.h" |
@@ -30,6 +29,7 @@ |
#include "net/quic/core/quic_time.h" |
#include "net/quic/platform/api/quic_export.h" |
#include "net/quic/platform/api/quic_mutex.h" |
+#include "net/quic/platform/api/quic_reference_counted.h" |
#include "net/quic/platform/api/quic_socket_address.h" |
namespace net { |
@@ -87,8 +87,7 @@ class QUIC_EXPORT_PRIVATE ValidateClientHelloResultCallback { |
public: |
// Opaque token that holds information about the client_hello and |
// its validity. Can be interpreted by calling ProcessClientHello. |
- struct QUIC_EXPORT_PRIVATE Result |
- : public base::RefCountedThreadSafe<Result> { |
+ struct QUIC_EXPORT_PRIVATE Result : public QuicReferenceCounted { |
Result(const CryptoHandshakeMessage& in_client_hello, |
QuicIpAddress in_client_ip, |
QuicWallTime in_now); |
@@ -101,15 +100,14 @@ class QUIC_EXPORT_PRIVATE ValidateClientHelloResultCallback { |
// Populated if the CHLO STK contained a CachedNetworkParameters proto. |
CachedNetworkParameters cached_network_params; |
- private: |
- friend class base::RefCountedThreadSafe<Result>; |
- ~Result(); |
+ protected: |
+ ~Result() override; |
}; |
ValidateClientHelloResultCallback(); |
- virtual void Run(scoped_refptr<Result> result, |
- std::unique_ptr<ProofSource::Details> details) = 0; |
virtual ~ValidateClientHelloResultCallback(); |
+ virtual void Run(QuicReferenceCountedPointer<Result> result, |
+ std::unique_ptr<ProofSource::Details> details) = 0; |
private: |
DISALLOW_COPY_AND_ASSIGN(ValidateClientHelloResultCallback); |
@@ -280,7 +278,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
const QuicSocketAddress& server_address, |
QuicVersion version, |
const QuicClock* clock, |
- scoped_refptr<QuicSignedServerConfig> crypto_proof, |
+ QuicReferenceCountedPointer<QuicSignedServerConfig> crypto_proof, |
std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; |
// ProcessClientHello processes |client_hello| and decides whether to accept |
@@ -313,7 +311,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
// chlo_packet_size: the size, in bytes, of the CHLO packet |
// done_cb: the callback invoked on completion |
void ProcessClientHello( |
- scoped_refptr<ValidateClientHelloResultCallback::Result> |
+ QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> |
validate_chlo_result, |
bool reject_only, |
QuicConnectionId connection_id, |
@@ -326,8 +324,8 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
const QuicClock* clock, |
QuicRandom* rand, |
QuicCompressedCertsCache* compressed_certs_cache, |
- scoped_refptr<QuicCryptoNegotiatedParameters> params, |
- scoped_refptr<QuicSignedServerConfig> crypto_proof, |
+ QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params, |
+ QuicReferenceCountedPointer<QuicSignedServerConfig> crypto_proof, |
QuicByteCount total_framing_overhead, |
QuicByteCount chlo_packet_size, |
std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const; |
@@ -430,7 +428,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
// Config represents a server config: a collection of preferences and |
// Diffie-Hellman public values. |
class QUIC_EXPORT_PRIVATE Config : public QuicCryptoConfig, |
- public base::RefCounted<Config> { |
+ public QuicReferenceCounted { |
public: |
Config(); |
@@ -486,23 +484,24 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
std::unique_ptr<CryptoSecretBoxer> source_address_token_boxer_storage; |
private: |
- friend class base::RefCounted<Config>; |
- |
- virtual ~Config(); |
+ ~Config() override; |
DISALLOW_COPY_AND_ASSIGN(Config); |
}; |
- typedef std::map<ServerConfigID, scoped_refptr<Config>> ConfigMap; |
+ typedef std::map<ServerConfigID, QuicReferenceCountedPointer<Config>> |
+ ConfigMap; |
// Get a ref to the config with a given server config id. |
- scoped_refptr<Config> GetConfigWithScid( |
- base::StringPiece requested_scid) const; |
+ QuicReferenceCountedPointer<Config> GetConfigWithScid( |
+ base::StringPiece requested_scid) const |
+ SHARED_LOCKS_REQUIRED(configs_lock_); |
// ConfigPrimaryTimeLessThan returns true if a->primary_time < |
// b->primary_time. |
- static bool ConfigPrimaryTimeLessThan(const scoped_refptr<Config>& a, |
- const scoped_refptr<Config>& b); |
+ static bool ConfigPrimaryTimeLessThan( |
+ const QuicReferenceCountedPointer<Config>& a, |
+ const QuicReferenceCountedPointer<Config>& b); |
// SelectNewPrimaryConfig reevaluates the primary config based on the |
// "primary_time" deadlines contained in each. |
@@ -514,10 +513,10 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
void EvaluateClientHello( |
const QuicSocketAddress& server_address, |
QuicVersion version, |
- scoped_refptr<Config> requested_config, |
- scoped_refptr<Config> primary_config, |
- scoped_refptr<QuicSignedServerConfig> crypto_proof, |
- scoped_refptr<ValidateClientHelloResultCallback::Result> |
+ QuicReferenceCountedPointer<Config> requested_config, |
+ QuicReferenceCountedPointer<Config> primary_config, |
+ QuicReferenceCountedPointer<QuicSignedServerConfig> crypto_proof, |
+ QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> |
client_hello_state, |
std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; |
@@ -535,12 +534,12 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
bool found_error, |
const QuicIpAddress& server_ip, |
QuicVersion version, |
- scoped_refptr<Config> requested_config, |
- scoped_refptr<Config> primary_config, |
- scoped_refptr<QuicSignedServerConfig> crypto_proof, |
+ QuicReferenceCountedPointer<Config> requested_config, |
+ QuicReferenceCountedPointer<Config> primary_config, |
+ QuicReferenceCountedPointer<QuicSignedServerConfig> crypto_proof, |
std::unique_ptr<ProofSource::Details> proof_source_details, |
bool get_proof_failed, |
- scoped_refptr<ValidateClientHelloResultCallback::Result> |
+ QuicReferenceCountedPointer<ValidateClientHelloResultCallback::Result> |
client_hello_state, |
std::unique_ptr<ValidateClientHelloResultCallback> done_cb) const; |
@@ -564,30 +563,31 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
const QuicClock* clock, |
QuicRandom* rand, |
QuicCompressedCertsCache* compressed_certs_cache, |
- scoped_refptr<QuicCryptoNegotiatedParameters> params, |
- scoped_refptr<QuicSignedServerConfig> crypto_proof, |
+ QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params, |
+ QuicReferenceCountedPointer<QuicSignedServerConfig> crypto_proof, |
QuicByteCount total_framing_overhead, |
QuicByteCount chlo_packet_size, |
- const scoped_refptr<Config>& requested_config, |
- const scoped_refptr<Config>& primary_config, |
+ const QuicReferenceCountedPointer<Config>& requested_config, |
+ const QuicReferenceCountedPointer<Config>& primary_config, |
std::unique_ptr<ProcessClientHelloResultCallback> done_cb) const; |
// BuildRejection sets |out| to be a REJ message in reply to |client_hello|. |
- void BuildRejection(QuicVersion version, |
- QuicWallTime now, |
- const Config& config, |
- const CryptoHandshakeMessage& client_hello, |
- const ClientHelloInfo& info, |
- const CachedNetworkParameters& cached_network_params, |
- bool use_stateless_rejects, |
- QuicConnectionId server_designated_connection_id, |
- QuicRandom* rand, |
- QuicCompressedCertsCache* compressed_certs_cache, |
- scoped_refptr<QuicCryptoNegotiatedParameters> params, |
- const QuicSignedServerConfig& crypto_proof, |
- QuicByteCount total_framing_overhead, |
- QuicByteCount chlo_packet_size, |
- CryptoHandshakeMessage* out) const; |
+ void BuildRejection( |
+ QuicVersion version, |
+ QuicWallTime now, |
+ const Config& config, |
+ const CryptoHandshakeMessage& client_hello, |
+ const ClientHelloInfo& info, |
+ const CachedNetworkParameters& cached_network_params, |
+ bool use_stateless_rejects, |
+ QuicConnectionId server_designated_connection_id, |
+ QuicRandom* rand, |
+ QuicCompressedCertsCache* compressed_certs_cache, |
+ QuicReferenceCountedPointer<QuicCryptoNegotiatedParameters> params, |
+ const QuicSignedServerConfig& crypto_proof, |
+ QuicByteCount total_framing_overhead, |
+ QuicByteCount chlo_packet_size, |
+ CryptoHandshakeMessage* out) const; |
// CompressChain compresses the certificates in |chain->certs| and returns a |
// compressed representation. |common_sets| contains the common certificate |
@@ -596,15 +596,15 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
// 64-bit, FNV-1a hashes of certificates that the peer already possesses. |
static std::string CompressChain( |
QuicCompressedCertsCache* compressed_certs_cache, |
- const scoped_refptr<ProofSource::Chain>& chain, |
+ const QuicReferenceCountedPointer<ProofSource::Chain>& chain, |
const std::string& client_common_set_hashes, |
const std::string& client_cached_cert_hashes, |
const CommonCertSets* common_sets); |
// ParseConfigProtobuf parses the given config protobuf and returns a |
- // scoped_refptr<Config> if successful. The caller adopts the reference to the |
- // Config. On error, ParseConfigProtobuf returns nullptr. |
- scoped_refptr<Config> ParseConfigProtobuf( |
+ // QuicReferenceCountedPointer<Config> if successful. The caller adopts the |
+ // reference to the Config. On error, ParseConfigProtobuf returns nullptr. |
+ QuicReferenceCountedPointer<Config> ParseConfigProtobuf( |
const std::unique_ptr<QuicServerConfigProtobuf>& protobuf); |
// NewSourceAddressToken returns a fresh source address token for the given |
@@ -692,7 +692,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
std::unique_ptr<BuildServerConfigUpdateMessageResultCallback> cb); |
void Run(bool ok, |
- const scoped_refptr<ProofSource::Chain>& chain, |
+ const QuicReferenceCountedPointer<ProofSource::Chain>& chain, |
const QuicCryptoProof& proof, |
std::unique_ptr<ProofSource::Details> details) override; |
@@ -719,7 +719,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
const std::string& client_cached_cert_hashes, |
bool sct_supported_by_client, |
bool ok, |
- const scoped_refptr<ProofSource::Chain>& chain, |
+ const QuicReferenceCountedPointer<ProofSource::Chain>& chain, |
const std::string& signature, |
const std::string& leaf_cert_sct, |
std::unique_ptr<ProofSource::Details> details, |
@@ -745,7 +745,8 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
ConfigMap configs_ GUARDED_BY(configs_lock_); |
// primary_config_ points to a Config (which is also in |configs_|) which is |
// the primary config - i.e. the one that we'll give out to new clients. |
- mutable scoped_refptr<Config> primary_config_ GUARDED_BY(configs_lock_); |
+ mutable QuicReferenceCountedPointer<Config> primary_config_ |
+ GUARDED_BY(configs_lock_); |
// next_config_promotion_time_ contains the nearest, future time when an |
// active config will be promoted to primary. |
mutable QuicWallTime next_config_promotion_time_ GUARDED_BY(configs_lock_); |
@@ -788,19 +789,18 @@ class QUIC_EXPORT_PRIVATE QuicCryptoServerConfig { |
}; |
struct QUIC_EXPORT_PRIVATE QuicSignedServerConfig |
- : public base::RefCounted<QuicSignedServerConfig> { |
+ : public QuicReferenceCounted { |
QuicSignedServerConfig(); |
QuicCryptoProof proof; |
- scoped_refptr<ProofSource::Chain> chain; |
+ QuicReferenceCountedPointer<ProofSource::Chain> chain; |
// The server config that is used for this proof (and the rest of the |
// request). |
- scoped_refptr<QuicCryptoServerConfig::Config> config; |
+ QuicReferenceCountedPointer<QuicCryptoServerConfig::Config> config; |
std::string primary_scid; |
- private: |
- friend class base::RefCounted<QuicSignedServerConfig>; |
- virtual ~QuicSignedServerConfig(); |
+ protected: |
+ ~QuicSignedServerConfig() override; |
}; |
} // namespace net |