Use grpc_mdelem_create() directly.

Remove grpc_mdelem_from_slices_no_unref() since it's a wrapper
around grpc_mdelem_create().
pull/16801/head
Soheil Hassas Yeganeh 6 years ago
parent d6b140df03
commit a280d89937
  1. 4
      src/core/ext/filters/client_channel/client_channel.cc
  2. 4
      src/core/ext/filters/http/client_authority_filter.cc
  3. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  4. 2
      src/core/lib/security/credentials/plugin/plugin_credentials.cc
  5. 8
      src/core/lib/surface/channel.cc
  6. 5
      src/core/lib/transport/metadata.cc
  7. 3
      src/core/lib/transport/metadata.h

@ -2211,9 +2211,9 @@ static void add_retriable_send_initial_metadata_op(
.grpc_previous_rpc_attempts);
}
if (GPR_UNLIKELY(calld->num_attempts_completed > 0)) {
grpc_mdelem retry_md = grpc_mdelem_from_slices_no_unref(
grpc_mdelem retry_md = grpc_mdelem_create(
GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS,
*retry_count_strings[calld->num_attempts_completed - 1]);
*retry_count_strings[calld->num_attempts_completed - 1], nullptr);
grpc_error* error = grpc_metadata_batch_add_tail(
&retry_state->send_initial_metadata,
&retry_state->send_initial_metadata_storage[calld->send_initial_metadata

@ -59,8 +59,8 @@ void authority_start_transport_stream_op_batch(
initial_metadata->idx.named.authority == nullptr) {
grpc_error* error = grpc_metadata_batch_add_head(
initial_metadata, &calld->authority_storage,
grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY,
chand->default_authority));
grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, chand->default_authority,
nullptr));
if (error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
calld->call_combiner);

@ -2127,8 +2127,8 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
GRPC_LOG_IF_ERROR(
"add_status_message",
grpc_chttp2_incoming_metadata_buffer_replace_or_add(
&s->metadata_buffer[1], grpc_mdelem_from_slices_no_unref(
GRPC_MDSTR_GRPC_MESSAGE, slice)));
&s->metadata_buffer[1],
grpc_mdelem_create(GRPC_MDSTR_GRPC_MESSAGE, slice, nullptr)));
}
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);

@ -102,7 +102,7 @@ static grpc_error* process_plugin_result(
} else {
for (size_t i = 0; i < num_md; ++i) {
grpc_mdelem mdelem =
grpc_mdelem_from_slices_no_unref(md[i].key, md[i].value);
grpc_mdelem_create(md[i].key, md[i].value, nullptr);
grpc_credentials_mdelem_array_add(r->md_array, mdelem);
GRPC_MDELEM_UNREF(mdelem);
}

@ -336,9 +336,9 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel,
grpc_core::ExecCtx exec_ctx;
grpc_call* call = grpc_channel_create_call_internal(
channel, parent_call, propagation_mask, cq, nullptr,
grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_PATH, method),
grpc_mdelem_create(GRPC_MDSTR_PATH, method, nullptr),
host != nullptr
? grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, *host)
? grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, *host, nullptr)
: GRPC_MDNULL,
grpc_timespec_to_millis_round_up(deadline));
@ -352,9 +352,9 @@ grpc_call* grpc_channel_create_pollset_set_call(
GPR_ASSERT(!reserved);
return grpc_channel_create_call_internal(
channel, parent_call, propagation_mask, nullptr, pollset_set,
grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_PATH, method),
grpc_mdelem_create(GRPC_MDSTR_PATH, method, nullptr),
host != nullptr
? grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, *host)
? grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, *host, nullptr)
: GRPC_MDNULL,
deadline);
}

@ -332,11 +332,6 @@ grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key,
return out;
}
grpc_mdelem grpc_mdelem_from_slices_no_unref(const grpc_slice& key,
const grpc_slice& value) {
return grpc_mdelem_create(key, value, nullptr);
}
grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata) {
bool changed = false;
grpc_slice key_slice =

@ -111,9 +111,6 @@ struct grpc_mdelem {
/* Unrefs the slices. */
grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key,
const grpc_slice& value);
/* Does not unref the slices. */
grpc_mdelem grpc_mdelem_from_slices_no_unref(const grpc_slice& key,
const grpc_slice& value);
/* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata
object as backing storage (so lifetimes should align) */

Loading…
Cancel
Save