Refactor to make :http_frames_lib build with --config=android_arm. cl/352042819 breaks //third_party/quic/core:quic_core_android_build target built with --config=android_arm, because it adds :http_encoder_lib and :http_frames_lib as dependencies of :quic_session_lib. However, :http_frames_lib indirectly depends on the following three targets that do not compile with --config=android_arm: //third_party/spdy/core:spdy_framer_lib //third_party/quic/core/qpack:qpack_header_table_lib //third_party/spdy/core/hpack:hpack_lib The easiest way to fix it is this minor refactor which breaks the indirect dependency of :http_frames_lib on these targets. PiperOrigin-RevId: 353280950 Change-Id: Ic0f627d2d87d7e56aef1b14bc18d8f4d80e48c50
diff --git a/quic/core/http/http_constants.cc b/quic/core/http/http_constants.cc new file mode 100644 index 0000000..b3262d2 --- /dev/null +++ b/quic/core/http/http_constants.cc
@@ -0,0 +1,26 @@ +// Copyright (c) 2021 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. + +#include "quic/core/http/http_constants.h" + +#include "absl/strings/str_cat.h" + +namespace quic { + +#define RETURN_STRING_LITERAL(x) \ + case x: \ + return #x; + +std::string H3SettingsToString(Http3AndQpackSettingsIdentifiers identifier) { + switch (identifier) { + RETURN_STRING_LITERAL(SETTINGS_QPACK_MAX_TABLE_CAPACITY); + RETURN_STRING_LITERAL(SETTINGS_MAX_FIELD_SECTION_SIZE); + RETURN_STRING_LITERAL(SETTINGS_QPACK_BLOCKED_STREAMS); + } + return absl::StrCat("UNSUPPORTED_SETTINGS_TYPE(", identifier, ")"); +} + +#undef RETURN_STRING_LITERAL // undef for jumbo builds + +} // namespace quic
diff --git a/quic/core/http/http_constants.h b/quic/core/http/http_constants.h index 37ecd20..65096a5 100644 --- a/quic/core/http/http_constants.h +++ b/quic/core/http/http_constants.h
@@ -6,6 +6,7 @@ #define QUICHE_QUIC_CORE_HTTP_HTTP_CONSTANTS_H_ #include <cstdint> +#include <string> #include "quic/core/quic_types.h" @@ -34,6 +35,9 @@ SETTINGS_QPACK_BLOCKED_STREAMS = 0x07, }; +// Returns HTTP/3 SETTINGS identifier as a string. +std::string H3SettingsToString(Http3AndQpackSettingsIdentifiers identifier); + // Default maximum dynamic table capacity, communicated via // SETTINGS_QPACK_MAX_TABLE_CAPACITY. const QuicByteCount kDefaultQpackMaxDynamicTableCapacity = 64 * 1024; // 64 KB @@ -47,6 +51,7 @@ const uint64_t kDefaultMaximumBlockedStreams = 100; const char kUserAgentHeaderName[] = "user-agent"; + } // namespace quic #endif // QUICHE_QUIC_CORE_HTTP_HTTP_CONSTANTS_H_
diff --git a/quic/core/http/http_decoder.cc b/quic/core/http/http_decoder.cc index 79ef921..a7df361 100644 --- a/quic/core/http/http_decoder.cc +++ b/quic/core/http/http_decoder.cc
@@ -14,6 +14,7 @@ #include "quic/core/quic_error_codes.h" #include "quic/core/quic_types.h" #include "quic/platform/api/quic_bug_tracker.h" +#include "quic/platform/api/quic_flag_utils.h" #include "quic/platform/api/quic_flags.h" #include "quic/platform/api/quic_logging.h"
diff --git a/quic/core/http/http_encoder.cc b/quic/core/http/http_encoder.cc index 80a3107..50717fd 100644 --- a/quic/core/http/http_encoder.cc +++ b/quic/core/http/http_encoder.cc
@@ -9,6 +9,8 @@ #include "quic/core/crypto/quic_random.h" #include "quic/core/quic_data_writer.h" #include "quic/core/quic_types.h" +#include "quic/platform/api/quic_bug_tracker.h" +#include "quic/platform/api/quic_flag_utils.h" #include "quic/platform/api/quic_flags.h" #include "quic/platform/api/quic_logging.h"
diff --git a/quic/core/http/http_frames.h b/quic/core/http/http_frames.h index 4708ec1..6669242 100644 --- a/quic/core/http/http_frames.h +++ b/quic/core/http/http_frames.h
@@ -13,9 +13,8 @@ #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" -#include "quic/core/http/spdy_utils.h" +#include "quic/core/http/http_constants.h" #include "quic/core/quic_types.h" -#include "spdy/core/spdy_framer.h" namespace quic { @@ -84,7 +83,7 @@ std::string s; for (auto it : values) { std::string setting = absl::StrCat( - SpdyUtils::H3SettingsToString( + H3SettingsToString( static_cast<Http3AndQpackSettingsIdentifiers>(it.first)), " = ", it.second, "; "); absl::StrAppend(&s, setting);
diff --git a/quic/core/http/spdy_utils.cc b/quic/core/http/spdy_utils.cc index 3b1cd77..a3d800a 100644 --- a/quic/core/http/spdy_utils.cc +++ b/quic/core/http/spdy_utils.cc
@@ -153,20 +153,4 @@ return true; } -#define RETURN_STRING_LITERAL(x) \ - case x: \ - return #x; - -// static -std::string SpdyUtils::H3SettingsToString( - Http3AndQpackSettingsIdentifiers identifier) { - switch (identifier) { - RETURN_STRING_LITERAL(SETTINGS_QPACK_MAX_TABLE_CAPACITY); - RETURN_STRING_LITERAL(SETTINGS_MAX_FIELD_SECTION_SIZE); - RETURN_STRING_LITERAL(SETTINGS_QPACK_BLOCKED_STREAMS); - } - return absl::StrCat("UNSUPPORTED_SETTINGS_TYPE(", identifier, ")"); -} - -#undef RETURN_STRING_LITERAL // undef for jumbo builds } // namespace quic
diff --git a/quic/core/http/spdy_utils.h b/quic/core/http/spdy_utils.h index 9ff3c34..a3b3134 100644 --- a/quic/core/http/spdy_utils.h +++ b/quic/core/http/spdy_utils.h
@@ -51,10 +51,6 @@ // which must be fully-qualified. static bool PopulateHeaderBlockFromUrl(const std::string url, spdy::SpdyHeaderBlock* headers); - - // Returns HTTP/3 SETTINGS identifier as a string. - static std::string H3SettingsToString( - Http3AndQpackSettingsIdentifiers identifier); }; } // namespace quic