Replace quic_macros.h with Abseil equivalents.
NOKEYCHECK
NOKEYCHECK=True
PiperOrigin-RevId: 339148534
Change-Id: I75a7122584638e1f30f4c650833a497b1b33df15
diff --git a/quic/core/crypto/proof_source_x509.h b/quic/core/crypto/proof_source_x509.h
index 38a70ae..bc6baaa 100644
--- a/quic/core/crypto/proof_source_x509.h
+++ b/quic/core/crypto/proof_source_x509.h
@@ -8,11 +8,11 @@
#include <forward_list>
#include <memory>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/certificate_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/proof_source.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
namespace quic {
@@ -50,7 +50,7 @@
// Adds a certificate chain to the verifier. Returns false if the chain is
// not valid. Newer certificates will override older certificates with the
// same SubjectAltName value.
- QUIC_MUST_USE_RESULT bool AddCertificateChain(
+ ABSL_MUST_USE_RESULT bool AddCertificateChain(
QuicReferenceCountedPointer<Chain> chain,
CertificatePrivateKey key);
diff --git a/quic/core/http/quic_spdy_stream_body_manager.h b/quic/core/http/quic_spdy_stream_body_manager.h
index d4afc10..5e73ac7 100644
--- a/quic/core/http/quic_spdy_stream_body_manager.h
+++ b/quic/core/http/quic_spdy_stream_body_manager.h
@@ -5,13 +5,13 @@
#ifndef QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_STREAM_BODY_MANAGER_H_
#define QUICHE_QUIC_CORE_HTTP_QUIC_SPDY_STREAM_BODY_MANAGER_H_
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_circular_deque.h"
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_iovec.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
namespace quic {
@@ -38,7 +38,7 @@
// sequencer (provided that all previous body fragments are consumed) is
// received. |length| must be positive. Returns number of bytes the caller
// must mark consumed, which might be zero.
- QUIC_MUST_USE_RESULT size_t OnNonBody(QuicByteCount length);
+ ABSL_MUST_USE_RESULT size_t OnNonBody(QuicByteCount length);
// Called when body is received. |body| is added to |fragments_|. The data
// pointed to by |body| must be kept alive until an OnBodyConsumed() or
@@ -49,7 +49,7 @@
// Returns the number of bytes that the caller should mark consumed with the
// sequencer, which is the sum of |num_bytes| for body, and the number of any
// interleaving or immediately trailing non-body bytes.
- QUIC_MUST_USE_RESULT size_t OnBodyConsumed(size_t num_bytes);
+ ABSL_MUST_USE_RESULT size_t OnBodyConsumed(size_t num_bytes);
// Set up to |iov_len| elements of iov[] to point to available bodies: each
// iov[i].iov_base will point to a body fragment, and iov[i].iov_len will be
@@ -63,7 +63,7 @@
// preassigned and will not be changed. Returns the total number of bytes the
// caller shall mark consumed. Sets |*total_bytes_read| to the total number
// of body bytes read.
- QUIC_MUST_USE_RESULT size_t ReadBody(const struct iovec* iov,
+ ABSL_MUST_USE_RESULT size_t ReadBody(const struct iovec* iov,
size_t iov_len,
size_t* total_bytes_read);
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index 3e833ea..20dcb90 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake_message.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_protocol.h"
@@ -21,7 +22,6 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_uint128.h"
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index 66fd57a..56996a7 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -20,6 +20,7 @@
#include <utility>
#include <vector>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/frames/quic_stream_frame.h"
#include "net/third_party/quiche/src/quic/core/quic_circular_deque.h"
@@ -28,7 +29,6 @@
#include "net/third_party/quiche/src/quic/core/quic_packets.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_export.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
namespace quic {
namespace test {
@@ -513,7 +513,7 @@
// retransmitted to packet_.retransmittable_frames. All frames must fit into
// a single packet. Returns true on success, otherwise, returns false.
// Fails if |encrypted_buffer| is not large enough for the encrypted packet.
- QUIC_MUST_USE_RESULT bool SerializePacket(
+ ABSL_MUST_USE_RESULT bool SerializePacket(
QuicOwnedPacketBuffer encrypted_buffer,
size_t encrypted_buffer_len);
diff --git a/quic/platform/api/quic_macros.h b/quic/platform/api/quic_macros.h
deleted file mode 100644
index 7edeb6a..0000000
--- a/quic/platform/api/quic_macros.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2019 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef QUICHE_QUIC_PLATFORM_API_QUIC_MACROS_H_
-#define QUICHE_QUIC_PLATFORM_API_QUIC_MACROS_H_
-
-#include "net/quic/platform/impl/quic_macros_impl.h"
-
-#define QUIC_MUST_USE_RESULT QUIC_MUST_USE_RESULT_IMPL
-#define QUIC_UNUSED QUIC_UNUSED_IMPL
-#define QUIC_CONST_INIT QUIC_CONST_INIT_IMPL
-
-#endif // QUICHE_QUIC_PLATFORM_API_QUIC_MACROS_H_
diff --git a/quic/quic_transport/quic_transport_stream.h b/quic/quic_transport/quic_transport_stream.h
index 0b98ac5..dfe943f 100644
--- a/quic/quic_transport/quic_transport_stream.h
+++ b/quic/quic_transport/quic_transport_stream.h
@@ -8,11 +8,11 @@
#include <cstddef>
#include <memory>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/quic_session.h"
#include "net/third_party/quiche/src/quic/core/quic_stream.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
#include "net/third_party/quiche/src/quic/quic_transport/quic_transport_session_interface.h"
namespace quic {
@@ -40,9 +40,9 @@
// Reads all available data and appends it to the end of |output|.
size_t Read(std::string* output);
// Writes |data| into the stream. Returns true on success.
- QUIC_MUST_USE_RESULT bool Write(absl::string_view data);
+ ABSL_MUST_USE_RESULT bool Write(absl::string_view data);
// Sends the FIN on the stream. Returns true on success.
- QUIC_MUST_USE_RESULT bool SendFin();
+ ABSL_MUST_USE_RESULT bool SendFin();
// Indicates whether it is possible to write into stream right now.
bool CanWrite() const;
diff --git a/quic/test_tools/packet_dropping_test_writer.h b/quic/test_tools/packet_dropping_test_writer.h
index 47a3216..02eebe9 100644
--- a/quic/test_tools/packet_dropping_test_writer.h
+++ b/quic/test_tools/packet_dropping_test_writer.h
@@ -9,10 +9,10 @@
#include <list>
#include <memory>
+#include "absl/base/attributes.h"
#include "net/third_party/quiche/src/quic/core/quic_alarm.h"
#include "net/third_party/quiche/src/quic/core/quic_clock.h"
#include "net/third_party/quiche/src/quic/core/quic_packet_writer_wrapper.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_client.h"
#include "net/third_party/quiche/src/quic/test_tools/quic_test_utils.h"
@@ -126,7 +126,9 @@
}
// Useful for reproducing very flaky issues.
- QUIC_UNUSED void set_seed(uint64_t seed) { simple_random_.set_seed(seed); }
+ ABSL_ATTRIBUTE_UNUSED void set_seed(uint64_t seed) {
+ simple_random_.set_seed(seed);
+ }
private:
// Writes out the next packet to the contained writer and returns the time
diff --git a/quic/test_tools/test_certificates.cc b/quic/test_tools/test_certificates.cc
index 038bda7..acbea92 100644
--- a/quic/test_tools/test_certificates.cc
+++ b/quic/test_tools/test_certificates.cc
@@ -8,7 +8,7 @@
namespace test {
// A test certificate generated by //net/tools/quic/certs/generate-certs.sh.
-QUIC_CONST_INIT const char kTestCertificateRaw[] = {
+ABSL_CONST_INIT const char kTestCertificateRaw[] = {
'\x30', '\x82', '\x03', '\xb4', '\x30', '\x82', '\x02', '\x9c', '\xa0',
'\x03', '\x02', '\x01', '\x02', '\x02', '\x01', '\x01', '\x30', '\x0d',
'\x06', '\x09', '\x2a', '\x86', '\x48', '\x86', '\xf7', '\x0d', '\x01',
@@ -116,11 +116,11 @@
'\xd3', '\xfb', '\xba', '\xaf', '\xd9', '\x61', '\x14', '\x3c', '\xe0',
'\xa1', '\xa9', '\x51', '\x51', '\x0f', '\xad', '\x60'};
-QUIC_CONST_INIT const absl::string_view kTestCertificate(
+ABSL_CONST_INIT const absl::string_view kTestCertificate(
kTestCertificateRaw,
sizeof(kTestCertificateRaw));
-QUIC_CONST_INIT const char kTestCertificatePem[] =
+ABSL_CONST_INIT const char kTestCertificatePem[] =
R"(Certificate:
Data:
Version: 3 (0x2)
@@ -206,7 +206,7 @@
-----END CERTIFICATE-----)";
// Same leaf as above, but with an intermediary attached.
-QUIC_CONST_INIT const char kTestCertificateChainPem[] =
+ABSL_CONST_INIT const char kTestCertificateChainPem[] =
R"(-----BEGIN CERTIFICATE-----
MIIDtDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAeMRwwGgYDVQQDDBNRVUlD
IFNlcnZlciBSb290IENBMB4XDTIwMDEzMDE4MTM1OVoXDTIwMDIwMjE4MTM1OVow
@@ -249,7 +249,7 @@
Cmn1Mj4hQ+pT0t+pw/DMOw==
-----END CERTIFICATE-----)";
-QUIC_CONST_INIT const char kTestCertWithUnknownSanTypePem[] =
+ABSL_CONST_INIT const char kTestCertWithUnknownSanTypePem[] =
R"(-----BEGIN CERTIFICATE-----
MIIEYTCCA0mgAwIBAgIJAILStmLgUUcVMA0GCSqGSIb3DQEBCwUAMHYxCzAJBgNV
BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRYwFAYDVQQHDA1TYW4gRnJhbmNp
@@ -277,7 +277,7 @@
M8MD3RDSq/90FSiME4vbyNEyTmj0
-----END CERTIFICATE-----)";
-QUIC_CONST_INIT const char kTestCertificatePrivateKeyRaw[] = {
+ABSL_CONST_INIT const char kTestCertificatePrivateKeyRaw[] = {
'\x30', '\x82', '\x04', '\xbc', '\x02', '\x01', '\x00', '\x30', '\x0d',
'\x06', '\x09', '\x2a', '\x86', '\x48', '\x86', '\xf7', '\x0d', '\x01',
'\x01', '\x01', '\x05', '\x00', '\x04', '\x82', '\x04', '\xa6', '\x30',
@@ -415,11 +415,11 @@
'\x3e', '\x6b', '\x2e', '\xfa', '\x4f', '\x4d', '\xe6', '\xbe', '\xd3',
'\x59'};
-QUIC_CONST_INIT const absl::string_view kTestCertificatePrivateKey(
+ABSL_CONST_INIT const absl::string_view kTestCertificatePrivateKey(
kTestCertificatePrivateKeyRaw,
sizeof(kTestCertificatePrivateKeyRaw));
-QUIC_CONST_INIT const char kTestCertificatePrivateKeyPem[] =
+ABSL_CONST_INIT const char kTestCertificatePrivateKeyPem[] =
R"(-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDF4lFtP9Yo8q00
c4dkyjMZM7d1kasxGSvjpCYJKYst91J1p1UV8BHHwsTtGBszC3Ey5jWJzS1aBVdO
@@ -450,7 +450,7 @@
-----END PRIVATE KEY-----)";
// The legacy version was manually generated from the one above using der2ascii.
-QUIC_CONST_INIT const char kTestCertificatePrivateKeyLegacyPem[] =
+ABSL_CONST_INIT const char kTestCertificatePrivateKeyLegacyPem[] =
R"(-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAxeJRbT/WKPKtNHOHZMozGTO3dZGrMRkr46QmCSmLLfdSdadVFfARx8LE7Rgb
MwtxMuY1ic0tWgVXTsJ4dWVyLYoXg9YykIX4IuJlqeCg/hmyOS0UAxAvzIteqiUnDaM3EAwX7PCL
@@ -475,7 +475,7 @@
TToPURKk2cKYdsW3KUDK9Lt0LXEDTecFdcCNln5ZoYs7oyulo8j30z5rLvpPTea+01k=
-----END RSA PRIVATE KEY-----)";
-QUIC_CONST_INIT const char kWildcardCertificateRaw[] = {
+ABSL_CONST_INIT const char kWildcardCertificateRaw[] = {
'\x30', '\x82', '\x03', '\x5f', '\x30', '\x82', '\x02', '\x47', '\xa0',
'\x03', '\x02', '\x01', '\x02', '\x02', '\x14', '\x36', '\x1d', '\xe3',
'\xd2', '\x39', '\x35', '\x20', '\xb1', '\xae', '\x18', '\xdd', '\x71',
@@ -574,11 +574,11 @@
'\xf0', '\xb7', '\xbb', '\x58', '\x4c', '\x8f', '\x6a', '\x5d', '\x8e',
'\x93', '\x5f', '\x35'};
-QUIC_CONST_INIT const absl::string_view kWildcardCertificate(
+ABSL_CONST_INIT const absl::string_view kWildcardCertificate(
kWildcardCertificateRaw,
sizeof(kWildcardCertificateRaw));
-QUIC_CONST_INIT const char kWildcardCertificatePrivateKeyRaw[] = {
+ABSL_CONST_INIT const char kWildcardCertificatePrivateKeyRaw[] = {
'\x30', '\x82', '\x04', '\xbe', '\x02', '\x01', '\x00', '\x30', '\x0d',
'\x06', '\x09', '\x2a', '\x86', '\x48', '\x86', '\xf7', '\x0d', '\x01',
'\x01', '\x01', '\x05', '\x00', '\x04', '\x82', '\x04', '\xa8', '\x30',
@@ -716,11 +716,11 @@
'\x47', '\xca', '\x21', '\x30', '\x65', '\xa4', '\xe5', '\xaa', '\x4e',
'\x9c', '\xbc', '\xa5'};
-QUIC_CONST_INIT const absl::string_view kWildcardCertificatePrivateKey(
+ABSL_CONST_INIT const absl::string_view kWildcardCertificatePrivateKey(
kWildcardCertificatePrivateKeyRaw,
sizeof(kWildcardCertificatePrivateKeyRaw));
-QUIC_CONST_INIT const char kTestEcPrivateKeyLegacyPem[] =
+ABSL_CONST_INIT const char kTestEcPrivateKeyLegacyPem[] =
R"(-----BEGIN EC PARAMETERS-----
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
diff --git a/quic/test_tools/test_certificates.h b/quic/test_tools/test_certificates.h
index 759e73e..6a7eba7 100644
--- a/quic/test_tools/test_certificates.h
+++ b/quic/test_tools/test_certificates.h
@@ -5,44 +5,44 @@
#ifndef QUICHE_QUIC_TEST_TOOLS_TEST_CERTIFICATES_H_
#define QUICHE_QUIC_TEST_TOOLS_TEST_CERTIFICATES_H_
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
namespace quic {
namespace test {
// A test certificate generated by //net/tools/quic/certs/generate-certs.sh.
-QUIC_CONST_INIT extern const absl::string_view kTestCertificate;
+ABSL_CONST_INIT extern const absl::string_view kTestCertificate;
// PEM-encoded version of |kTestCertificate|.
-QUIC_CONST_INIT extern const char kTestCertificatePem[];
+ABSL_CONST_INIT extern const char kTestCertificatePem[];
// |kTestCertificatePem| with a PEM-encoded root appended to the end.
-QUIC_CONST_INIT extern const char kTestCertificateChainPem[];
+ABSL_CONST_INIT extern const char kTestCertificateChainPem[];
// PEM-encoded certificate that contains a subjectAltName with an
// unknown/unsupported type.
-QUIC_CONST_INIT extern const char kTestCertWithUnknownSanTypePem[];
+ABSL_CONST_INIT extern const char kTestCertWithUnknownSanTypePem[];
// DER-encoded private key for |kTestCertificate|.
-QUIC_CONST_INIT extern const absl::string_view kTestCertificatePrivateKey;
+ABSL_CONST_INIT extern const absl::string_view kTestCertificatePrivateKey;
// PEM-encoded version of |kTestCertificatePrivateKey|.
-QUIC_CONST_INIT extern const char kTestCertificatePrivateKeyPem[];
+ABSL_CONST_INIT extern const char kTestCertificatePrivateKeyPem[];
// The legacy PEM-encoded version of |kTestCertificatePrivateKey| manually
// generated from the one above using der2ascii.
-QUIC_CONST_INIT extern const char kTestCertificatePrivateKeyLegacyPem[];
+ABSL_CONST_INIT extern const char kTestCertificatePrivateKeyLegacyPem[];
// Another DER-encoded test certificate, valid for foo.test, www.foo.test and
// *.wildcard.test.
-QUIC_CONST_INIT extern const absl::string_view kWildcardCertificate;
+ABSL_CONST_INIT extern const absl::string_view kWildcardCertificate;
// DER-encoded private key for |kWildcardCertificate|.
-QUIC_CONST_INIT extern const absl::string_view kWildcardCertificatePrivateKey;
+ABSL_CONST_INIT extern const absl::string_view kWildcardCertificatePrivateKey;
// PEM-encoded P-256 private key using legacy OpenSSL encoding.
-QUIC_CONST_INIT extern const char kTestEcPrivateKeyLegacyPem[];
+ABSL_CONST_INIT extern const char kTestEcPrivateKeyLegacyPem[];
} // namespace test
} // namespace quic
diff --git a/quic/tools/quic_client_base.h b/quic/tools/quic_client_base.h
index 873c362..ce2444c 100644
--- a/quic/tools/quic_client_base.h
+++ b/quic/tools/quic_client_base.h
@@ -10,13 +10,13 @@
#include <string>
+#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "net/third_party/quiche/src/quic/core/crypto/crypto_handshake.h"
#include "net/third_party/quiche/src/quic/core/http/quic_client_push_promise_index.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_session.h"
#include "net/third_party/quiche/src/quic/core/http/quic_spdy_client_stream.h"
#include "net/third_party/quiche/src/quic/core/quic_config.h"
-#include "net/third_party/quiche/src/quic/platform/api/quic_macros.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_socket_address.h"
namespace quic {
@@ -104,12 +104,12 @@
// Wait for 1-RTT keys become available.
// Returns true once 1-RTT keys are available, false otherwise.
- QUIC_MUST_USE_RESULT bool WaitForOneRttKeysAvailable();
+ ABSL_MUST_USE_RESULT bool WaitForOneRttKeysAvailable();
// Wait for handshake state proceeds to HANDSHAKE_CONFIRMED.
// In QUIC crypto, this does the same as WaitForOneRttKeysAvailable, while in
// TLS, this waits for HANDSHAKE_DONE frame is received.
- QUIC_MUST_USE_RESULT bool WaitForHandshakeConfirmed();
+ ABSL_MUST_USE_RESULT bool WaitForHandshakeConfirmed();
// Wait up to 50ms, and handle any events which occur.
// Returns true if there are any outstanding requests.