[metadata] Remove arena from `grpc_metadata_batch` constructor (#36118)

Internally, use `std::vector` instead of `ChunkedVector` to hold extra metadatum.

I'm not totally convinced this is the right move, so it's going to be a try it and monitor for a month or so thing... I might roll back if performance is actually affected (but I think we'll see some wins and losses and overall about a wash).

Closes #36118

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36118 from ctiller:YUPYUPYUP 68e0acd0a2
PiperOrigin-RevId: 620902195
pull/36212/head
Craig Tiller 8 months ago committed by Copybara-Service
parent 3d96c05834
commit 8b8f43aecf
  1. 14
      fuzztest/core/transport/chttp2/hpack_encoder_timeout_test.cc
  2. 2
      src/core/client_channel/client_channel_filter.cc
  3. 12
      src/core/client_channel/retry_filter_legacy_call_data.h
  4. 6
      src/core/client_channel/subchannel_stream_client.cc
  5. 2
      src/core/ext/filters/http/server/http_server_filter.cc
  6. 2
      src/core/ext/filters/message_size/message_size_filter.cc
  7. 4
      src/core/ext/transport/chaotic_good/client/chaotic_good_connector.cc
  8. 2
      src/core/ext/transport/chaotic_good/frame.cc
  9. 4
      src/core/ext/transport/chaotic_good/server/chaotic_good_server.cc
  10. 5
      src/core/ext/transport/chaotic_good/settings_metadata.cc
  11. 2
      src/core/ext/transport/chaotic_good/settings_metadata.h
  12. 9
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  13. 2
      src/core/ext/transport/chttp2/transport/internal.h
  14. 8
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  15. 14
      src/core/ext/transport/inproc/legacy_inproc_transport.cc
  16. 13
      src/core/lib/channel/connected_channel.cc
  17. 21
      src/core/lib/surface/call.cc
  18. 6
      src/core/lib/transport/batch_builder.h
  19. 2
      src/core/lib/transport/metadata.cc
  20. 7
      src/core/lib/transport/metadata_batch.cc
  21. 19
      src/core/lib/transport/metadata_batch.h
  22. 4
      test/core/filters/filter_test.cc
  23. 15
      test/core/promise/try_seq_metadata_test.cc
  24. 2
      test/core/security/credentials_test.cc
  25. 2
      test/core/security/oauth2_utils.cc
  26. 8
      test/core/transport/binder/binder_transport_test.cc
  27. 65
      test/core/transport/call_filters_test.cc
  28. 3
      test/core/transport/chaotic_good/client_transport_error_test.cc
  29. 3
      test/core/transport/chaotic_good/client_transport_test.cc
  30. 6
      test/core/transport/chaotic_good/server_transport_test.cc
  31. 8
      test/core/transport/chttp2/hpack_encoder_test.cc
  32. 2
      test/core/transport/chttp2/hpack_parser_fuzzer_test.cc
  33. 2
      test/core/transport/chttp2/hpack_parser_input_size_fuzzer.cc
  34. 2
      test/core/transport/chttp2/hpack_parser_test.cc
  35. 2
      test/core/transport/chttp2/hpack_sync_fuzzer.cc
  36. 12
      test/core/transport/metadata_map_test.cc
  37. 6
      test/core/transport/test_suite/call_content.cc
  38. 48
      test/core/transport/test_suite/call_shapes.cc
  39. 6
      test/core/transport/test_suite/stress.cc
  40. 3
      test/core/util/evaluate_args_test_util.h
  41. 10
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  42. 2
      test/cpp/microbenchmarks/bm_chttp2_transport.cc

@ -14,23 +14,20 @@
// Test to verify Fuzztest integration
#include <grpc/event_engine/memory_allocator.h>
#include <stddef.h>
#include <stdint.h>
#include <vector>
#include <memory>
#include <optional>
#include <vector>
#include "absl/random/random.h"
#include "fuzztest/fuzztest.h"
#include "gtest/gtest.h"
#include "src/core/ext/transport/chttp2/transport/hpack_encoder.h"
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/transport/metadata_batch.h"
@ -43,9 +40,6 @@ void EncodeTimeouts(std::vector<uint32_t> timeouts) {
hpack_encoder_detail::TimeoutCompressorImpl timeout_compressor;
HPackCompressor compressor;
HPackParser parser;
MemoryAllocator memory_allocator = MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
auto arena = MakeScopedArena(1024, &memory_allocator);
for (size_t i = 0; i < timeouts.size(); i++) {
SliceBuffer encoded;
hpack_encoder_detail::Encoder encoder(&compressor, false, encoded);
@ -53,7 +47,7 @@ void EncodeTimeouts(std::vector<uint32_t> timeouts) {
"grpc-timeout",
Timestamp::ProcessEpoch() + Duration::Milliseconds(timeouts[i]),
&encoder);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
const uint32_t kMetadataSizeLimit = 3u * 1024 * 1024 * 1024;
parser.BeginFrame(
&b, kMetadataSizeLimit, kMetadataSizeLimit, HPackParser::Boundary::None,

@ -3535,7 +3535,7 @@ ClientChannelFilter::PromiseBasedLoadBalancedCall::MakeCallPromise(
[this]() {
// TODO(roth): Change CallTracer API to not pass metadata
// batch to this method, since the batch is always empty.
grpc_metadata_batch metadata(GetContext<Arena>());
grpc_metadata_batch metadata;
call_attempt_tracer()->RecordSendTrailingMetadata(&metadata);
});
}

@ -266,11 +266,11 @@ class RetryFilter::LegacyCallData {
// BatchData.batch.payload points to this.
grpc_transport_stream_op_batch_payload batch_payload_;
// For send_initial_metadata.
grpc_metadata_batch send_initial_metadata_{calld_->arena_};
grpc_metadata_batch send_initial_metadata_;
// For send_trailing_metadata.
grpc_metadata_batch send_trailing_metadata_{calld_->arena_};
grpc_metadata_batch send_trailing_metadata_;
// For intercepting recv_initial_metadata.
grpc_metadata_batch recv_initial_metadata_{calld_->arena_};
grpc_metadata_batch recv_initial_metadata_;
grpc_closure recv_initial_metadata_ready_;
bool trailing_metadata_available_ = false;
// For intercepting recv_message.
@ -278,7 +278,7 @@ class RetryFilter::LegacyCallData {
absl::optional<SliceBuffer> recv_message_;
uint32_t recv_message_flags_;
// For intercepting recv_trailing_metadata.
grpc_metadata_batch recv_trailing_metadata_{calld_->arena_};
grpc_metadata_batch recv_trailing_metadata_;
grpc_transport_stream_stats collect_stats_;
grpc_closure recv_trailing_metadata_ready_;
// These fields indicate which ops have been started and completed on
@ -420,7 +420,7 @@ class RetryFilter::LegacyCallData {
// Cached data for retrying send ops.
// send_initial_metadata
bool seen_send_initial_metadata_ = false;
grpc_metadata_batch send_initial_metadata_{arena_};
grpc_metadata_batch send_initial_metadata_;
// send_message
// When we get a send_message op, we replace the original byte stream
// with a CachingByteStream that caches the slices to a local buffer for
@ -435,7 +435,7 @@ class RetryFilter::LegacyCallData {
absl::InlinedVector<CachedSendMessage, 3> send_messages_;
// send_trailing_metadata
bool seen_send_trailing_metadata_ = false;
grpc_metadata_batch send_trailing_metadata_{arena_};
grpc_metadata_batch send_trailing_metadata_;
};
} // namespace grpc_core

@ -172,11 +172,7 @@ SubchannelStreamClient::CallState::CallState(
arena_(Arena::Create(subchannel_stream_client_->connected_subchannel_
->GetInitialCallSizeEstimate(),
&subchannel_stream_client_->call_allocator_)),
payload_(context_),
send_initial_metadata_(arena_.get()),
send_trailing_metadata_(arena_.get()),
recv_initial_metadata_(arena_.get()),
recv_trailing_metadata_(arena_.get()) {}
payload_(context_) {}
SubchannelStreamClient::CallState::~CallState() {
if (GPR_UNLIKELY(subchannel_stream_client_->tracer_ != nullptr)) {

@ -67,7 +67,7 @@ void FilterOutgoingMetadata(ServerMetadata* md) {
ServerMetadataHandle MalformedRequest(absl::string_view explanation) {
auto* arena = GetContext<Arena>();
auto hdl = arena->MakePooled<ServerMetadata>(arena);
auto hdl = arena->MakePooled<ServerMetadata>();
hdl->Set(GrpcStatusMetadata(), GRPC_STATUS_UNKNOWN);
hdl->Set(GrpcMessageMetadata(), Slice::FromStaticString(explanation));
hdl->Set(GrpcTarPit(), Empty());

@ -168,7 +168,7 @@ ServerMetadataHandle CheckPayload(const Message& msg,
is_send ? "send" : "recv", msg.payload()->Length(), *max_length);
}
if (msg.payload()->Length() <= *max_length) return nullptr;
auto r = GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
auto r = GetContext<Arena>()->MakePooled<ServerMetadata>();
r->Set(GrpcStatusMetadata(), GRPC_STATUS_RESOURCE_EXHAUSTED);
r->Set(GrpcMessageMetadata(),
Slice::FromCopiedString(absl::StrFormat(

@ -113,7 +113,7 @@ auto ChaoticGoodConnector::DataEndpointWriteSettingsFrame(
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kData,
self->connection_id_, kDataAlignmentBytes}
.ToMetadataBatch(GetContext<Arena>());
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->data_endpoint_.Write(std::move(write_buffer.control));
}
@ -214,7 +214,7 @@ auto ChaoticGoodConnector::ControlEndpointWriteSettingsFrame(
// frame.header set connectiion_type: control
frame.headers = SettingsMetadata{SettingsMetadata::ConnectionType::kControl,
absl::nullopt, absl::nullopt}
.ToMetadataBatch(GetContext<Arena>());
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->hpack_compressor_);
return self->control_endpoint_.Write(std::move(write_buffer.control));
}

@ -154,7 +154,7 @@ absl::StatusOr<Arena::PoolPtr<Metadata>> ReadMetadata(
if (!maybe_slices.ok()) return maybe_slices.status();
auto& slices = *maybe_slices;
GPR_ASSERT(arena != nullptr);
Arena::PoolPtr<Metadata> metadata = Arena::MakePooled<Metadata>(arena);
Arena::PoolPtr<Metadata> metadata = Arena::MakePooled<Metadata>();
parser->BeginFrame(
metadata.get(), std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint32_t>::max(),

@ -339,7 +339,7 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
frame.headers =
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
absl::nullopt}
.ToMetadataBatch(GetContext<Arena>());
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
return TrySeq(
self->connection_->endpoint_.Write(std::move(write_buffer.control)),
@ -353,7 +353,7 @@ auto ChaoticGoodServerListener::ActiveConnection::HandshakingState::
frame.headers =
SettingsMetadata{absl::nullopt, self->connection_->connection_id_,
self->connection_->data_alignment_}
.ToMetadataBatch(GetContext<Arena>());
.ToMetadataBatch();
auto write_buffer = frame.Serialize(&self->connection_->hpack_compressor_);
return TrySeq(
self->connection_->endpoint_.Write(std::move(write_buffer.control)),

@ -23,9 +23,8 @@
namespace grpc_core {
namespace chaotic_good {
Arena::PoolPtr<grpc_metadata_batch> SettingsMetadata::ToMetadataBatch(
Arena* arena) {
auto md = Arena::MakePooled<grpc_metadata_batch>(arena);
Arena::PoolPtr<grpc_metadata_batch> SettingsMetadata::ToMetadataBatch() {
auto md = Arena::MakePooled<grpc_metadata_batch>();
auto add = [&md](absl::string_view key, std::string value) {
md->Append(key, Slice::FromCopiedString(value),
[key, value](absl::string_view error, const Slice&) {

@ -35,7 +35,7 @@ struct SettingsMetadata {
absl::optional<std::string> connection_id;
absl::optional<uint32_t> alignment;
Arena::PoolPtr<grpc_metadata_batch> ToMetadataBatch(Arena* arena);
Arena::PoolPtr<grpc_metadata_batch> ToMetadataBatch();
static absl::StatusOr<SettingsMetadata> FromMetadataBatch(
const grpc_metadata_batch& batch);
};

@ -790,8 +790,7 @@ void grpc_chttp2_stream_unref(grpc_chttp2_stream* s) {
grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
grpc_stream_refcount* refcount,
const void* server_data,
grpc_core::Arena* arena)
const void* server_data)
: t(t->Ref()),
refcount([refcount]() {
// We reserve one 'active stream' that's dropped when the stream is
@ -805,8 +804,6 @@ grpc_chttp2_stream::grpc_chttp2_stream(grpc_chttp2_transport* t,
#endif
return refcount;
}()),
initial_metadata_buffer(arena),
trailing_metadata_buffer(arena),
flow_control(&t->flow_control) {
t->streams_allocated.fetch_add(1, std::memory_order_relaxed);
if (server_data) {
@ -864,8 +861,8 @@ grpc_chttp2_stream::~grpc_chttp2_stream() {
void grpc_chttp2_transport::InitStream(grpc_stream* gs,
grpc_stream_refcount* refcount,
const void* server_data,
grpc_core::Arena* arena) {
new (gs) grpc_chttp2_stream(this, refcount, server_data, arena);
grpc_core::Arena*) {
new (gs) grpc_chttp2_stream(this, refcount, server_data);
}
static void destroy_stream_locked(void* sp, grpc_error_handle /*error*/) {

@ -546,7 +546,7 @@ typedef enum {
struct grpc_chttp2_stream {
grpc_chttp2_stream(grpc_chttp2_transport* t, grpc_stream_refcount* refcount,
const void* server_data, grpc_core::Arena* arena);
const void* server_data);
~grpc_chttp2_stream();
void* context = nullptr;

@ -154,9 +154,6 @@ typedef struct grpc_cronet_transport grpc_cronet_transport;
// TODO (makdharma): reorder structure for memory efficiency per
// http://www.catb.org/esr/structure-packing/#_structure_reordering:
struct read_state {
explicit read_state(grpc_core::Arena* arena)
: trailing_metadata(arena), initial_metadata(arena) {}
// vars to store data coming from server
char* read_buffer = nullptr;
bool length_field_received = false;
@ -185,8 +182,6 @@ struct write_state {
// track state of one stream op
struct op_state {
explicit op_state(grpc_core::Arena* arena) : rs(arena) {}
bool state_op_done[OP_NUM_OPS] = {};
bool state_callback_received[OP_NUM_OPS] = {};
// A non-zero gRPC status code has been seen
@ -352,7 +347,7 @@ static grpc_error_handle make_error_with_desc(int error_code,
inline op_and_state::op_and_state(stream_obj* s,
const grpc_transport_stream_op_batch& op)
: op(op), state(s->arena), s(s) {}
: op(op), s(s) {}
//
// Add a new stream op to op storage.
@ -1412,7 +1407,6 @@ inline stream_obj::stream_obj(grpc_core::Transport* gt, grpc_stream* gs,
: arena(arena),
curr_ct(reinterpret_cast<grpc_cronet_transport*>(gt)),
curr_gs(gs),
state(arena),
refcount(refcount) {
GRPC_CRONET_STREAM_REF(this, "cronet transport");
gpr_mu_init(&mu);

@ -268,18 +268,18 @@ struct inproc_stream {
grpc_stream_refcount* refs;
grpc_core::Arena* arena;
grpc_metadata_batch to_read_initial_md{arena};
grpc_metadata_batch to_read_initial_md;
bool to_read_initial_md_filled = false;
grpc_metadata_batch to_read_trailing_md{arena};
grpc_metadata_batch to_read_trailing_md;
bool to_read_trailing_md_filled = false;
bool ops_needed = false;
// Write buffer used only during gap at init time when client-side
// stream is set up but server side stream is not yet set up
grpc_metadata_batch write_buffer_initial_md{arena};
grpc_metadata_batch write_buffer_initial_md;
bool write_buffer_initial_md_filled = false;
grpc_core::Timestamp write_buffer_deadline =
grpc_core::Timestamp::InfFuture();
grpc_metadata_batch write_buffer_trailing_md{arena};
grpc_metadata_batch write_buffer_trailing_md;
bool write_buffer_trailing_md_filled = false;
grpc_error_handle write_buffer_cancel_error;
@ -457,7 +457,7 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
// Send trailing md to the other side indicating cancellation
s->trailing_md_sent = true;
grpc_metadata_batch fake_md(s->arena);
grpc_metadata_batch fake_md;
inproc_stream* other = s->other_side;
grpc_metadata_batch* dest = (other == nullptr)
? &s->write_buffer_trailing_md
@ -480,7 +480,7 @@ void fail_helper_locked(inproc_stream* s, grpc_error_handle error) {
if (!s->t->is_client) {
// If this is a server, provide initial metadata with a path and
// authority since it expects that as well as no error yet
grpc_metadata_batch fake_md(s->arena);
grpc_metadata_batch fake_md;
fake_md.Set(grpc_core::HttpPathMetadata(),
grpc_core::Slice::FromStaticString("/"));
fake_md.Set(grpc_core::HttpAuthorityMetadata(),
@ -903,7 +903,7 @@ bool cancel_stream_locked(inproc_stream* s, grpc_error_handle error) {
// already have
s->trailing_md_sent = true;
grpc_metadata_batch cancel_md(s->arena);
grpc_metadata_batch cancel_md;
grpc_metadata_batch* dest = (other == nullptr)
? &s->write_buffer_trailing_md

@ -465,7 +465,7 @@ ArenaPromise<ServerMetadataHandle> MakeClientCallPromise(Transport* transport,
// Start a promise to receive server initial metadata and then forward it up
// through the receiving pipe.
auto server_initial_metadata =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
GetContext<Arena>()->MakePooled<ServerMetadata>();
party->Spawn(
"recv_initial_metadata",
TrySeq(GetContext<BatchBuilder>()->ReceiveServerInitialMetadata(
@ -503,15 +503,14 @@ ArenaPromise<ServerMetadataHandle> MakeClientCallPromise(Transport* transport,
// If this fails, we massage the error into metadata that we can report
// upwards.
auto server_trailing_metadata =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
GetContext<Arena>()->MakePooled<ServerMetadata>();
auto recv_trailing_metadata =
Map(GetContext<BatchBuilder>()->ReceiveServerTrailingMetadata(
stream->batch_target()),
[](absl::StatusOr<ServerMetadataHandle> status) mutable {
if (!status.ok()) {
auto server_trailing_metadata =
GetContext<Arena>()->MakePooled<ServerMetadata>(
GetContext<Arena>());
GetContext<Arena>()->MakePooled<ServerMetadata>();
grpc_status_code status_code = GRPC_STATUS_UNKNOWN;
std::string message;
grpc_error_get_status(status.status(), Timestamp::InfFuture(),
@ -787,8 +786,7 @@ ArenaPromise<ServerMetadataHandle> MakeServerCallPromise(
trailing_metadata = std::move(*status);
} else {
trailing_metadata =
GetContext<Arena>()->MakePooled<ClientMetadata>(
GetContext<Arena>());
GetContext<Arena>()->MakePooled<ClientMetadata>();
grpc_status_code status_code = GRPC_STATUS_UNKNOWN;
std::string message;
grpc_error_get_status(status.status(), Timestamp::InfFuture(),
@ -898,8 +896,7 @@ ArenaPromise<ServerMetadataHandle> MakeClientTransportCallPromise(
md->Set(GrpcStatusFromWire(), true);
return md;
}
auto m = GetContext<Arena>()->MakePooled<ServerMetadata>(
GetContext<Arena>());
auto m = GetContext<Arena>()->MakePooled<ServerMetadata>();
m->Set(GrpcStatusMetadata(), GRPC_STATUS_CANCELLED);
m->Set(GrpcCallWasCancelled(), true);
return m;

@ -722,10 +722,10 @@ class FilterStackCall final : public Call {
grpc_transport_stream_op_batch_payload stream_op_payload_;
// first idx: is_receiving, second idx: is_trailing
grpc_metadata_batch send_initial_metadata_{arena()};
grpc_metadata_batch send_trailing_metadata_{arena()};
grpc_metadata_batch recv_initial_metadata_{arena()};
grpc_metadata_batch recv_trailing_metadata_{arena()};
grpc_metadata_batch send_initial_metadata_;
grpc_metadata_batch send_trailing_metadata_;
grpc_metadata_batch recv_initial_metadata_;
grpc_metadata_batch recv_trailing_metadata_;
// Buffered read metadata waiting to be returned to the application.
// Element 0 is initial metadata, element 1 is trailing metadata.
@ -2740,8 +2740,7 @@ class ClientPromiseBasedCall final : public PromiseBasedCall {
ScopedContext context(this);
args->channel->channel_stack()->stats_plugin_group->AddClientCallTracers(
*args->path, args->registered_method, this->context());
send_initial_metadata_ =
GetContext<Arena>()->MakePooled<ClientMetadata>(GetContext<Arena>());
send_initial_metadata_ = GetContext<Arena>()->MakePooled<ClientMetadata>();
send_initial_metadata_->Set(HttpPathMetadata(), std::move(*args->path));
if (args->authority.has_value()) {
send_initial_metadata_->Set(HttpAuthorityMetadata(),
@ -3147,7 +3146,7 @@ void ClientPromiseBasedCall::StartRecvInitialMetadata(
is_trailers_only_ = metadata->get(GrpcTrailersOnly()).value_or(false);
} else {
is_trailers_only_ = true;
metadata = arena()->MakePooled<ServerMetadata>(arena());
metadata = arena()->MakePooled<ServerMetadata>();
}
ProcessIncomingInitialMetadata(*metadata);
PublishMetadataArray(metadata.get(), array, true);
@ -3524,7 +3523,7 @@ void ServerPromiseBasedCall::CommitBatch(const grpc_op* ops, size_t nops,
const grpc_op& op = ops[op_idx];
switch (op.op) {
case GRPC_OP_SEND_INITIAL_METADATA: {
auto metadata = arena()->MakePooled<ServerMetadata>(arena());
auto metadata = arena()->MakePooled<ServerMetadata>();
PrepareOutgoingInitialMetadata(op, *metadata);
CToMetadata(op.data.send_initial_metadata.metadata,
op.data.send_initial_metadata.count, metadata.get());
@ -3564,7 +3563,7 @@ void ServerPromiseBasedCall::CommitBatch(const grpc_op* ops, size_t nops,
client_to_server_messages_, true, spawner);
break;
case GRPC_OP_SEND_STATUS_FROM_SERVER: {
auto metadata = arena()->MakePooled<ServerMetadata>(arena());
auto metadata = arena()->MakePooled<ServerMetadata>();
CToMetadata(op.data.send_status_from_server.trailing_metadata,
op.data.send_status_from_server.trailing_metadata_count,
metadata.get());
@ -4037,7 +4036,7 @@ void ServerCallSpine::CommitBatch(const grpc_op* ops, size_t nops,
if (!is_notify_tag_closure) grpc_cq_begin_op(cq(), notify_tag);
auto send_initial_metadata = MaybeOp(
ops, got_ops[GRPC_OP_SEND_INITIAL_METADATA], [this](const grpc_op& op) {
auto metadata = arena()->MakePooled<ServerMetadata>(arena());
auto metadata = arena()->MakePooled<ServerMetadata>();
PrepareOutgoingInitialMetadata(op, *metadata);
CToMetadata(op.data.send_initial_metadata.metadata,
op.data.send_initial_metadata.count, metadata.get());
@ -4067,7 +4066,7 @@ void ServerCallSpine::CommitBatch(const grpc_op* ops, size_t nops,
});
auto send_trailing_metadata = MaybeOp(
ops, got_ops[GRPC_OP_SEND_STATUS_FROM_SERVER], [this](const grpc_op& op) {
auto metadata = arena()->MakePooled<ServerMetadata>(arena());
auto metadata = arena()->MakePooled<ServerMetadata>();
CToMetadata(op.data.send_status_from_server.trailing_metadata,
op.data.send_status_from_server.trailing_metadata_count,
metadata.get());

@ -162,8 +162,7 @@ class BatchBuilder {
using PendingCompletion::PendingCompletion;
Arena::PoolPtr<grpc_metadata_batch> metadata =
GetContext<Arena>()->MakePooled<grpc_metadata_batch>(
GetContext<Arena>());
GetContext<Arena>()->MakePooled<grpc_metadata_batch>();
protected:
~PendingReceiveMetadata() = default;
@ -330,8 +329,7 @@ inline auto BatchBuilder::SendClientTrailingMetadata(Target target) {
auto* pc = batch->GetInitializedCompletion(&Batch::pending_sends);
batch->batch.on_complete = &pc->on_done_closure;
batch->batch.send_trailing_metadata = true;
auto metadata =
GetContext<Arena>()->MakePooled<grpc_metadata_batch>(GetContext<Arena>());
auto metadata = GetContext<Arena>()->MakePooled<grpc_metadata_batch>();
payload_->send_trailing_metadata.send_trailing_metadata = metadata.get();
payload_->send_trailing_metadata.sent = nullptr;
pc->send_trailing_metadata = std::move(metadata);

@ -22,7 +22,7 @@ namespace grpc_core {
ServerMetadataHandle ServerMetadataFromStatus(const absl::Status& status,
Arena* arena) {
auto hdl = arena->MakePooled<ServerMetadata>(arena);
auto hdl = arena->MakePooled<ServerMetadata>();
grpc_status_code code;
std::string message;
grpc_error_get_status(status, Timestamp::InfFuture(), &code, &message,

@ -96,14 +96,15 @@ bool DebugStringBuilder::IsAllowListed(const absl::string_view key) const {
}
void UnknownMap::Append(absl::string_view key, Slice value) {
unknown_.EmplaceBack(Slice::FromCopiedString(key), value.Ref());
unknown_.emplace_back(Slice::FromCopiedString(key), value.Ref());
}
void UnknownMap::Remove(absl::string_view key) {
unknown_.SetEnd(std::remove_if(unknown_.begin(), unknown_.end(),
unknown_.erase(std::remove_if(unknown_.begin(), unknown_.end(),
[key](const std::pair<Slice, Slice>& p) {
return p.first.as_string_view() == key;
}));
}),
unknown_.end());
}
absl::optional<absl::string_view> UnknownMap::GetStringValue(

@ -47,7 +47,6 @@
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/gprpp/type_list.h"
#include "src/core/lib/promise/poll.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/custom_metadata.h"
#include "src/core/lib/transport/metadata_compression_traits.h"
@ -1051,22 +1050,19 @@ class TransportSizeEncoder {
// Handle unknown (non-trait-based) fields in the metadata map.
class UnknownMap {
public:
explicit UnknownMap(Arena* arena) : unknown_(arena) {}
using BackingType = ChunkedVector<std::pair<Slice, Slice>, 5>;
using BackingType = std::vector<std::pair<Slice, Slice>>;
void Append(absl::string_view key, Slice value);
void Remove(absl::string_view key);
absl::optional<absl::string_view> GetStringValue(absl::string_view key,
std::string* backing) const;
BackingType::ConstForwardIterator begin() const { return unknown_.cbegin(); }
BackingType::ConstForwardIterator end() const { return unknown_.cend(); }
BackingType::const_iterator begin() const { return unknown_.cbegin(); }
BackingType::const_iterator end() const { return unknown_.cend(); }
bool empty() const { return unknown_.empty(); }
size_t size() const { return unknown_.size(); }
void Clear() { unknown_.Clear(); }
Arena* arena() const { return unknown_.arena(); }
void Clear() { unknown_.clear(); }
private:
// Backing store for added metadata.
@ -1223,7 +1219,7 @@ MetadataValueAsSlice(typename Which::ValueType value) {
template <class Derived, typename... Traits>
class MetadataMap {
public:
explicit MetadataMap(Arena* arena);
MetadataMap() = default;
~MetadataMap();
// Given a compressor factory - template taking <MetadataTrait,
@ -1446,9 +1442,6 @@ inline bool IsStatusOk(const MetadataMap<Derived, Args...>& m) {
GRPC_STATUS_OK;
}
template <typename Derived, typename... Traits>
MetadataMap<Derived, Traits...>::MetadataMap(Arena* arena) : unknown_(arena) {}
template <typename Derived, typename... Traits>
MetadataMap<Derived, Traits...>::MetadataMap(MetadataMap&& other) noexcept
: table_(std::move(other.table_)), unknown_(std::move(other.unknown_)) {}
@ -1482,7 +1475,7 @@ size_t MetadataMap<Derived, Traits...>::TransportSize() const {
template <typename Derived, typename... Traits>
Derived MetadataMap<Derived, Traits...>::Copy() const {
Derived out(unknown_.arena());
Derived out;
metadata_detail::CopySink<Derived> sink(&out);
ForEach(&sink);
return out;

@ -354,7 +354,7 @@ Arena* FilterTestBase::Call::arena() { return impl_->arena(); }
ClientMetadataHandle FilterTestBase::Call::NewClientMetadata(
std::initializer_list<std::pair<absl::string_view, absl::string_view>>
init) {
auto md = impl_->arena()->MakePooled<ClientMetadata>(impl_->arena());
auto md = impl_->arena()->MakePooled<ClientMetadata>();
for (auto& p : init) {
auto parsed = ClientMetadata::Parse(
p.first, Slice::FromCopiedString(p.second), false,
@ -371,7 +371,7 @@ ClientMetadataHandle FilterTestBase::Call::NewClientMetadata(
ServerMetadataHandle FilterTestBase::Call::NewServerMetadata(
std::initializer_list<std::pair<absl::string_view, absl::string_view>>
init) {
auto md = impl_->arena()->MakePooled<ClientMetadata>(impl_->arena());
auto md = impl_->arena()->MakePooled<ClientMetadata>();
for (auto& p : init) {
auto parsed = ServerMetadata::Parse(
p.first, Slice::FromCopiedString(p.second), false,

@ -19,12 +19,8 @@
#include <grpc/event_engine/memory_allocator.h>
#include <grpc/status.h>
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/promise/poll.h"
#include "src/core/lib/promise/try_seq.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/resource_quota/memory_quota.h"
#include "src/core/lib/resource_quota/resource_quota.h"
#include "src/core/lib/transport/metadata_batch.h"
namespace grpc_core {
@ -34,17 +30,14 @@ struct TestMap : public MetadataMap<TestMap, GrpcStatusMetadata> {
};
TEST(PromiseTest, SucceedAndThenFail) {
MemoryAllocator memory_allocator = MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
auto arena = MakeScopedArena(1024, &memory_allocator);
Poll<TestMap> r = TrySeq(
[&arena] {
TestMap m(arena.get());
[] {
TestMap m;
m.Set(GrpcStatusMetadata(), GRPC_STATUS_OK);
return m;
},
[&arena]() {
TestMap m(arena.get());
[]() {
TestMap m;
m.Set(GrpcStatusMetadata(), GRPC_STATUS_UNAVAILABLE);
return m;
})();

@ -519,7 +519,7 @@ class RequestMetadataState : public RefCounted<RequestMetadataState> {
MemoryAllocator memory_allocator_ = MemoryAllocator(
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator("test"));
ScopedArenaPtr arena_ = MakeScopedArena(1024, &memory_allocator_);
grpc_metadata_batch md_{arena_.get()};
grpc_metadata_batch md_;
grpc_call_credentials::GetRequestMetadataArgs get_request_metadata_args_;
grpc_polling_entity pollent_;
ActivityPtr activity_;

@ -54,7 +54,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials(
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch initial_metadata{arena.get()};
grpc_metadata_batch initial_metadata;
char* token = nullptr;
auto activity = grpc_core::MakeActivity(

@ -240,7 +240,7 @@ struct MakeSendInitialMetadata {
->CreateMemoryAllocator("test"));
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
grpc_metadata_batch grpc_initial_metadata;
};
struct MakeSendMessage {
@ -271,7 +271,7 @@ struct MakeSendTrailingMetadata {
->CreateMemoryAllocator("test"));
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
grpc_metadata_batch grpc_trailing_metadata;
};
struct MakeRecvInitialMetadata {
@ -299,7 +299,7 @@ struct MakeRecvInitialMetadata {
->CreateMemoryAllocator("test"));
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch grpc_initial_metadata{arena.get()};
grpc_metadata_batch grpc_initial_metadata;
grpc_core::Notification notification;
};
@ -347,7 +347,7 @@ struct MakeRecvTrailingMetadata {
->CreateMemoryAllocator("test"));
grpc_core::ScopedArenaPtr arena =
grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch grpc_trailing_metadata{arena.get()};
grpc_metadata_batch grpc_trailing_metadata;
grpc_core::Notification notification;
};

@ -354,10 +354,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningVoid) {
EXPECT_EQ(d.client_initial_metadata.ops[0].poll, nullptr);
EXPECT_EQ(d.client_initial_metadata.ops[0].early_destroy, nullptr);
// Check promise init
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
char call_data;
auto r = d.client_initial_metadata.ops[0].promise_init(
@ -392,10 +389,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningVoidTakingChannelPtr) {
EXPECT_EQ(d.client_initial_metadata.ops[0].poll, nullptr);
EXPECT_EQ(d.client_initial_metadata.ops[0].early_destroy, nullptr);
// Check promise init
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
char call_data;
auto r = d.client_initial_metadata.ops[0].promise_init(
@ -442,7 +436,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningAbslStatus) {
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -453,7 +447,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningAbslStatus) {
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
nullptr, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -502,7 +496,7 @@ TEST(StackDataTest,
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -513,7 +507,7 @@ TEST(StackDataTest,
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
nullptr, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -561,7 +555,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningServerMetadata) {
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -572,7 +566,7 @@ TEST(StackDataTest, InstantClientInitialMetadataReturningServerMetadata) {
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
nullptr, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -623,7 +617,7 @@ TEST(StackDataTest,
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -634,7 +628,7 @@ TEST(StackDataTest,
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
nullptr, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -683,7 +677,7 @@ TEST(StackDataTest, PromiseClientInitialMetadataReturningAbslStatus) {
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -701,7 +695,7 @@ TEST(StackDataTest, PromiseClientInitialMetadataReturningAbslStatus) {
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
promise_data, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -714,7 +708,7 @@ TEST(StackDataTest, PromiseClientInitialMetadataReturningAbslStatus) {
EXPECT_EQ(r.value().ok, nullptr);
EXPECT_EQ(r.value().error->get(GrpcStatusMetadata()), GRPC_STATUS_CANCELLED);
// A cancelled call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
promise_data, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -766,7 +760,7 @@ TEST(StackDataTest,
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ClientMetadata>(arena.get());
auto md = Arena::MakePooled<ClientMetadata>();
promise_detail::Context<Arena> ctx(arena.get());
// A succeeding call
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
@ -784,7 +778,7 @@ TEST(StackDataTest,
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"hello");
// A failing call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
promise_data, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -797,7 +791,7 @@ TEST(StackDataTest,
EXPECT_EQ(r.value().ok, nullptr);
EXPECT_EQ(r.value().error->get(GrpcStatusMetadata()), GRPC_STATUS_CANCELLED);
// A cancelled call
md = Arena::MakePooled<ClientMetadata>(arena.get());
md = Arena::MakePooled<ClientMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = d.client_initial_metadata.ops[0].promise_init(
promise_data, call_data, d.client_initial_metadata.ops[0].channel_data,
@ -836,7 +830,7 @@ TEST(StackDataTest, InstantServerInitialMetadataReturningVoid) {
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
char call_data;
auto r = d.server_initial_metadata.ops[0].promise_init(
@ -943,7 +937,7 @@ TEST(StackDataTest, InstantServerTrailingMetadataReturningVoid) {
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
char call_data;
auto r = d.server_trailing_metadata.ops[0].promise_init(
@ -983,7 +977,7 @@ TEST(StackDataTest,
auto memory_allocator =
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
char call_data;
auto r = d.server_trailing_metadata.ops[0].promise_init(
@ -1075,7 +1069,7 @@ TEST(OperationExecutorTest, InstantTwo) {
auto arena = MakeScopedArena(1024, &memory_allocator);
promise_detail::Context<Arena> ctx(arena.get());
// First call succeeds
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
auto r =
transformer.Start(&d.client_initial_metadata, std::move(md), call_data1);
@ -1083,7 +1077,7 @@ TEST(OperationExecutorTest, InstantTwo) {
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"world");
// Second fails
md = Arena::MakePooled<ServerMetadata>(arena.get());
md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = transformer.Start(&d.client_initial_metadata, std::move(md), call_data1);
EXPECT_TRUE(r.ready());
@ -1140,7 +1134,7 @@ TEST(OperationExecutorTest, PromiseTwo) {
auto arena = MakeScopedArena(1024, &memory_allocator);
promise_detail::Context<Arena> ctx(arena.get());
// First call succeeds after two sets of two step delays.
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
auto r =
transformer.Start(&d.client_initial_metadata, std::move(md), call_data1);
@ -1156,7 +1150,7 @@ TEST(OperationExecutorTest, PromiseTwo) {
EXPECT_EQ(r.value().ok->get_pointer(HttpPathMetadata())->as_string_view(),
"world");
// Second fails after one set of two step delays.
md = Arena::MakePooled<ServerMetadata>(arena.get());
md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
r = transformer.Start(&d.client_initial_metadata, std::move(md), call_data1);
EXPECT_FALSE(r.ready());
@ -1211,7 +1205,7 @@ TEST(InfallibleOperationExecutor, InstantTwo) {
MakeMemoryQuota("test-quota")->CreateMemoryAllocator("foo");
auto arena = MakeScopedArena(1024, &memory_allocator);
promise_detail::Context<Arena> ctx(arena.get());
auto md = Arena::MakePooled<ServerMetadata>(arena.get());
auto md = Arena::MakePooled<ServerMetadata>();
EXPECT_EQ(md->get_pointer(HttpPathMetadata()), nullptr);
auto r =
transformer.Start(&d.server_trailing_metadata, std::move(md), call_data);
@ -1416,8 +1410,8 @@ TEST(CallFiltersTest, UnaryCall) {
StrictMock<MockActivity> activity;
activity.Activate();
// Push client initial metadata
auto push_client_initial_metadata = filters.PushClientInitialMetadata(
Arena::MakePooled<ClientMetadata>(arena.get()));
auto push_client_initial_metadata =
filters.PushClientInitialMetadata(Arena::MakePooled<ClientMetadata>());
EXPECT_THAT(push_client_initial_metadata(), IsPending());
auto pull_client_initial_metadata = filters.PullClientInitialMetadata();
// Pull client initial metadata, expect a wakeup
@ -1438,8 +1432,8 @@ TEST(CallFiltersTest, UnaryCall) {
// Push should be done
EXPECT_THAT(push_client_to_server_message(), IsReady(Success{}));
// Push server initial metadata
auto push_server_initial_metadata = filters.PushServerInitialMetadata(
Arena::MakePooled<ServerMetadata>(arena.get()));
auto push_server_initial_metadata =
filters.PushServerInitialMetadata(Arena::MakePooled<ServerMetadata>());
EXPECT_THAT(push_server_initial_metadata(), IsPending());
auto pull_server_initial_metadata = filters.PullServerInitialMetadata();
// Pull server initial metadata, expect a wakeup
@ -1460,8 +1454,7 @@ TEST(CallFiltersTest, UnaryCall) {
// Push should be done
EXPECT_THAT(push_server_to_client_message(), IsReady(Success{}));
// Push server trailing metadata
filters.PushServerTrailingMetadata(
Arena::MakePooled<ServerMetadata>(arena.get()));
filters.PushServerTrailingMetadata(Arena::MakePooled<ServerMetadata>());
// Pull server trailing metadata
auto pull_server_trailing_metadata = filters.PullServerTrailingMetadata();
// Should be done

@ -120,8 +120,7 @@ auto SendClientToServerMessages(CallInitiator initiator, int num_messages) {
}
ClientMetadataHandle TestInitialMetadata() {
auto md =
GetContext<Arena>()->MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = GetContext<Arena>()->MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromStaticString("/test"));
return md;
}

@ -67,8 +67,7 @@ const uint8_t kGrpcStatus0[] = {0x10, 0x0b, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x01, 0x30};
ClientMetadataHandle TestInitialMetadata() {
auto md =
GetContext<Arena>()->MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = GetContext<Arena>()->MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromStaticString("/demo.Service/Step"));
return md;
}

@ -71,15 +71,13 @@ const uint8_t kGrpcStatus0[] = {0x40, 0x0b, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x01, 0x30};
ServerMetadataHandle TestInitialMetadata() {
auto md =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = GetContext<Arena>()->MakePooled<ServerMetadata>();
md->Set(HttpPathMetadata(), Slice::FromStaticString("/demo.Service/Step"));
return md;
}
ServerMetadataHandle TestTrailingMetadata() {
auto md =
GetContext<Arena>()->MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = GetContext<Arena>()->MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_OK);
return md;
}

@ -159,7 +159,7 @@ grpc_slice EncodeHeaderIntoBytes(
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
for (const auto& field : header_fields) {
b.Append(field.first,
@ -309,7 +309,7 @@ static void verify_continuation_headers(const char* key, const char* value,
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_slice_buffer output;
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
b.Append(key, grpc_core::Slice::FromStaticString(value), CrashOnAppendError);
grpc_slice_buffer_init(&output);
@ -349,7 +349,7 @@ TEST(HpackEncoderTest, EncodeBinaryAsBase64) {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
// Haiku by Bard
b.Append("grpc-trace-bin",
grpc_core::Slice::FromStaticString(
@ -379,7 +379,7 @@ TEST(HpackEncoderTest, EncodeBinaryAsTrueBinary) {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
// Haiku by Bard
b.Append("grpc-trace-bin",
grpc_core::Slice::FromStaticString(

@ -70,7 +70,7 @@ DEFINE_PROTO_FUZZER(const hpack_parser_fuzzer::Msg& msg) {
for (int i = 0; i < msg.frames_size(); i++) {
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_core::ExecCtx exec_ctx;
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
const auto& frame = msg.frames(i);
if (frame.parse_size() == 0) continue;

@ -90,7 +90,7 @@ absl::StatusOr<std::string> TestVector(grpc_slice_split_mode mode,
size_t nslices;
size_t i;
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
HPackParser parser;
parser.BeginFrame(

@ -118,7 +118,7 @@ class ParseTest : public ::testing::TestWithParam<Test> {
size_t i;
absl::BitGen bitgen;
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
parser_->BeginFrame(
&b, max_metadata_size.value_or(4096), max_metadata_size.value_or(4096),

@ -122,7 +122,7 @@ void FuzzOneInput(const hpack_sync_fuzzer::Msg& msg) {
"test-allocator");
auto arena = MakeScopedArena(1024, &memory_allocator);
ExecCtx exec_ctx;
grpc_metadata_batch read_metadata(arena.get());
grpc_metadata_batch read_metadata;
parser.BeginFrame(
&read_metadata, 1024, 1024, HPackParser::Boundary::EndOfHeaders,
HPackParser::Priority::None,

@ -64,17 +64,17 @@ class MetadataMapTest : public ::testing::Test {
TEST_F(MetadataMapTest, Noop) {
auto arena = MakeScopedArena(1024, &memory_allocator_);
EmptyMetadataMap(arena.get());
EmptyMetadataMap();
}
TEST_F(MetadataMapTest, NoopWithDeadline) {
auto arena = MakeScopedArena(1024, &memory_allocator_);
TimeoutOnlyMetadataMap(arena.get());
TimeoutOnlyMetadataMap();
}
TEST_F(MetadataMapTest, SimpleOps) {
auto arena = MakeScopedArena(1024, &memory_allocator_);
TimeoutOnlyMetadataMap map(arena.get());
TimeoutOnlyMetadataMap map;
EXPECT_EQ(map.get_pointer(GrpcTimeoutMetadata()), nullptr);
EXPECT_EQ(map.get(GrpcTimeoutMetadata()), absl::nullopt);
map.Set(GrpcTimeoutMetadata(),
@ -113,7 +113,7 @@ class FakeEncoder {
TEST_F(MetadataMapTest, EmptyEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024, &memory_allocator_);
TimeoutOnlyMetadataMap map(arena.get());
TimeoutOnlyMetadataMap map;
map.Encode(&encoder);
EXPECT_EQ(encoder.output(), "");
}
@ -121,7 +121,7 @@ TEST_F(MetadataMapTest, EmptyEncodeTest) {
TEST_F(MetadataMapTest, TimeoutEncodeTest) {
FakeEncoder encoder;
auto arena = MakeScopedArena(1024, &memory_allocator_);
TimeoutOnlyMetadataMap map(arena.get());
TimeoutOnlyMetadataMap map;
map.Set(GrpcTimeoutMetadata(),
Timestamp::FromMillisecondsAfterProcessEpoch(1234));
map.Encode(&encoder);
@ -135,7 +135,7 @@ TEST_F(MetadataMapTest, NonEncodableTrait) {
}
};
auto arena = MakeScopedArena(1024, &memory_allocator_);
StreamNetworkStateMetadataMap map(arena.get());
StreamNetworkStateMetadataMap map;
map.Set(GrpcStreamNetworkState(), GrpcStreamNetworkState::kNotSentOnWire);
EXPECT_EQ(map.get(GrpcStreamNetworkState()),
GrpcStreamNetworkState::kNotSentOnWire);

@ -72,7 +72,7 @@ TRANSPORT_TEST(UnaryWithSomeContent) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
FillMetadata(client_initial_metadata, *md);
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -126,7 +126,7 @@ TRANSPORT_TEST(UnaryWithSomeContent) {
[&](NextResult<MessageHandle> msg) {
EXPECT_FALSE(msg.has_value());
EXPECT_FALSE(msg.cancelled());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
FillMetadata(server_initial_metadata, *md);
return handler.PushServerInitialMetadata(std::move(md));
},
@ -137,7 +137,7 @@ TRANSPORT_TEST(UnaryWithSomeContent) {
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
FillMetadata(server_trailing_metadata, *md);
return handler.PushServerTrailingMetadata(std::move(md));
},

@ -22,7 +22,7 @@ TRANSPORT_TEST(MetadataOnlyRequest) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -55,13 +55,13 @@ TRANSPORT_TEST(MetadataOnlyRequest) {
},
[&](NextResult<MessageHandle> msg) {
EXPECT_FALSE(msg.has_value());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md));
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -83,7 +83,7 @@ TRANSPORT_TEST(MetadataOnlyRequestServerAbortsAfterInitialMetadata) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -115,13 +115,13 @@ TRANSPORT_TEST(MetadataOnlyRequestServerAbortsAfterInitialMetadata) {
"/foo/bar");
// Don't wait for end of stream for client->server messages, just
// publish initial then trailing metadata.
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md));
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -143,7 +143,7 @@ TRANSPORT_TEST(MetadataOnlyRequestServerAbortsImmediately) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -173,7 +173,7 @@ TRANSPORT_TEST(MetadataOnlyRequestServerAbortsImmediately) {
"/foo/bar");
// Don't wait for end of stream for client->server messages, just
// and don't send initial metadata - just trailing metadata.
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -190,7 +190,7 @@ TRANSPORT_TEST(CanCreateCallThenAbandonIt) {
SpawnTestSeq(
initiator, "start-call",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -212,7 +212,7 @@ TRANSPORT_TEST(UnaryRequest) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -267,7 +267,7 @@ TRANSPORT_TEST(UnaryRequest) {
[&](NextResult<MessageHandle> msg) {
EXPECT_FALSE(msg.has_value());
EXPECT_FALSE(msg.cancelled());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md));
},
@ -278,7 +278,7 @@ TRANSPORT_TEST(UnaryRequest) {
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -295,7 +295,7 @@ TRANSPORT_TEST(UnaryRequestOmitCheckEndOfStream) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -340,7 +340,7 @@ TRANSPORT_TEST(UnaryRequestOmitCheckEndOfStream) {
[&](NextResult<MessageHandle> msg) {
EXPECT_TRUE(msg.has_value());
EXPECT_EQ(msg.value()->payload()->JoinIntoString(), "hello world");
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md));
},
@ -351,7 +351,7 @@ TRANSPORT_TEST(UnaryRequestOmitCheckEndOfStream) {
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -368,7 +368,7 @@ TRANSPORT_TEST(UnaryRequestWaitForServerInitialMetadataBeforeSendingPayload) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -413,7 +413,7 @@ TRANSPORT_TEST(UnaryRequestWaitForServerInitialMetadataBeforeSendingPayload) {
EXPECT_TRUE(md.ok());
EXPECT_EQ(md.value()->get_pointer(HttpPathMetadata())->as_string_view(),
"/foo/bar");
auto md_out = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md_out = Arena::MakePooled<ServerMetadata>();
md_out->Set(ContentTypeMetadata(),
ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md_out));
@ -435,7 +435,7 @@ TRANSPORT_TEST(UnaryRequestWaitForServerInitialMetadataBeforeSendingPayload) {
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -452,7 +452,7 @@ TRANSPORT_TEST(ClientStreamingRequest) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -511,7 +511,7 @@ TRANSPORT_TEST(ClientStreamingRequest) {
EXPECT_TRUE(md.ok());
EXPECT_EQ(md.value()->get_pointer(HttpPathMetadata())->as_string_view(),
"/foo/bar");
auto md_out = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md_out = Arena::MakePooled<ServerMetadata>();
md_out->Set(ContentTypeMetadata(),
ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md_out));
@ -548,7 +548,7 @@ TRANSPORT_TEST(ClientStreamingRequest) {
[&](NextResult<MessageHandle> msg) {
EXPECT_FALSE(msg.has_value());
EXPECT_FALSE(msg.cancelled());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},
@ -565,7 +565,7 @@ TRANSPORT_TEST(ServerStreamingRequest) {
SpawnTestSeq(
initiator, "initiator",
[&]() {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(), Slice::FromExternalString("/foo/bar"));
return initiator.PushClientInitialMetadata(std::move(md));
},
@ -635,7 +635,7 @@ TRANSPORT_TEST(ServerStreamingRequest) {
EXPECT_TRUE(md.ok());
EXPECT_EQ(md.value()->get_pointer(HttpPathMetadata())->as_string_view(),
"/foo/bar");
auto md_out = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md_out = Arena::MakePooled<ServerMetadata>();
md_out->Set(ContentTypeMetadata(),
ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md_out));
@ -677,7 +677,7 @@ TRANSPORT_TEST(ServerStreamingRequest) {
},
[&](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},

@ -36,7 +36,7 @@ TRANSPORT_TEST(ManyUnaryRequests) {
SpawnTestSeq(
initiator, make_call_name(i, "initiator"),
[initiator, i]() mutable {
auto md = Arena::MakePooled<ClientMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ClientMetadata>();
md->Set(HttpPathMetadata(),
Slice::FromCopiedString(std::to_string(i)));
return initiator.PushClientInitialMetadata(std::move(md));
@ -102,7 +102,7 @@ TRANSPORT_TEST(ManyUnaryRequests) {
[handler](NextResult<MessageHandle> msg) mutable {
EXPECT_FALSE(msg.has_value());
EXPECT_FALSE(msg.cancelled());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(ContentTypeMetadata(), ContentTypeMetadata::kApplicationGrpc);
return handler.PushServerInitialMetadata(std::move(md));
},
@ -116,7 +116,7 @@ TRANSPORT_TEST(ManyUnaryRequests) {
},
[handler](StatusFlag result) mutable {
EXPECT_TRUE(result.ok());
auto md = Arena::MakePooled<ServerMetadata>(GetContext<Arena>());
auto md = Arena::MakePooled<ServerMetadata>();
md->Set(GrpcStatusMetadata(), GRPC_STATUS_UNIMPLEMENTED);
return handler.PushServerTrailingMetadata(std::move(md));
},

@ -74,8 +74,7 @@ class EvaluateArgsTestUtil {
MemoryAllocator allocator_ =
ResourceQuota::Default()->memory_quota()->CreateMemoryAllocator(
"EvaluateArgsTestUtil");
ScopedArenaPtr arena_ = MakeScopedArena(1024, &allocator_);
grpc_metadata_batch metadata_{arena_.get()};
grpc_metadata_batch metadata_;
MockAuthorizationEndpoint endpoint_{/*local_uri=*/"", /*peer_uri=*/""};
grpc_auth_context auth_context_{nullptr};
EvaluateArgs::PerChannelArgs* channel_args_ = nullptr;

@ -75,7 +75,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
b.Set(grpc_core::GrpcTimeoutMetadata(),
saved_now + grpc_core::Duration::Seconds(30));
@ -111,7 +111,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
Fixture::Prepare(&b);
grpc_core::HPackCompressor c;
@ -351,7 +351,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
->CreateMemoryAllocator("test"));
auto* arena = grpc_core::Arena::Create(kArenaSize, &memory_allocator);
grpc_core::ManualConstructor<grpc_metadata_batch> b;
b.Init(arena);
b.Init();
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint32_t>::max(),
grpc_core::HPackParser::Boundary::None,
@ -377,7 +377,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) {
b.Destroy();
arena->Destroy();
arena = grpc_core::Arena::Create(kArenaSize, &memory_allocator);
b.Init(arena);
b.Init();
p.BeginFrame(&*b, std::numeric_limits<uint32_t>::max(),
std::numeric_limits<uint32_t>::max(),
grpc_core::HPackParser::Boundary::None,
@ -410,7 +410,7 @@ class FromEncoderFixture {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
EncoderFixture::Prepare(&b);
grpc_core::HPackCompressor c;

@ -333,7 +333,7 @@ static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) {
->memory_quota()
->CreateMemoryAllocator("test"));
auto arena = grpc_core::MakeScopedArena(1024, &memory_allocator);
grpc_metadata_batch b(arena.get());
grpc_metadata_batch b;
Metadata::Prepare(&b);
f.FlushExecCtx();

Loading…
Cancel
Save