Fix remaining Chromim compile issues.
Chromium does not allow C++17-features and actually has -Wc++17-extensions
enabled. Unfortunately adding it to the internal BUILD file does not seem to
have the desired effect.
Also remove an unnecessary internal-only include.
Also convert static constexpr class members to enum members. Unfortunately
static constexpr members do not link when used in EXPECT_ macros. I have
already seen this strangeness, see
https://quiche.googlesource.com/quiche/+/9d0a88542030288b1e02646485b929abb1f0f481.
PiperOrigin-RevId: 387364180
diff --git a/http2/adapter/data_source.h b/http2/adapter/data_source.h
index b7f1afa..6b1a8ce 100644
--- a/http2/adapter/data_source.h
+++ b/http2/adapter/data_source.h
@@ -15,8 +15,7 @@
public:
virtual ~DataFrameSource() {}
- static constexpr ssize_t kBlocked = 0;
- static constexpr ssize_t kError = -1;
+ enum : ssize_t { kBlocked = 0, kError = -1 };
// Returns the number of bytes to send in the next DATA frame, and whether
// this frame indicates the end of the data. Returns {kBlocked, false} if
diff --git a/http2/adapter/http2_protocol.h b/http2/adapter/http2_protocol.h
index 2ed3a50..e25d177 100644
--- a/http2/adapter/http2_protocol.h
+++ b/http2/adapter/http2_protocol.h
@@ -5,7 +5,6 @@
#include <string>
#include <utility>
-#include "base/integral_types.h"
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "absl/types/variant.h"
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc
index 93195f3..b7ecf04 100644
--- a/http2/adapter/oghttp2_session.cc
+++ b/http2/adapter/oghttp2_session.cc
@@ -1,5 +1,7 @@
#include "http2/adapter/oghttp2_session.h"
+#include <tuple>
+
#include "absl/strings/escaping.h"
#include "http2/adapter/oghttp2_util.h"
@@ -159,8 +161,8 @@
}
bool OgHttp2Session::ResumeStream(Http2StreamId stream_id) {
- if (auto it = stream_map_.find(stream_id);
- it->second.outbound_body == nullptr ||
+ auto it = stream_map_.find(stream_id);
+ if (it->second.outbound_body == nullptr ||
!write_scheduler_.StreamRegistered(stream_id)) {
return false;
}
@@ -362,7 +364,9 @@
int32_t available_window = std::min(
std::min(connection_send_window_, state.send_window), max_frame_payload_);
while (available_window > 0 && state.outbound_body != nullptr) {
- auto [length, end_data] =
+ ssize_t length;
+ bool end_data;
+ std::tie(length, end_data) =
state.outbound_body->SelectPayloadLength(available_window);
if (length == DataFrameSource::kBlocked) {
source_can_produce = false;
@@ -432,7 +436,9 @@
[this, stream_id](size_t window_update_delta) {
SendWindowUpdate(stream_id, window_update_delta);
};
- auto [iter, inserted] = stream_map_.try_emplace(
+ absl::flat_hash_map<Http2StreamId, StreamState>::iterator iter;
+ bool inserted;
+ std::tie(iter, inserted) = stream_map_.try_emplace(
stream_id,
StreamState(stream_receive_window_limit_, std::move(listener)));
if (!inserted) {
@@ -760,7 +766,8 @@
void OgHttp2Session::MarkDataBuffered(Http2StreamId stream_id, size_t bytes) {
connection_window_manager_.MarkDataBuffered(bytes);
- if (auto it = stream_map_.find(stream_id); it != stream_map_.end()) {
+ auto it = stream_map_.find(stream_id);
+ if (it != stream_map_.end()) {
it->second.window_manager.MarkDataBuffered(bytes);
}
}
diff --git a/http2/adapter/test_frame_sequence.cc b/http2/adapter/test_frame_sequence.cc
index a64f915..3b2ac9a 100644
--- a/http2/adapter/test_frame_sequence.cc
+++ b/http2/adapter/test_frame_sequence.cc
@@ -12,8 +12,9 @@
std::vector<const Header> ToHeaders(
absl::Span<const std::pair<absl::string_view, absl::string_view>> headers) {
std::vector<const Header> out;
- for (auto [name, value] : headers) {
- out.push_back(std::make_pair(HeaderRep(name), HeaderRep(value)));
+ for (const auto& header : headers) {
+ out.push_back(
+ std::make_pair(HeaderRep(header.first), HeaderRep(header.second)));
}
return out;
}