Refactor QUICHE platform flag utilities. Move flag count macro implementations from http2, quic, and spdy platform directories to quiche/common/platform, removing some code duplication, and making all macros available from all three components. Feature flag accessors, protocol flags, and flag saver are not touched by this CL. PiperOrigin-RevId: 348632606 Change-Id: I623bc0ff532020188cce51e802118cb622f1d101
diff --git a/common/platform/api/quiche_flag_utils.h b/common/platform/api/quiche_flag_utils.h new file mode 100644 index 0000000..0534064 --- /dev/null +++ b/common/platform/api/quiche_flag_utils.h
@@ -0,0 +1,19 @@ +// Copyright 2020 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_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_ +#define QUICHE_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_ + +#include "net/quiche/common/platform/impl/quiche_flag_utils_impl.h" + +#define QUICHE_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT_IMPL +#define QUICHE_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N_IMPL + +#define QUICHE_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT_IMPL +#define QUICHE_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N_IMPL + +#define QUICHE_CODE_COUNT QUICHE_CODE_COUNT_IMPL +#define QUICHE_CODE_COUNT_N QUICHE_CODE_COUNT_N_IMPL + +#endif // QUICHE_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_
diff --git a/http2/hpack/decoder/hpack_block_decoder.cc b/http2/hpack/decoder/hpack_block_decoder.cc index 3211daa..7715980 100644 --- a/http2/hpack/decoder/hpack_block_decoder.cc +++ b/http2/hpack/decoder/hpack_block_decoder.cc
@@ -7,6 +7,7 @@ #include <cstdint> #include "absl/strings/str_cat.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_flag_utils.h" #include "net/third_party/quiche/src/http2/platform/api/http2_flags.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
diff --git a/http2/hpack/decoder/hpack_decoder.cc b/http2/hpack/decoder/hpack_decoder.cc index 6cfd1e0..440b92c 100644 --- a/http2/hpack/decoder/hpack_decoder.cc +++ b/http2/hpack/decoder/hpack_decoder.cc
@@ -6,6 +6,7 @@ #include "net/third_party/quiche/src/http2/decoder/decode_status.h" #include "net/third_party/quiche/src/http2/platform/api/http2_estimate_memory_usage.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_flag_utils.h" #include "net/third_party/quiche/src/http2/platform/api/http2_flags.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h"
diff --git a/http2/hpack/decoder/hpack_entry_decoder.cc b/http2/hpack/decoder/hpack_entry_decoder.cc index 4e8b4d0..c97c855 100644 --- a/http2/hpack/decoder/hpack_entry_decoder.cc +++ b/http2/hpack/decoder/hpack_entry_decoder.cc
@@ -9,6 +9,7 @@ #include <cstdint> #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_flag_utils.h" #include "net/third_party/quiche/src/http2/platform/api/http2_flags.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h"
diff --git a/http2/hpack/decoder/hpack_entry_type_decoder.cc b/http2/hpack/decoder/hpack_entry_type_decoder.cc index c2fe470..f087176 100644 --- a/http2/hpack/decoder/hpack_entry_type_decoder.cc +++ b/http2/hpack/decoder/hpack_entry_type_decoder.cc
@@ -6,6 +6,7 @@ #include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/http2/platform/api/http2_bug_tracker.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_flag_utils.h" #include "net/third_party/quiche/src/http2/platform/api/http2_flags.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_string_utils.h"
diff --git a/http2/hpack/decoder/hpack_whole_entry_buffer.cc b/http2/hpack/decoder/hpack_whole_entry_buffer.cc index 4d54b16..9ace91f 100644 --- a/http2/hpack/decoder/hpack_whole_entry_buffer.cc +++ b/http2/hpack/decoder/hpack_whole_entry_buffer.cc
@@ -6,6 +6,7 @@ #include "absl/strings/str_cat.h" #include "net/third_party/quiche/src/http2/platform/api/http2_estimate_memory_usage.h" +#include "net/third_party/quiche/src/http2/platform/api/http2_flag_utils.h" #include "net/third_party/quiche/src/http2/platform/api/http2_flags.h" #include "net/third_party/quiche/src/http2/platform/api/http2_logging.h" #include "net/third_party/quiche/src/http2/platform/api/http2_macros.h"
diff --git a/http2/platform/api/http2_flag_utils.h b/http2/platform/api/http2_flag_utils.h index 4303c43..46afc79 100644 --- a/http2/platform/api/http2_flag_utils.h +++ b/http2/platform/api/http2_flag_utils.h
@@ -5,8 +5,15 @@ #ifndef QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_ #define QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_ -#include "net/http2/platform/impl/http2_flag_utils_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_flag_utils.h" -#define HTTP2_RELOADABLE_FLAG_COUNT HTTP2_RELOADABLE_FLAG_COUNT_IMPL +#define HTTP2_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT +#define HTTP2_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N + +#define HTTP2_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT +#define HTTP2_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N + +#define HTTP2_CODE_COUNT QUICHE_CODE_COUNT +#define HTTP2_CODE_COUNT_N QUICHE_CODE_COUNT_N #endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAG_UTILS_H_
diff --git a/http2/platform/api/http2_flags.h b/http2/platform/api/http2_flags.h index 097d35e..08f95da 100644 --- a/http2/platform/api/http2_flags.h +++ b/http2/platform/api/http2_flags.h
@@ -11,6 +11,4 @@ #define SetHttp2ReloadableFlag(flag, value) \ SetHttp2ReloadableFlagImpl(flag, value) -#define HTTP2_CODE_COUNT_N HTTP2_CODE_COUNT_N_IMPL - #endif // QUICHE_HTTP2_PLATFORM_API_HTTP2_FLAGS_H_
diff --git a/quic/core/crypto/tls_server_connection.cc b/quic/core/crypto/tls_server_connection.cc index 0208a9c..8315210 100644 --- a/quic/core/crypto/tls_server_connection.cc +++ b/quic/core/crypto/tls_server_connection.cc
@@ -7,6 +7,7 @@ #include "absl/strings/string_view.h" #include "third_party/boringssl/src/include/openssl/ssl.h" #include "net/third_party/quiche/src/quic/core/crypto/proof_source.h" +#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" namespace quic {
diff --git a/quic/core/qpack/qpack_decoder.cc b/quic/core/qpack/qpack_decoder.cc index 8638331..1b307bc 100644 --- a/quic/core/qpack/qpack_decoder.cc +++ b/quic/core/qpack/qpack_decoder.cc
@@ -8,6 +8,7 @@ #include "absl/strings/string_view.h" #include "net/third_party/quiche/src/quic/core/qpack/qpack_index_conversions.h" +#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"
diff --git a/quic/core/qpack/qpack_encoder.cc b/quic/core/qpack/qpack_encoder.cc index 0e8c35c..1b2ab3a 100644 --- a/quic/core/qpack/qpack_encoder.cc +++ b/quic/core/qpack/qpack_encoder.cc
@@ -13,6 +13,7 @@ #include "net/third_party/quiche/src/quic/core/qpack/qpack_instruction_encoder.h" #include "net/third_party/quiche/src/quic/core/qpack/qpack_required_insert_count.h" #include "net/third_party/quiche/src/quic/core/qpack/value_splitting_header_list.h" +#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"
diff --git a/quic/platform/api/quic_flag_utils.h b/quic/platform/api/quic_flag_utils.h index bec9b39..eabca1f 100644 --- a/quic/platform/api/quic_flag_utils.h +++ b/quic/platform/api/quic_flag_utils.h
@@ -5,15 +5,15 @@ #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_ #define QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_ -#include "net/quic/platform/impl/quic_flag_utils_impl.h" +#include "net/third_party/quiche/src/common/platform/api/quiche_flag_utils.h" -#define QUIC_RELOADABLE_FLAG_COUNT QUIC_RELOADABLE_FLAG_COUNT_IMPL -#define QUIC_RELOADABLE_FLAG_COUNT_N QUIC_RELOADABLE_FLAG_COUNT_N_IMPL +#define QUIC_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT +#define QUIC_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N -#define QUIC_RESTART_FLAG_COUNT QUIC_RESTART_FLAG_COUNT_IMPL -#define QUIC_RESTART_FLAG_COUNT_N QUIC_RESTART_FLAG_COUNT_N_IMPL +#define QUIC_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT +#define QUIC_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N -#define QUIC_CODE_COUNT QUIC_CODE_COUNT_IMPL -#define QUIC_CODE_COUNT_N QUIC_CODE_COUNT_N_IMPL +#define QUIC_CODE_COUNT QUICHE_CODE_COUNT +#define QUIC_CODE_COUNT_N QUICHE_CODE_COUNT_N #endif // QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_
diff --git a/quic/platform/api/quic_flags.h b/quic/platform/api/quic_flags.h index bf6fc3c..302036f 100644 --- a/quic/platform/api/quic_flags.h +++ b/quic/platform/api/quic_flags.h
@@ -8,7 +8,6 @@ #include <string> #include <vector> -#include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h" #include "net/quic/platform/impl/quic_flags_impl.h" // Define a command-line flag that can be automatically set via
diff --git a/spdy/core/hpack/hpack_encoder.cc b/spdy/core/hpack/hpack_encoder.cc index c0d2ec6..5f53011 100644 --- a/spdy/core/hpack/hpack_encoder.cc +++ b/spdy/core/hpack/hpack_encoder.cc
@@ -14,6 +14,7 @@ #include "net/third_party/quiche/src/spdy/core/hpack/hpack_huffman_table.h" #include "net/third_party/quiche/src/spdy/core/hpack/hpack_output_stream.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_estimate_memory_usage.h" +#include "net/third_party/quiche/src/spdy/platform/api/spdy_flag_utils.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_flags.h" #include "net/third_party/quiche/src/spdy/platform/api/spdy_logging.h"
diff --git a/spdy/platform/api/spdy_flag_utils.h b/spdy/platform/api/spdy_flag_utils.h new file mode 100644 index 0000000..7b46537 --- /dev/null +++ b/spdy/platform/api/spdy_flag_utils.h
@@ -0,0 +1,19 @@ +// Copyright 2020 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_SPDY_PLATFORM_API_SPDY_FLAG_UTILS_H_ +#define QUICHE_SPDY_PLATFORM_API_SPDY_FLAG_UTILS_H_ + +#include "net/third_party/quiche/src/common/platform/api/quiche_flag_utils.h" + +#define SPDY_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT +#define SPDY_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N + +#define SPDY_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT +#define SPDY_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N + +#define SPDY_CODE_COUNT QUICHE_CODE_COUNT +#define SPDY_CODE_COUNT_N QUICHE_CODE_COUNT_N + +#endif // QUICHE_SPDY_PLATFORM_API_SPDY_FLAG_UTILS_H_
diff --git a/spdy/platform/api/spdy_flags.h b/spdy/platform/api/spdy_flags.h index 7d9345e..f3446d9 100644 --- a/spdy/platform/api/spdy_flags.h +++ b/spdy/platform/api/spdy_flags.h
@@ -10,7 +10,4 @@ #define GetSpdyReloadableFlag(flag) GetSpdyReloadableFlagImpl(flag) #define GetSpdyRestartFlag(flag) GetSpdyRestartFlagImpl(flag) -#define SPDY_CODE_COUNT SPDY_CODE_COUNT_IMPL -#define SPDY_CODE_COUNT_N SPDY_CODE_COUNT_N_IMPL - #endif // QUICHE_SPDY_PLATFORM_API_SPDY_FLAGS_H_