Uniquify QuicCryptoServerConfig::Add[Default]Config
gfe-relnote: Use unique_ptr for memory management rather than bare pointer. No functional change intended, not flag-protected.
PiperOrigin-RevId: 238574036
Change-Id: I0bb803fb9d68925ecbfdf113ba70335a66b3f099
diff --git a/quic/test_tools/crypto_test_utils.cc b/quic/test_tools/crypto_test_utils.cc
index 78bbc4e..94ca8e1 100644
--- a/quic/test_tools/crypto_test_utils.cc
+++ b/quic/test_tools/crypto_test_utils.cc
@@ -502,8 +502,8 @@
QuicCryptoServerConfig::ConfigOptions options;
options.channel_id_enabled = true;
options.token_binding_params = fake_options.token_binding_params;
- std::unique_ptr<CryptoHandshakeMessage> scfg(
- crypto_config->AddDefaultConfig(rand, clock, options));
+ std::unique_ptr<CryptoHandshakeMessage> scfg =
+ crypto_config->AddDefaultConfig(rand, clock, options);
}
void SendHandshakeMessageToStream(QuicCryptoStream* stream,
@@ -1006,14 +1006,14 @@
QuicCryptoServerConfig::ConfigOptions old_config_options;
QuicCryptoServerConfig::ConfigOptions new_config_options;
old_config_options.id = "old-config-id";
- delete crypto_config->AddDefaultConfig(QuicRandom::GetInstance(), clock,
- old_config_options);
- std::unique_ptr<QuicServerConfigProtobuf> primary_config(
+ crypto_config->AddDefaultConfig(QuicRandom::GetInstance(), clock,
+ old_config_options);
+ std::unique_ptr<QuicServerConfigProtobuf> primary_config =
crypto_config->GenerateConfig(QuicRandom::GetInstance(), clock,
- new_config_options));
+ new_config_options);
primary_config->set_primary_time(clock->WallNow().ToUNIXSeconds());
- std::unique_ptr<CryptoHandshakeMessage> msg(
- crypto_config->AddConfig(std::move(primary_config), clock->WallNow()));
+ std::unique_ptr<CryptoHandshakeMessage> msg =
+ crypto_config->AddConfig(std::move(primary_config), clock->WallNow());
QuicStringPiece orbit;
CHECK(msg->GetStringPiece(kORBT, &orbit));
std::string nonce;
diff --git a/quic/test_tools/crypto_test_utils_test.cc b/quic/test_tools/crypto_test_utils_test.cc
index 19fdfbb..ff288d9 100644
--- a/quic/test_tools/crypto_test_utils_test.cc
+++ b/quic/test_tools/crypto_test_utils_test.cc
@@ -124,15 +124,15 @@
QuicCryptoServerConfig::ConfigOptions old_config_options;
old_config_options.id = "old-config-id";
- delete crypto_config.AddDefaultConfig(QuicRandom::GetInstance(), &clock,
- old_config_options);
+ crypto_config.AddDefaultConfig(QuicRandom::GetInstance(), &clock,
+ old_config_options);
QuicCryptoServerConfig::ConfigOptions new_config_options;
- std::unique_ptr<QuicServerConfigProtobuf> primary_config(
+ std::unique_ptr<QuicServerConfigProtobuf> primary_config =
crypto_config.GenerateConfig(QuicRandom::GetInstance(), &clock,
- new_config_options));
+ new_config_options);
primary_config->set_primary_time(clock.WallNow().ToUNIXSeconds());
- std::unique_ptr<CryptoHandshakeMessage> msg(
- crypto_config.AddConfig(std::move(primary_config), clock.WallNow()));
+ std::unique_ptr<CryptoHandshakeMessage> msg =
+ crypto_config.AddConfig(std::move(primary_config), clock.WallNow());
QuicStringPiece orbit;
ASSERT_TRUE(msg->GetStringPiece(kORBT, &orbit));
std::string nonce;