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

Unified Diff: net/quic/core/crypto/quic_crypto_server_config.cc

Issue 2417023003: Remove stl_util's deletion functions from: (Closed)
Patch Set: internal snapshot 10 Created 4 years, 2 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
Index: net/quic/core/crypto/quic_crypto_server_config.cc
diff --git a/net/quic/core/crypto/quic_crypto_server_config.cc b/net/quic/core/crypto/quic_crypto_server_config.cc
index 3deaf629fe041959a0c27b2efb4142577a461b26..3e230d31564fb382b90b75961430378ead8377b8 100644
--- a/net/quic/core/crypto/quic_crypto_server_config.cc
+++ b/net/quic/core/crypto/quic_crypto_server_config.cc
@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/stl_util.h"
#include "crypto/hkdf.h"
#include "crypto/secure_hash.h"
#include "net/base/ip_address.h"
@@ -257,10 +256,10 @@ QuicCryptoServerConfig::~QuicCryptoServerConfig() {
}
// static
-QuicServerConfigProtobuf* QuicCryptoServerConfig::GenerateConfig(
- QuicRandom* rand,
- const QuicClock* clock,
- const ConfigOptions& options) {
+std::unique_ptr<QuicServerConfigProtobuf>
+QuicCryptoServerConfig::GenerateConfig(QuicRandom* rand,
+ const QuicClock* clock,
+ const ConfigOptions& options) {
CryptoHandshakeMessage msg;
const string curve25519_private_key =
@@ -351,7 +350,7 @@ QuicServerConfigProtobuf* QuicCryptoServerConfig::GenerateConfig(
}
// Don't put new tags below this point. The SCID generation should hash over
// everything but itself and so extra tags should be added prior to the
- // preceeding if block.
+ // preceding if block.
std::unique_ptr<QuicData> serialized(
CryptoFramer::ConstructHandshakeMessage(msg));
@@ -369,11 +368,11 @@ QuicServerConfigProtobuf* QuicCryptoServerConfig::GenerateConfig(
p256_key->set_private_key(p256_private_key);
}
- return config.release();
+ return config;
}
CryptoHandshakeMessage* QuicCryptoServerConfig::AddConfig(
- QuicServerConfigProtobuf* protobuf,
+ std::unique_ptr<QuicServerConfigProtobuf> protobuf,
const QuicWallTime now) {
std::unique_ptr<CryptoHandshakeMessage> msg(
CryptoFramer::ParseMessage(protobuf->config()));
@@ -411,20 +410,17 @@ CryptoHandshakeMessage* QuicCryptoServerConfig::AddDefaultConfig(
QuicRandom* rand,
const QuicClock* clock,
const ConfigOptions& options) {
- std::unique_ptr<QuicServerConfigProtobuf> config(
- GenerateConfig(rand, clock, options));
- return AddConfig(config.get(), clock->WallNow());
+ return AddConfig(GenerateConfig(rand, clock, options), clock->WallNow());
}
bool QuicCryptoServerConfig::SetConfigs(
- const vector<QuicServerConfigProtobuf*>& protobufs,
+ const vector<std::unique_ptr<QuicServerConfigProtobuf>>& protobufs,
const QuicWallTime now) {
vector<scoped_refptr<Config>> parsed_configs;
bool ok = true;
- for (vector<QuicServerConfigProtobuf*>::const_iterator i = protobufs.begin();
- i != protobufs.end(); ++i) {
- scoped_refptr<Config> config(ParseConfigProtobuf(*i));
+ for (auto& protobuf : protobufs) {
+ scoped_refptr<Config> config(ParseConfigProtobuf(protobuf));
if (!config.get()) {
ok = false;
break;
@@ -893,7 +889,7 @@ void QuicCryptoServerConfig::ProcessClientHelloAfterGetProof(
}
const KeyExchange* key_exchange =
- requested_config->key_exchanges[key_exchange_index];
+ requested_config->key_exchanges[key_exchange_index].get();
if (!key_exchange->CalculateSharedKey(public_value,
&params->initial_premaster_secret)) {
helper.Fail(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER, "Invalid public value");
@@ -1760,7 +1756,7 @@ string QuicCryptoServerConfig::CompressChain(
scoped_refptr<QuicCryptoServerConfig::Config>
QuicCryptoServerConfig::ParseConfigProtobuf(
- QuicServerConfigProtobuf* protobuf) {
+ const std::unique_ptr<QuicServerConfigProtobuf>& protobuf) {
std::unique_ptr<CryptoHandshakeMessage> msg(
CryptoFramer::ParseMessage(protobuf->config()));
@@ -1911,14 +1907,14 @@ QuicCryptoServerConfig::ParseConfigProtobuf(
return nullptr;
}
- for (const KeyExchange* key_exchange : config->key_exchanges) {
+ for (const auto& key_exchange : config->key_exchanges) {
if (key_exchange->tag() == tag) {
LOG(WARNING) << "Duplicate key exchange in config: " << tag;
return nullptr;
}
}
- config->key_exchanges.push_back(ka.release());
+ config->key_exchanges.push_back(std::move(ka));
}
uint64_t expiry_seconds;
@@ -2250,7 +2246,6 @@ QuicCryptoServerConfig::Config::Config()
source_address_token_boxer(nullptr) {}
QuicCryptoServerConfig::Config::~Config() {
- base::STLDeleteElements(&key_exchanges);
}
QuicCryptoProof::QuicCryptoProof() {}
« no previous file with comments | « net/quic/core/crypto/quic_crypto_server_config.h ('k') | net/quic/core/crypto/quic_crypto_server_config_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698