aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-12-06 09:47:54 -0800
committerGravatar GitHub <noreply@github.com>2017-12-06 09:47:54 -0800
commit8cf1470a51ea276ca84825e7495d4ee24743540d (patch)
tree72385cc865094115bc08cb813201d48cb09840bb /src/core/ext
parent1d4e99508409be052bd129ba507bae1fbe7eb7fa (diff)
Revert "Revert "All instances of exec_ctx being passed around in src/core removed""
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/filters/client_channel/backup_poller.cc47
-rw-r--r--src/core/ext/filters/client_channel/backup_poller.h4
-rw-r--r--src/core/ext/filters/client_channel/channel_connectivity.cc52
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc409
-rw-r--r--src/core/ext/filters/client_channel/client_channel.h8
-rw-r--r--src/core/ext/filters/client_channel/client_channel_factory.cc23
-rw-r--r--src/core/ext/filters/client_channel/client_channel_factory.h19
-rw-r--r--src/core/ext/filters/client_channel/client_channel_plugin.cc13
-rw-r--r--src/core/ext/filters/client_channel/connector.cc13
-rw-r--r--src/core/ext/filters/client_channel/connector.h14
-rw-r--r--src/core/ext/filters/client_channel/http_connect_handshaker.cc84
-rw-r--r--src/core/ext/filters/client_channel/http_proxy.cc18
-rw-r--r--src/core/ext/filters/client_channel/lb_policy.cc79
-rw-r--r--src/core/ext/filters/client_channel/lb_policy.h80
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc27
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc434
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h4
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc10
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc190
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc140
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc54
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.h18
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_factory.cc15
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_factory.h11
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_registry.cc4
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_registry.h2
-rw-r--r--src/core/ext/filters/client_channel/proxy_mapper.cc14
-rw-r--r--src/core/ext/filters/client_channel/proxy_mapper.h14
-rw-r--r--src/core/ext/filters/client_channel/proxy_mapper_registry.cc30
-rw-r--r--src/core/ext/filters/client_channel/proxy_mapper_registry.h6
-rw-r--r--src/core/ext/filters/client_channel/resolver.cc24
-rw-r--r--src/core/ext/filters/client_channel/resolver.h31
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc94
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h6
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc52
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc70
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h12
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc20
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc90
-rw-r--r--src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc52
-rw-r--r--src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h2
-rw-r--r--src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc55
-rw-r--r--src/core/ext/filters/client_channel/resolver_factory.cc5
-rw-r--r--src/core/ext/filters/client_channel/resolver_factory.h6
-rw-r--r--src/core/ext/filters/client_channel/resolver_registry.cc27
-rw-r--r--src/core/ext/filters/client_channel/resolver_registry.h7
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc239
-rw-r--r--src/core/ext/filters/client_channel/subchannel.h75
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.cc63
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.h12
-rw-r--r--src/core/ext/filters/client_channel/uri_parser.cc28
-rw-r--r--src/core/ext/filters/client_channel/uri_parser.h3
-rw-r--r--src/core/ext/filters/deadline/deadline_filter.cc112
-rw-r--r--src/core/ext/filters/deadline/deadline_filter.h10
-rw-r--r--src/core/ext/filters/http/client/http_client_filter.cc125
-rw-r--r--src/core/ext/filters/http/http_filters_plugin.cc6
-rw-r--r--src/core/ext/filters/http/message_compress/message_compress_filter.cc126
-rw-r--r--src/core/ext/filters/http/server/http_server_filter.cc118
-rw-r--r--src/core/ext/filters/load_reporting/server_load_reporting_filter.cc33
-rw-r--r--src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc2
-rw-r--r--src/core/ext/filters/max_age/max_age_filter.cc101
-rw-r--r--src/core/ext/filters/message_size/message_size_filter.cc36
-rw-r--r--src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc23
-rw-r--r--src/core/ext/transport/chttp2/client/chttp2_connector.cc70
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.cc32
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc16
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc51
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc108
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.h3
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc6
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc17
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc11
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_decoder.cc14
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_decoder.h5
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_encoder.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc1088
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.h7
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.cc15
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.h7
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.cc62
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.h7
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.cc5
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.h3
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.cc11
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.cc5
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.h3
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_settings.cc5
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_settings.h3
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_window_update.cc16
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_window_update.h8
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.cc144
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.h6
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.cc546
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.h17
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.cc32
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.h13
-rw-r--r--src/core/ext/transport/chttp2/transport/incoming_metadata.cc19
-rw-r--r--src/core/ext/transport/chttp2/transport/incoming_metadata.h9
-rw-r--r--src/core/ext/transport/chttp2/transport/internal.h106
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.cc185
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc121
-rw-r--r--src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc5
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.cc173
-rw-r--r--src/core/ext/transport/inproc/inproc_transport.cc342
106 files changed, 2932 insertions, 3875 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc
index ed437d255c..339a79b0fb 100644
--- a/src/core/ext/filters/client_channel/backup_poller.cc
+++ b/src/core/ext/filters/client_channel/backup_poller.cc
@@ -69,20 +69,19 @@ static void init_globals() {
gpr_free(env);
}
-static void backup_poller_shutdown_unref(grpc_exec_ctx* exec_ctx,
- backup_poller* p) {
+static void backup_poller_shutdown_unref(backup_poller* p) {
if (gpr_unref(&p->shutdown_refs)) {
- grpc_pollset_destroy(exec_ctx, p->pollset);
+ grpc_pollset_destroy(p->pollset);
gpr_free(p->pollset);
gpr_free(p);
}
}
-static void done_poller(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
- backup_poller_shutdown_unref(exec_ctx, (backup_poller*)arg);
+static void done_poller(void* arg, grpc_error* error) {
+ backup_poller_shutdown_unref((backup_poller*)arg);
}
-static void g_poller_unref(grpc_exec_ctx* exec_ctx) {
+static void g_poller_unref() {
if (gpr_unref(&g_poller->refs)) {
gpr_mu_lock(&g_poller_mu);
backup_poller* p = g_poller;
@@ -90,40 +89,40 @@ static void g_poller_unref(grpc_exec_ctx* exec_ctx) {
gpr_mu_unlock(&g_poller_mu);
gpr_mu_lock(p->pollset_mu);
p->shutting_down = true;
- grpc_pollset_shutdown(exec_ctx, p->pollset,
- GRPC_CLOSURE_INIT(&p->shutdown_closure, done_poller,
- p, grpc_schedule_on_exec_ctx));
+ grpc_pollset_shutdown(
+ p->pollset, GRPC_CLOSURE_INIT(&p->shutdown_closure, done_poller, p,
+ grpc_schedule_on_exec_ctx));
gpr_mu_unlock(p->pollset_mu);
- grpc_timer_cancel(exec_ctx, &p->polling_timer);
+ grpc_timer_cancel(&p->polling_timer);
}
}
-static void run_poller(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void run_poller(void* arg, grpc_error* error) {
backup_poller* p = (backup_poller*)arg;
if (error != GRPC_ERROR_NONE) {
if (error != GRPC_ERROR_CANCELLED) {
GRPC_LOG_IF_ERROR("run_poller", GRPC_ERROR_REF(error));
}
- backup_poller_shutdown_unref(exec_ctx, p);
+ backup_poller_shutdown_unref(p);
return;
}
gpr_mu_lock(p->pollset_mu);
if (p->shutting_down) {
gpr_mu_unlock(p->pollset_mu);
- backup_poller_shutdown_unref(exec_ctx, p);
+ backup_poller_shutdown_unref(p);
return;
}
- grpc_error* err = grpc_pollset_work(exec_ctx, p->pollset, nullptr,
- grpc_exec_ctx_now(exec_ctx));
+ grpc_error* err =
+ grpc_pollset_work(p->pollset, nullptr, grpc_core::ExecCtx::Get()->Now());
gpr_mu_unlock(p->pollset_mu);
GRPC_LOG_IF_ERROR("Run client channel backup poller", err);
- grpc_timer_init(exec_ctx, &p->polling_timer,
- grpc_exec_ctx_now(exec_ctx) + g_poll_interval_ms,
+ grpc_timer_init(&p->polling_timer,
+ grpc_core::ExecCtx::Get()->Now() + g_poll_interval_ms,
&p->run_poller_closure);
}
void grpc_client_channel_start_backup_polling(
- grpc_exec_ctx* exec_ctx, grpc_pollset_set* interested_parties) {
+ grpc_pollset_set* interested_parties) {
gpr_once_init(&g_once, init_globals);
if (g_poll_interval_ms == 0) {
return;
@@ -139,8 +138,8 @@ void grpc_client_channel_start_backup_polling(
gpr_ref_init(&g_poller->shutdown_refs, 2);
GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
grpc_schedule_on_exec_ctx);
- grpc_timer_init(exec_ctx, &g_poller->polling_timer,
- grpc_exec_ctx_now(exec_ctx) + g_poll_interval_ms,
+ grpc_timer_init(&g_poller->polling_timer,
+ grpc_core::ExecCtx::Get()->Now() + g_poll_interval_ms,
&g_poller->run_poller_closure);
}
@@ -152,14 +151,14 @@ void grpc_client_channel_start_backup_polling(
grpc_pollset* pollset = g_poller->pollset;
gpr_mu_unlock(&g_poller_mu);
- grpc_pollset_set_add_pollset(exec_ctx, interested_parties, pollset);
+ grpc_pollset_set_add_pollset(interested_parties, pollset);
}
void grpc_client_channel_stop_backup_polling(
- grpc_exec_ctx* exec_ctx, grpc_pollset_set* interested_parties) {
+ grpc_pollset_set* interested_parties) {
if (g_poll_interval_ms == 0) {
return;
}
- grpc_pollset_set_del_pollset(exec_ctx, interested_parties, g_poller->pollset);
- g_poller_unref(exec_ctx);
+ grpc_pollset_set_del_pollset(interested_parties, g_poller->pollset);
+ g_poller_unref();
}
diff --git a/src/core/ext/filters/client_channel/backup_poller.h b/src/core/ext/filters/client_channel/backup_poller.h
index e993d50639..551e0331dc 100644
--- a/src/core/ext/filters/client_channel/backup_poller.h
+++ b/src/core/ext/filters/client_channel/backup_poller.h
@@ -25,10 +25,10 @@
/* Start polling \a interested_parties periodically in the timer thread */
void grpc_client_channel_start_backup_polling(
- grpc_exec_ctx* exec_ctx, grpc_pollset_set* interested_parties);
+ grpc_pollset_set* interested_parties);
/* Stop polling \a interested_parties */
void grpc_client_channel_stop_backup_polling(
- grpc_exec_ctx* exec_ctx, grpc_pollset_set* interested_parties);
+ grpc_pollset_set* interested_parties);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_BACKUP_POLLER_H */
diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc
index 7eaf5d98cd..20693ba419 100644
--- a/src/core/ext/filters/client_channel/channel_connectivity.cc
+++ b/src/core/ext/filters/client_channel/channel_connectivity.cc
@@ -33,22 +33,22 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
/* forward through to the underlying client channel */
grpc_channel_element* client_channel_elem =
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_connectivity_state state;
GRPC_API_TRACE(
"grpc_channel_check_connectivity_state(channel=%p, try_to_connect=%d)", 2,
(channel, try_to_connect));
if (client_channel_elem->filter == &grpc_client_channel_filter) {
- state = grpc_client_channel_check_connectivity_state(
- &exec_ctx, client_channel_elem, try_to_connect);
- grpc_exec_ctx_finish(&exec_ctx);
+ state = grpc_client_channel_check_connectivity_state(client_channel_elem,
+ try_to_connect);
+
return state;
}
gpr_log(GPR_ERROR,
"grpc_channel_check_connectivity_state called on something that is "
"not a client channel, but '%s'",
client_channel_elem->filter->name);
- grpc_exec_ctx_finish(&exec_ctx);
+
return GRPC_CHANNEL_SHUTDOWN;
}
@@ -73,12 +73,11 @@ typedef struct {
void* tag;
} state_watcher;
-static void delete_state_watcher(grpc_exec_ctx* exec_ctx, state_watcher* w) {
+static void delete_state_watcher(state_watcher* w) {
grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(w->channel));
if (client_channel_elem->filter == &grpc_client_channel_filter) {
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, w->channel,
- "watch_channel_connectivity");
+ GRPC_CHANNEL_INTERNAL_UNREF(w->channel, "watch_channel_connectivity");
} else {
abort();
}
@@ -86,8 +85,7 @@ static void delete_state_watcher(grpc_exec_ctx* exec_ctx, state_watcher* w) {
gpr_free(w);
}
-static void finished_completion(grpc_exec_ctx* exec_ctx, void* pw,
- grpc_cq_completion* ignored) {
+static void finished_completion(void* pw, grpc_cq_completion* ignored) {
bool should_delete = false;
state_watcher* w = (state_watcher*)pw;
gpr_mu_lock(&w->mu);
@@ -102,19 +100,19 @@ static void finished_completion(grpc_exec_ctx* exec_ctx, void* pw,
gpr_mu_unlock(&w->mu);
if (should_delete) {
- delete_state_watcher(exec_ctx, w);
+ delete_state_watcher(w);
}
}
-static void partly_done(grpc_exec_ctx* exec_ctx, state_watcher* w,
- bool due_to_completion, grpc_error* error) {
+static void partly_done(state_watcher* w, bool due_to_completion,
+ grpc_error* error) {
if (due_to_completion) {
- grpc_timer_cancel(exec_ctx, &w->alarm);
+ grpc_timer_cancel(&w->alarm);
} else {
grpc_channel_element* client_channel_elem = grpc_channel_stack_last_element(
grpc_channel_get_channel_stack(w->channel));
grpc_client_channel_watch_connectivity_state(
- exec_ctx, client_channel_elem,
+ client_channel_elem,
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)),
nullptr, &w->on_complete, nullptr);
}
@@ -149,7 +147,7 @@ static void partly_done(grpc_exec_ctx* exec_ctx, state_watcher* w,
w->error = error;
}
w->phase = CALLING_BACK_AND_FINISHED;
- grpc_cq_end_op(exec_ctx, w->cq, w->tag, w->error, finished_completion, w,
+ grpc_cq_end_op(w->cq, w->tag, w->error, finished_completion, w,
&w->completion_storage);
break;
case CALLING_BACK_AND_FINISHED:
@@ -161,14 +159,12 @@ static void partly_done(grpc_exec_ctx* exec_ctx, state_watcher* w,
GRPC_ERROR_UNREF(error);
}
-static void watch_complete(grpc_exec_ctx* exec_ctx, void* pw,
- grpc_error* error) {
- partly_done(exec_ctx, (state_watcher*)pw, true, GRPC_ERROR_REF(error));
+static void watch_complete(void* pw, grpc_error* error) {
+ partly_done((state_watcher*)pw, true, GRPC_ERROR_REF(error));
}
-static void timeout_complete(grpc_exec_ctx* exec_ctx, void* pw,
- grpc_error* error) {
- partly_done(exec_ctx, (state_watcher*)pw, false, GRPC_ERROR_REF(error));
+static void timeout_complete(void* pw, grpc_error* error) {
+ partly_done((state_watcher*)pw, false, GRPC_ERROR_REF(error));
}
int grpc_channel_num_external_connectivity_watchers(grpc_channel* channel) {
@@ -183,12 +179,10 @@ typedef struct watcher_timer_init_arg {
gpr_timespec deadline;
} watcher_timer_init_arg;
-static void watcher_timer_init(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error_ignored) {
+static void watcher_timer_init(void* arg, grpc_error* error_ignored) {
watcher_timer_init_arg* wa = (watcher_timer_init_arg*)arg;
- grpc_timer_init(exec_ctx, &wa->w->alarm,
- grpc_timespec_to_millis_round_up(wa->deadline),
+ grpc_timer_init(&wa->w->alarm, grpc_timespec_to_millis_round_up(wa->deadline),
&wa->w->on_timeout);
gpr_free(wa);
}
@@ -204,7 +198,7 @@ void grpc_channel_watch_connectivity_state(
gpr_timespec deadline, grpc_completion_queue* cq, void* tag) {
grpc_channel_element* client_channel_elem =
grpc_channel_stack_last_element(grpc_channel_get_channel_stack(channel));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
state_watcher* w = (state_watcher*)gpr_malloc(sizeof(*w));
GRPC_API_TRACE(
@@ -241,12 +235,10 @@ void grpc_channel_watch_connectivity_state(
if (client_channel_elem->filter == &grpc_client_channel_filter) {
GRPC_CHANNEL_INTERNAL_REF(channel, "watch_channel_connectivity");
grpc_client_channel_watch_connectivity_state(
- &exec_ctx, client_channel_elem,
+ client_channel_elem,
grpc_polling_entity_create_from_pollset(grpc_cq_pollset(cq)), &w->state,
&w->on_complete, &w->watcher_timer_init);
} else {
abort();
}
-
- grpc_exec_ctx_finish(&exec_ctx);
}
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index aced9adf9f..ba82c88eb7 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -91,8 +91,7 @@ static void method_parameters_unref(method_parameters* method_params) {
static void* method_parameters_ref_wrapper(void* value) {
return method_parameters_ref((method_parameters*)value);
}
-static void method_parameters_unref_wrapper(grpc_exec_ctx* exec_ctx,
- void* value) {
+static void method_parameters_unref_wrapper(void* value) {
method_parameters_unref((method_parameters*)value);
}
@@ -228,12 +227,11 @@ typedef struct {
grpc_lb_policy* lb_policy;
} lb_policy_connectivity_watcher;
-static void watch_lb_policy_locked(grpc_exec_ctx* exec_ctx, channel_data* chand,
+static void watch_lb_policy_locked(channel_data* chand,
grpc_lb_policy* lb_policy,
grpc_connectivity_state current_state);
-static void set_channel_connectivity_state_locked(grpc_exec_ctx* exec_ctx,
- channel_data* chand,
+static void set_channel_connectivity_state_locked(channel_data* chand,
grpc_connectivity_state state,
grpc_error* error,
const char* reason) {
@@ -245,12 +243,12 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx* exec_ctx,
if (state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
/* cancel picks with wait_for_ready=false */
grpc_lb_policy_cancel_picks_locked(
- exec_ctx, chand->lb_policy,
+ chand->lb_policy,
/* mask= */ GRPC_INITIAL_METADATA_WAIT_FOR_READY,
/* check= */ 0, GRPC_ERROR_REF(error));
} else if (state == GRPC_CHANNEL_SHUTDOWN) {
/* cancel all picks */
- grpc_lb_policy_cancel_picks_locked(exec_ctx, chand->lb_policy,
+ grpc_lb_policy_cancel_picks_locked(chand->lb_policy,
/* mask= */ 0, /* check= */ 0,
GRPC_ERROR_REF(error));
}
@@ -259,12 +257,10 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p: setting connectivity state to %s", chand,
grpc_connectivity_state_name(state));
}
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, error,
- reason);
+ grpc_connectivity_state_set(&chand->state_tracker, state, error, reason);
}
-static void on_lb_policy_state_changed_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void on_lb_policy_state_changed_locked(void* arg, grpc_error* error) {
lb_policy_connectivity_watcher* w = (lb_policy_connectivity_watcher*)arg;
/* check if the notification is for the latest policy */
if (w->lb_policy == w->chand->lb_policy) {
@@ -272,17 +268,17 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p: lb_policy=%p state changed to %s", w->chand,
w->lb_policy, grpc_connectivity_state_name(w->state));
}
- set_channel_connectivity_state_locked(exec_ctx, w->chand, w->state,
+ set_channel_connectivity_state_locked(w->chand, w->state,
GRPC_ERROR_REF(error), "lb_changed");
if (w->state != GRPC_CHANNEL_SHUTDOWN) {
- watch_lb_policy_locked(exec_ctx, w->chand, w->lb_policy, w->state);
+ watch_lb_policy_locked(w->chand, w->lb_policy, w->state);
}
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack, "watch_lb_policy");
+ GRPC_CHANNEL_STACK_UNREF(w->chand->owning_stack, "watch_lb_policy");
gpr_free(w);
}
-static void watch_lb_policy_locked(grpc_exec_ctx* exec_ctx, channel_data* chand,
+static void watch_lb_policy_locked(channel_data* chand,
grpc_lb_policy* lb_policy,
grpc_connectivity_state current_state) {
lb_policy_connectivity_watcher* w =
@@ -293,19 +289,18 @@ static void watch_lb_policy_locked(grpc_exec_ctx* exec_ctx, channel_data* chand,
grpc_combiner_scheduler(chand->combiner));
w->state = current_state;
w->lb_policy = lb_policy;
- grpc_lb_policy_notify_on_state_change_locked(exec_ctx, lb_policy, &w->state,
+ grpc_lb_policy_notify_on_state_change_locked(lb_policy, &w->state,
&w->on_changed);
}
-static void start_resolving_locked(grpc_exec_ctx* exec_ctx,
- channel_data* chand) {
+static void start_resolving_locked(channel_data* chand) {
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: starting name resolution", chand);
}
GPR_ASSERT(!chand->started_resolving);
chand->started_resolving = true;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "resolver");
- grpc_resolver_next_locked(exec_ctx, chand->resolver, &chand->resolver_result,
+ grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
}
@@ -369,29 +364,26 @@ static void parse_retry_throttle_params(const grpc_json* field, void* arg) {
}
}
-static void request_reresolution_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void request_reresolution_locked(void* arg, grpc_error* error) {
reresolution_request_args* args = (reresolution_request_args*)arg;
channel_data* chand = args->chand;
// If this invocation is for a stale LB policy, treat it as an LB shutdown
// signal.
if (args->lb_policy != chand->lb_policy || error != GRPC_ERROR_NONE ||
chand->resolver == nullptr) {
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "re-resolution");
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack, "re-resolution");
gpr_free(args);
return;
}
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: started name re-resolving", chand);
}
- grpc_resolver_channel_saw_error_locked(exec_ctx, chand->resolver);
+ grpc_resolver_channel_saw_error_locked(chand->resolver);
// Give back the closure to the LB policy.
- grpc_lb_policy_set_reresolve_closure_locked(exec_ctx, chand->lb_policy,
- &args->closure);
+ grpc_lb_policy_set_reresolve_closure_locked(chand->lb_policy, &args->closure);
}
-static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void on_resolver_result_changed_locked(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: got resolver result: error=%s", chand,
@@ -458,12 +450,10 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
if (chand->lb_policy != nullptr && !lb_policy_name_changed) {
// Continue using the same LB policy. Update with new addresses.
lb_policy_updated = true;
- grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy,
- &lb_policy_args);
+ grpc_lb_policy_update_locked(chand->lb_policy, &lb_policy_args);
} else {
// Instantiate new LB policy.
- new_lb_policy =
- grpc_lb_policy_create(exec_ctx, lb_policy_name, &lb_policy_args);
+ new_lb_policy = grpc_lb_policy_create(lb_policy_name, &lb_policy_args);
if (new_lb_policy == nullptr) {
gpr_log(GPR_ERROR, "could not create LB policy \"%s\"",
lb_policy_name);
@@ -475,7 +465,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&args->closure, request_reresolution_locked, args,
grpc_combiner_scheduler(chand->combiner));
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "re-resolution");
- grpc_lb_policy_set_reresolve_closure_locked(exec_ctx, new_lb_policy,
+ grpc_lb_policy_set_reresolve_closure_locked(new_lb_policy,
&args->closure);
}
}
@@ -492,8 +482,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
GRPC_ARG_SERVER_URI);
GPR_ASSERT(channel_arg != nullptr);
GPR_ASSERT(channel_arg->type == GRPC_ARG_STRING);
- grpc_uri* uri =
- grpc_uri_parse(exec_ctx, channel_arg->value.string, true);
+ grpc_uri* uri = grpc_uri_parse(channel_arg->value.string, true);
GPR_ASSERT(uri->path[0] != '\0');
service_config_parsing_state parsing_state;
memset(&parsing_state, 0, sizeof(parsing_state));
@@ -504,7 +493,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
grpc_uri_destroy(uri);
retry_throttle_data = parsing_state.retry_throttle_data;
method_params_table = grpc_service_config_create_method_config_table(
- exec_ctx, service_config, method_parameters_create_from_json,
+ service_config, method_parameters_create_from_json,
method_parameters_ref_wrapper, method_parameters_unref_wrapper);
grpc_service_config_destroy(service_config);
}
@@ -514,7 +503,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// The copy will be saved in chand->lb_policy_name below.
lb_policy_name_dup = gpr_strdup(lb_policy_name);
}
- grpc_channel_args_destroy(exec_ctx, chand->resolver_result);
+ grpc_channel_args_destroy(chand->resolver_result);
chand->resolver_result = nullptr;
}
if (grpc_client_channel_trace.enabled()) {
@@ -546,7 +535,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
chand->retry_throttle_data = retry_throttle_data;
// Swap out the method params table.
if (chand->method_params_table != nullptr) {
- grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
+ grpc_slice_hash_table_unref(chand->method_params_table);
}
chand->method_params_table = method_params_table;
// If we have a new LB policy or are shutting down (in which case
@@ -562,10 +551,9 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p: unreffing lb_policy=%p", chand,
chand->lb_policy);
}
- grpc_pollset_set_del_pollset_set(exec_ctx,
- chand->lb_policy->interested_parties,
+ grpc_pollset_set_del_pollset_set(chand->lb_policy->interested_parties,
chand->interested_parties);
- GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
+ GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel");
}
chand->lb_policy = new_lb_policy;
}
@@ -579,21 +567,20 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p: shutting down resolver", chand);
}
- grpc_resolver_shutdown_locked(exec_ctx, chand->resolver);
- GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
+ grpc_resolver_shutdown_locked(chand->resolver);
+ GRPC_RESOLVER_UNREF(chand->resolver, "channel");
chand->resolver = nullptr;
}
set_channel_connectivity_state_locked(
- exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
+ chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Got resolver result after disconnection", &error, 1),
"resolver_gone");
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "resolver");
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack, "resolver");
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Channel disconnected", &error, 1));
- GRPC_CLOSURE_LIST_SCHED(exec_ctx,
- &chand->waiting_for_resolver_result_closures);
+ GRPC_CLOSURE_LIST_SCHED(&chand->waiting_for_resolver_result_closures);
} else { // Not shutting down.
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
grpc_error* state_error =
@@ -603,33 +590,28 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p: initializing new LB policy", chand);
}
GRPC_ERROR_UNREF(state_error);
- state = grpc_lb_policy_check_connectivity_locked(exec_ctx, new_lb_policy,
- &state_error);
- grpc_pollset_set_add_pollset_set(exec_ctx,
- new_lb_policy->interested_parties,
+ state =
+ grpc_lb_policy_check_connectivity_locked(new_lb_policy, &state_error);
+ grpc_pollset_set_add_pollset_set(new_lb_policy->interested_parties,
chand->interested_parties);
- GRPC_CLOSURE_LIST_SCHED(exec_ctx,
- &chand->waiting_for_resolver_result_closures);
+ GRPC_CLOSURE_LIST_SCHED(&chand->waiting_for_resolver_result_closures);
if (chand->exit_idle_when_lb_policy_arrives) {
- grpc_lb_policy_exit_idle_locked(exec_ctx, new_lb_policy);
+ grpc_lb_policy_exit_idle_locked(new_lb_policy);
chand->exit_idle_when_lb_policy_arrives = false;
}
- watch_lb_policy_locked(exec_ctx, chand, new_lb_policy, state);
+ watch_lb_policy_locked(chand, new_lb_policy, state);
}
if (!lb_policy_updated) {
- set_channel_connectivity_state_locked(exec_ctx, chand, state,
- GRPC_ERROR_REF(state_error),
- "new_lb+resolver");
+ set_channel_connectivity_state_locked(
+ chand, state, GRPC_ERROR_REF(state_error), "new_lb+resolver");
}
- grpc_resolver_next_locked(exec_ctx, chand->resolver,
- &chand->resolver_result,
+ grpc_resolver_next_locked(chand->resolver, &chand->resolver_result,
&chand->on_resolver_result_changed);
GRPC_ERROR_UNREF(state_error);
}
}
-static void start_transport_op_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error_ignored) {
+static void start_transport_op_locked(void* arg, grpc_error* error_ignored) {
grpc_transport_op* op = (grpc_transport_op*)arg;
grpc_channel_element* elem =
(grpc_channel_element*)op->handler_private.extra_arg;
@@ -637,7 +619,7 @@ static void start_transport_op_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (op->on_connectivity_state_change != nullptr) {
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &chand->state_tracker, op->connectivity_state,
+ &chand->state_tracker, op->connectivity_state,
op->on_connectivity_state_change);
op->on_connectivity_state_change = nullptr;
op->connectivity_state = nullptr;
@@ -645,11 +627,10 @@ static void start_transport_op_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (op->send_ping != nullptr) {
if (chand->lb_policy == nullptr) {
- GRPC_CLOSURE_SCHED(
- exec_ctx, op->send_ping,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Ping with no load balancing"));
+ GRPC_CLOSURE_SCHED(op->send_ping, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Ping with no load balancing"));
} else {
- grpc_lb_policy_ping_one_locked(exec_ctx, chand->lb_policy, op->send_ping);
+ grpc_lb_policy_ping_one_locked(chand->lb_policy, op->send_ping);
op->bind_pollset = nullptr;
}
op->send_ping = nullptr;
@@ -658,54 +639,48 @@ static void start_transport_op_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
if (chand->resolver != nullptr) {
set_channel_connectivity_state_locked(
- exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
+ chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
- grpc_resolver_shutdown_locked(exec_ctx, chand->resolver);
- GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
+ grpc_resolver_shutdown_locked(chand->resolver);
+ GRPC_RESOLVER_UNREF(chand->resolver, "channel");
chand->resolver = nullptr;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
GRPC_ERROR_REF(op->disconnect_with_error));
- GRPC_CLOSURE_LIST_SCHED(exec_ctx,
- &chand->waiting_for_resolver_result_closures);
+ GRPC_CLOSURE_LIST_SCHED(&chand->waiting_for_resolver_result_closures);
}
if (chand->lb_policy != nullptr) {
- grpc_pollset_set_del_pollset_set(exec_ctx,
- chand->lb_policy->interested_parties,
+ grpc_pollset_set_del_pollset_set(chand->lb_policy->interested_parties,
chand->interested_parties);
- GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
+ GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel");
chand->lb_policy = nullptr;
}
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "start_transport_op");
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack, "start_transport_op");
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
}
-static void cc_start_transport_op(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static void cc_start_transport_op(grpc_channel_element* elem,
grpc_transport_op* op) {
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(op->set_accept_stream == false);
if (op->bind_pollset != nullptr) {
- grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties,
- op->bind_pollset);
+ grpc_pollset_set_add_pollset(chand->interested_parties, op->bind_pollset);
}
op->handler_private.extra_arg = elem;
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "start_transport_op");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&op->handler_private.closure, start_transport_op_locked,
op, grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
}
-static void cc_get_channel_info(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static void cc_get_channel_info(grpc_channel_element* elem,
const grpc_channel_info* info) {
channel_data* chand = (channel_data*)elem->channel_data;
gpr_mu_lock(&chand->info_mu);
@@ -724,8 +699,7 @@ static void cc_get_channel_info(grpc_exec_ctx* exec_ctx,
}
/* Constructor for channel_data */
-static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* cc_init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(args->is_last);
@@ -746,7 +720,7 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
chand->interested_parties = grpc_pollset_set_create();
grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
"client_channel");
- grpc_client_channel_start_backup_polling(exec_ctx, chand->interested_parties);
+ grpc_client_channel_start_backup_polling(chand->interested_parties);
// Record client channel factory.
const grpc_arg* arg = grpc_channel_args_find(args->channel_args,
GRPC_ARG_CLIENT_CHANNEL_FACTORY);
@@ -774,15 +748,15 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
}
char* proxy_name = nullptr;
grpc_channel_args* new_args = nullptr;
- grpc_proxy_mappers_map_name(exec_ctx, arg->value.string, args->channel_args,
+ grpc_proxy_mappers_map_name(arg->value.string, args->channel_args,
&proxy_name, &new_args);
// Instantiate resolver.
chand->resolver = grpc_resolver_create(
- exec_ctx, proxy_name != nullptr ? proxy_name : arg->value.string,
+ proxy_name != nullptr ? proxy_name : arg->value.string,
new_args != nullptr ? new_args : args->channel_args,
chand->interested_parties, chand->combiner);
if (proxy_name != nullptr) gpr_free(proxy_name);
- if (new_args != nullptr) grpc_channel_args_destroy(exec_ctx, new_args);
+ if (new_args != nullptr) grpc_channel_args_destroy(new_args);
if (chand->resolver == nullptr) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("resolver creation failed");
}
@@ -791,32 +765,28 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static void shutdown_resolver_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void shutdown_resolver_locked(void* arg, grpc_error* error) {
grpc_resolver* resolver = (grpc_resolver*)arg;
- grpc_resolver_shutdown_locked(exec_ctx, resolver);
- GRPC_RESOLVER_UNREF(exec_ctx, resolver, "channel");
+ grpc_resolver_shutdown_locked(resolver);
+ GRPC_RESOLVER_UNREF(resolver, "channel");
}
/* Destructor for channel_data */
-static void cc_destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {
+static void cc_destroy_channel_elem(grpc_channel_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
if (chand->resolver != nullptr) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver,
grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
}
if (chand->client_channel_factory != nullptr) {
- grpc_client_channel_factory_unref(exec_ctx, chand->client_channel_factory);
+ grpc_client_channel_factory_unref(chand->client_channel_factory);
}
if (chand->lb_policy != nullptr) {
- grpc_pollset_set_del_pollset_set(exec_ctx,
- chand->lb_policy->interested_parties,
+ grpc_pollset_set_del_pollset_set(chand->lb_policy->interested_parties,
chand->interested_parties);
- GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
+ GRPC_LB_POLICY_UNREF(chand->lb_policy, "channel");
}
gpr_free(chand->info_lb_policy_name);
gpr_free(chand->info_service_config_json);
@@ -824,12 +794,12 @@ static void cc_destroy_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_server_retry_throttle_data_unref(chand->retry_throttle_data);
}
if (chand->method_params_table != nullptr) {
- grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
+ grpc_slice_hash_table_unref(chand->method_params_table);
}
- grpc_client_channel_stop_backup_polling(exec_ctx, chand->interested_parties);
- grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
- grpc_pollset_set_destroy(exec_ctx, chand->interested_parties);
- GRPC_COMBINER_UNREF(exec_ctx, chand->combiner, "client_channel");
+ grpc_client_channel_stop_backup_polling(chand->interested_parties);
+ grpc_connectivity_state_destroy(&chand->state_tracker);
+ grpc_pollset_set_destroy(chand->interested_parties);
+ GRPC_COMBINER_UNREF(chand->combiner, "client_channel");
gpr_mu_destroy(&chand->info_mu);
gpr_mu_destroy(&chand->external_connectivity_watcher_list_mu);
}
@@ -916,21 +886,18 @@ static void waiting_for_pick_batches_add(
}
// This is called via the call combiner, so access to calld is synchronized.
-static void fail_pending_batch_in_call_combiner(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void fail_pending_batch_in_call_combiner(void* arg, grpc_error* error) {
call_data* calld = (call_data*)arg;
if (calld->waiting_for_pick_batches_count > 0) {
--calld->waiting_for_pick_batches_count;
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx,
calld->waiting_for_pick_batches[calld->waiting_for_pick_batches_count],
GRPC_ERROR_REF(error), calld->call_combiner);
}
}
// This is called via the call combiner, so access to calld is synchronized.
-static void waiting_for_pick_batches_fail(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static void waiting_for_pick_batches_fail(grpc_call_element* elem,
grpc_error* error) {
call_data* calld = (call_data*)elem->call_data;
if (grpc_client_channel_trace.enabled()) {
@@ -943,37 +910,34 @@ static void waiting_for_pick_batches_fail(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&calld->handle_pending_batch_in_call_combiner[i],
fail_pending_batch_in_call_combiner, calld,
grpc_schedule_on_exec_ctx);
- GRPC_CALL_COMBINER_START(exec_ctx, calld->call_combiner,
- &calld->handle_pending_batch_in_call_combiner[i],
- GRPC_ERROR_REF(error),
- "waiting_for_pick_batches_fail");
+ GRPC_CALL_COMBINER_START(
+ calld->call_combiner, &calld->handle_pending_batch_in_call_combiner[i],
+ GRPC_ERROR_REF(error), "waiting_for_pick_batches_fail");
}
if (calld->initial_metadata_batch != nullptr) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, calld->initial_metadata_batch, GRPC_ERROR_REF(error),
+ calld->initial_metadata_batch, GRPC_ERROR_REF(error),
calld->call_combiner);
} else {
- GRPC_CALL_COMBINER_STOP(exec_ctx, calld->call_combiner,
+ GRPC_CALL_COMBINER_STOP(calld->call_combiner,
"waiting_for_pick_batches_fail");
}
GRPC_ERROR_UNREF(error);
}
// This is called via the call combiner, so access to calld is synchronized.
-static void run_pending_batch_in_call_combiner(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* ignored) {
+static void run_pending_batch_in_call_combiner(void* arg, grpc_error* ignored) {
call_data* calld = (call_data*)arg;
if (calld->waiting_for_pick_batches_count > 0) {
--calld->waiting_for_pick_batches_count;
grpc_subchannel_call_process_op(
- exec_ctx, calld->subchannel_call,
+ calld->subchannel_call,
calld->waiting_for_pick_batches[calld->waiting_for_pick_batches_count]);
}
}
// This is called via the call combiner, so access to calld is synchronized.
-static void waiting_for_pick_batches_resume(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void waiting_for_pick_batches_resume(grpc_call_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
if (grpc_client_channel_trace.enabled()) {
@@ -987,20 +951,18 @@ static void waiting_for_pick_batches_resume(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&calld->handle_pending_batch_in_call_combiner[i],
run_pending_batch_in_call_combiner, calld,
grpc_schedule_on_exec_ctx);
- GRPC_CALL_COMBINER_START(exec_ctx, calld->call_combiner,
- &calld->handle_pending_batch_in_call_combiner[i],
- GRPC_ERROR_NONE,
- "waiting_for_pick_batches_resume");
+ GRPC_CALL_COMBINER_START(
+ calld->call_combiner, &calld->handle_pending_batch_in_call_combiner[i],
+ GRPC_ERROR_NONE, "waiting_for_pick_batches_resume");
}
GPR_ASSERT(calld->initial_metadata_batch != nullptr);
- grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call,
+ grpc_subchannel_call_process_op(calld->subchannel_call,
calld->initial_metadata_batch);
}
// Applies service config to the call. Must be invoked once we know
// that the resolver has returned results to the channel.
-static void apply_service_config_to_call_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void apply_service_config_to_call_locked(grpc_call_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
if (grpc_client_channel_trace.enabled()) {
@@ -1013,7 +975,7 @@ static void apply_service_config_to_call_locked(grpc_exec_ctx* exec_ctx,
}
if (chand->method_params_table != nullptr) {
calld->method_params = (method_parameters*)grpc_method_config_table_get(
- exec_ctx, chand->method_params_table, calld->path);
+ chand->method_params_table, calld->path);
if (calld->method_params != nullptr) {
method_parameters_ref(calld->method_params);
// If the deadline from the service config is shorter than the one
@@ -1025,15 +987,14 @@ static void apply_service_config_to_call_locked(grpc_exec_ctx* exec_ctx,
calld->method_params->timeout;
if (per_method_deadline < calld->deadline) {
calld->deadline = per_method_deadline;
- grpc_deadline_state_reset(exec_ctx, elem, calld->deadline);
+ grpc_deadline_state_reset(elem, calld->deadline);
}
}
}
}
}
-static void create_subchannel_call_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static void create_subchannel_call_locked(grpc_call_element* elem,
grpc_error* error) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
@@ -1047,24 +1008,22 @@ static void create_subchannel_call_locked(grpc_exec_ctx* exec_ctx,
calld->call_combiner // call_combiner
};
grpc_error* new_error = grpc_connected_subchannel_create_call(
- exec_ctx, calld->connected_subchannel, &call_args,
- &calld->subchannel_call);
+ calld->connected_subchannel, &call_args, &calld->subchannel_call);
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: create subchannel_call=%p: error=%s",
chand, calld, calld->subchannel_call, grpc_error_string(new_error));
}
if (new_error != GRPC_ERROR_NONE) {
new_error = grpc_error_add_child(new_error, error);
- waiting_for_pick_batches_fail(exec_ctx, elem, new_error);
+ waiting_for_pick_batches_fail(elem, new_error);
} else {
- waiting_for_pick_batches_resume(exec_ctx, elem);
+ waiting_for_pick_batches_resume(elem);
}
GRPC_ERROR_UNREF(error);
}
// Invoked when a pick is completed, on both success or failure.
-static void pick_done_locked(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_error* error) {
+static void pick_done_locked(grpc_call_element* elem, grpc_error* error) {
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
if (calld->connected_subchannel == nullptr) {
@@ -1080,10 +1039,10 @@ static void pick_done_locked(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
"chand=%p calld=%p: failed to create subchannel: error=%s", chand,
calld, grpc_error_string(calld->error));
}
- waiting_for_pick_batches_fail(exec_ctx, elem, GRPC_ERROR_REF(calld->error));
+ waiting_for_pick_batches_fail(elem, GRPC_ERROR_REF(calld->error));
} else {
/* Create call on subchannel. */
- create_subchannel_call_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
+ create_subchannel_call_locked(elem, GRPC_ERROR_REF(error));
}
GRPC_ERROR_UNREF(error);
}
@@ -1092,19 +1051,17 @@ static void pick_done_locked(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
// either (a) the pick was deferred pending a resolver result or (b) the
// pick was done asynchronously. Removes the call's polling entity from
// chand->interested_parties before invoking pick_done_locked().
-static void async_pick_done_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem, grpc_error* error) {
+static void async_pick_done_locked(grpc_call_element* elem, grpc_error* error) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
- grpc_polling_entity_del_from_pollset_set(exec_ctx, calld->pollent,
+ grpc_polling_entity_del_from_pollset_set(calld->pollent,
chand->interested_parties);
- pick_done_locked(exec_ctx, elem, error);
+ pick_done_locked(elem, error);
}
// Note: This runs under the client_channel combiner, but will NOT be
// holding the call combiner.
-static void pick_callback_cancel_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void pick_callback_cancel_locked(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
@@ -1113,17 +1070,15 @@ static void pick_callback_cancel_locked(grpc_exec_ctx* exec_ctx, void* arg,
gpr_log(GPR_DEBUG, "chand=%p calld=%p: cancelling pick from LB policy %p",
chand, calld, calld->lb_policy);
}
- grpc_lb_policy_cancel_pick_locked(exec_ctx, calld->lb_policy,
- &calld->connected_subchannel,
- GRPC_ERROR_REF(error));
+ grpc_lb_policy_cancel_pick_locked(
+ calld->lb_policy, &calld->connected_subchannel, GRPC_ERROR_REF(error));
}
- GRPC_CALL_STACK_UNREF(exec_ctx, calld->owning_call, "pick_callback_cancel");
+ GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback_cancel");
}
// Callback invoked by grpc_lb_policy_pick_locked() for async picks.
// Unrefs the LB policy and invokes async_pick_done_locked().
-static void pick_callback_done_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void pick_callback_done_locked(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
@@ -1132,23 +1087,22 @@ static void pick_callback_done_locked(grpc_exec_ctx* exec_ctx, void* arg,
chand, calld);
}
GPR_ASSERT(calld->lb_policy != nullptr);
- GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
+ GRPC_LB_POLICY_UNREF(calld->lb_policy, "pick_subchannel");
calld->lb_policy = nullptr;
- async_pick_done_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
+ async_pick_done_locked(elem, GRPC_ERROR_REF(error));
}
// Takes a ref to chand->lb_policy and calls grpc_lb_policy_pick_locked().
// If the pick was completed synchronously, unrefs the LB policy and
// returns true.
-static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static bool pick_callback_start_locked(grpc_call_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: starting pick on lb_policy=%p",
chand, calld, chand->lb_policy);
}
- apply_service_config_to_call_locked(exec_ctx, elem);
+ apply_service_config_to_call_locked(elem);
// If the application explicitly set wait_for_ready, use that.
// Otherwise, if the service config specified a value for this
// method, use that.
@@ -1178,7 +1132,7 @@ static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&calld->lb_pick_closure, pick_callback_done_locked, elem,
grpc_combiner_scheduler(chand->combiner));
const bool pick_done = grpc_lb_policy_pick_locked(
- exec_ctx, chand->lb_policy, &inputs, &calld->connected_subchannel,
+ chand->lb_policy, &inputs, &calld->connected_subchannel,
calld->subchannel_call_context, nullptr, &calld->lb_pick_closure);
if (pick_done) {
/* synchronous grpc_lb_policy_pick call. Unref the LB policy. */
@@ -1186,12 +1140,12 @@ static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p calld=%p: pick completed synchronously",
chand, calld);
}
- GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
+ GRPC_LB_POLICY_UNREF(calld->lb_policy, "pick_subchannel");
calld->lb_policy = nullptr;
} else {
GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel");
grpc_call_combiner_set_notify_on_cancel(
- exec_ctx, calld->call_combiner,
+ calld->call_combiner,
GRPC_CLOSURE_INIT(&calld->lb_pick_cancel_closure,
pick_callback_cancel_locked, elem,
grpc_combiner_scheduler(chand->combiner)));
@@ -1208,8 +1162,7 @@ typedef struct {
// Note: This runs under the client_channel combiner, but will NOT be
// holding the call combiner.
-static void pick_after_resolver_result_cancel_locked(grpc_exec_ctx* exec_ctx,
- void* arg,
+static void pick_after_resolver_result_cancel_locked(void* arg,
grpc_error* error) {
pick_after_resolver_result_args* args = (pick_after_resolver_result_args*)arg;
if (args->finished) {
@@ -1237,16 +1190,13 @@ static void pick_after_resolver_result_cancel_locked(grpc_exec_ctx* exec_ctx,
// it's safe to call async_pick_done_locked() here -- we are
// essentially calling it here instead of calling it in
// pick_after_resolver_result_done_locked().
- async_pick_done_locked(exec_ctx, elem,
- GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
- "Pick cancelled", &error, 1));
+ async_pick_done_locked(elem, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
+ "Pick cancelled", &error, 1));
}
-static void pick_after_resolver_result_start_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem);
+static void pick_after_resolver_result_start_locked(grpc_call_element* elem);
-static void pick_after_resolver_result_done_locked(grpc_exec_ctx* exec_ctx,
- void* arg,
+static void pick_after_resolver_result_done_locked(void* arg,
grpc_error* error) {
pick_after_resolver_result_args* args = (pick_after_resolver_result_args*)arg;
if (args->finished) {
@@ -1266,19 +1216,19 @@ static void pick_after_resolver_result_done_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver failed to return data",
chand, calld);
}
- async_pick_done_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
+ async_pick_done_locked(elem, GRPC_ERROR_REF(error));
} else if (chand->lb_policy != nullptr) {
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver returned, doing pick",
chand, calld);
}
- if (pick_callback_start_locked(exec_ctx, elem)) {
+ if (pick_callback_start_locked(elem)) {
// Even if the LB policy returns a result synchronously, we have
// already added our polling entity to chand->interested_parties
// in order to wait for the resolver result, so we need to
// remove it here. Therefore, we call async_pick_done_locked()
// instead of pick_done_locked().
- async_pick_done_locked(exec_ctx, elem, GRPC_ERROR_NONE);
+ async_pick_done_locked(elem, GRPC_ERROR_NONE);
}
}
// TODO(roth): It should be impossible for chand->lb_policy to be NULL
@@ -1296,19 +1246,18 @@ static void pick_after_resolver_result_done_locked(grpc_exec_ctx* exec_ctx,
"trying again",
chand, calld);
}
- pick_after_resolver_result_start_locked(exec_ctx, elem);
+ pick_after_resolver_result_start_locked(elem);
} else {
if (grpc_client_channel_trace.enabled()) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver disconnected", chand,
calld);
}
async_pick_done_locked(
- exec_ctx, elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected"));
+ elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected"));
}
}
-static void pick_after_resolver_result_start_locked(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void pick_after_resolver_result_start_locked(grpc_call_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
if (grpc_client_channel_trace.enabled()) {
@@ -1324,47 +1273,46 @@ static void pick_after_resolver_result_start_locked(grpc_exec_ctx* exec_ctx,
grpc_closure_list_append(&chand->waiting_for_resolver_result_closures,
&args->closure, GRPC_ERROR_NONE);
grpc_call_combiner_set_notify_on_cancel(
- exec_ctx, calld->call_combiner,
+ calld->call_combiner,
GRPC_CLOSURE_INIT(&args->cancel_closure,
pick_after_resolver_result_cancel_locked, args,
grpc_combiner_scheduler(chand->combiner)));
}
-static void start_pick_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* ignored) {
+static void start_pick_locked(void* arg, grpc_error* ignored) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(calld->connected_subchannel == nullptr);
if (chand->lb_policy != nullptr) {
// We already have an LB policy, so ask it for a pick.
- if (pick_callback_start_locked(exec_ctx, elem)) {
+ if (pick_callback_start_locked(elem)) {
// Pick completed synchronously.
- pick_done_locked(exec_ctx, elem, GRPC_ERROR_NONE);
+ pick_done_locked(elem, GRPC_ERROR_NONE);
return;
}
} else {
// We do not yet have an LB policy, so wait for a resolver result.
if (chand->resolver == nullptr) {
- pick_done_locked(exec_ctx, elem,
+ pick_done_locked(elem,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected"));
return;
}
if (!chand->started_resolving) {
- start_resolving_locked(exec_ctx, chand);
+ start_resolving_locked(chand);
}
- pick_after_resolver_result_start_locked(exec_ctx, elem);
+ pick_after_resolver_result_start_locked(elem);
}
// We need to wait for either a resolver result or for an async result
// from the LB policy. Add the polling entity from call_data to the
// channel_data's interested_parties, so that the I/O of the LB policy
// and resolver can be done under it. The polling entity will be
// removed in async_pick_done_locked().
- grpc_polling_entity_add_to_pollset_set(exec_ctx, calld->pollent,
+ grpc_polling_entity_add_to_pollset_set(calld->pollent,
chand->interested_parties);
}
-static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void on_complete(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
if (calld->retry_throttle_data != nullptr) {
@@ -1380,18 +1328,15 @@ static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
calld->retry_throttle_data);
}
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_on_complete,
- GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_RUN(calld->original_on_complete, GRPC_ERROR_REF(error));
}
static void cc_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* batch) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
if (chand->deadline_checking_enabled) {
- grpc_deadline_state_client_start_transport_stream_op_batch(exec_ctx, elem,
- batch);
+ grpc_deadline_state_client_start_transport_stream_op_batch(elem, batch);
}
GPR_TIMER_BEGIN("cc_start_transport_stream_op_batch", 0);
// If we've previously been cancelled, immediately fail any new batches.
@@ -1401,7 +1346,7 @@ static void cc_start_transport_stream_op_batch(
chand, calld, grpc_error_string(calld->error));
}
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, batch, GRPC_ERROR_REF(calld->error), calld->call_combiner);
+ batch, GRPC_ERROR_REF(calld->error), calld->call_combiner);
goto done;
}
if (batch->cancel_stream) {
@@ -1419,11 +1364,10 @@ static void cc_start_transport_stream_op_batch(
// If we have a subchannel call, send the cancellation batch down.
// Otherwise, fail all pending batches.
if (calld->subchannel_call != nullptr) {
- grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call, batch);
+ grpc_subchannel_call_process_op(calld->subchannel_call, batch);
} else {
waiting_for_pick_batches_add(calld, batch);
- waiting_for_pick_batches_fail(exec_ctx, elem,
- GRPC_ERROR_REF(calld->error));
+ waiting_for_pick_batches_fail(elem, GRPC_ERROR_REF(calld->error));
}
goto done;
}
@@ -1446,7 +1390,7 @@ static void cc_start_transport_stream_op_batch(
"chand=%p calld=%p: sending batch to subchannel_call=%p", chand,
calld, calld->subchannel_call);
}
- grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call, batch);
+ grpc_subchannel_call_process_op(calld->subchannel_call, batch);
goto done;
}
// We do not yet have a subchannel call.
@@ -1460,7 +1404,6 @@ static void cc_start_transport_stream_op_batch(
chand, calld);
}
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&batch->handler_private.closure, start_pick_locked,
elem, grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
@@ -1471,7 +1414,7 @@ static void cc_start_transport_stream_op_batch(
"chand=%p calld=%p: saved batch, yeilding call combiner", chand,
calld);
}
- GRPC_CALL_COMBINER_STOP(exec_ctx, calld->call_combiner,
+ GRPC_CALL_COMBINER_STOP(calld->call_combiner,
"batch does not include send_initial_metadata");
}
done:
@@ -1479,8 +1422,7 @@ done:
}
/* Constructor for call_data */
-static grpc_error* cc_init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* cc_init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
@@ -1492,23 +1434,22 @@ static grpc_error* cc_init_call_elem(grpc_exec_ctx* exec_ctx,
calld->owning_call = args->call_stack;
calld->call_combiner = args->call_combiner;
if (chand->deadline_checking_enabled) {
- grpc_deadline_state_init(exec_ctx, elem, args->call_stack,
- args->call_combiner, calld->deadline);
+ grpc_deadline_state_init(elem, args->call_stack, args->call_combiner,
+ calld->deadline);
}
return GRPC_ERROR_NONE;
}
/* Destructor for call_data */
-static void cc_destroy_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static void cc_destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* then_schedule_closure) {
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
if (chand->deadline_checking_enabled) {
- grpc_deadline_state_destroy(exec_ctx, elem);
+ grpc_deadline_state_destroy(elem);
}
- grpc_slice_unref_internal(exec_ctx, calld->path);
+ grpc_slice_unref_internal(calld->path);
if (calld->method_params != nullptr) {
method_parameters_unref(calld->method_params);
}
@@ -1517,14 +1458,13 @@ static void cc_destroy_call_elem(grpc_exec_ctx* exec_ctx,
grpc_subchannel_call_set_cleanup_closure(calld->subchannel_call,
then_schedule_closure);
then_schedule_closure = nullptr;
- GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, calld->subchannel_call,
+ GRPC_SUBCHANNEL_CALL_UNREF(calld->subchannel_call,
"client_channel_destroy_call");
}
GPR_ASSERT(calld->lb_policy == nullptr);
GPR_ASSERT(calld->waiting_for_pick_batches_count == 0);
if (calld->connected_subchannel != nullptr) {
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel,
- "picked");
+ GRPC_CONNECTED_SUBCHANNEL_UNREF(calld->connected_subchannel, "picked");
}
for (size_t i = 0; i < GRPC_CONTEXT_COUNT; ++i) {
if (calld->subchannel_call_context[i].value != nullptr) {
@@ -1532,11 +1472,10 @@ static void cc_destroy_call_elem(grpc_exec_ctx* exec_ctx,
calld->subchannel_call_context[i].value);
}
}
- GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE);
}
-static void cc_set_pollset_or_pollset_set(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static void cc_set_pollset_or_pollset_set(grpc_call_element* elem,
grpc_polling_entity* pollent) {
call_data* calld = (call_data*)elem->call_data;
calld->pollent = pollent;
@@ -1560,29 +1499,27 @@ const grpc_channel_filter grpc_client_channel_filter = {
"client-channel",
};
-static void try_to_connect_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error_ignored) {
+static void try_to_connect_locked(void* arg, grpc_error* error_ignored) {
channel_data* chand = (channel_data*)arg;
if (chand->lb_policy != nullptr) {
- grpc_lb_policy_exit_idle_locked(exec_ctx, chand->lb_policy);
+ grpc_lb_policy_exit_idle_locked(chand->lb_policy);
} else {
chand->exit_idle_when_lb_policy_arrives = true;
if (!chand->started_resolving && chand->resolver != nullptr) {
- start_resolving_locked(exec_ctx, chand);
+ start_resolving_locked(chand);
}
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->owning_stack, "try_to_connect");
+ GRPC_CHANNEL_STACK_UNREF(chand->owning_stack, "try_to_connect");
}
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
- grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, int try_to_connect) {
+ grpc_channel_element* elem, int try_to_connect) {
channel_data* chand = (channel_data*)elem->channel_data;
grpc_connectivity_state out =
grpc_connectivity_state_check(&chand->state_tracker);
if (out == GRPC_CHANNEL_IDLE && try_to_connect) {
GRPC_CHANNEL_STACK_REF(chand->owning_stack, "try_to_connect");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_CREATE(try_to_connect_locked, chand,
grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
@@ -1663,50 +1600,49 @@ int grpc_client_channel_num_external_connectivity_watchers(
return count;
}
-static void on_external_watch_complete_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void on_external_watch_complete_locked(void* arg, grpc_error* error) {
external_connectivity_watcher* w = (external_connectivity_watcher*)arg;
grpc_closure* follow_up = w->on_complete;
- grpc_polling_entity_del_from_pollset_set(exec_ctx, &w->pollent,
+ grpc_polling_entity_del_from_pollset_set(&w->pollent,
w->chand->interested_parties);
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
+ GRPC_CHANNEL_STACK_UNREF(w->chand->owning_stack,
"external_connectivity_watcher");
external_connectivity_watcher_list_remove(w->chand, w);
gpr_free(w);
- GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_RUN(follow_up, GRPC_ERROR_REF(error));
}
-static void watch_connectivity_state_locked(grpc_exec_ctx* exec_ctx, void* arg,
+static void watch_connectivity_state_locked(void* arg,
grpc_error* error_ignored) {
external_connectivity_watcher* w = (external_connectivity_watcher*)arg;
external_connectivity_watcher* found = nullptr;
if (w->state != nullptr) {
external_connectivity_watcher_list_append(w->chand, w);
- GRPC_CLOSURE_RUN(exec_ctx, w->watcher_timer_init, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(w->watcher_timer_init, GRPC_ERROR_NONE);
GRPC_CLOSURE_INIT(&w->my_closure, on_external_watch_complete_locked, w,
grpc_combiner_scheduler(w->chand->combiner));
- grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &w->chand->state_tracker, w->state, &w->my_closure);
+ grpc_connectivity_state_notify_on_state_change(&w->chand->state_tracker,
+ w->state, &w->my_closure);
} else {
GPR_ASSERT(w->watcher_timer_init == nullptr);
found = lookup_external_connectivity_watcher(w->chand, w->on_complete);
if (found) {
GPR_ASSERT(found->on_complete == w->on_complete);
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &found->chand->state_tracker, nullptr, &found->my_closure);
+ &found->chand->state_tracker, nullptr, &found->my_closure);
}
- grpc_polling_entity_del_from_pollset_set(exec_ctx, &w->pollent,
+ grpc_polling_entity_del_from_pollset_set(&w->pollent,
w->chand->interested_parties);
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, w->chand->owning_stack,
+ GRPC_CHANNEL_STACK_UNREF(w->chand->owning_stack,
"external_connectivity_watcher");
gpr_free(w);
}
}
void grpc_client_channel_watch_connectivity_state(
- grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
- grpc_polling_entity pollent, grpc_connectivity_state* state,
- grpc_closure* closure, grpc_closure* watcher_timer_init) {
+ grpc_channel_element* elem, grpc_polling_entity pollent,
+ grpc_connectivity_state* state, grpc_closure* closure,
+ grpc_closure* watcher_timer_init) {
channel_data* chand = (channel_data*)elem->channel_data;
external_connectivity_watcher* w =
(external_connectivity_watcher*)gpr_zalloc(sizeof(*w));
@@ -1715,12 +1651,11 @@ void grpc_client_channel_watch_connectivity_state(
w->on_complete = closure;
w->state = state;
w->watcher_timer_init = watcher_timer_init;
- grpc_polling_entity_add_to_pollset_set(exec_ctx, &w->pollent,
+ grpc_polling_entity_add_to_pollset_set(&w->pollent,
chand->interested_parties);
GRPC_CHANNEL_STACK_REF(w->chand->owning_stack,
"external_connectivity_watcher");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&w->my_closure, watch_connectivity_state_locked, w,
grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
diff --git a/src/core/ext/filters/client_channel/client_channel.h b/src/core/ext/filters/client_channel/client_channel.h
index 48e4637a82..9670405cbe 100644
--- a/src/core/ext/filters/client_channel/client_channel.h
+++ b/src/core/ext/filters/client_channel/client_channel.h
@@ -38,15 +38,15 @@ extern grpc_core::TraceFlag grpc_client_channel_trace;
extern const grpc_channel_filter grpc_client_channel_filter;
grpc_connectivity_state grpc_client_channel_check_connectivity_state(
- grpc_exec_ctx* exec_ctx, grpc_channel_element* elem, int try_to_connect);
+ grpc_channel_element* elem, int try_to_connect);
int grpc_client_channel_num_external_connectivity_watchers(
grpc_channel_element* elem);
void grpc_client_channel_watch_connectivity_state(
- grpc_exec_ctx* exec_ctx, grpc_channel_element* elem,
- grpc_polling_entity pollent, grpc_connectivity_state* state,
- grpc_closure* on_complete, grpc_closure* watcher_timer_init);
+ grpc_channel_element* elem, grpc_polling_entity pollent,
+ grpc_connectivity_state* state, grpc_closure* on_complete,
+ grpc_closure* watcher_timer_init);
/* Debug helper: pull the subchannel call from a call stack element */
grpc_subchannel_call* grpc_client_channel_get_subchannel_call(
diff --git a/src/core/ext/filters/client_channel/client_channel_factory.cc b/src/core/ext/filters/client_channel/client_channel_factory.cc
index 57eac8f875..60c95d7dc9 100644
--- a/src/core/ext/filters/client_channel/client_channel_factory.cc
+++ b/src/core/ext/filters/client_channel/client_channel_factory.cc
@@ -23,23 +23,19 @@ void grpc_client_channel_factory_ref(grpc_client_channel_factory* factory) {
factory->vtable->ref(factory);
}
-void grpc_client_channel_factory_unref(grpc_exec_ctx* exec_ctx,
- grpc_client_channel_factory* factory) {
- factory->vtable->unref(exec_ctx, factory);
+void grpc_client_channel_factory_unref(grpc_client_channel_factory* factory) {
+ factory->vtable->unref(factory);
}
grpc_subchannel* grpc_client_channel_factory_create_subchannel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
- const grpc_subchannel_args* args) {
- return factory->vtable->create_subchannel(exec_ctx, factory, args);
+ grpc_client_channel_factory* factory, const grpc_subchannel_args* args) {
+ return factory->vtable->create_subchannel(factory, args);
}
grpc_channel* grpc_client_channel_factory_create_channel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
- const char* target, grpc_client_channel_type type,
- const grpc_channel_args* args) {
- return factory->vtable->create_client_channel(exec_ctx, factory, target, type,
- args);
+ grpc_client_channel_factory* factory, const char* target,
+ grpc_client_channel_type type, const grpc_channel_args* args) {
+ return factory->vtable->create_client_channel(factory, target, type, args);
}
static void* factory_arg_copy(void* factory) {
@@ -47,9 +43,8 @@ static void* factory_arg_copy(void* factory) {
return factory;
}
-static void factory_arg_destroy(grpc_exec_ctx* exec_ctx, void* factory) {
- grpc_client_channel_factory_unref(exec_ctx,
- (grpc_client_channel_factory*)factory);
+static void factory_arg_destroy(void* factory) {
+ grpc_client_channel_factory_unref((grpc_client_channel_factory*)factory);
}
static int factory_arg_cmp(void* factory1, void* factory2) {
diff --git a/src/core/ext/filters/client_channel/client_channel_factory.h b/src/core/ext/filters/client_channel/client_channel_factory.h
index db82b733ce..766ebb9389 100644
--- a/src/core/ext/filters/client_channel/client_channel_factory.h
+++ b/src/core/ext/filters/client_channel/client_channel_factory.h
@@ -45,31 +45,26 @@ struct grpc_client_channel_factory {
struct grpc_client_channel_factory_vtable {
void (*ref)(grpc_client_channel_factory* factory);
- void (*unref)(grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory);
- grpc_subchannel* (*create_subchannel)(grpc_exec_ctx* exec_ctx,
- grpc_client_channel_factory* factory,
+ void (*unref)(grpc_client_channel_factory* factory);
+ grpc_subchannel* (*create_subchannel)(grpc_client_channel_factory* factory,
const grpc_subchannel_args* args);
- grpc_channel* (*create_client_channel)(grpc_exec_ctx* exec_ctx,
- grpc_client_channel_factory* factory,
+ grpc_channel* (*create_client_channel)(grpc_client_channel_factory* factory,
const char* target,
grpc_client_channel_type type,
const grpc_channel_args* args);
};
void grpc_client_channel_factory_ref(grpc_client_channel_factory* factory);
-void grpc_client_channel_factory_unref(grpc_exec_ctx* exec_ctx,
- grpc_client_channel_factory* factory);
+void grpc_client_channel_factory_unref(grpc_client_channel_factory* factory);
/** Create a new grpc_subchannel */
grpc_subchannel* grpc_client_channel_factory_create_subchannel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
- const grpc_subchannel_args* args);
+ grpc_client_channel_factory* factory, const grpc_subchannel_args* args);
/** Create a new grpc_channel */
grpc_channel* grpc_client_channel_factory_create_channel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
- const char* target, grpc_client_channel_type type,
- const grpc_channel_args* args);
+ grpc_client_channel_factory* factory, const char* target,
+ grpc_client_channel_type type, const grpc_channel_args* args);
grpc_arg grpc_client_channel_factory_create_channel_arg(
grpc_client_channel_factory* factory);
diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc
index 7a5bb18157..ea630d2917 100644
--- a/src/core/ext/filters/client_channel/client_channel_plugin.cc
+++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc
@@ -34,14 +34,12 @@
#include "src/core/ext/filters/client_channel/subchannel_index.h"
#include "src/core/lib/surface/channel_init.h"
-static bool append_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder, void* arg) {
+static bool append_filter(grpc_channel_stack_builder* builder, void* arg) {
return grpc_channel_stack_builder_append_filter(
builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
}
-static bool set_default_host_if_unset(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool set_default_host_if_unset(grpc_channel_stack_builder* builder,
void* unused) {
const grpc_channel_args* args =
grpc_channel_stack_builder_get_channel_arguments(builder);
@@ -52,15 +50,14 @@ static bool set_default_host_if_unset(grpc_exec_ctx* exec_ctx,
}
}
char* default_authority = grpc_get_default_authority(
- exec_ctx, grpc_channel_stack_builder_get_target(builder));
+ grpc_channel_stack_builder_get_target(builder));
if (default_authority != nullptr) {
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority);
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
- grpc_channel_stack_builder_set_channel_arguments(exec_ctx, builder,
- new_args);
+ grpc_channel_stack_builder_set_channel_arguments(builder, new_args);
gpr_free(default_authority);
- grpc_channel_args_destroy(exec_ctx, new_args);
+ grpc_channel_args_destroy(new_args);
}
return true;
}
diff --git a/src/core/ext/filters/client_channel/connector.cc b/src/core/ext/filters/client_channel/connector.cc
index c258468e58..c8bf2f3e1c 100644
--- a/src/core/ext/filters/client_channel/connector.cc
+++ b/src/core/ext/filters/client_channel/connector.cc
@@ -23,18 +23,17 @@ grpc_connector* grpc_connector_ref(grpc_connector* connector) {
return connector;
}
-void grpc_connector_unref(grpc_exec_ctx* exec_ctx, grpc_connector* connector) {
- connector->vtable->unref(exec_ctx, connector);
+void grpc_connector_unref(grpc_connector* connector) {
+ connector->vtable->unref(connector);
}
-void grpc_connector_connect(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
+void grpc_connector_connect(grpc_connector* connector,
const grpc_connect_in_args* in_args,
grpc_connect_out_args* out_args,
grpc_closure* notify) {
- connector->vtable->connect(exec_ctx, connector, in_args, out_args, notify);
+ connector->vtable->connect(connector, in_args, out_args, notify);
}
-void grpc_connector_shutdown(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
- grpc_error* why) {
- connector->vtable->shutdown(exec_ctx, connector, why);
+void grpc_connector_shutdown(grpc_connector* connector, grpc_error* why) {
+ connector->vtable->shutdown(connector, why);
}
diff --git a/src/core/ext/filters/client_channel/connector.h b/src/core/ext/filters/client_channel/connector.h
index 239ed8a8bd..d657658d67 100644
--- a/src/core/ext/filters/client_channel/connector.h
+++ b/src/core/ext/filters/client_channel/connector.h
@@ -49,25 +49,23 @@ typedef struct {
struct grpc_connector_vtable {
void (*ref)(grpc_connector* connector);
- void (*unref)(grpc_exec_ctx* exec_ctx, grpc_connector* connector);
+ void (*unref)(grpc_connector* connector);
/** Implementation of grpc_connector_shutdown */
- void (*shutdown)(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
- grpc_error* why);
+ void (*shutdown)(grpc_connector* connector, grpc_error* why);
/** Implementation of grpc_connector_connect */
- void (*connect)(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
+ void (*connect)(grpc_connector* connector,
const grpc_connect_in_args* in_args,
grpc_connect_out_args* out_args, grpc_closure* notify);
};
grpc_connector* grpc_connector_ref(grpc_connector* connector);
-void grpc_connector_unref(grpc_exec_ctx* exec_ctx, grpc_connector* connector);
+void grpc_connector_unref(grpc_connector* connector);
/** Connect using the connector: max one outstanding call at a time */
-void grpc_connector_connect(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
+void grpc_connector_connect(grpc_connector* connector,
const grpc_connect_in_args* in_args,
grpc_connect_out_args* out_args,
grpc_closure* notify);
/** Cancel any pending connection */
-void grpc_connector_shutdown(grpc_exec_ctx* exec_ctx, grpc_connector* connector,
- grpc_error* why);
+void grpc_connector_shutdown(grpc_connector* connector, grpc_error* why);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_CONNECTOR_H */
diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.cc b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
index b7cb2e3eba..556a3bc6a1 100644
--- a/src/core/ext/filters/client_channel/http_connect_handshaker.cc
+++ b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
@@ -61,41 +61,38 @@ typedef struct http_connect_handshaker {
} http_connect_handshaker;
// Unref and clean up handshaker.
-static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
- http_connect_handshaker* handshaker) {
+static void http_connect_handshaker_unref(http_connect_handshaker* handshaker) {
if (gpr_unref(&handshaker->refcount)) {
gpr_mu_destroy(&handshaker->mu);
if (handshaker->endpoint_to_destroy != nullptr) {
- grpc_endpoint_destroy(exec_ctx, handshaker->endpoint_to_destroy);
+ grpc_endpoint_destroy(handshaker->endpoint_to_destroy);
}
if (handshaker->read_buffer_to_destroy != nullptr) {
- grpc_slice_buffer_destroy_internal(exec_ctx,
- handshaker->read_buffer_to_destroy);
+ grpc_slice_buffer_destroy_internal(handshaker->read_buffer_to_destroy);
gpr_free(handshaker->read_buffer_to_destroy);
}
- grpc_slice_buffer_destroy_internal(exec_ctx, &handshaker->write_buffer);
+ grpc_slice_buffer_destroy_internal(&handshaker->write_buffer);
grpc_http_parser_destroy(&handshaker->http_parser);
grpc_http_response_destroy(&handshaker->http_response);
gpr_free(handshaker);
}
}
-// Set args fields to NULL, saving the endpoint and read buffer for
+// Set args fields to nullptr, saving the endpoint and read buffer for
// later destruction.
static void cleanup_args_for_failure_locked(
- grpc_exec_ctx* exec_ctx, http_connect_handshaker* handshaker) {
+ http_connect_handshaker* handshaker) {
handshaker->endpoint_to_destroy = handshaker->args->endpoint;
handshaker->args->endpoint = nullptr;
handshaker->read_buffer_to_destroy = handshaker->args->read_buffer;
handshaker->args->read_buffer = nullptr;
- grpc_channel_args_destroy(exec_ctx, handshaker->args->args);
+ grpc_channel_args_destroy(handshaker->args->args);
handshaker->args->args = nullptr;
}
// If the handshake failed or we're shutting down, clean up and invoke the
// callback with the error.
-static void handshake_failed_locked(grpc_exec_ctx* exec_ctx,
- http_connect_handshaker* handshaker,
+static void handshake_failed_locked(http_connect_handshaker* handshaker,
grpc_error* error) {
if (error == GRPC_ERROR_NONE) {
// If we were shut down after an endpoint operation succeeded but
@@ -108,34 +105,32 @@ static void handshake_failed_locked(grpc_exec_ctx* exec_ctx,
// before destroying them, even if we know that there are no
// pending read/write callbacks. This should be fixed, at which
// point this can be removed.
- grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint,
- GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(handshaker->args->endpoint, GRPC_ERROR_REF(error));
// Not shutting down, so the handshake failed. Clean up before
// invoking the callback.
- cleanup_args_for_failure_locked(exec_ctx, handshaker);
+ cleanup_args_for_failure_locked(handshaker);
// Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing.
handshaker->shutdown = true;
}
// Invoke callback.
- GRPC_CLOSURE_SCHED(exec_ctx, handshaker->on_handshake_done, error);
+ GRPC_CLOSURE_SCHED(handshaker->on_handshake_done, error);
}
// Callback invoked when finished writing HTTP CONNECT request.
-static void on_write_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_write_done(void* arg, grpc_error* error) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)arg;
gpr_mu_lock(&handshaker->mu);
if (error != GRPC_ERROR_NONE || handshaker->shutdown) {
// If the write failed or we're shutting down, clean up and invoke the
// callback with the error.
- handshake_failed_locked(exec_ctx, handshaker, GRPC_ERROR_REF(error));
+ handshake_failed_locked(handshaker, GRPC_ERROR_REF(error));
gpr_mu_unlock(&handshaker->mu);
- http_connect_handshaker_unref(exec_ctx, handshaker);
+ http_connect_handshaker_unref(handshaker);
} else {
// Otherwise, read the response.
// The read callback inherits our ref to the handshaker.
- grpc_endpoint_read(exec_ctx, handshaker->args->endpoint,
+ grpc_endpoint_read(handshaker->args->endpoint,
handshaker->args->read_buffer,
&handshaker->response_read_closure);
gpr_mu_unlock(&handshaker->mu);
@@ -143,14 +138,13 @@ static void on_write_done(grpc_exec_ctx* exec_ctx, void* arg,
}
// Callback invoked for reading HTTP CONNECT response.
-static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_read_done(void* arg, grpc_error* error) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)arg;
gpr_mu_lock(&handshaker->mu);
if (error != GRPC_ERROR_NONE || handshaker->shutdown) {
// If the read failed or we're shutting down, clean up and invoke the
// callback with the error.
- handshake_failed_locked(exec_ctx, handshaker, GRPC_ERROR_REF(error));
+ handshake_failed_locked(handshaker, GRPC_ERROR_REF(error));
goto done;
}
// Add buffer to parser.
@@ -161,7 +155,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
handshaker->args->read_buffer->slices[i],
&body_start_offset);
if (error != GRPC_ERROR_NONE) {
- handshake_failed_locked(exec_ctx, handshaker, error);
+ handshake_failed_locked(handshaker, error);
goto done;
}
if (handshaker->http_parser.state == GRPC_HTTP_BODY) {
@@ -180,7 +174,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
&handshaker->args->read_buffer->slices[i + 1],
handshaker->args->read_buffer->count - i - 1);
grpc_slice_buffer_swap(handshaker->args->read_buffer, &tmp_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &tmp_buffer);
+ grpc_slice_buffer_destroy_internal(&tmp_buffer);
break;
}
}
@@ -197,9 +191,8 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
// complete (e.g., handling chunked transfer encoding or looking
// at the Content-Length: header).
if (handshaker->http_parser.state != GRPC_HTTP_BODY) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
- handshaker->args->read_buffer);
- grpc_endpoint_read(exec_ctx, handshaker->args->endpoint,
+ grpc_slice_buffer_reset_and_unref_internal(handshaker->args->read_buffer);
+ grpc_endpoint_read(handshaker->args->endpoint,
handshaker->args->read_buffer,
&handshaker->response_read_closure);
gpr_mu_unlock(&handshaker->mu);
@@ -213,48 +206,44 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
handshaker->http_response.status);
error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- handshake_failed_locked(exec_ctx, handshaker, error);
+ handshake_failed_locked(handshaker, error);
goto done;
}
// Success. Invoke handshake-done callback.
- GRPC_CLOSURE_SCHED(exec_ctx, handshaker->on_handshake_done, error);
+ GRPC_CLOSURE_SCHED(handshaker->on_handshake_done, error);
done:
// Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing.
handshaker->shutdown = true;
gpr_mu_unlock(&handshaker->mu);
- http_connect_handshaker_unref(exec_ctx, handshaker);
+ http_connect_handshaker_unref(handshaker);
}
//
// Public handshaker methods
//
-static void http_connect_handshaker_destroy(grpc_exec_ctx* exec_ctx,
- grpc_handshaker* handshaker_in) {
+static void http_connect_handshaker_destroy(grpc_handshaker* handshaker_in) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in;
- http_connect_handshaker_unref(exec_ctx, handshaker);
+ http_connect_handshaker_unref(handshaker);
}
-static void http_connect_handshaker_shutdown(grpc_exec_ctx* exec_ctx,
- grpc_handshaker* handshaker_in,
+static void http_connect_handshaker_shutdown(grpc_handshaker* handshaker_in,
grpc_error* why) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in;
gpr_mu_lock(&handshaker->mu);
if (!handshaker->shutdown) {
handshaker->shutdown = true;
- grpc_endpoint_shutdown(exec_ctx, handshaker->args->endpoint,
- GRPC_ERROR_REF(why));
- cleanup_args_for_failure_locked(exec_ctx, handshaker);
+ grpc_endpoint_shutdown(handshaker->args->endpoint, GRPC_ERROR_REF(why));
+ cleanup_args_for_failure_locked(handshaker);
}
gpr_mu_unlock(&handshaker->mu);
GRPC_ERROR_UNREF(why);
}
static void http_connect_handshaker_do_handshake(
- grpc_exec_ctx* exec_ctx, grpc_handshaker* handshaker_in,
- grpc_tcp_server_acceptor* acceptor, grpc_closure* on_handshake_done,
- grpc_handshaker_args* args) {
+ grpc_handshaker* handshaker_in, grpc_tcp_server_acceptor* acceptor,
+ grpc_closure* on_handshake_done, grpc_handshaker_args* args) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in;
// Check for HTTP CONNECT channel arg.
// If not found, invoke on_handshake_done without doing anything.
@@ -266,7 +255,7 @@ static void http_connect_handshaker_do_handshake(
gpr_mu_lock(&handshaker->mu);
handshaker->shutdown = true;
gpr_mu_unlock(&handshaker->mu);
- GRPC_CLOSURE_SCHED(exec_ctx, on_handshake_done, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(on_handshake_done, GRPC_ERROR_NONE);
return;
}
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
@@ -324,7 +313,7 @@ static void http_connect_handshaker_do_handshake(
gpr_free(header_strings);
// Take a new ref to be held by the write callback.
gpr_ref(&handshaker->refcount);
- grpc_endpoint_write(exec_ctx, args->endpoint, &handshaker->write_buffer,
+ grpc_endpoint_write(args->endpoint, &handshaker->write_buffer,
&handshaker->request_done_closure);
gpr_mu_unlock(&handshaker->mu);
}
@@ -355,14 +344,13 @@ static grpc_handshaker* grpc_http_connect_handshaker_create() {
//
static void handshaker_factory_add_handshakers(
- grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* factory,
- const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) {
+ grpc_handshaker_factory* factory, const grpc_channel_args* args,
+ grpc_handshake_manager* handshake_mgr) {
grpc_handshake_manager_add(handshake_mgr,
grpc_http_connect_handshaker_create());
}
-static void handshaker_factory_destroy(grpc_exec_ctx* exec_ctx,
- grpc_handshaker_factory* factory) {}
+static void handshaker_factory_destroy(grpc_handshaker_factory* factory) {}
static const grpc_handshaker_factory_vtable handshaker_factory_vtable = {
handshaker_factory_add_handshakers, handshaker_factory_destroy};
diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc
index 405d8c0e55..2eafeee702 100644
--- a/src/core/ext/filters/client_channel/http_proxy.cc
+++ b/src/core/ext/filters/client_channel/http_proxy.cc
@@ -36,19 +36,18 @@
/**
* Parses the 'http_proxy' env var and returns the proxy hostname to resolve or
- * NULL on error. Also sets 'user_cred' to user credentials if present in the
+ * nullptr on error. Also sets 'user_cred' to user credentials if present in the
* 'http_proxy' env var, otherwise leaves it unchanged. It is caller's
* responsibility to gpr_free user_cred.
*/
-static char* get_http_proxy_server(grpc_exec_ctx* exec_ctx, char** user_cred) {
+static char* get_http_proxy_server(char** user_cred) {
GPR_ASSERT(user_cred != nullptr);
char* proxy_name = nullptr;
char* uri_str = gpr_getenv("http_proxy");
char** authority_strs = nullptr;
size_t authority_nstrs;
if (uri_str == nullptr) return nullptr;
- grpc_uri* uri =
- grpc_uri_parse(exec_ctx, uri_str, false /* suppress_errors */);
+ grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
if (uri == nullptr || uri->authority == nullptr) {
gpr_log(GPR_ERROR, "cannot parse value of 'http_proxy' env var");
goto done;
@@ -82,18 +81,16 @@ done:
return proxy_name;
}
-static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
char* user_cred = nullptr;
- *name_to_resolve = get_http_proxy_server(exec_ctx, &user_cred);
+ *name_to_resolve = get_http_proxy_server(&user_cred);
if (*name_to_resolve == nullptr) return false;
char* no_proxy_str = nullptr;
- grpc_uri* uri =
- grpc_uri_parse(exec_ctx, server_uri, false /* suppress_errors */);
+ grpc_uri* uri = grpc_uri_parse(server_uri, false /* suppress_errors */);
if (uri == nullptr || uri->path[0] == '\0') {
gpr_log(GPR_ERROR,
"'http_proxy' environment variable set, but cannot "
@@ -174,8 +171,7 @@ no_use_proxy:
return false;
}
-static bool proxy_mapper_map_address(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+static bool proxy_mapper_map_address(grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
diff --git a/src/core/ext/filters/client_channel/lb_policy.cc b/src/core/ext/filters/client_channel/lb_policy.cc
index db566f1b56..b97aa319f7 100644
--- a/src/core/ext/filters/client_channel/lb_policy.cc
+++ b/src/core/ext/filters/client_channel/lb_policy.cc
@@ -63,15 +63,13 @@ void grpc_lb_policy_ref(grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
ref_mutate(policy, 1 << WEAK_REF_BITS, 0 REF_MUTATE_PASS_ARGS("STRONG_REF"));
}
-static void shutdown_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void shutdown_locked(void* arg, grpc_error* error) {
grpc_lb_policy* policy = (grpc_lb_policy*)arg;
- policy->vtable->shutdown_locked(exec_ctx, policy);
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, policy, "strong-unref");
+ policy->vtable->shutdown_locked(policy);
+ GRPC_LB_POLICY_WEAK_UNREF(policy, "strong-unref");
}
-void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
+void grpc_lb_policy_unref(grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
gpr_atm old_val =
ref_mutate(policy, (gpr_atm)1 - (gpr_atm)(1 << WEAK_REF_BITS),
1 REF_MUTATE_PASS_ARGS("STRONG_UNREF"));
@@ -79,13 +77,11 @@ void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx,
gpr_atm check = 1 << WEAK_REF_BITS;
if ((old_val & mask) == check) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_CREATE(shutdown_locked, policy,
grpc_combiner_scheduler(policy->combiner)),
GRPC_ERROR_NONE);
} else {
- grpc_lb_policy_weak_unref(exec_ctx,
- policy REF_FUNC_PASS_ARGS("strong-unref"));
+ grpc_lb_policy_weak_unref(policy REF_FUNC_PASS_ARGS("strong-unref"));
}
}
@@ -93,88 +89,75 @@ void grpc_lb_policy_weak_ref(grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
ref_mutate(policy, 1, 0 REF_MUTATE_PASS_ARGS("WEAK_REF"));
}
-void grpc_lb_policy_weak_unref(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
+void grpc_lb_policy_weak_unref(grpc_lb_policy* policy REF_FUNC_EXTRA_ARGS) {
gpr_atm old_val =
ref_mutate(policy, -(gpr_atm)1, 1 REF_MUTATE_PASS_ARGS("WEAK_UNREF"));
if (old_val == 1) {
- grpc_pollset_set_destroy(exec_ctx, policy->interested_parties);
+ grpc_pollset_set_destroy(policy->interested_parties);
grpc_combiner* combiner = policy->combiner;
- policy->vtable->destroy(exec_ctx, policy);
- GRPC_COMBINER_UNREF(exec_ctx, combiner, "lb_policy");
+ policy->vtable->destroy(policy);
+ GRPC_COMBINER_UNREF(combiner, "lb_policy");
}
}
-int grpc_lb_policy_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+int grpc_lb_policy_pick_locked(grpc_lb_policy* policy,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context,
void** user_data, grpc_closure* on_complete) {
- return policy->vtable->pick_locked(exec_ctx, policy, pick_args, target,
- context, user_data, on_complete);
+ return policy->vtable->pick_locked(policy, pick_args, target, context,
+ user_data, on_complete);
}
-void grpc_lb_policy_cancel_pick_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_pick_locked(grpc_lb_policy* policy,
grpc_connected_subchannel** target,
grpc_error* error) {
- policy->vtable->cancel_pick_locked(exec_ctx, policy, target, error);
+ policy->vtable->cancel_pick_locked(policy, target, error);
}
-void grpc_lb_policy_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_picks_locked(grpc_lb_policy* policy,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error) {
- policy->vtable->cancel_picks_locked(exec_ctx, policy,
- initial_metadata_flags_mask,
+ policy->vtable->cancel_picks_locked(policy, initial_metadata_flags_mask,
initial_metadata_flags_eq, error);
}
-void grpc_lb_policy_exit_idle_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy) {
- policy->vtable->exit_idle_locked(exec_ctx, policy);
+void grpc_lb_policy_exit_idle_locked(grpc_lb_policy* policy) {
+ policy->vtable->exit_idle_locked(policy);
}
-void grpc_lb_policy_ping_one_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_ping_one_locked(grpc_lb_policy* policy,
grpc_closure* closure) {
- policy->vtable->ping_one_locked(exec_ctx, policy, closure);
+ policy->vtable->ping_one_locked(policy, closure);
}
void grpc_lb_policy_notify_on_state_change_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_connectivity_state* state, grpc_closure* closure) {
- policy->vtable->notify_on_state_change_locked(exec_ctx, policy, state,
- closure);
+ grpc_lb_policy* policy, grpc_connectivity_state* state,
+ grpc_closure* closure) {
+ policy->vtable->notify_on_state_change_locked(policy, state, closure);
}
grpc_connectivity_state grpc_lb_policy_check_connectivity_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_error** connectivity_error) {
- return policy->vtable->check_connectivity_locked(exec_ctx, policy,
- connectivity_error);
+ grpc_lb_policy* policy, grpc_error** connectivity_error) {
+ return policy->vtable->check_connectivity_locked(policy, connectivity_error);
}
-void grpc_lb_policy_update_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_update_locked(grpc_lb_policy* policy,
const grpc_lb_policy_args* lb_policy_args) {
- policy->vtable->update_locked(exec_ctx, policy, lb_policy_args);
+ policy->vtable->update_locked(policy, lb_policy_args);
}
void grpc_lb_policy_set_reresolve_closure_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* request_reresolution) {
- policy->vtable->set_reresolve_closure_locked(exec_ctx, policy,
- request_reresolution);
+ grpc_lb_policy* policy, grpc_closure* request_reresolution) {
+ policy->vtable->set_reresolve_closure_locked(policy, request_reresolution);
}
-void grpc_lb_policy_try_reresolve(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_try_reresolve(grpc_lb_policy* policy,
grpc_core::TraceFlag* grpc_lb_trace,
grpc_error* error) {
if (policy->request_reresolution != nullptr) {
- GRPC_CLOSURE_SCHED(exec_ctx, policy->request_reresolution, error);
+ GRPC_CLOSURE_SCHED(policy->request_reresolution, error);
policy->request_reresolution = nullptr;
if (grpc_lb_trace->enabled()) {
gpr_log(GPR_DEBUG,
diff --git a/src/core/ext/filters/client_channel/lb_policy.h b/src/core/ext/filters/client_channel/lb_policy.h
index d3159eebf3..fd28a2b623 100644
--- a/src/core/ext/filters/client_channel/lb_policy.h
+++ b/src/core/ext/filters/client_channel/lb_policy.h
@@ -55,53 +55,49 @@ typedef struct grpc_lb_policy_pick_args {
} grpc_lb_policy_pick_args;
struct grpc_lb_policy_vtable {
- void (*destroy)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
- void (*shutdown_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
+ void (*destroy)(grpc_lb_policy* policy);
+ void (*shutdown_locked)(grpc_lb_policy* policy);
/** \see grpc_lb_policy_pick */
- int (*pick_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ int (*pick_locked)(grpc_lb_policy* policy,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
grpc_closure* on_complete);
/** \see grpc_lb_policy_cancel_pick */
- void (*cancel_pick_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ void (*cancel_pick_locked)(grpc_lb_policy* policy,
grpc_connected_subchannel** target,
grpc_error* error);
/** \see grpc_lb_policy_cancel_picks */
- void (*cancel_picks_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ void (*cancel_picks_locked)(grpc_lb_policy* policy,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error);
/** \see grpc_lb_policy_ping_one */
- void (*ping_one_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* closure);
+ void (*ping_one_locked)(grpc_lb_policy* policy, grpc_closure* closure);
/** Try to enter a READY connectivity state */
- void (*exit_idle_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
+ void (*exit_idle_locked)(grpc_lb_policy* policy);
/** check the current connectivity of the lb_policy */
grpc_connectivity_state (*check_connectivity_locked)(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_error** connectivity_error);
+ grpc_lb_policy* policy, grpc_error** connectivity_error);
/** call notify when the connectivity state of a channel changes from *state.
Updates *state with the new state of the policy. Calling with a NULL \a
state cancels the subscription. */
- void (*notify_on_state_change_locked)(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+ void (*notify_on_state_change_locked)(grpc_lb_policy* policy,
grpc_connectivity_state* state,
grpc_closure* closure);
- void (*update_locked)(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+ void (*update_locked)(grpc_lb_policy* policy,
const grpc_lb_policy_args* args);
/** \see grpc_lb_policy_set_reresolve_closure */
- void (*set_reresolve_closure_locked)(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+ void (*set_reresolve_closure_locked)(grpc_lb_policy* policy,
grpc_closure* request_reresolution);
};
@@ -110,33 +106,33 @@ struct grpc_lb_policy_vtable {
/* Strong references: the policy will shutdown when they reach zero */
#define GRPC_LB_POLICY_REF(p, r) \
grpc_lb_policy_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_LB_POLICY_UNREF(exec_ctx, p, r) \
- grpc_lb_policy_unref((exec_ctx), (p), __FILE__, __LINE__, (r))
+#define GRPC_LB_POLICY_UNREF(p, r) \
+ grpc_lb_policy_unref((p), __FILE__, __LINE__, (r))
/* Weak references: they don't prevent the shutdown of the LB policy. When no
* strong references are left but there are still weak ones, shutdown is called.
* Once the weak reference also reaches zero, the LB policy is destroyed. */
#define GRPC_LB_POLICY_WEAK_REF(p, r) \
grpc_lb_policy_weak_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, p, r) \
- grpc_lb_policy_weak_unref((exec_ctx), (p), __FILE__, __LINE__, (r))
+#define GRPC_LB_POLICY_WEAK_UNREF(p, r) \
+ grpc_lb_policy_weak_unref((p), __FILE__, __LINE__, (r))
void grpc_lb_policy_ref(grpc_lb_policy* policy, const char* file, int line,
const char* reason);
-void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- const char* file, int line, const char* reason);
+void grpc_lb_policy_unref(grpc_lb_policy* policy, const char* file, int line,
+ const char* reason);
void grpc_lb_policy_weak_ref(grpc_lb_policy* policy, const char* file, int line,
const char* reason);
-void grpc_lb_policy_weak_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- const char* file, int line, const char* reason);
+void grpc_lb_policy_weak_unref(grpc_lb_policy* policy, const char* file,
+ int line, const char* reason);
#else
#define GRPC_LB_POLICY_REF(p, r) grpc_lb_policy_ref((p))
-#define GRPC_LB_POLICY_UNREF(cl, p, r) grpc_lb_policy_unref((cl), (p))
+#define GRPC_LB_POLICY_UNREF(p, r) grpc_lb_policy_unref((p))
#define GRPC_LB_POLICY_WEAK_REF(p, r) grpc_lb_policy_weak_ref((p))
-#define GRPC_LB_POLICY_WEAK_UNREF(cl, p, r) grpc_lb_policy_weak_unref((cl), (p))
+#define GRPC_LB_POLICY_WEAK_UNREF(p, r) grpc_lb_policy_weak_unref((p))
void grpc_lb_policy_ref(grpc_lb_policy* policy);
-void grpc_lb_policy_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
+void grpc_lb_policy_unref(grpc_lb_policy* policy);
void grpc_lb_policy_weak_ref(grpc_lb_policy* policy);
-void grpc_lb_policy_weak_unref(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy);
+void grpc_lb_policy_weak_unref(grpc_lb_policy* policy);
#endif
/** called by concrete implementations to initialize the base struct */
@@ -161,7 +157,7 @@ void grpc_lb_policy_init(grpc_lb_policy* policy,
Any IO should be done under the \a interested_parties \a grpc_pollset_set
in the \a grpc_lb_policy struct. */
-int grpc_lb_policy_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+int grpc_lb_policy_pick_locked(grpc_lb_policy* policy,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context,
@@ -169,55 +165,47 @@ int grpc_lb_policy_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
/** Perform a connected subchannel ping (see \a grpc_connected_subchannel_ping)
against one of the connected subchannels managed by \a policy. */
-void grpc_lb_policy_ping_one_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_ping_one_locked(grpc_lb_policy* policy,
grpc_closure* closure);
/** Cancel picks for \a target.
The \a on_complete callback of the pending picks will be invoked with \a
*target set to NULL. */
-void grpc_lb_policy_cancel_pick_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_pick_locked(grpc_lb_policy* policy,
grpc_connected_subchannel** target,
grpc_error* error);
/** Cancel all pending picks for which their \a initial_metadata_flags (as given
in the call to \a grpc_lb_policy_pick) matches \a initial_metadata_flags_eq
when AND'd with \a initial_metadata_flags_mask */
-void grpc_lb_policy_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_cancel_picks_locked(grpc_lb_policy* policy,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error);
/** Try to enter a READY connectivity state */
-void grpc_lb_policy_exit_idle_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy);
+void grpc_lb_policy_exit_idle_locked(grpc_lb_policy* policy);
/* Call notify when the connectivity state of a channel changes from \a *state.
* Updates \a *state with the new state of the policy */
void grpc_lb_policy_notify_on_state_change_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_connectivity_state* state, grpc_closure* closure);
+ grpc_lb_policy* policy, grpc_connectivity_state* state,
+ grpc_closure* closure);
grpc_connectivity_state grpc_lb_policy_check_connectivity_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_error** connectivity_error);
+ grpc_lb_policy* policy, grpc_error** connectivity_error);
/** Update \a policy with \a lb_policy_args. */
-void grpc_lb_policy_update_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_update_locked(grpc_lb_policy* policy,
const grpc_lb_policy_args* lb_policy_args);
/** Set the re-resolution closure to \a request_reresolution. */
void grpc_lb_policy_set_reresolve_closure_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* request_reresolution);
+ grpc_lb_policy* policy, grpc_closure* request_reresolution);
/** Try to request a re-resolution. It's NOT a public API; it's only for use by
the LB policy implementations. */
-void grpc_lb_policy_try_reresolve(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* policy,
+void grpc_lb_policy_try_reresolve(grpc_lb_policy* policy,
grpc_core::TraceFlag* grpc_lb_trace,
grpc_error* error);
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
index 6d9fadaf30..3eedb08ecc 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
@@ -25,14 +25,12 @@
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/profiling/timers.h"
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
return GRPC_ERROR_NONE;
}
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
typedef struct {
// Stats object to update.
@@ -47,28 +45,24 @@ typedef struct {
bool recv_initial_metadata_succeeded;
} call_data;
-static void on_complete_for_send(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_complete_for_send(void* arg, grpc_error* error) {
call_data* calld = (call_data*)arg;
if (error == GRPC_ERROR_NONE) {
calld->send_initial_metadata_succeeded = true;
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_on_complete_for_send,
- GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_RUN(calld->original_on_complete_for_send, GRPC_ERROR_REF(error));
}
-static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
call_data* calld = (call_data*)arg;
if (error == GRPC_ERROR_NONE) {
calld->recv_initial_metadata_succeeded = true;
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_recv_initial_metadata_ready,
+ GRPC_CLOSURE_RUN(calld->original_recv_initial_metadata_ready,
GRPC_ERROR_REF(error));
}
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
// Get stats object from context and take a ref.
@@ -81,7 +75,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
call_data* calld = (call_data*)elem->call_data;
@@ -96,8 +90,7 @@ static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
}
static void start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* batch) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
call_data* calld = (call_data*)elem->call_data;
GPR_TIMER_BEGIN("clr_start_transport_stream_op_batch", 0);
// Intercept send_initial_metadata.
@@ -118,7 +111,7 @@ static void start_transport_stream_op_batch(
&calld->recv_initial_metadata_ready;
}
// Chain to next filter.
- grpc_call_next_op(exec_ctx, elem, batch);
+ grpc_call_next_op(elem, batch);
GPR_TIMER_END("clr_start_transport_stream_op_batch", 0);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
index db06fc20b6..eadeea0368 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
@@ -131,12 +131,12 @@ grpc_core::TraceFlag grpc_lb_glb_trace(false, "glb");
/* add lb_token of selected subchannel (address) to the call's initial
* metadata */
static grpc_error* initial_metadata_add_lb_token(
- grpc_exec_ctx* exec_ctx, grpc_metadata_batch* initial_metadata,
+ grpc_metadata_batch* initial_metadata,
grpc_linked_mdelem* lb_token_mdelem_storage, grpc_mdelem lb_token) {
GPR_ASSERT(lb_token_mdelem_storage != nullptr);
GPR_ASSERT(!GRPC_MDISNULL(lb_token));
- return grpc_metadata_batch_add_tail(exec_ctx, initial_metadata,
- lb_token_mdelem_storage, lb_token);
+ return grpc_metadata_batch_add_tail(initial_metadata, lb_token_mdelem_storage,
+ lb_token);
}
static void destroy_client_stats(void* arg) {
@@ -186,20 +186,19 @@ typedef struct wrapped_rr_closure_arg {
/* The \a on_complete closure passed as part of the pick requires keeping a
* reference to its associated round robin instance. We wrap this closure in
* order to unref the round robin instance upon its invocation */
-static void wrapped_rr_closure(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void wrapped_rr_closure(void* arg, grpc_error* error) {
wrapped_rr_closure_arg* wc_arg = (wrapped_rr_closure_arg*)arg;
GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
- GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
if (wc_arg->rr_policy != nullptr) {
- /* if *target is NULL, no pick has been made by the RR policy (eg, all
+ /* if *target is nullptr, no pick has been made by the RR policy (eg, all
* addresses failed to connect). There won't be any user_data/token
* available */
if (*wc_arg->target != nullptr) {
if (!GRPC_MDISNULL(wc_arg->lb_token)) {
- initial_metadata_add_lb_token(exec_ctx, wc_arg->initial_metadata,
+ initial_metadata_add_lb_token(wc_arg->initial_metadata,
wc_arg->lb_token_mdelem_storage,
GRPC_MDELEM_REF(wc_arg->lb_token));
} else {
@@ -221,7 +220,7 @@ static void wrapped_rr_closure(grpc_exec_ctx* exec_ctx, void* arg,
gpr_log(GPR_INFO, "[grpclb %p] Unreffing RR %p", wc_arg->glb_policy,
wc_arg->rr_policy);
}
- GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "wrapped_rr_closure");
+ GRPC_LB_POLICY_UNREF(wc_arg->rr_policy, "wrapped_rr_closure");
}
GPR_ASSERT(wc_arg->free_when_done != nullptr);
gpr_free(wc_arg->free_when_done);
@@ -241,8 +240,8 @@ typedef struct pending_pick {
/* original pick()'s arguments */
grpc_lb_policy_pick_args pick_args;
- /* output argument where to store the pick()ed connected subchannel, or NULL
- * upon error. */
+ /* output argument where to store the pick()ed connected subchannel, or
+ * nullptr upon error. */
grpc_connected_subchannel** target;
/* args for wrapped_on_complete */
@@ -328,8 +327,8 @@ typedef struct glb_lb_policy {
/** connectivity state of the LB channel */
grpc_connectivity_state lb_channel_connectivity;
- /** stores the deserialized response from the LB. May be NULL until one such
- * response has arrived. */
+ /** stores the deserialized response from the LB. May be nullptr until one
+ * such response has arrived. */
grpc_grpclb_serverlist* serverlist;
/** Index into serverlist for next pick.
@@ -459,9 +458,9 @@ static void* lb_token_copy(void* token) {
? nullptr
: (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload;
}
-static void lb_token_destroy(grpc_exec_ctx* exec_ctx, void* token) {
+static void lb_token_destroy(void* token) {
if (token != nullptr) {
- GRPC_MDELEM_UNREF(exec_ctx, grpc_mdelem{(uintptr_t)token});
+ GRPC_MDELEM_UNREF(grpc_mdelem{(uintptr_t)token});
}
}
static int lb_token_cmp(void* token1, void* token2) {
@@ -497,7 +496,7 @@ static void parse_server(const grpc_grpclb_server* server,
/* Returns addresses extracted from \a serverlist. */
static grpc_lb_addresses* process_serverlist_locked(
- grpc_exec_ctx* exec_ctx, const grpc_grpclb_serverlist* serverlist) {
+ const grpc_grpclb_serverlist* serverlist) {
size_t num_valid = 0;
/* first pass: count how many are valid in order to allocate the necessary
* memory in a single block */
@@ -528,9 +527,9 @@ static grpc_lb_addresses* process_serverlist_locked(
strnlen(server->load_balance_token, lb_token_max_length);
grpc_slice lb_token_mdstr = grpc_slice_from_copied_buffer(
server->load_balance_token, lb_token_length);
- user_data = (void*)grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_LB_TOKEN,
- lb_token_mdstr)
- .payload;
+ user_data =
+ (void*)grpc_mdelem_from_slices(GRPC_MDSTR_LB_TOKEN, lb_token_mdstr)
+ .payload;
} else {
char* uri = grpc_sockaddr_to_uri(&addr);
gpr_log(GPR_INFO,
@@ -552,7 +551,7 @@ static grpc_lb_addresses* process_serverlist_locked(
/* Returns the backend addresses extracted from the given addresses */
static grpc_lb_addresses* extract_backend_addresses_locked(
- grpc_exec_ctx* exec_ctx, const grpc_lb_addresses* addresses) {
+ const grpc_lb_addresses* addresses) {
/* first pass: count the number of backend addresses */
size_t num_backends = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
@@ -577,8 +576,8 @@ static grpc_lb_addresses* extract_backend_addresses_locked(
}
static void update_lb_connectivity_status_locked(
- grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
- grpc_connectivity_state rr_state, grpc_error* rr_state_error) {
+ glb_lb_policy* glb_policy, grpc_connectivity_state rr_state,
+ grpc_error* rr_state_error) {
const grpc_connectivity_state curr_glb_state =
grpc_connectivity_state_check(&glb_policy->state_tracker);
@@ -630,7 +629,7 @@ static void update_lb_connectivity_status_locked(
glb_policy, grpc_connectivity_state_name(rr_state),
glb_policy->rr_policy);
}
- grpc_connectivity_state_set(exec_ctx, &glb_policy->state_tracker, rr_state,
+ grpc_connectivity_state_set(&glb_policy->state_tracker, rr_state,
rr_state_error,
"update_lb_connectivity_status_locked");
}
@@ -641,9 +640,9 @@ static void update_lb_connectivity_status_locked(
* If \a force_async is true, then we will manually schedule the
* completion callback even if the pick is available immediately. */
static bool pick_from_internal_rr_locked(
- grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
- const grpc_lb_policy_pick_args* pick_args, bool force_async,
- grpc_connected_subchannel** target, wrapped_rr_closure_arg* wc_arg) {
+ glb_lb_policy* glb_policy, const grpc_lb_policy_pick_args* pick_args,
+ bool force_async, grpc_connected_subchannel** target,
+ wrapped_rr_closure_arg* wc_arg) {
// Check for drops if we are not using fallback backend addresses.
if (glb_policy->serverlist != nullptr) {
// Look at the index into the serverlist to see if we should drop this call.
@@ -658,7 +657,7 @@ static bool pick_from_internal_rr_locked(
gpr_log(GPR_INFO, "[grpclb %p] Unreffing RR %p for drop", glb_policy,
wc_arg->rr_policy);
}
- GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "glb_pick_sync");
+ GRPC_LB_POLICY_UNREF(wc_arg->rr_policy, "glb_pick_sync");
// Update client load reporting stats to indicate the number of
// dropped calls. Note that we have to do this here instead of in
// the client_load_reporting filter, because we do not create a
@@ -670,7 +669,7 @@ static bool pick_from_internal_rr_locked(
grpc_grpclb_client_stats_unref(wc_arg->client_stats);
if (force_async) {
GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
- GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(wc_arg->wrapped_closure, GRPC_ERROR_NONE);
gpr_free(wc_arg->free_when_done);
return false;
}
@@ -680,7 +679,7 @@ static bool pick_from_internal_rr_locked(
}
// Pick via the RR policy.
const bool pick_done = grpc_lb_policy_pick_locked(
- exec_ctx, wc_arg->rr_policy, pick_args, target, wc_arg->context,
+ wc_arg->rr_policy, pick_args, target, wc_arg->context,
(void**)&wc_arg->lb_token, &wc_arg->wrapper_closure);
if (pick_done) {
/* synchronous grpc_lb_policy_pick call. Unref the RR policy. */
@@ -688,9 +687,9 @@ static bool pick_from_internal_rr_locked(
gpr_log(GPR_INFO, "[grpclb %p] Unreffing RR %p", glb_policy,
wc_arg->rr_policy);
}
- GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "glb_pick_sync");
+ GRPC_LB_POLICY_UNREF(wc_arg->rr_policy, "glb_pick_sync");
/* add the load reporting initial metadata */
- initial_metadata_add_lb_token(exec_ctx, pick_args->initial_metadata,
+ initial_metadata_add_lb_token(pick_args->initial_metadata,
pick_args->lb_token_mdelem_storage,
GRPC_MDELEM_REF(wc_arg->lb_token));
// Pass on client stats via context. Passes ownership of the reference.
@@ -699,7 +698,7 @@ static bool pick_from_internal_rr_locked(
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].destroy = destroy_client_stats;
if (force_async) {
GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
- GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(wc_arg->wrapped_closure, GRPC_ERROR_NONE);
gpr_free(wc_arg->free_when_done);
return false;
}
@@ -712,12 +711,11 @@ static bool pick_from_internal_rr_locked(
return pick_done;
}
-static grpc_lb_policy_args* lb_policy_args_create(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static grpc_lb_policy_args* lb_policy_args_create(glb_lb_policy* glb_policy) {
grpc_lb_addresses* addresses;
if (glb_policy->serverlist != nullptr) {
GPR_ASSERT(glb_policy->serverlist->num_servers > 0);
- addresses = process_serverlist_locked(exec_ctx, glb_policy->serverlist);
+ addresses = process_serverlist_locked(glb_policy->serverlist);
} else {
// If rr_handover_locked() is invoked when we haven't received any
// serverlist from the balancer, we use the fallback backends returned by
@@ -737,24 +735,21 @@ static grpc_lb_policy_args* lb_policy_args_create(grpc_exec_ctx* exec_ctx,
args->args = grpc_channel_args_copy_and_add_and_remove(
glb_policy->args, keys_to_remove, GPR_ARRAY_SIZE(keys_to_remove), &arg,
1);
- grpc_lb_addresses_destroy(exec_ctx, addresses);
+ grpc_lb_addresses_destroy(addresses);
return args;
}
-static void lb_policy_args_destroy(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy_args* args) {
- grpc_channel_args_destroy(exec_ctx, args->args);
+static void lb_policy_args_destroy(grpc_lb_policy_args* args) {
+ grpc_channel_args_destroy(args->args);
gpr_free(args);
}
-static void glb_rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error);
-static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
+static void glb_rr_connectivity_changed_locked(void* arg, grpc_error* error);
+static void create_rr_locked(glb_lb_policy* glb_policy,
grpc_lb_policy_args* args) {
GPR_ASSERT(glb_policy->rr_policy == nullptr);
- grpc_lb_policy* new_rr_policy =
- grpc_lb_policy_create(exec_ctx, "round_robin", args);
+ grpc_lb_policy* new_rr_policy = grpc_lb_policy_create("round_robin", args);
if (new_rr_policy == nullptr) {
gpr_log(GPR_ERROR,
"[grpclb %p] Failure creating a RoundRobin policy for serverlist "
@@ -767,21 +762,19 @@ static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
return;
}
grpc_lb_policy_set_reresolve_closure_locked(
- exec_ctx, new_rr_policy, glb_policy->base.request_reresolution);
+ new_rr_policy, glb_policy->base.request_reresolution);
glb_policy->base.request_reresolution = nullptr;
glb_policy->rr_policy = new_rr_policy;
grpc_error* rr_state_error = nullptr;
const grpc_connectivity_state rr_state =
- grpc_lb_policy_check_connectivity_locked(exec_ctx, glb_policy->rr_policy,
+ grpc_lb_policy_check_connectivity_locked(glb_policy->rr_policy,
&rr_state_error);
/* Connectivity state is a function of the RR policy updated/created */
- update_lb_connectivity_status_locked(exec_ctx, glb_policy, rr_state,
- rr_state_error);
+ update_lb_connectivity_status_locked(glb_policy, rr_state, rr_state_error);
/* Add the gRPC LB's interested_parties pollset_set to that of the newly
* created RR policy. This will make the RR policy progress upon activity on
* gRPC LB, which in turn is tied to the application's call */
- grpc_pollset_set_add_pollset_set(exec_ctx,
- glb_policy->rr_policy->interested_parties,
+ grpc_pollset_set_add_pollset_set(glb_policy->rr_policy->interested_parties,
glb_policy->base.interested_parties);
/* Allocate the data for the tracking of the new RR policy's connectivity.
@@ -796,10 +789,10 @@ static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
/* Subscribe to changes to the connectivity of the new RR */
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "glb_rr_connectivity_cb");
- grpc_lb_policy_notify_on_state_change_locked(exec_ctx, glb_policy->rr_policy,
+ grpc_lb_policy_notify_on_state_change_locked(glb_policy->rr_policy,
&rr_connectivity->state,
&rr_connectivity->on_change);
- grpc_lb_policy_exit_idle_locked(exec_ctx, glb_policy->rr_policy);
+ grpc_lb_policy_exit_idle_locked(glb_policy->rr_policy);
/* Update picks and pings in wait */
pending_pick* pp;
@@ -814,7 +807,7 @@ static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
"[grpclb %p] Pending pick about to (async) PICK from RR %p",
glb_policy, glb_policy->rr_policy);
}
- pick_from_internal_rr_locked(exec_ctx, glb_policy, &pp->pick_args,
+ pick_from_internal_rr_locked(glb_policy, &pp->pick_args,
true /* force_async */, pp->target,
&pp->wrapped_on_complete_arg);
}
@@ -828,40 +821,37 @@ static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
gpr_log(GPR_INFO, "[grpclb %p] Pending ping about to PING from RR %p",
glb_policy, glb_policy->rr_policy);
}
- grpc_lb_policy_ping_one_locked(exec_ctx, glb_policy->rr_policy,
+ grpc_lb_policy_ping_one_locked(glb_policy->rr_policy,
&pping->wrapped_notify_arg.wrapper_closure);
}
}
-/* glb_policy->rr_policy may be NULL (initial handover) */
-static void rr_handover_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+/* glb_policy->rr_policy may be nullptr (initial handover) */
+static void rr_handover_locked(glb_lb_policy* glb_policy) {
if (glb_policy->shutting_down) return;
- grpc_lb_policy_args* args = lb_policy_args_create(exec_ctx, glb_policy);
+ grpc_lb_policy_args* args = lb_policy_args_create(glb_policy);
GPR_ASSERT(args != nullptr);
if (glb_policy->rr_policy != nullptr) {
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_DEBUG, "[grpclb %p] Updating RR policy %p", glb_policy,
glb_policy->rr_policy);
}
- grpc_lb_policy_update_locked(exec_ctx, glb_policy->rr_policy, args);
+ grpc_lb_policy_update_locked(glb_policy->rr_policy, args);
} else {
- create_rr_locked(exec_ctx, glb_policy, args);
+ create_rr_locked(glb_policy, args);
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_DEBUG, "[grpclb %p] Created new RR policy %p", glb_policy,
glb_policy->rr_policy);
}
}
- lb_policy_args_destroy(exec_ctx, args);
+ lb_policy_args_destroy(args);
}
-static void glb_rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void glb_rr_connectivity_changed_locked(void* arg, grpc_error* error) {
rr_connectivity_data* rr_connectivity = (rr_connectivity_data*)arg;
glb_lb_policy* glb_policy = rr_connectivity->glb_policy;
if (glb_policy->shutting_down) {
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
- "glb_rr_connectivity_cb");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "glb_rr_connectivity_cb");
gpr_free(rr_connectivity);
return;
}
@@ -869,25 +859,22 @@ static void glb_rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx,
/* An RR policy that has transitioned into the SHUTDOWN connectivity state
* should not be considered for picks or updates: the SHUTDOWN state is a
* sink, policies can't transition back from it. .*/
- GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy,
- "rr_connectivity_shutdown");
+ GRPC_LB_POLICY_UNREF(glb_policy->rr_policy, "rr_connectivity_shutdown");
glb_policy->rr_policy = nullptr;
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
- "glb_rr_connectivity_cb");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "glb_rr_connectivity_cb");
gpr_free(rr_connectivity);
return;
}
/* rr state != SHUTDOWN && !glb_policy->shutting down: biz as usual */
- update_lb_connectivity_status_locked(
- exec_ctx, glb_policy, rr_connectivity->state, GRPC_ERROR_REF(error));
+ update_lb_connectivity_status_locked(glb_policy, rr_connectivity->state,
+ GRPC_ERROR_REF(error));
/* Resubscribe. Reuse the "glb_rr_connectivity_cb" weak ref. */
- grpc_lb_policy_notify_on_state_change_locked(exec_ctx, glb_policy->rr_policy,
+ grpc_lb_policy_notify_on_state_change_locked(glb_policy->rr_policy,
&rr_connectivity->state,
&rr_connectivity->on_change);
}
-static void destroy_balancer_name(grpc_exec_ctx* exec_ctx,
- void* balancer_name) {
+static void destroy_balancer_name(void* balancer_name) {
gpr_free(balancer_name);
}
@@ -914,7 +901,7 @@ static int balancer_name_cmp_fn(void* a, void* b) {
* above the grpclb policy.
* - \a args: other args inherited from the grpclb policy. */
static grpc_channel_args* build_lb_channel_args(
- grpc_exec_ctx* exec_ctx, const grpc_lb_addresses* addresses,
+ const grpc_lb_addresses* addresses,
grpc_fake_resolver_response_generator* response_generator,
const grpc_channel_args* args) {
size_t num_grpclb_addrs = 0;
@@ -957,7 +944,7 @@ static grpc_channel_args* build_lb_channel_args(
gpr_free(targets_info_entries);
grpc_channel_args* lb_channel_args =
- grpc_lb_policy_grpclb_build_lb_channel_args(exec_ctx, targets_info,
+ grpc_lb_policy_grpclb_build_lb_channel_args(targets_info,
response_generator, args);
grpc_arg lb_channel_addresses_arg =
@@ -965,34 +952,34 @@ static grpc_channel_args* build_lb_channel_args(
grpc_channel_args* result = grpc_channel_args_copy_and_add(
lb_channel_args, &lb_channel_addresses_arg, 1);
- grpc_slice_hash_table_unref(exec_ctx, targets_info);
- grpc_channel_args_destroy(exec_ctx, lb_channel_args);
- grpc_lb_addresses_destroy(exec_ctx, lb_addresses);
+ grpc_slice_hash_table_unref(targets_info);
+ grpc_channel_args_destroy(lb_channel_args);
+ grpc_lb_addresses_destroy(lb_addresses);
return result;
}
-static void glb_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void glb_destroy(grpc_lb_policy* pol) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
GPR_ASSERT(glb_policy->pending_picks == nullptr);
GPR_ASSERT(glb_policy->pending_pings == nullptr);
gpr_free((void*)glb_policy->server_name);
- grpc_channel_args_destroy(exec_ctx, glb_policy->args);
+ grpc_channel_args_destroy(glb_policy->args);
if (glb_policy->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(glb_policy->client_stats);
}
- grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker);
+ grpc_connectivity_state_destroy(&glb_policy->state_tracker);
if (glb_policy->serverlist != nullptr) {
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
}
if (glb_policy->fallback_backend_addresses != nullptr) {
- grpc_lb_addresses_destroy(exec_ctx, glb_policy->fallback_backend_addresses);
+ grpc_lb_addresses_destroy(glb_policy->fallback_backend_addresses);
}
grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
grpc_subchannel_index_unref();
gpr_free(glb_policy);
}
-static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void glb_shutdown_locked(grpc_lb_policy* pol) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel shutdown");
glb_policy->shutting_down = true;
@@ -1011,11 +998,11 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
/* lb_on_server_status_received will pick up the cancel and clean up */
}
if (glb_policy->retry_timer_active) {
- grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
+ grpc_timer_cancel(&glb_policy->lb_call_retry_timer);
glb_policy->retry_timer_active = false;
}
if (glb_policy->fallback_timer_active) {
- grpc_timer_cancel(exec_ctx, &glb_policy->lb_fallback_timer);
+ grpc_timer_cancel(&glb_policy->lb_fallback_timer);
glb_policy->fallback_timer_active = false;
}
@@ -1024,10 +1011,9 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
pending_ping* pping = glb_policy->pending_pings;
glb_policy->pending_pings = nullptr;
if (glb_policy->rr_policy != nullptr) {
- GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "glb_shutdown");
+ GRPC_LB_POLICY_UNREF(glb_policy->rr_policy, "glb_shutdown");
} else {
- grpc_lb_policy_try_reresolve(exec_ctx, pol, &grpc_lb_glb_trace,
- GRPC_ERROR_CANCELLED);
+ grpc_lb_policy_try_reresolve(pol, &grpc_lb_glb_trace, GRPC_ERROR_CANCELLED);
}
// We destroy the LB channel here because
// glb_lb_channel_on_connectivity_changed_cb needs a valid glb_policy
@@ -1037,14 +1023,13 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
grpc_channel_destroy(glb_policy->lb_channel);
glb_policy->lb_channel = nullptr;
}
- grpc_connectivity_state_set(exec_ctx, &glb_policy->state_tracker,
- GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
- "glb_shutdown");
+ grpc_connectivity_state_set(&glb_policy->state_tracker, GRPC_CHANNEL_SHUTDOWN,
+ GRPC_ERROR_REF(error), "glb_shutdown");
while (pp != nullptr) {
pending_pick* next = pp->next;
*pp->target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
+ GRPC_CLOSURE_SCHED(&pp->wrapped_on_complete_arg.wrapper_closure,
GRPC_ERROR_REF(error));
gpr_free(pp);
pp = next;
@@ -1052,7 +1037,7 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
while (pping != nullptr) {
pending_ping* next = pping->next;
- GRPC_CLOSURE_SCHED(exec_ctx, &pping->wrapped_notify_arg.wrapper_closure,
+ GRPC_CLOSURE_SCHED(&pping->wrapped_notify_arg.wrapper_closure,
GRPC_ERROR_REF(error));
gpr_free(pping);
pping = next;
@@ -1069,8 +1054,8 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
// pick needs also be cancelled by the RR instance.
// - Otherwise, without an RR instance, picks stay pending at this policy's
// level (grpclb), inside the glb_policy->pending_picks list. To cancel these,
-// we invoke the completion closure and set *target to NULL right here.
-static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+// we invoke the completion closure and set *target to nullptr right here.
+static void glb_cancel_pick_locked(grpc_lb_policy* pol,
grpc_connected_subchannel** target,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
@@ -1080,7 +1065,7 @@ static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
pending_pick* next = pp->next;
if (pp->target == target) {
*target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
+ GRPC_CLOSURE_SCHED(&pp->wrapped_on_complete_arg.wrapper_closure,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
} else {
@@ -1090,7 +1075,7 @@ static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
pp = next;
}
if (glb_policy->rr_policy != nullptr) {
- grpc_lb_policy_cancel_pick_locked(exec_ctx, glb_policy->rr_policy, target,
+ grpc_lb_policy_cancel_pick_locked(glb_policy->rr_policy, target,
GRPC_ERROR_REF(error));
}
GRPC_ERROR_UNREF(error);
@@ -1105,9 +1090,8 @@ static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
// pick needs also be cancelled by the RR instance.
// - Otherwise, without an RR instance, picks stay pending at this policy's
// level (grpclb), inside the glb_policy->pending_picks list. To cancel these,
-// we invoke the completion closure and set *target to NULL right here.
-static void glb_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* pol,
+// we invoke the completion closure and set *target to nullptr right here.
+static void glb_cancel_picks_locked(grpc_lb_policy* pol,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error) {
@@ -1118,7 +1102,7 @@ static void glb_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
pending_pick* next = pp->next;
if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
- GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
+ GRPC_CLOSURE_SCHED(&pp->wrapped_on_complete_arg.wrapper_closure,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
} else {
@@ -1129,52 +1113,49 @@ static void glb_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
}
if (glb_policy->rr_policy != nullptr) {
grpc_lb_policy_cancel_picks_locked(
- exec_ctx, glb_policy->rr_policy, initial_metadata_flags_mask,
+ glb_policy->rr_policy, initial_metadata_flags_mask,
initial_metadata_flags_eq, GRPC_ERROR_REF(error));
}
GRPC_ERROR_UNREF(error);
}
-static void lb_on_fallback_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy);
-static void start_picking_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void lb_on_fallback_timer_locked(void* arg, grpc_error* error);
+static void query_for_backends_locked(glb_lb_policy* glb_policy);
+static void start_picking_locked(glb_lb_policy* glb_policy) {
/* start a timer to fall back */
if (glb_policy->lb_fallback_timeout_ms > 0 &&
glb_policy->serverlist == nullptr && !glb_policy->fallback_timer_active) {
grpc_millis deadline =
- grpc_exec_ctx_now(exec_ctx) + glb_policy->lb_fallback_timeout_ms;
+ grpc_core::ExecCtx::Get()->Now() + glb_policy->lb_fallback_timeout_ms;
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_fallback_timer");
GRPC_CLOSURE_INIT(&glb_policy->lb_on_fallback, lb_on_fallback_timer_locked,
glb_policy,
grpc_combiner_scheduler(glb_policy->base.combiner));
glb_policy->fallback_timer_active = true;
- grpc_timer_init(exec_ctx, &glb_policy->lb_fallback_timer, deadline,
+ grpc_timer_init(&glb_policy->lb_fallback_timer, deadline,
&glb_policy->lb_on_fallback);
}
glb_policy->started_picking = true;
grpc_backoff_reset(&glb_policy->lb_call_backoff_state);
- query_for_backends_locked(exec_ctx, glb_policy);
+ query_for_backends_locked(glb_policy);
}
-static void glb_exit_idle_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void glb_exit_idle_locked(grpc_lb_policy* pol) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
if (!glb_policy->started_picking) {
- start_picking_locked(exec_ctx, glb_policy);
+ start_picking_locked(glb_policy);
}
}
-static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static int glb_pick_locked(grpc_lb_policy* pol,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
grpc_closure* on_complete) {
if (pick_args->lb_token_mdelem_storage == nullptr) {
*target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, on_complete,
+ GRPC_CLOSURE_SCHED(on_complete,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No mdelem storage for the LB token. Load reporting "
"won't work without it. Failing"));
@@ -1184,8 +1165,8 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
bool pick_done = false;
if (glb_policy->rr_policy != nullptr) {
const grpc_connectivity_state rr_connectivity_state =
- grpc_lb_policy_check_connectivity_locked(
- exec_ctx, glb_policy->rr_policy, nullptr);
+ grpc_lb_policy_check_connectivity_locked(glb_policy->rr_policy,
+ nullptr);
// The glb_policy->rr_policy may have transitioned to SHUTDOWN but the
// callback registered to capture this event
// (glb_rr_connectivity_changed_locked) may not have been invoked yet. We
@@ -1222,9 +1203,8 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
wc_arg->initial_metadata = pick_args->initial_metadata;
wc_arg->free_when_done = wc_arg;
wc_arg->glb_policy = pol;
- pick_done =
- pick_from_internal_rr_locked(exec_ctx, glb_policy, pick_args,
- false /* force_async */, target, wc_arg);
+ pick_done = pick_from_internal_rr_locked(
+ glb_policy, pick_args, false /* force_async */, target, wc_arg);
}
} else { // glb_policy->rr_policy == NULL
if (grpc_lb_glb_trace.enabled()) {
@@ -1235,7 +1215,7 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
add_pending_pick(&glb_policy->pending_picks, pick_args, target, context,
on_complete);
if (!glb_policy->started_picking) {
- start_picking_locked(exec_ctx, glb_policy);
+ start_picking_locked(glb_policy);
}
pick_done = false;
}
@@ -1243,37 +1223,33 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
}
static grpc_connectivity_state glb_check_connectivity_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
- grpc_error** connectivity_error) {
+ grpc_lb_policy* pol, grpc_error** connectivity_error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
return grpc_connectivity_state_get(&glb_policy->state_tracker,
connectivity_error);
}
-static void glb_ping_one_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
- grpc_closure* closure) {
+static void glb_ping_one_locked(grpc_lb_policy* pol, grpc_closure* closure) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
if (glb_policy->rr_policy) {
- grpc_lb_policy_ping_one_locked(exec_ctx, glb_policy->rr_policy, closure);
+ grpc_lb_policy_ping_one_locked(glb_policy->rr_policy, closure);
} else {
add_pending_ping(&glb_policy->pending_pings, closure);
if (!glb_policy->started_picking) {
- start_picking_locked(exec_ctx, glb_policy);
+ start_picking_locked(glb_policy);
}
}
}
-static void glb_notify_on_state_change_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* pol,
+static void glb_notify_on_state_change_locked(grpc_lb_policy* pol,
grpc_connectivity_state* current,
grpc_closure* notify) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
- grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &glb_policy->state_tracker, current, notify);
+ grpc_connectivity_state_notify_on_state_change(&glb_policy->state_tracker,
+ current, notify);
}
-static void lb_call_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void lb_call_on_retry_timer_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
glb_policy->retry_timer_active = false;
if (!glb_policy->shutting_down && glb_policy->lb_call == nullptr &&
@@ -1281,28 +1257,26 @@ static void lb_call_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_INFO, "[grpclb %p] Restarting call to LB server", glb_policy);
}
- query_for_backends_locked(exec_ctx, glb_policy);
+ query_for_backends_locked(glb_policy);
}
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base, "grpclb_retry_timer");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "grpclb_retry_timer");
}
-static void maybe_restart_lb_call(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void maybe_restart_lb_call(glb_lb_policy* glb_policy) {
if (glb_policy->started_picking && glb_policy->updating_lb_call) {
if (glb_policy->retry_timer_active) {
- grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
+ grpc_timer_cancel(&glb_policy->lb_call_retry_timer);
}
- if (!glb_policy->shutting_down) start_picking_locked(exec_ctx, glb_policy);
+ if (!glb_policy->shutting_down) start_picking_locked(glb_policy);
glb_policy->updating_lb_call = false;
} else if (!glb_policy->shutting_down) {
/* if we aren't shutting down, restart the LB client call after some time */
- grpc_millis next_try =
- grpc_backoff_step(exec_ctx, &glb_policy->lb_call_backoff_state)
- .next_attempt_start_time;
+ grpc_millis next_try = grpc_backoff_step(&glb_policy->lb_call_backoff_state)
+ .next_attempt_start_time;
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_DEBUG, "[grpclb %p] Connection to LB server lost...",
glb_policy);
- grpc_millis timeout = next_try - grpc_exec_ctx_now(exec_ctx);
+ grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
if (timeout > 0) {
gpr_log(GPR_DEBUG,
"[grpclb %p] ... retry_timer_active in %" PRIuPTR "ms.",
@@ -1317,43 +1291,40 @@ static void maybe_restart_lb_call(grpc_exec_ctx* exec_ctx,
lb_call_on_retry_timer_locked, glb_policy,
grpc_combiner_scheduler(glb_policy->base.combiner));
glb_policy->retry_timer_active = true;
- grpc_timer_init(exec_ctx, &glb_policy->lb_call_retry_timer, next_try,
+ grpc_timer_init(&glb_policy->lb_call_retry_timer, next_try,
&glb_policy->lb_on_call_retry);
}
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base,
"lb_on_server_status_received_locked");
}
-static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
+static void send_client_load_report_locked(void* arg, grpc_error* error);
-static void schedule_next_client_load_report(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void schedule_next_client_load_report(glb_lb_policy* glb_policy) {
const grpc_millis next_client_load_report_time =
- grpc_exec_ctx_now(exec_ctx) + glb_policy->client_stats_report_interval;
+ grpc_core::ExecCtx::Get()->Now() +
+ glb_policy->client_stats_report_interval;
GRPC_CLOSURE_INIT(&glb_policy->client_load_report_closure,
send_client_load_report_locked, glb_policy,
grpc_combiner_scheduler(glb_policy->base.combiner));
- grpc_timer_init(exec_ctx, &glb_policy->client_load_report_timer,
+ grpc_timer_init(&glb_policy->client_load_report_timer,
next_client_load_report_time,
&glb_policy->client_load_report_closure);
}
-static void client_load_report_done_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void client_load_report_done_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
grpc_byte_buffer_destroy(glb_policy->client_load_report_payload);
glb_policy->client_load_report_payload = nullptr;
if (error != GRPC_ERROR_NONE || glb_policy->lb_call == nullptr) {
glb_policy->client_load_report_timer_pending = false;
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
- "client_load_report");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "client_load_report");
if (glb_policy->lb_call == nullptr) {
- maybe_restart_lb_call(exec_ctx, glb_policy);
+ maybe_restart_lb_call(glb_policy);
}
return;
}
- schedule_next_client_load_report(exec_ctx, glb_policy);
+ schedule_next_client_load_report(glb_policy);
}
static bool load_report_counters_are_zero(grpc_grpclb_request* request) {
@@ -1368,15 +1339,13 @@ static bool load_report_counters_are_zero(grpc_grpclb_request* request) {
(drop_entries == nullptr || drop_entries->num_entries == 0);
}
-static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void send_client_load_report_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
if (error == GRPC_ERROR_CANCELLED || glb_policy->lb_call == nullptr) {
glb_policy->client_load_report_timer_pending = false;
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
- "client_load_report");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "client_load_report");
if (glb_policy->lb_call == nullptr) {
- maybe_restart_lb_call(exec_ctx, glb_policy);
+ maybe_restart_lb_call(glb_policy);
}
return;
}
@@ -1389,7 +1358,7 @@ static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (load_report_counters_are_zero(request)) {
if (glb_policy->last_client_load_report_counters_were_zero) {
grpc_grpclb_request_destroy(request);
- schedule_next_client_load_report(exec_ctx, glb_policy);
+ schedule_next_client_load_report(glb_policy);
return;
}
glb_policy->last_client_load_report_counters_were_zero = true;
@@ -1399,7 +1368,7 @@ static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
glb_policy->client_load_report_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
- grpc_slice_unref_internal(exec_ctx, request_payload_slice);
+ grpc_slice_unref_internal(request_payload_slice);
grpc_grpclb_request_destroy(request);
// Send load report message.
grpc_op op;
@@ -1410,20 +1379,16 @@ static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
client_load_report_done_locked, glb_policy,
grpc_combiner_scheduler(glb_policy->base.combiner));
grpc_call_error call_error = grpc_call_start_batch_and_execute(
- exec_ctx, glb_policy->lb_call, &op, 1,
- &glb_policy->client_load_report_closure);
+ glb_policy->lb_call, &op, 1, &glb_policy->client_load_report_closure);
if (call_error != GRPC_CALL_OK) {
gpr_log(GPR_ERROR, "[grpclb %p] call_error=%d", glb_policy, call_error);
GPR_ASSERT(GRPC_CALL_OK == call_error);
}
}
-static void lb_on_server_status_received_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error);
-static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void lb_on_server_status_received_locked(void* arg, grpc_error* error);
+static void lb_on_response_received_locked(void* arg, grpc_error* error);
+static void lb_call_init_locked(glb_lb_policy* glb_policy) {
GPR_ASSERT(glb_policy->server_name != nullptr);
GPR_ASSERT(glb_policy->server_name[0] != '\0');
GPR_ASSERT(glb_policy->lb_call == nullptr);
@@ -1436,13 +1401,13 @@ static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
grpc_millis deadline =
glb_policy->lb_call_timeout_ms == 0
? GRPC_MILLIS_INF_FUTURE
- : grpc_exec_ctx_now(exec_ctx) + glb_policy->lb_call_timeout_ms;
+ : grpc_core::ExecCtx::Get()->Now() + glb_policy->lb_call_timeout_ms;
glb_policy->lb_call = grpc_channel_create_pollset_set_call(
- exec_ctx, glb_policy->lb_channel, nullptr, GRPC_PROPAGATE_DEFAULTS,
+ glb_policy->lb_channel, nullptr, GRPC_PROPAGATE_DEFAULTS,
glb_policy->base.interested_parties,
GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD,
&host, deadline, nullptr);
- grpc_slice_unref_internal(exec_ctx, host);
+ grpc_slice_unref_internal(host);
if (glb_policy->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(glb_policy->client_stats);
@@ -1457,7 +1422,7 @@ static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
glb_policy->lb_request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
- grpc_slice_unref_internal(exec_ctx, request_payload_slice);
+ grpc_slice_unref_internal(request_payload_slice);
grpc_grpclb_request_destroy(request);
GRPC_CLOSURE_INIT(&glb_policy->lb_on_server_status_received,
@@ -1478,8 +1443,7 @@ static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
glb_policy->last_client_load_report_counters_were_zero = false;
}
-static void lb_call_destroy_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void lb_call_destroy_locked(glb_lb_policy* glb_policy) {
GPR_ASSERT(glb_policy->lb_call != nullptr);
grpc_call_unref(glb_policy->lb_call);
glb_policy->lb_call = nullptr;
@@ -1488,22 +1452,21 @@ static void lb_call_destroy_locked(grpc_exec_ctx* exec_ctx,
grpc_metadata_array_destroy(&glb_policy->lb_trailing_metadata_recv);
grpc_byte_buffer_destroy(glb_policy->lb_request_payload);
- grpc_slice_unref_internal(exec_ctx, glb_policy->lb_call_status_details);
+ grpc_slice_unref_internal(glb_policy->lb_call_status_details);
if (glb_policy->client_load_report_timer_pending) {
- grpc_timer_cancel(exec_ctx, &glb_policy->client_load_report_timer);
+ grpc_timer_cancel(&glb_policy->client_load_report_timer);
}
}
/*
* Auxiliary functions and LB client callbacks.
*/
-static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy) {
+static void query_for_backends_locked(glb_lb_policy* glb_policy) {
GPR_ASSERT(glb_policy->lb_channel != nullptr);
if (glb_policy->shutting_down) return;
- lb_call_init_locked(exec_ctx, glb_policy);
+ lb_call_init_locked(glb_policy);
if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_INFO,
@@ -1534,8 +1497,8 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
op->flags = 0;
op->reserved = nullptr;
op++;
- call_error = grpc_call_start_batch_and_execute(
- exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops), nullptr);
+ call_error = grpc_call_start_batch_and_execute(glb_policy->lb_call, ops,
+ (size_t)(op - ops), nullptr);
GPR_ASSERT(GRPC_CALL_OK == call_error);
op = ops;
@@ -1553,7 +1516,7 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base,
"lb_on_server_status_received_locked");
call_error = grpc_call_start_batch_and_execute(
- exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
+ glb_policy->lb_call, ops, (size_t)(op - ops),
&glb_policy->lb_on_server_status_received);
GPR_ASSERT(GRPC_CALL_OK == call_error);
@@ -1567,13 +1530,12 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
* lb_on_response_received_locked */
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "lb_on_response_received_locked");
call_error = grpc_call_start_batch_and_execute(
- exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
+ glb_policy->lb_call, ops, (size_t)(op - ops),
&glb_policy->lb_on_response_received);
GPR_ASSERT(GRPC_CALL_OK == call_error);
}
-static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void lb_on_response_received_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
grpc_op ops[2];
memset(ops, 0, sizeof(ops));
@@ -1607,7 +1569,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
* send_client_load_report_locked() */
glb_policy->client_load_report_timer_pending = true;
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "client_load_report");
- schedule_next_client_load_report(exec_ctx, glb_policy);
+ schedule_next_client_load_report(glb_policy);
} else if (grpc_lb_glb_trace.enabled()) {
gpr_log(GPR_INFO,
"[grpclb %p] Received initial LB response message; client load "
@@ -1652,11 +1614,10 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
} else {
/* or dispose of the fallback */
- grpc_lb_addresses_destroy(exec_ctx,
- glb_policy->fallback_backend_addresses);
+ grpc_lb_addresses_destroy(glb_policy->fallback_backend_addresses);
glb_policy->fallback_backend_addresses = nullptr;
if (glb_policy->fallback_timer_active) {
- grpc_timer_cancel(exec_ctx, &glb_policy->lb_fallback_timer);
+ grpc_timer_cancel(&glb_policy->lb_fallback_timer);
glb_policy->fallback_timer_active = false;
}
}
@@ -1665,7 +1626,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
* update or in glb_destroy() */
glb_policy->serverlist = serverlist;
glb_policy->serverlist_index = 0;
- rr_handover_locked(exec_ctx, glb_policy);
+ rr_handover_locked(glb_policy);
}
} else {
if (grpc_lb_glb_trace.enabled()) {
@@ -1675,14 +1636,14 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
grpc_grpclb_destroy_serverlist(serverlist);
}
- } else { /* serverlist == NULL */
+ } else { /* serverlist == nullptr */
gpr_log(GPR_ERROR,
"[grpclb %p] Invalid LB response received: '%s'. Ignoring.",
glb_policy,
grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
}
}
- grpc_slice_unref_internal(exec_ctx, response_slice);
+ grpc_slice_unref_internal(response_slice);
if (!glb_policy->shutting_down) {
/* keep listening for serverlist updates */
op->op = GRPC_OP_RECV_MESSAGE;
@@ -1693,23 +1654,22 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
/* reuse the "lb_on_response_received_locked" weak ref taken in
* query_for_backends_locked() */
const grpc_call_error call_error = grpc_call_start_batch_and_execute(
- exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops),
+ glb_policy->lb_call, ops, (size_t)(op - ops),
&glb_policy->lb_on_response_received); /* loop */
GPR_ASSERT(GRPC_CALL_OK == call_error);
} else {
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base,
"lb_on_response_received_locked_shutdown");
}
} else { /* empty payload: call cancelled. */
/* dispose of the "lb_on_response_received_locked" weak ref taken in
* query_for_backends_locked() and reused in every reception loop */
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base,
"lb_on_response_received_locked_empty_payload");
}
}
-static void lb_on_fallback_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void lb_on_fallback_timer_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
glb_policy->fallback_timer_active = false;
/* If we receive a serverlist after the timer fires but before this callback
@@ -1722,15 +1682,13 @@ static void lb_on_fallback_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
glb_policy);
}
GPR_ASSERT(glb_policy->fallback_backend_addresses != nullptr);
- rr_handover_locked(exec_ctx, glb_policy);
+ rr_handover_locked(glb_policy);
}
}
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
- "grpclb_fallback_timer");
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base, "grpclb_fallback_timer");
}
-static void lb_on_server_status_received_locked(grpc_exec_ctx* exec_ctx,
- void* arg, grpc_error* error) {
+static void lb_on_server_status_received_locked(void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
GPR_ASSERT(glb_policy->lb_call != nullptr);
if (grpc_lb_glb_trace.enabled()) {
@@ -1744,29 +1702,28 @@ static void lb_on_server_status_received_locked(grpc_exec_ctx* exec_ctx,
gpr_free(status_details);
}
/* We need to perform cleanups no matter what. */
- lb_call_destroy_locked(exec_ctx, glb_policy);
+ lb_call_destroy_locked(glb_policy);
// If the load report timer is still pending, we wait for it to be
// called before restarting the call. Otherwise, we restart the call
// here.
if (!glb_policy->client_load_report_timer_pending) {
- maybe_restart_lb_call(exec_ctx, glb_policy);
+ maybe_restart_lb_call(glb_policy);
}
}
-static void fallback_update_locked(grpc_exec_ctx* exec_ctx,
- glb_lb_policy* glb_policy,
+static void fallback_update_locked(glb_lb_policy* glb_policy,
const grpc_lb_addresses* addresses) {
GPR_ASSERT(glb_policy->fallback_backend_addresses != nullptr);
- grpc_lb_addresses_destroy(exec_ctx, glb_policy->fallback_backend_addresses);
+ grpc_lb_addresses_destroy(glb_policy->fallback_backend_addresses);
glb_policy->fallback_backend_addresses =
- extract_backend_addresses_locked(exec_ctx, addresses);
+ extract_backend_addresses_locked(addresses);
if (glb_policy->lb_fallback_timeout_ms > 0 &&
glb_policy->rr_policy != nullptr) {
- rr_handover_locked(exec_ctx, glb_policy);
+ rr_handover_locked(glb_policy);
}
}
-static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+static void glb_update_locked(grpc_lb_policy* policy,
const grpc_lb_policy_args* args) {
glb_lb_policy* glb_policy = (glb_lb_policy*)policy;
const grpc_arg* arg =
@@ -1776,7 +1733,7 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// If we don't have a current channel to the LB, go into TRANSIENT
// FAILURE.
grpc_connectivity_state_set(
- exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &glb_policy->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
"glb_update_missing");
} else {
@@ -1793,16 +1750,16 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// If a non-empty serverlist hasn't been received from the balancer,
// propagate the update to fallback_backend_addresses.
if (glb_policy->serverlist == nullptr) {
- fallback_update_locked(exec_ctx, glb_policy, addresses);
+ fallback_update_locked(glb_policy, addresses);
}
GPR_ASSERT(glb_policy->lb_channel != nullptr);
// Propagate updates to the LB channel (pick_first) through the fake
// resolver.
grpc_channel_args* lb_channel_args = build_lb_channel_args(
- exec_ctx, addresses, glb_policy->response_generator, args->args);
+ addresses, glb_policy->response_generator, args->args);
grpc_fake_resolver_response_generator_set_response(
- exec_ctx, glb_policy->response_generator, lb_channel_args);
- grpc_channel_args_destroy(exec_ctx, lb_channel_args);
+ glb_policy->response_generator, lb_channel_args);
+ grpc_channel_args_destroy(lb_channel_args);
// Start watching the LB channel connectivity for connection, if not
// already doing so.
if (!glb_policy->watching_lb_channel) {
@@ -1814,7 +1771,7 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
glb_policy->watching_lb_channel = true;
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "watch_lb_channel_connectivity");
grpc_client_channel_watch_connectivity_state(
- exec_ctx, client_channel_elem,
+ client_channel_elem,
grpc_polling_entity_create_from_pollset_set(
glb_policy->base.interested_parties),
&glb_policy->lb_channel_connectivity,
@@ -1825,8 +1782,7 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// Invoked as part of the update process. It continues watching the LB channel
// until it shuts down or becomes READY. It's invoked even if the LB channel
// stayed READY throughout the update (for example if the update is identical).
-static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx* exec_ctx,
- void* arg,
+static void glb_lb_channel_on_connectivity_changed_cb(void* arg,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
if (glb_policy->shutting_down) goto done;
@@ -1842,7 +1798,7 @@ static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx* exec_ctx,
grpc_channel_get_channel_stack(glb_policy->lb_channel));
GPR_ASSERT(client_channel_elem->filter == &grpc_client_channel_filter);
grpc_client_channel_watch_connectivity_state(
- exec_ctx, client_channel_elem,
+ client_channel_elem,
grpc_polling_entity_create_from_pollset_set(
glb_policy->base.interested_parties),
&glb_policy->lb_channel_connectivity,
@@ -1861,29 +1817,28 @@ static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx* exec_ctx,
// lb_call.
} else if (glb_policy->started_picking) {
if (glb_policy->retry_timer_active) {
- grpc_timer_cancel(exec_ctx, &glb_policy->lb_call_retry_timer);
+ grpc_timer_cancel(&glb_policy->lb_call_retry_timer);
glb_policy->retry_timer_active = false;
}
- start_picking_locked(exec_ctx, glb_policy);
+ start_picking_locked(glb_policy);
}
/* fallthrough */
case GRPC_CHANNEL_SHUTDOWN:
done:
glb_policy->watching_lb_channel = false;
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
+ GRPC_LB_POLICY_WEAK_UNREF(&glb_policy->base,
"watch_lb_channel_connectivity_cb_shutdown");
break;
}
}
static void glb_set_reresolve_closure_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* request_reresolution) {
+ grpc_lb_policy* policy, grpc_closure* request_reresolution) {
glb_lb_policy* glb_policy = (glb_lb_policy*)policy;
GPR_ASSERT(!glb_policy->shutting_down);
GPR_ASSERT(glb_policy->base.request_reresolution == nullptr);
if (glb_policy->rr_policy != nullptr) {
- grpc_lb_policy_set_reresolve_closure_locked(exec_ctx, glb_policy->rr_policy,
+ grpc_lb_policy_set_reresolve_closure_locked(glb_policy->rr_policy,
request_reresolution);
} else {
glb_policy->base.request_reresolution = request_reresolution;
@@ -1904,8 +1859,7 @@ static const grpc_lb_policy_vtable glb_lb_policy_vtable = {
glb_update_locked,
glb_set_reresolve_closure_locked};
-static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy_factory* factory,
+static grpc_lb_policy* glb_create(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
/* Count the number of gRPC-LB addresses. There must be at least one. */
const grpc_arg* arg =
@@ -1926,7 +1880,7 @@ static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI);
GPR_ASSERT(arg != nullptr);
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
- grpc_uri* uri = grpc_uri_parse(exec_ctx, arg->value.string, true);
+ grpc_uri* uri = grpc_uri_parse(arg->value.string, true);
GPR_ASSERT(uri->path[0] != '\0');
glb_policy->server_name =
gpr_strdup(uri->path[0] == '/' ? uri->path + 1 : uri->path);
@@ -1959,26 +1913,26 @@ static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
/* Extract the backend addresses (may be empty) from the resolver for
* fallback. */
glb_policy->fallback_backend_addresses =
- extract_backend_addresses_locked(exec_ctx, addresses);
+ extract_backend_addresses_locked(addresses);
/* Create a client channel over them to communicate with a LB service */
glb_policy->response_generator =
grpc_fake_resolver_response_generator_create();
grpc_channel_args* lb_channel_args = build_lb_channel_args(
- exec_ctx, addresses, glb_policy->response_generator, args->args);
+ addresses, glb_policy->response_generator, args->args);
char* uri_str;
gpr_asprintf(&uri_str, "fake:///%s", glb_policy->server_name);
glb_policy->lb_channel = grpc_lb_policy_grpclb_create_lb_channel(
- exec_ctx, uri_str, args->client_channel_factory, lb_channel_args);
+ uri_str, args->client_channel_factory, lb_channel_args);
/* Propagate initial resolution */
grpc_fake_resolver_response_generator_set_response(
- exec_ctx, glb_policy->response_generator, lb_channel_args);
- grpc_channel_args_destroy(exec_ctx, lb_channel_args);
+ glb_policy->response_generator, lb_channel_args);
+ grpc_channel_args_destroy(lb_channel_args);
gpr_free(uri_str);
if (glb_policy->lb_channel == nullptr) {
gpr_free((void*)glb_policy->server_name);
- grpc_channel_args_destroy(exec_ctx, glb_policy->args);
+ grpc_channel_args_destroy(glb_policy->args);
gpr_free(glb_policy);
return nullptr;
}
@@ -2009,7 +1963,7 @@ grpc_lb_policy_factory* grpc_glb_lb_factory_create() {
// Only add client_load_reporting filter if the grpclb LB policy is used.
static bool maybe_add_client_load_reporting_filter(
- grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
+ grpc_channel_stack_builder* builder, void* arg) {
const grpc_channel_args* args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* channel_arg =
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
index aacaec197d..a8ecea4212 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
@@ -26,17 +26,17 @@
#include "src/core/lib/support/string.h"
grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
- grpc_exec_ctx* exec_ctx, const char* lb_service_target_addresses,
+ const char* lb_service_target_addresses,
grpc_client_channel_factory* client_channel_factory,
grpc_channel_args* args) {
grpc_channel* lb_channel = grpc_client_channel_factory_create_channel(
- exec_ctx, client_channel_factory, lb_service_target_addresses,
+ client_channel_factory, lb_service_target_addresses,
GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, args);
return lb_channel;
}
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
- grpc_exec_ctx* exec_ctx, grpc_slice_hash_table* targets_info,
+ grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
const grpc_channel_args* args) {
const grpc_arg to_add[] = {
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
index 70b1c28b0d..56104b2ec0 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
@@ -31,12 +31,12 @@
* \a client_channel_factory will be used for the creation of the LB channel,
* alongside the channel args passed in \a args. */
grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
- grpc_exec_ctx* exec_ctx, const char* lb_service_target_addresses,
+ const char* lb_service_target_addresses,
grpc_client_channel_factory* client_channel_factory,
grpc_channel_args* args);
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
- grpc_exec_ctx* exec_ctx, grpc_slice_hash_table* targets_info,
+ grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
const grpc_channel_args* args);
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
index 8eaa90e97b..76bcddf945 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
@@ -29,7 +29,7 @@
#include "src/core/lib/support/string.h"
grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
- grpc_exec_ctx* exec_ctx, const char* lb_service_target_addresses,
+ const char* lb_service_target_addresses,
grpc_client_channel_factory* client_channel_factory,
grpc_channel_args* args) {
grpc_channel_args* new_args = args;
@@ -50,19 +50,19 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
new_args = grpc_channel_args_copy_and_add_and_remove(
args, keys_to_remove, GPR_ARRAY_SIZE(keys_to_remove), args_to_add,
GPR_ARRAY_SIZE(args_to_add));
- grpc_channel_credentials_unref(exec_ctx, creds_sans_call_creds);
+ grpc_channel_credentials_unref(creds_sans_call_creds);
}
grpc_channel* lb_channel = grpc_client_channel_factory_create_channel(
- exec_ctx, client_channel_factory, lb_service_target_addresses,
+ client_channel_factory, lb_service_target_addresses,
GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, new_args);
if (channel_credentials != nullptr) {
- grpc_channel_args_destroy(exec_ctx, new_args);
+ grpc_channel_args_destroy(new_args);
}
return lb_channel;
}
grpc_channel_args* grpc_lb_policy_grpclb_build_lb_channel_args(
- grpc_exec_ctx* exec_ctx, grpc_slice_hash_table* targets_info,
+ grpc_slice_hash_table* targets_info,
grpc_fake_resolver_response_generator* response_generator,
const grpc_channel_args* args) {
const grpc_arg to_add[] = {
diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
index 228a77d9db..5e75b64843 100644
--- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
@@ -57,12 +57,12 @@ typedef struct {
grpc_connectivity_state_tracker state_tracker;
} pick_first_lb_policy;
-static void pf_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void pf_destroy(grpc_lb_policy* pol) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
GPR_ASSERT(p->subchannel_list == nullptr);
GPR_ASSERT(p->latest_pending_subchannel_list == nullptr);
GPR_ASSERT(p->pending_picks == nullptr);
- grpc_connectivity_state_destroy(exec_ctx, &p->state_tracker);
+ grpc_connectivity_state_destroy(&p->state_tracker);
gpr_free(p);
grpc_subchannel_index_unref();
if (grpc_lb_pick_first_trace.enabled()) {
@@ -70,7 +70,7 @@ static void pf_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
}
}
-static void pf_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void pf_shutdown_locked(grpc_lb_policy* pol) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel shutdown");
if (grpc_lb_pick_first_trace.enabled()) {
@@ -81,28 +81,27 @@ static void pf_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
while ((pp = p->pending_picks) != nullptr) {
p->pending_picks = pp->next;
*pp->target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(pp->on_complete, GRPC_ERROR_REF(error));
gpr_free(pp);
}
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
- "shutdown");
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_SHUTDOWN,
+ GRPC_ERROR_REF(error), "shutdown");
if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"pf_shutdown");
p->subchannel_list = nullptr;
}
if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->latest_pending_subchannel_list, "pf_shutdown");
+ p->latest_pending_subchannel_list, "pf_shutdown");
p->latest_pending_subchannel_list = nullptr;
}
- grpc_lb_policy_try_reresolve(exec_ctx, &p->base, &grpc_lb_pick_first_trace,
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_pick_first_trace,
GRPC_ERROR_CANCELLED);
GRPC_ERROR_UNREF(error);
}
-static void pf_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static void pf_cancel_pick_locked(grpc_lb_policy* pol,
grpc_connected_subchannel** target,
grpc_error* error) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
@@ -112,7 +111,7 @@ static void pf_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
pending_pick* next = pp->next;
if (pp->target == target) {
*target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
+ GRPC_CLOSURE_SCHED(pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
gpr_free(pp);
@@ -125,7 +124,7 @@ static void pf_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
GRPC_ERROR_UNREF(error);
}
-static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static void pf_cancel_picks_locked(grpc_lb_policy* pol,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error) {
@@ -136,7 +135,7 @@ static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
pending_pick* next = pp->next;
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
+ GRPC_CLOSURE_SCHED(pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
gpr_free(pp);
@@ -149,8 +148,7 @@ static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
GRPC_ERROR_UNREF(error);
}
-static void start_picking_locked(grpc_exec_ctx* exec_ctx,
- pick_first_lb_policy* p) {
+static void start_picking_locked(pick_first_lb_policy* p) {
p->started_picking = true;
if (p->subchannel_list != nullptr &&
p->subchannel_list->num_subchannels > 0) {
@@ -160,21 +158,21 @@ static void start_picking_locked(grpc_exec_ctx* exec_ctx,
grpc_lb_subchannel_list_ref_for_connectivity_watch(
p->subchannel_list, "connectivity_watch+start_picking");
grpc_lb_subchannel_data_start_connectivity_watch(
- exec_ctx, &p->subchannel_list->subchannels[i]);
+ &p->subchannel_list->subchannels[i]);
break;
}
}
}
}
-static void pf_exit_idle_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void pf_exit_idle_locked(grpc_lb_policy* pol) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
if (!p->started_picking) {
- start_picking_locked(exec_ctx, p);
+ start_picking_locked(p);
}
}
-static int pf_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static int pf_pick_locked(grpc_lb_policy* pol,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
@@ -188,7 +186,7 @@ static int pf_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
}
// No subchannel selected yet, so handle asynchronously.
if (!p->started_picking) {
- start_picking_locked(exec_ctx, p);
+ start_picking_locked(p);
}
pending_pick* pp = (pending_pick*)gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks;
@@ -199,48 +197,43 @@ static int pf_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
return 0;
}
-static void destroy_unselected_subchannels_locked(grpc_exec_ctx* exec_ctx,
- pick_first_lb_policy* p) {
+static void destroy_unselected_subchannels_locked(pick_first_lb_policy* p) {
for (size_t i = 0; i < p->subchannel_list->num_subchannels; ++i) {
grpc_lb_subchannel_data* sd = &p->subchannel_list->subchannels[i];
if (p->selected != sd) {
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd,
+ grpc_lb_subchannel_data_unref_subchannel(sd,
"selected_different_subchannel");
}
}
}
static grpc_connectivity_state pf_check_connectivity_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol, grpc_error** error) {
+ grpc_lb_policy* pol, grpc_error** error) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
return grpc_connectivity_state_get(&p->state_tracker, error);
}
-static void pf_notify_on_state_change_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* pol,
+static void pf_notify_on_state_change_locked(grpc_lb_policy* pol,
grpc_connectivity_state* current,
grpc_closure* notify) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
- grpc_connectivity_state_notify_on_state_change(exec_ctx, &p->state_tracker,
- current, notify);
+ grpc_connectivity_state_notify_on_state_change(&p->state_tracker, current,
+ notify);
}
-static void pf_ping_one_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
- grpc_closure* closure) {
+static void pf_ping_one_locked(grpc_lb_policy* pol, grpc_closure* closure) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
if (p->selected) {
- grpc_connected_subchannel_ping(exec_ctx, p->selected->connected_subchannel,
- closure);
+ grpc_connected_subchannel_ping(p->selected->connected_subchannel, closure);
} else {
- GRPC_CLOSURE_SCHED(exec_ctx, closure,
+ GRPC_CLOSURE_SCHED(closure,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Not connected"));
}
}
-static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
+static void pf_connectivity_changed_locked(void* arg, grpc_error* error);
-static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+static void pf_update_locked(grpc_lb_policy* policy,
const grpc_lb_policy_args* args) {
pick_first_lb_policy* p = (pick_first_lb_policy*)policy;
const grpc_arg* arg =
@@ -249,7 +242,7 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
if (p->subchannel_list == nullptr) {
// If we don't have a current subchannel list, go into TRANSIENT FAILURE.
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
"pf_update_missing");
} else {
@@ -268,17 +261,17 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
(void*)p, (unsigned long)addresses->num_addresses);
}
grpc_lb_subchannel_list* subchannel_list = grpc_lb_subchannel_list_create(
- exec_ctx, &p->base, &grpc_lb_pick_first_trace, addresses, args,
+ &p->base, &grpc_lb_pick_first_trace, addresses, args,
pf_connectivity_changed_locked);
if (subchannel_list->num_subchannels == 0) {
// Empty update or no valid subchannels. Unsubscribe from all current
// subchannels and put the channel in TRANSIENT_FAILURE.
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
"pf_update_empty");
if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"sl_shutdown_empty_update");
}
p->subchannel_list = subchannel_list; // Empty list.
@@ -289,7 +282,7 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// We don't yet have a selected subchannel, so replace the current
// subchannel list immediately.
if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"pf_update_before_selected");
}
p->subchannel_list = subchannel_list;
@@ -314,19 +307,19 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
p->selected = sd;
if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->subchannel_list, "pf_update_includes_selected");
+ p->subchannel_list, "pf_update_includes_selected");
}
p->subchannel_list = subchannel_list;
- destroy_unselected_subchannels_locked(exec_ctx, p);
+ destroy_unselected_subchannels_locked(p);
grpc_lb_subchannel_list_ref_for_connectivity_watch(
subchannel_list, "connectivity_watch+replace_selected");
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
// If there was a previously pending update (which may or may
// not have contained the currently selected subchannel), drop
// it, so that it doesn't override what we've done here.
if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->latest_pending_subchannel_list,
+ p->latest_pending_subchannel_list,
"pf_update_includes_selected+outdated");
p->latest_pending_subchannel_list = nullptr;
}
@@ -346,8 +339,7 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
(void*)subchannel_list);
}
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->latest_pending_subchannel_list,
- "sl_outdated_dont_smash");
+ p->latest_pending_subchannel_list, "sl_outdated_dont_smash");
}
p->latest_pending_subchannel_list = subchannel_list;
}
@@ -357,12 +349,11 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
grpc_lb_subchannel_list_ref_for_connectivity_watch(
subchannel_list, "connectivity_watch+update");
grpc_lb_subchannel_data_start_connectivity_watch(
- exec_ctx, &subchannel_list->subchannels[0]);
+ &subchannel_list->subchannels[0]);
}
}
-static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void pf_connectivity_changed_locked(void* arg, grpc_error* error) {
grpc_lb_subchannel_data* sd = (grpc_lb_subchannel_data*)arg;
pick_first_lb_policy* p = (pick_first_lb_policy*)sd->subchannel_list->policy;
if (grpc_lb_pick_first_trace.enabled()) {
@@ -380,18 +371,18 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
// If the policy is shutting down, unref and return.
if (p->shutdown) {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, "pf_shutdown");
- grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "pf_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "pf_shutdown");
+ grpc_lb_subchannel_list_unref_for_connectivity_watch(sd->subchannel_list,
+ "pf_shutdown");
return;
}
// If the subchannel list is shutting down, stop watching.
if (sd->subchannel_list->shutting_down || error == GRPC_ERROR_CANCELLED) {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, "pf_sl_shutdown");
- grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "pf_sl_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "pf_sl_shutdown");
+ grpc_lb_subchannel_list_unref_for_connectivity_watch(sd->subchannel_list,
+ "pf_sl_shutdown");
return;
}
// If we're still here, the notification must be for a subchannel in
@@ -407,15 +398,15 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (sd->curr_connectivity_state != GRPC_CHANNEL_READY &&
p->latest_pending_subchannel_list != nullptr) {
p->selected = nullptr;
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "selected_not_ready+switch_to_update");
+ sd->subchannel_list, "selected_not_ready+switch_to_update");
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->subchannel_list, "selected_not_ready+switch_to_update");
+ p->subchannel_list, "selected_not_ready+switch_to_update");
p->subchannel_list = p->latest_pending_subchannel_list;
p->latest_pending_subchannel_list = nullptr;
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "selected_not_ready+switch_to_update");
} else {
// TODO(juanlishen): we re-resolve when the selected subchannel goes to
@@ -426,27 +417,26 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (sd->curr_connectivity_state == GRPC_CHANNEL_SHUTDOWN ||
sd->curr_connectivity_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
// If the selected channel goes bad, request a re-resolution.
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_IDLE, GRPC_ERROR_NONE,
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
+ GRPC_ERROR_NONE,
"selected_changed+reresolve");
p->started_picking = false;
- grpc_lb_policy_try_reresolve(
- exec_ctx, &p->base, &grpc_lb_pick_first_trace, GRPC_ERROR_NONE);
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_pick_first_trace,
+ GRPC_ERROR_NONE);
} else {
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
+ grpc_connectivity_state_set(&p->state_tracker,
sd->curr_connectivity_state,
GRPC_ERROR_REF(error), "selected_changed");
}
if (sd->curr_connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
// Renew notification.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
} else {
p->selected = nullptr;
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "pf_selected_shutdown");
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd,
- "pf_selected_shutdown");
+ sd->subchannel_list, "pf_selected_shutdown");
+ grpc_lb_subchannel_data_unref_subchannel(sd, "pf_selected_shutdown");
}
}
return;
@@ -466,15 +456,14 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
// p->subchannel_list.
if (sd->subchannel_list == p->latest_pending_subchannel_list) {
GPR_ASSERT(p->subchannel_list != nullptr);
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"finish_update");
p->subchannel_list = p->latest_pending_subchannel_list;
p->latest_pending_subchannel_list = nullptr;
}
// Cases 1 and 2.
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_READY, GRPC_ERROR_NONE,
- "connecting_ready");
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_READY,
+ GRPC_ERROR_NONE, "connecting_ready");
sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF(
grpc_subchannel_get_connected_subchannel(sd->subchannel),
"connected");
@@ -484,7 +473,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
(void*)sd->subchannel);
}
// Drop all other subchannels, since we are now connected.
- destroy_unselected_subchannels_locked(exec_ctx, p);
+ destroy_unselected_subchannels_locked(p);
// Update any calls that were waiting for a pick.
pending_pick* pp;
while ((pp = p->pending_picks)) {
@@ -496,15 +485,15 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
"Servicing pending pick with selected subchannel %p",
(void*)p->selected);
}
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(pp->on_complete, GRPC_ERROR_NONE);
gpr_free(pp);
}
// Renew notification.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
break;
}
case GRPC_CHANNEL_TRANSIENT_FAILURE: {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
do {
sd->subchannel_list->checking_subchannel =
(sd->subchannel_list->checking_subchannel + 1) %
@@ -517,29 +506,28 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
if (sd->subchannel_list->checking_subchannel == 0 &&
sd->subchannel_list == p->subchannel_list) {
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "connecting_transient_failure");
}
// Reuses the connectivity refs from the previous watch.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
break;
}
case GRPC_CHANNEL_CONNECTING:
case GRPC_CHANNEL_IDLE: {
// Only update connectivity state in case 1.
if (sd->subchannel_list == p->subchannel_list) {
- grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_CONNECTING,
- GRPC_ERROR_REF(error), "connecting_changed");
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_CONNECTING,
+ GRPC_ERROR_REF(error),
+ "connecting_changed");
}
// Renew notification.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
break;
}
case GRPC_CHANNEL_SHUTDOWN: {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd,
- "pf_candidate_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "pf_candidate_shutdown");
// Advance to next subchannel and check its state.
grpc_lb_subchannel_data* original_sd = sd;
do {
@@ -551,31 +539,30 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
} while (sd->subchannel == nullptr && sd != original_sd);
if (sd == original_sd) {
grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "pf_exhausted_subchannels");
+ sd->subchannel_list, "pf_exhausted_subchannels");
if (sd->subchannel_list == p->subchannel_list) {
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_IDLE, GRPC_ERROR_NONE,
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
+ GRPC_ERROR_NONE,
"exhausted_subchannels+reresolve");
p->started_picking = false;
- grpc_lb_policy_try_reresolve(
- exec_ctx, &p->base, &grpc_lb_pick_first_trace, GRPC_ERROR_NONE);
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_pick_first_trace,
+ GRPC_ERROR_NONE);
}
} else {
if (sd->subchannel_list == p->subchannel_list) {
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "subchannel_failed");
}
// Reuses the connectivity refs from the previous watch.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
}
}
}
}
static void pf_set_reresolve_closure_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* request_reresolution) {
+ grpc_lb_policy* policy, grpc_closure* request_reresolution) {
pick_first_lb_policy* p = (pick_first_lb_policy*)policy;
GPR_ASSERT(!p->shutdown);
GPR_ASSERT(policy->request_reresolution == nullptr);
@@ -599,15 +586,14 @@ static void pick_first_factory_ref(grpc_lb_policy_factory* factory) {}
static void pick_first_factory_unref(grpc_lb_policy_factory* factory) {}
-static grpc_lb_policy* create_pick_first(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy_factory* factory,
+static grpc_lb_policy* create_pick_first(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
GPR_ASSERT(args->client_channel_factory != nullptr);
pick_first_lb_policy* p = (pick_first_lb_policy*)gpr_zalloc(sizeof(*p));
if (grpc_lb_pick_first_trace.enabled()) {
gpr_log(GPR_DEBUG, "Pick First %p created.", (void*)p);
}
- pf_update_locked(exec_ctx, &p->base, args);
+ pf_update_locked(&p->base, args);
grpc_lb_policy_init(&p->base, &pick_first_lb_policy_vtable, args->combiner);
grpc_subchannel_index_ref();
return &p->base;
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index f68daba474..6958b72693 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -154,7 +154,7 @@ static void update_last_ready_subchannel_index_locked(round_robin_lb_policy* p,
}
}
-static void rr_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void rr_destroy(grpc_lb_policy* pol) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
if (grpc_lb_round_robin_trace.enabled()) {
gpr_log(GPR_DEBUG, "[RR %p] Destroying Round Robin policy at %p",
@@ -162,12 +162,12 @@ static void rr_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
}
GPR_ASSERT(p->subchannel_list == nullptr);
GPR_ASSERT(p->latest_pending_subchannel_list == nullptr);
- grpc_connectivity_state_destroy(exec_ctx, &p->state_tracker);
+ grpc_connectivity_state_destroy(&p->state_tracker);
grpc_subchannel_index_unref();
gpr_free(p);
}
-static void rr_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void rr_shutdown_locked(grpc_lb_policy* pol) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel shutdown");
if (grpc_lb_round_robin_trace.enabled()) {
@@ -178,29 +178,27 @@ static void rr_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
while ((pp = p->pending_picks) != nullptr) {
p->pending_picks = pp->next;
*pp->target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(pp->on_complete, GRPC_ERROR_REF(error));
gpr_free(pp);
}
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
- "rr_shutdown");
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_SHUTDOWN,
+ GRPC_ERROR_REF(error), "rr_shutdown");
if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"sl_shutdown_rr_shutdown");
p->subchannel_list = nullptr;
}
if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->latest_pending_subchannel_list,
- "sl_shutdown_pending_rr_shutdown");
+ p->latest_pending_subchannel_list, "sl_shutdown_pending_rr_shutdown");
p->latest_pending_subchannel_list = nullptr;
}
- grpc_lb_policy_try_reresolve(exec_ctx, &p->base, &grpc_lb_round_robin_trace,
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
GRPC_ERROR_CANCELLED);
GRPC_ERROR_UNREF(error);
}
-static void rr_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static void rr_cancel_pick_locked(grpc_lb_policy* pol,
grpc_connected_subchannel** target,
grpc_error* error) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
@@ -210,7 +208,7 @@ static void rr_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
pending_pick* next = pp->next;
if (pp->target == target) {
*target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
+ GRPC_CLOSURE_SCHED(pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick cancelled", &error, 1));
gpr_free(pp);
@@ -223,7 +221,7 @@ static void rr_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
GRPC_ERROR_UNREF(error);
}
-static void rr_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static void rr_cancel_picks_locked(grpc_lb_policy* pol,
uint32_t initial_metadata_flags_mask,
uint32_t initial_metadata_flags_eq,
grpc_error* error) {
@@ -235,7 +233,7 @@ static void rr_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
*pp->target = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
+ GRPC_CLOSURE_SCHED(pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick cancelled", &error, 1));
gpr_free(pp);
@@ -248,27 +246,26 @@ static void rr_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
GRPC_ERROR_UNREF(error);
}
-static void start_picking_locked(grpc_exec_ctx* exec_ctx,
- round_robin_lb_policy* p) {
+static void start_picking_locked(round_robin_lb_policy* p) {
p->started_picking = true;
for (size_t i = 0; i < p->subchannel_list->num_subchannels; i++) {
if (p->subchannel_list->subchannels[i].subchannel != nullptr) {
grpc_lb_subchannel_list_ref_for_connectivity_watch(p->subchannel_list,
"connectivity_watch");
grpc_lb_subchannel_data_start_connectivity_watch(
- exec_ctx, &p->subchannel_list->subchannels[i]);
+ &p->subchannel_list->subchannels[i]);
}
}
}
-static void rr_exit_idle_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
+static void rr_exit_idle_locked(grpc_lb_policy* pol) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
if (!p->started_picking) {
- start_picking_locked(exec_ctx, p);
+ start_picking_locked(p);
}
}
-static int rr_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
+static int rr_pick_locked(grpc_lb_policy* pol,
const grpc_lb_policy_pick_args* pick_args,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
@@ -305,7 +302,7 @@ static int rr_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
}
/* no pick currently available. Save for later in list of pending picks */
if (!p->started_picking) {
- start_picking_locked(exec_ctx, p);
+ start_picking_locked(p);
}
pending_pick* pp = (pending_pick*)gpr_malloc(sizeof(*pp));
pp->next = p->pending_picks;
@@ -348,8 +345,7 @@ static void update_state_counters_locked(grpc_lb_subchannel_data* sd) {
* (the grpc_lb_subchannel_data associated with the updated subchannel) and the
* subchannel list \a sd belongs to (sd->subchannel_list). \a error will be used
* only if the policy transitions to state TRANSIENT_FAILURE. */
-static void update_lb_connectivity_status_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_data* sd,
+static void update_lb_connectivity_status_locked(grpc_lb_subchannel_data* sd,
grpc_error* error) {
/* In priority order. The first rule to match terminates the search (ie, if we
* are on rule n, all previous rules were unfulfilled).
@@ -382,38 +378,36 @@ static void update_lb_connectivity_status_locked(grpc_exec_ctx* exec_ctx,
round_robin_lb_policy* p = (round_robin_lb_policy*)subchannel_list->policy;
if (subchannel_list->num_ready > 0) {
/* 1) READY */
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_READY,
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_READY,
GRPC_ERROR_NONE, "rr_ready");
} else if (sd->curr_connectivity_state == GRPC_CHANNEL_CONNECTING) {
/* 2) CONNECTING */
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE,
- "rr_connecting");
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_CONNECTING,
+ GRPC_ERROR_NONE, "rr_connecting");
} else if (subchannel_list->num_shutdown ==
subchannel_list->num_subchannels) {
/* 3) IDLE and re-resolve */
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE,
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
GRPC_ERROR_NONE,
"rr_exhausted_subchannels+reresolve");
p->started_picking = false;
- grpc_lb_policy_try_reresolve(exec_ctx, &p->base, &grpc_lb_round_robin_trace,
+ grpc_lb_policy_try_reresolve(&p->base, &grpc_lb_round_robin_trace,
GRPC_ERROR_NONE);
} else if (subchannel_list->num_transient_failures ==
subchannel_list->num_subchannels) {
/* 4) TRANSIENT_FAILURE */
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
+ grpc_connectivity_state_set(&p->state_tracker,
GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "rr_transient_failure");
} else if (subchannel_list->num_idle == subchannel_list->num_subchannels) {
/* 5) IDLE */
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker, GRPC_CHANNEL_IDLE,
+ grpc_connectivity_state_set(&p->state_tracker, GRPC_CHANNEL_IDLE,
GRPC_ERROR_NONE, "rr_idle");
}
GRPC_ERROR_UNREF(error);
}
-static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
grpc_lb_subchannel_data* sd = (grpc_lb_subchannel_data*)arg;
round_robin_lb_policy* p =
(round_robin_lb_policy*)sd->subchannel_list->policy;
@@ -431,18 +425,18 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
// If the policy is shutting down, unref and return.
if (p->shutdown) {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, "rr_shutdown");
- grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "rr_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "rr_shutdown");
+ grpc_lb_subchannel_list_unref_for_connectivity_watch(sd->subchannel_list,
+ "rr_shutdown");
return;
}
// If the subchannel list is shutting down, stop watching.
if (sd->subchannel_list->shutting_down || error == GRPC_ERROR_CANCELLED) {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, "rr_sl_shutdown");
- grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "rr_sl_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "rr_sl_shutdown");
+ grpc_lb_subchannel_list_unref_for_connectivity_watch(sd->subchannel_list,
+ "rr_sl_shutdown");
return;
}
// If we're still here, the notification must be for a subchannel in
@@ -455,14 +449,13 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
sd->curr_connectivity_state = sd->pending_connectivity_state_unsafe;
// Update state counters and new overall state.
update_state_counters_locked(sd);
- update_lb_connectivity_status_locked(exec_ctx, sd, GRPC_ERROR_REF(error));
+ update_lb_connectivity_status_locked(sd, GRPC_ERROR_REF(error));
// If the sd's new state is SHUTDOWN, unref the subchannel.
if (sd->curr_connectivity_state == GRPC_CHANNEL_SHUTDOWN) {
- grpc_lb_subchannel_data_stop_connectivity_watch(exec_ctx, sd);
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd,
- "rr_connectivity_shutdown");
+ grpc_lb_subchannel_data_stop_connectivity_watch(sd);
+ grpc_lb_subchannel_data_unref_subchannel(sd, "rr_connectivity_shutdown");
grpc_lb_subchannel_list_unref_for_connectivity_watch(
- exec_ctx, sd->subchannel_list, "rr_connectivity_shutdown");
+ sd->subchannel_list, "rr_connectivity_shutdown");
} else { // sd not in SHUTDOWN
if (sd->curr_connectivity_state == GRPC_CHANNEL_READY) {
if (sd->connected_subchannel == nullptr) {
@@ -490,8 +483,8 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
if (p->subchannel_list != nullptr) {
// dispose of the current subchannel_list
- grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->subchannel_list, "sl_phase_out_shutdown");
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
+ "sl_phase_out_shutdown");
}
p->subchannel_list = p->latest_pending_subchannel_list;
p->latest_pending_subchannel_list = nullptr;
@@ -523,32 +516,30 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
(void*)p, (void*)selected->subchannel,
(void*)p->subchannel_list, (unsigned long)next_ready_index);
}
- GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(pp->on_complete, GRPC_ERROR_NONE);
gpr_free(pp);
}
}
// Renew notification.
- grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
+ grpc_lb_subchannel_data_start_connectivity_watch(sd);
}
}
static grpc_connectivity_state rr_check_connectivity_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol, grpc_error** error) {
+ grpc_lb_policy* pol, grpc_error** error) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
return grpc_connectivity_state_get(&p->state_tracker, error);
}
-static void rr_notify_on_state_change_locked(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy* pol,
+static void rr_notify_on_state_change_locked(grpc_lb_policy* pol,
grpc_connectivity_state* current,
grpc_closure* notify) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
- grpc_connectivity_state_notify_on_state_change(exec_ctx, &p->state_tracker,
- current, notify);
+ grpc_connectivity_state_notify_on_state_change(&p->state_tracker, current,
+ notify);
}
-static void rr_ping_one_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
- grpc_closure* closure) {
+static void rr_ping_one_locked(grpc_lb_policy* pol, grpc_closure* closure) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
const size_t next_ready_index = get_next_ready_subchannel_index_locked(p);
if (next_ready_index < p->subchannel_list->num_subchannels) {
@@ -556,16 +547,15 @@ static void rr_ping_one_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
&p->subchannel_list->subchannels[next_ready_index];
grpc_connected_subchannel* target = GRPC_CONNECTED_SUBCHANNEL_REF(
selected->connected_subchannel, "rr_ping");
- grpc_connected_subchannel_ping(exec_ctx, target, closure);
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, target, "rr_ping");
+ grpc_connected_subchannel_ping(target, closure);
+ GRPC_CONNECTED_SUBCHANNEL_UNREF(target, "rr_ping");
} else {
- GRPC_CLOSURE_SCHED(
- exec_ctx, closure,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Round Robin not connected"));
+ GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Round Robin not connected"));
}
}
-static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
+static void rr_update_locked(grpc_lb_policy* policy,
const grpc_lb_policy_args* args) {
round_robin_lb_policy* p = (round_robin_lb_policy*)policy;
const grpc_arg* arg =
@@ -576,7 +566,7 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// Otherwise, keep using the current subchannel list (ignore this update).
if (p->subchannel_list == nullptr) {
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
"rr_update_missing");
}
@@ -588,15 +578,15 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
addresses->num_addresses);
}
grpc_lb_subchannel_list* subchannel_list = grpc_lb_subchannel_list_create(
- exec_ctx, &p->base, &grpc_lb_round_robin_trace, addresses, args,
+ &p->base, &grpc_lb_round_robin_trace, addresses, args,
rr_connectivity_changed_locked);
if (subchannel_list->num_subchannels == 0) {
grpc_connectivity_state_set(
- exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
"rr_update_empty");
if (p->subchannel_list != nullptr) {
- grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
+ grpc_lb_subchannel_list_shutdown_and_unref(p->subchannel_list,
"sl_shutdown_empty_update");
}
p->subchannel_list = subchannel_list; // empty list
@@ -612,7 +602,7 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
(void*)subchannel_list);
}
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->latest_pending_subchannel_list, "sl_outdated");
+ p->latest_pending_subchannel_list, "sl_outdated");
}
p->latest_pending_subchannel_list = subchannel_list;
for (size_t i = 0; i < subchannel_list->num_subchannels; ++i) {
@@ -623,22 +613,21 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
grpc_lb_subchannel_list_ref_for_connectivity_watch(subchannel_list,
"connectivity_watch");
grpc_lb_subchannel_data_start_connectivity_watch(
- exec_ctx, &subchannel_list->subchannels[i]);
+ &subchannel_list->subchannels[i]);
}
} else {
// The policy isn't picking yet. Save the update for later, disposing of
// previous version if any.
if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
- exec_ctx, p->subchannel_list, "rr_update_before_started_picking");
+ p->subchannel_list, "rr_update_before_started_picking");
}
p->subchannel_list = subchannel_list;
}
}
static void rr_set_reresolve_closure_locked(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
- grpc_closure* request_reresolution) {
+ grpc_lb_policy* policy, grpc_closure* request_reresolution) {
round_robin_lb_policy* p = (round_robin_lb_policy*)policy;
GPR_ASSERT(!p->shutdown);
GPR_ASSERT(policy->request_reresolution == nullptr);
@@ -662,8 +651,7 @@ static void round_robin_factory_ref(grpc_lb_policy_factory* factory) {}
static void round_robin_factory_unref(grpc_lb_policy_factory* factory) {}
-static grpc_lb_policy* round_robin_create(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy_factory* factory,
+static grpc_lb_policy* round_robin_create(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
GPR_ASSERT(args->client_channel_factory != nullptr);
round_robin_lb_policy* p = (round_robin_lb_policy*)gpr_zalloc(sizeof(*p));
@@ -671,7 +659,7 @@ static grpc_lb_policy* round_robin_create(grpc_exec_ctx* exec_ctx,
grpc_subchannel_index_ref();
grpc_connectivity_state_init(&p->state_tracker, GRPC_CHANNEL_IDLE,
"round_robin");
- rr_update_locked(exec_ctx, &p->base, args);
+ rr_update_locked(&p->base, args);
if (grpc_lb_round_robin_trace.enabled()) {
gpr_log(GPR_DEBUG, "[RR %p] Created with %lu subchannels", (void*)p,
(unsigned long)p->subchannel_list->num_subchannels);
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index b6fce4d207..a3b4c8e524 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -28,8 +28,7 @@
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/connectivity_state.h"
-void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_data* sd,
+void grpc_lb_subchannel_data_unref_subchannel(grpc_lb_subchannel_data* sd,
const char* reason) {
if (sd->subchannel != nullptr) {
if (sd->subchannel_list->tracer->enabled()) {
@@ -41,23 +40,22 @@ void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
(size_t)(sd - sd->subchannel_list->subchannels),
sd->subchannel_list->num_subchannels, sd->subchannel);
}
- GRPC_SUBCHANNEL_UNREF(exec_ctx, sd->subchannel, reason);
+ GRPC_SUBCHANNEL_UNREF(sd->subchannel, reason);
sd->subchannel = nullptr;
if (sd->connected_subchannel != nullptr) {
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, sd->connected_subchannel,
- reason);
+ GRPC_CONNECTED_SUBCHANNEL_UNREF(sd->connected_subchannel, reason);
sd->connected_subchannel = nullptr;
}
if (sd->user_data != nullptr) {
GPR_ASSERT(sd->user_data_vtable != nullptr);
- sd->user_data_vtable->destroy(exec_ctx, sd->user_data);
+ sd->user_data_vtable->destroy(sd->user_data);
sd->user_data = nullptr;
}
}
}
void grpc_lb_subchannel_data_start_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_data* sd) {
+ grpc_lb_subchannel_data* sd) {
if (sd->subchannel_list->tracer->enabled()) {
gpr_log(GPR_DEBUG,
"[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
@@ -69,13 +67,13 @@ void grpc_lb_subchannel_data_start_connectivity_watch(
}
sd->connectivity_notification_pending = true;
grpc_subchannel_notify_on_state_change(
- exec_ctx, sd->subchannel, sd->subchannel_list->policy->interested_parties,
+ sd->subchannel, sd->subchannel_list->policy->interested_parties,
&sd->pending_connectivity_state_unsafe,
&sd->connectivity_changed_closure);
}
void grpc_lb_subchannel_data_stop_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_data* sd) {
+ grpc_lb_subchannel_data* sd) {
if (sd->subchannel_list->tracer->enabled()) {
gpr_log(GPR_DEBUG,
"[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
@@ -90,7 +88,7 @@ void grpc_lb_subchannel_data_stop_connectivity_watch(
}
grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* p, grpc_core::TraceFlag* tracer,
+ grpc_lb_policy* p, grpc_core::TraceFlag* tracer,
const grpc_lb_addresses* addresses, const grpc_lb_policy_args* args,
grpc_iomgr_cb_func connectivity_changed_cb) {
grpc_lb_subchannel_list* subchannel_list =
@@ -124,8 +122,8 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
gpr_free(addr_arg.value.string);
sc_args.args = new_args;
grpc_subchannel* subchannel = grpc_client_channel_factory_create_subchannel(
- exec_ctx, args->client_channel_factory, &sc_args);
- grpc_channel_args_destroy(exec_ctx, new_args);
+ args->client_channel_factory, &sc_args);
+ grpc_channel_args_destroy(new_args);
if (subchannel == nullptr) {
// Subchannel could not be created.
if (tracer->enabled()) {
@@ -172,8 +170,7 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
return subchannel_list;
}
-static void subchannel_list_destroy(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_list* subchannel_list) {
+static void subchannel_list_destroy(grpc_lb_subchannel_list* subchannel_list) {
if (subchannel_list->tracer->enabled()) {
gpr_log(GPR_DEBUG, "[%s %p] Destroying subchannel_list %p",
subchannel_list->tracer->name(), subchannel_list->policy,
@@ -181,8 +178,7 @@ static void subchannel_list_destroy(grpc_exec_ctx* exec_ctx,
}
for (size_t i = 0; i < subchannel_list->num_subchannels; i++) {
grpc_lb_subchannel_data* sd = &subchannel_list->subchannels[i];
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd,
- "subchannel_list_destroy");
+ grpc_lb_subchannel_data_unref_subchannel(sd, "subchannel_list_destroy");
}
gpr_free(subchannel_list->subchannels);
gpr_free(subchannel_list);
@@ -200,8 +196,7 @@ void grpc_lb_subchannel_list_ref(grpc_lb_subchannel_list* subchannel_list,
}
}
-void grpc_lb_subchannel_list_unref(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_list* subchannel_list,
+void grpc_lb_subchannel_list_unref(grpc_lb_subchannel_list* subchannel_list,
const char* reason) {
const bool done = gpr_unref(&subchannel_list->refcount);
if (subchannel_list->tracer->enabled()) {
@@ -212,7 +207,7 @@ void grpc_lb_subchannel_list_unref(grpc_exec_ctx* exec_ctx,
reason);
}
if (done) {
- subchannel_list_destroy(exec_ctx, subchannel_list);
+ subchannel_list_destroy(subchannel_list);
}
}
@@ -223,14 +218,13 @@ void grpc_lb_subchannel_list_ref_for_connectivity_watch(
}
void grpc_lb_subchannel_list_unref_for_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list,
- const char* reason) {
- GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, subchannel_list->policy, reason);
- grpc_lb_subchannel_list_unref(exec_ctx, subchannel_list, reason);
+ grpc_lb_subchannel_list* subchannel_list, const char* reason) {
+ GRPC_LB_POLICY_WEAK_UNREF(subchannel_list->policy, reason);
+ grpc_lb_subchannel_list_unref(subchannel_list, reason);
}
static void subchannel_data_cancel_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_data* sd, const char* reason) {
+ grpc_lb_subchannel_data* sd, const char* reason) {
if (sd->subchannel_list->tracer->enabled()) {
gpr_log(GPR_DEBUG,
"[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
@@ -240,14 +234,12 @@ static void subchannel_data_cancel_connectivity_watch(
(size_t)(sd - sd->subchannel_list->subchannels),
sd->subchannel_list->num_subchannels, sd->subchannel, reason);
}
- grpc_subchannel_notify_on_state_change(exec_ctx, sd->subchannel, nullptr,
- nullptr,
+ grpc_subchannel_notify_on_state_change(sd->subchannel, nullptr, nullptr,
&sd->connectivity_changed_closure);
}
void grpc_lb_subchannel_list_shutdown_and_unref(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list,
- const char* reason) {
+ grpc_lb_subchannel_list* subchannel_list, const char* reason) {
if (subchannel_list->tracer->enabled()) {
gpr_log(GPR_DEBUG, "[%s %p] Shutting down subchannel_list %p (%s)",
subchannel_list->tracer->name(), subchannel_list->policy,
@@ -261,10 +253,10 @@ void grpc_lb_subchannel_list_shutdown_and_unref(
// the callback is responsible for unreffing the subchannel.
// Otherwise, unref the subchannel directly.
if (sd->connectivity_notification_pending) {
- subchannel_data_cancel_connectivity_watch(exec_ctx, sd, reason);
+ subchannel_data_cancel_connectivity_watch(sd, reason);
} else if (sd->subchannel != nullptr) {
- grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, reason);
+ grpc_lb_subchannel_data_unref_subchannel(sd, reason);
}
}
- grpc_lb_subchannel_list_unref(exec_ctx, subchannel_list, reason);
+ grpc_lb_subchannel_list_unref(subchannel_list, reason);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
index e3e5eba56a..0f8cea9347 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
@@ -65,8 +65,7 @@ typedef struct {
} grpc_lb_subchannel_data;
/// Unrefs the subchannel contained in sd.
-void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_data* sd,
+void grpc_lb_subchannel_data_unref_subchannel(grpc_lb_subchannel_data* sd,
const char* reason);
/// Starts watching the connectivity state of the subchannel.
@@ -74,11 +73,11 @@ void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
/// grpc_lb_subchannel_data_stop_connectivity_watch() or again call
/// grpc_lb_subchannel_data_start_connectivity_watch().
void grpc_lb_subchannel_data_start_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_data* sd);
+ grpc_lb_subchannel_data* sd);
/// Stops watching the connectivity state of the subchannel.
void grpc_lb_subchannel_data_stop_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_data* sd);
+ grpc_lb_subchannel_data* sd);
struct grpc_lb_subchannel_list {
/** backpointer to owning policy */
@@ -117,15 +116,14 @@ struct grpc_lb_subchannel_list {
};
grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy* p, grpc_core::TraceFlag* tracer,
+ grpc_lb_policy* p, grpc_core::TraceFlag* tracer,
const grpc_lb_addresses* addresses, const grpc_lb_policy_args* args,
grpc_iomgr_cb_func connectivity_changed_cb);
void grpc_lb_subchannel_list_ref(grpc_lb_subchannel_list* subchannel_list,
const char* reason);
-void grpc_lb_subchannel_list_unref(grpc_exec_ctx* exec_ctx,
- grpc_lb_subchannel_list* subchannel_list,
+void grpc_lb_subchannel_list_unref(grpc_lb_subchannel_list* subchannel_list,
const char* reason);
/// Takes and releases refs needed for a connectivity notification.
@@ -133,13 +131,11 @@ void grpc_lb_subchannel_list_unref(grpc_exec_ctx* exec_ctx,
void grpc_lb_subchannel_list_ref_for_connectivity_watch(
grpc_lb_subchannel_list* subchannel_list, const char* reason);
void grpc_lb_subchannel_list_unref_for_connectivity_watch(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list,
- const char* reason);
+ grpc_lb_subchannel_list* subchannel_list, const char* reason);
/// Mark subchannel_list as discarded. Unsubscribes all its subchannels. The
/// connectivity state notification callback will ultimately unref it.
void grpc_lb_subchannel_list_shutdown_and_unref(
- grpc_exec_ctx* exec_ctx, grpc_lb_subchannel_list* subchannel_list,
- const char* reason);
+ grpc_lb_subchannel_list* subchannel_list, const char* reason);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_SUBCHANNEL_LIST_H */
diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.cc b/src/core/ext/filters/client_channel/lb_policy_factory.cc
index d43f9fd1b9..dbf69fdcba 100644
--- a/src/core/ext/filters/client_channel/lb_policy_factory.cc
+++ b/src/core/ext/filters/client_channel/lb_policy_factory.cc
@@ -112,13 +112,11 @@ int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1,
return 0;
}
-void grpc_lb_addresses_destroy(grpc_exec_ctx* exec_ctx,
- grpc_lb_addresses* addresses) {
+void grpc_lb_addresses_destroy(grpc_lb_addresses* addresses) {
for (size_t i = 0; i < addresses->num_addresses; ++i) {
gpr_free(addresses->addresses[i].balancer_name);
if (addresses->addresses[i].user_data != nullptr) {
- addresses->user_data_vtable->destroy(exec_ctx,
- addresses->addresses[i].user_data);
+ addresses->user_data_vtable->destroy(addresses->addresses[i].user_data);
}
}
gpr_free(addresses->addresses);
@@ -128,8 +126,8 @@ void grpc_lb_addresses_destroy(grpc_exec_ctx* exec_ctx,
static void* lb_addresses_copy(void* addresses) {
return grpc_lb_addresses_copy((grpc_lb_addresses*)addresses);
}
-static void lb_addresses_destroy(grpc_exec_ctx* exec_ctx, void* addresses) {
- grpc_lb_addresses_destroy(exec_ctx, (grpc_lb_addresses*)addresses);
+static void lb_addresses_destroy(void* addresses) {
+ grpc_lb_addresses_destroy((grpc_lb_addresses*)addresses);
}
static int lb_addresses_cmp(void* addresses1, void* addresses2) {
return grpc_lb_addresses_cmp((grpc_lb_addresses*)addresses1,
@@ -162,8 +160,7 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory* factory) {
}
grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory,
- grpc_lb_policy_args* args) {
+ grpc_lb_policy_factory* factory, grpc_lb_policy_args* args) {
if (factory == nullptr) return nullptr;
- return factory->vtable->create_lb_policy(exec_ctx, factory, args);
+ return factory->vtable->create_lb_policy(factory, args);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.h b/src/core/ext/filters/client_channel/lb_policy_factory.h
index 8f6d8c1b08..9da231b657 100644
--- a/src/core/ext/filters/client_channel/lb_policy_factory.h
+++ b/src/core/ext/filters/client_channel/lb_policy_factory.h
@@ -50,7 +50,7 @@ typedef struct grpc_lb_address {
typedef struct grpc_lb_user_data_vtable {
void* (*copy)(void*);
- void (*destroy)(grpc_exec_ctx* exec_ctx, void*);
+ void (*destroy)(void*);
int (*cmp)(void*, void*);
} grpc_lb_user_data_vtable;
@@ -91,8 +91,7 @@ int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1,
const grpc_lb_addresses* addresses2);
/** Destroys \a addresses. */
-void grpc_lb_addresses_destroy(grpc_exec_ctx* exec_ctx,
- grpc_lb_addresses* addresses);
+void grpc_lb_addresses_destroy(grpc_lb_addresses* addresses);
/** Returns a channel arg containing \a addresses. */
grpc_arg grpc_lb_addresses_create_channel_arg(
@@ -114,8 +113,7 @@ struct grpc_lb_policy_factory_vtable {
void (*unref)(grpc_lb_policy_factory* factory);
/** Implementation of grpc_lb_policy_factory_create_lb_policy */
- grpc_lb_policy* (*create_lb_policy)(grpc_exec_ctx* exec_ctx,
- grpc_lb_policy_factory* factory,
+ grpc_lb_policy* (*create_lb_policy)(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args);
/** Name for the LB policy this factory implements */
@@ -127,7 +125,6 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory* factory);
/** Create a lb_policy instance. */
grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy(
- grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory,
- grpc_lb_policy_args* args);
+ grpc_lb_policy_factory* factory, grpc_lb_policy_args* args);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_FACTORY_H */
diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc
index 6e710e86d9..edd0330c6a 100644
--- a/src/core/ext/filters/client_channel/lb_policy_registry.cc
+++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc
@@ -61,10 +61,10 @@ static grpc_lb_policy_factory* lookup_factory(const char* name) {
return nullptr;
}
-grpc_lb_policy* grpc_lb_policy_create(grpc_exec_ctx* exec_ctx, const char* name,
+grpc_lb_policy* grpc_lb_policy_create(const char* name,
grpc_lb_policy_args* args) {
grpc_lb_policy_factory* factory = lookup_factory(name);
grpc_lb_policy* lb_policy =
- grpc_lb_policy_factory_create_lb_policy(exec_ctx, factory, args);
+ grpc_lb_policy_factory_create_lb_policy(factory, args);
return lb_policy;
}
diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.h b/src/core/ext/filters/client_channel/lb_policy_registry.h
index acddc90fdd..5aff79376b 100644
--- a/src/core/ext/filters/client_channel/lb_policy_registry.h
+++ b/src/core/ext/filters/client_channel/lb_policy_registry.h
@@ -34,7 +34,7 @@ void grpc_register_lb_policy(grpc_lb_policy_factory* factory);
*
* If \a name is NULL, the default factory from \a grpc_lb_policy_registry_init
* will be returned. */
-grpc_lb_policy* grpc_lb_policy_create(grpc_exec_ctx* exec_ctx, const char* name,
+grpc_lb_policy* grpc_lb_policy_create(const char* name,
grpc_lb_policy_args* args);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_REGISTRY_H */
diff --git a/src/core/ext/filters/client_channel/proxy_mapper.cc b/src/core/ext/filters/client_channel/proxy_mapper.cc
index c6ea5fc680..be85cfcced 100644
--- a/src/core/ext/filters/client_channel/proxy_mapper.cc
+++ b/src/core/ext/filters/client_channel/proxy_mapper.cc
@@ -23,24 +23,22 @@ void grpc_proxy_mapper_init(const grpc_proxy_mapper_vtable* vtable,
mapper->vtable = vtable;
}
-bool grpc_proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+bool grpc_proxy_mapper_map_name(grpc_proxy_mapper* mapper,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
- return mapper->vtable->map_name(exec_ctx, mapper, server_uri, args,
- name_to_resolve, new_args);
+ return mapper->vtable->map_name(mapper, server_uri, args, name_to_resolve,
+ new_args);
}
-bool grpc_proxy_mapper_map_address(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+bool grpc_proxy_mapper_map_address(grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
grpc_channel_args** new_args) {
- return mapper->vtable->map_address(exec_ctx, mapper, address, args,
- new_address, new_args);
+ return mapper->vtable->map_address(mapper, address, args, new_address,
+ new_args);
}
void grpc_proxy_mapper_destroy(grpc_proxy_mapper* mapper) {
diff --git a/src/core/ext/filters/client_channel/proxy_mapper.h b/src/core/ext/filters/client_channel/proxy_mapper.h
index a13861ccaf..ce3e65ee46 100644
--- a/src/core/ext/filters/client_channel/proxy_mapper.h
+++ b/src/core/ext/filters/client_channel/proxy_mapper.h
@@ -32,14 +32,14 @@ typedef struct {
/// If no proxy is needed, returns false.
/// Otherwise, sets \a name_to_resolve, optionally sets \a new_args,
/// and returns true.
- bool (*map_name)(grpc_exec_ctx* exec_ctx, grpc_proxy_mapper* mapper,
- const char* server_uri, const grpc_channel_args* args,
- char** name_to_resolve, grpc_channel_args** new_args);
+ bool (*map_name)(grpc_proxy_mapper* mapper, const char* server_uri,
+ const grpc_channel_args* args, char** name_to_resolve,
+ grpc_channel_args** new_args);
/// Determines the proxy address to use to contact \a address.
/// If no proxy is needed, returns false.
/// Otherwise, sets \a new_address, optionally sets \a new_args, and
/// returns true.
- bool (*map_address)(grpc_exec_ctx* exec_ctx, grpc_proxy_mapper* mapper,
+ bool (*map_address)(grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
@@ -55,15 +55,13 @@ struct grpc_proxy_mapper {
void grpc_proxy_mapper_init(const grpc_proxy_mapper_vtable* vtable,
grpc_proxy_mapper* mapper);
-bool grpc_proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+bool grpc_proxy_mapper_map_name(grpc_proxy_mapper* mapper,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args);
-bool grpc_proxy_mapper_map_address(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper* mapper,
+bool grpc_proxy_mapper_map_address(grpc_proxy_mapper* mapper,
const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.cc b/src/core/ext/filters/client_channel/proxy_mapper_registry.cc
index 09967eea3c..51778a20cc 100644
--- a/src/core/ext/filters/client_channel/proxy_mapper_registry.cc
+++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.cc
@@ -46,14 +46,13 @@ static void grpc_proxy_mapper_list_register(grpc_proxy_mapper_list* list,
++list->num_mappers;
}
-static bool grpc_proxy_mapper_list_map_name(grpc_exec_ctx* exec_ctx,
- grpc_proxy_mapper_list* list,
+static bool grpc_proxy_mapper_list_map_name(grpc_proxy_mapper_list* list,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
for (size_t i = 0; i < list->num_mappers; ++i) {
- if (grpc_proxy_mapper_map_name(exec_ctx, list->list[i], server_uri, args,
+ if (grpc_proxy_mapper_map_name(list->list[i], server_uri, args,
name_to_resolve, new_args)) {
return true;
}
@@ -62,12 +61,12 @@ static bool grpc_proxy_mapper_list_map_name(grpc_exec_ctx* exec_ctx,
}
static bool grpc_proxy_mapper_list_map_address(
- grpc_exec_ctx* exec_ctx, grpc_proxy_mapper_list* list,
- const grpc_resolved_address* address, const grpc_channel_args* args,
- grpc_resolved_address** new_address, grpc_channel_args** new_args) {
+ grpc_proxy_mapper_list* list, const grpc_resolved_address* address,
+ const grpc_channel_args* args, grpc_resolved_address** new_address,
+ grpc_channel_args** new_args) {
for (size_t i = 0; i < list->num_mappers; ++i) {
- if (grpc_proxy_mapper_map_address(exec_ctx, list->list[i], address, args,
- new_address, new_args)) {
+ if (grpc_proxy_mapper_map_address(list->list[i], address, args, new_address,
+ new_args)) {
return true;
}
}
@@ -105,20 +104,17 @@ void grpc_proxy_mapper_register(bool at_start, grpc_proxy_mapper* mapper) {
grpc_proxy_mapper_list_register(&g_proxy_mapper_list, at_start, mapper);
}
-bool grpc_proxy_mappers_map_name(grpc_exec_ctx* exec_ctx,
- const char* server_uri,
+bool grpc_proxy_mappers_map_name(const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
- return grpc_proxy_mapper_list_map_name(exec_ctx, &g_proxy_mapper_list,
- server_uri, args, name_to_resolve,
- new_args);
+ return grpc_proxy_mapper_list_map_name(&g_proxy_mapper_list, server_uri, args,
+ name_to_resolve, new_args);
}
-bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx,
- const grpc_resolved_address* address,
+bool grpc_proxy_mappers_map_address(const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
grpc_channel_args** new_args) {
- return grpc_proxy_mapper_list_map_address(
- exec_ctx, &g_proxy_mapper_list, address, args, new_address, new_args);
+ return grpc_proxy_mapper_list_map_address(&g_proxy_mapper_list, address, args,
+ new_address, new_args);
}
diff --git a/src/core/ext/filters/client_channel/proxy_mapper_registry.h b/src/core/ext/filters/client_channel/proxy_mapper_registry.h
index 99e54d1a78..2ad6c04e1d 100644
--- a/src/core/ext/filters/client_channel/proxy_mapper_registry.h
+++ b/src/core/ext/filters/client_channel/proxy_mapper_registry.h
@@ -29,14 +29,12 @@ void grpc_proxy_mapper_registry_shutdown();
/// the list. Otherwise, it will be added to the end.
void grpc_proxy_mapper_register(bool at_start, grpc_proxy_mapper* mapper);
-bool grpc_proxy_mappers_map_name(grpc_exec_ctx* exec_ctx,
- const char* server_uri,
+bool grpc_proxy_mappers_map_name(const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args);
-bool grpc_proxy_mappers_map_address(grpc_exec_ctx* exec_ctx,
- const grpc_resolved_address* address,
+bool grpc_proxy_mappers_map_address(const grpc_resolved_address* address,
const grpc_channel_args* args,
grpc_resolved_address** new_address,
grpc_channel_args** new_args);
diff --git a/src/core/ext/filters/client_channel/resolver.cc b/src/core/ext/filters/client_channel/resolver.cc
index c16b1515c7..ff54e7179d 100644
--- a/src/core/ext/filters/client_channel/resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver.cc
@@ -46,8 +46,8 @@ void grpc_resolver_ref(grpc_resolver* resolver) {
}
#ifndef NDEBUG
-void grpc_resolver_unref(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
- const char* file, int line, const char* reason) {
+void grpc_resolver_unref(grpc_resolver* resolver, const char* file, int line,
+ const char* reason) {
if (grpc_trace_resolver_refcount.enabled()) {
gpr_atm old_refs = gpr_atm_no_barrier_load(&resolver->refs.count);
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG,
@@ -55,27 +55,25 @@ void grpc_resolver_unref(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
old_refs, old_refs - 1, reason);
}
#else
-void grpc_resolver_unref(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver) {
+void grpc_resolver_unref(grpc_resolver* resolver) {
#endif
if (gpr_unref(&resolver->refs)) {
grpc_combiner* combiner = resolver->combiner;
- resolver->vtable->destroy(exec_ctx, resolver);
- GRPC_COMBINER_UNREF(exec_ctx, combiner, "resolver");
+ resolver->vtable->destroy(resolver);
+ GRPC_COMBINER_UNREF(combiner, "resolver");
}
}
-void grpc_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
- resolver->vtable->shutdown_locked(exec_ctx, resolver);
+void grpc_resolver_shutdown_locked(grpc_resolver* resolver) {
+ resolver->vtable->shutdown_locked(resolver);
}
-void grpc_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
- resolver->vtable->channel_saw_error_locked(exec_ctx, resolver);
+void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
+ resolver->vtable->channel_saw_error_locked(resolver);
}
-void grpc_resolver_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
+void grpc_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** result,
grpc_closure* on_complete) {
- resolver->vtable->next_locked(exec_ctx, resolver, result, on_complete);
+ resolver->vtable->next_locked(resolver, result, on_complete);
}
diff --git a/src/core/ext/filters/client_channel/resolver.h b/src/core/ext/filters/client_channel/resolver.h
index 4e8cfbe417..f6a4af01d6 100644
--- a/src/core/ext/filters/client_channel/resolver.h
+++ b/src/core/ext/filters/client_channel/resolver.h
@@ -35,43 +35,40 @@ struct grpc_resolver {
};
struct grpc_resolver_vtable {
- void (*destroy)(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver);
- void (*shutdown_locked)(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver);
- void (*channel_saw_error_locked)(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver);
- void (*next_locked)(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
- grpc_channel_args** result, grpc_closure* on_complete);
+ void (*destroy)(grpc_resolver* resolver);
+ void (*shutdown_locked)(grpc_resolver* resolver);
+ void (*channel_saw_error_locked)(grpc_resolver* resolver);
+ void (*next_locked)(grpc_resolver* resolver, grpc_channel_args** result,
+ grpc_closure* on_complete);
};
#ifndef NDEBUG
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_RESOLVER_UNREF(e, p, r) \
- grpc_resolver_unref((e), (p), __FILE__, __LINE__, (r))
+#define GRPC_RESOLVER_UNREF(p, r) \
+ grpc_resolver_unref((p), __FILE__, __LINE__, (r))
void grpc_resolver_ref(grpc_resolver* policy, const char* file, int line,
const char* reason);
-void grpc_resolver_unref(grpc_exec_ctx* exec_ctx, grpc_resolver* policy,
- const char* file, int line, const char* reason);
+void grpc_resolver_unref(grpc_resolver* policy, const char* file, int line,
+ const char* reason);
#else
#define GRPC_RESOLVER_REF(p, r) grpc_resolver_ref((p))
-#define GRPC_RESOLVER_UNREF(e, p, r) grpc_resolver_unref((e), (p))
+#define GRPC_RESOLVER_UNREF(p, r) grpc_resolver_unref((p))
void grpc_resolver_ref(grpc_resolver* policy);
-void grpc_resolver_unref(grpc_exec_ctx* exec_ctx, grpc_resolver* policy);
+void grpc_resolver_unref(grpc_resolver* policy);
#endif
void grpc_resolver_init(grpc_resolver* resolver,
const grpc_resolver_vtable* vtable,
grpc_combiner* combiner);
-void grpc_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver);
+void grpc_resolver_shutdown_locked(grpc_resolver* resolver);
/** Notification that the channel has seen an error on some address.
Can be used as a hint that re-resolution is desirable soon.
Must be called from the combiner passed as a resolver_arg at construction
time.*/
-void grpc_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver);
+void grpc_resolver_channel_saw_error_locked(grpc_resolver* resolver);
/** Get the next result from the resolver. Expected to set \a *result with
new channel args and then schedule \a on_complete for execution.
@@ -81,7 +78,7 @@ void grpc_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
Must be called from the combiner passed as a resolver_arg at construction
time.*/
-void grpc_resolver_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
+void grpc_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** result,
grpc_closure* on_complete);
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
index 3a16b3492d..4ec4477c82 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@@ -97,17 +97,14 @@ typedef struct {
char* service_config_json;
} ares_dns_resolver;
-static void dns_ares_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
+static void dns_ares_destroy(grpc_resolver* r);
-static void dns_ares_start_resolving_locked(grpc_exec_ctx* exec_ctx,
- ares_dns_resolver* r);
-static void dns_ares_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- ares_dns_resolver* r);
+static void dns_ares_start_resolving_locked(ares_dns_resolver* r);
+static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r);
-static void dns_ares_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
-static void dns_ares_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* r);
-static void dns_ares_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r,
+static void dns_ares_shutdown_locked(grpc_resolver* r);
+static void dns_ares_channel_saw_error_locked(grpc_resolver* r);
+static void dns_ares_next_locked(grpc_resolver* r,
grpc_channel_args** target_result,
grpc_closure* on_complete);
@@ -115,43 +112,39 @@ static const grpc_resolver_vtable dns_ares_resolver_vtable = {
dns_ares_destroy, dns_ares_shutdown_locked,
dns_ares_channel_saw_error_locked, dns_ares_next_locked};
-static void dns_ares_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void dns_ares_shutdown_locked(grpc_resolver* resolver) {
ares_dns_resolver* r = (ares_dns_resolver*)resolver;
if (r->have_retry_timer) {
- grpc_timer_cancel(exec_ctx, &r->retry_timer);
+ grpc_timer_cancel(&r->retry_timer);
}
if (r->pending_request != nullptr) {
- grpc_cancel_ares_request(exec_ctx, r->pending_request);
+ grpc_cancel_ares_request(r->pending_request);
}
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
- GRPC_CLOSURE_SCHED(
- exec_ctx, r->next_completion,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Resolver Shutdown"));
r->next_completion = nullptr;
}
}
-static void dns_ares_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void dns_ares_channel_saw_error_locked(grpc_resolver* resolver) {
ares_dns_resolver* r = (ares_dns_resolver*)resolver;
if (!r->resolving) {
grpc_backoff_reset(&r->backoff_state);
- dns_ares_start_resolving_locked(exec_ctx, r);
+ dns_ares_start_resolving_locked(r);
}
}
-static void dns_ares_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void dns_ares_on_retry_timer_locked(void* arg, grpc_error* error) {
ares_dns_resolver* r = (ares_dns_resolver*)arg;
r->have_retry_timer = false;
if (error == GRPC_ERROR_NONE) {
if (!r->resolving) {
- dns_ares_start_resolving_locked(exec_ctx, r);
+ dns_ares_start_resolving_locked(r);
}
}
- GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "retry-timer");
+ GRPC_RESOLVER_UNREF(&r->base, "retry-timer");
}
static bool value_in_json_array(grpc_json* array, const char* value) {
@@ -226,8 +219,7 @@ static char* choose_service_config(char* service_config_choice_json) {
return service_config;
}
-static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
ares_dns_resolver* r = (ares_dns_resolver*)arg;
grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
@@ -268,13 +260,13 @@ static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
num_args_to_add);
if (service_config != nullptr) grpc_service_config_destroy(service_config);
gpr_free(service_config_string);
- grpc_lb_addresses_destroy(exec_ctx, r->lb_addresses);
+ grpc_lb_addresses_destroy(r->lb_addresses);
} else {
const char* msg = grpc_error_string(error);
gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
grpc_millis next_try =
- grpc_backoff_step(exec_ctx, &r->backoff_state).next_attempt_start_time;
- grpc_millis timeout = next_try - grpc_exec_ctx_now(exec_ctx);
+ grpc_backoff_step(&r->backoff_state).next_attempt_start_time;
+ grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_retry_timer);
@@ -285,20 +277,19 @@ static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
} else {
gpr_log(GPR_DEBUG, "retrying immediately");
}
- grpc_timer_init(exec_ctx, &r->retry_timer, next_try,
+ grpc_timer_init(&r->retry_timer, next_try,
&r->dns_ares_on_retry_timer_locked);
}
if (r->resolved_result != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->resolved_result);
+ grpc_channel_args_destroy(r->resolved_result);
}
r->resolved_result = result;
r->resolved_version++;
- dns_ares_maybe_finish_next_locked(exec_ctx, r);
- GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "dns-resolving");
+ dns_ares_maybe_finish_next_locked(r);
+ GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
}
-static void dns_ares_next_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver,
+static void dns_ares_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
gpr_log(GPR_DEBUG, "dns_ares_next is called.");
@@ -308,56 +299,53 @@ static void dns_ares_next_locked(grpc_exec_ctx* exec_ctx,
r->target_result = target_result;
if (r->resolved_version == 0 && !r->resolving) {
grpc_backoff_reset(&r->backoff_state);
- dns_ares_start_resolving_locked(exec_ctx, r);
+ dns_ares_start_resolving_locked(r);
} else {
- dns_ares_maybe_finish_next_locked(exec_ctx, r);
+ dns_ares_maybe_finish_next_locked(r);
}
}
-static void dns_ares_start_resolving_locked(grpc_exec_ctx* exec_ctx,
- ares_dns_resolver* r) {
+static void dns_ares_start_resolving_locked(ares_dns_resolver* r) {
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
r->lb_addresses = nullptr;
r->service_config_json = nullptr;
r->pending_request = grpc_dns_lookup_ares(
- exec_ctx, r->dns_server, r->name_to_resolve, r->default_port,
- r->interested_parties, &r->dns_ares_on_resolved_locked, &r->lb_addresses,
+ r->dns_server, r->name_to_resolve, r->default_port, r->interested_parties,
+ &r->dns_ares_on_resolved_locked, &r->lb_addresses,
true /* check_grpclb */,
r->request_service_config ? &r->service_config_json : nullptr);
}
-static void dns_ares_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- ares_dns_resolver* r) {
+static void dns_ares_maybe_finish_next_locked(ares_dns_resolver* r) {
if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
*r->target_result = r->resolved_result == nullptr
? nullptr
: grpc_channel_args_copy(r->resolved_result);
gpr_log(GPR_DEBUG, "dns_ares_maybe_finish_next_locked");
- GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
r->published_version = r->resolved_version;
}
}
-static void dns_ares_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
+static void dns_ares_destroy(grpc_resolver* gr) {
gpr_log(GPR_DEBUG, "dns_ares_destroy");
ares_dns_resolver* r = (ares_dns_resolver*)gr;
if (r->resolved_result != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->resolved_result);
+ grpc_channel_args_destroy(r->resolved_result);
}
- grpc_pollset_set_destroy(exec_ctx, r->interested_parties);
+ grpc_pollset_set_destroy(r->interested_parties);
gpr_free(r->dns_server);
gpr_free(r->name_to_resolve);
gpr_free(r->default_port);
- grpc_channel_args_destroy(exec_ctx, r->channel_args);
+ grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
-static grpc_resolver* dns_ares_create(grpc_exec_ctx* exec_ctx,
- grpc_resolver_args* args,
+static grpc_resolver* dns_ares_create(grpc_resolver_args* args,
const char* default_port) {
/* Get name from args. */
const char* path = args->uri->path;
@@ -378,8 +366,7 @@ static grpc_resolver* dns_ares_create(grpc_exec_ctx* exec_ctx,
arg, (grpc_integer_options){false, false, true});
r->interested_parties = grpc_pollset_set_create();
if (args->pollset_set != nullptr) {
- grpc_pollset_set_add_pollset_set(exec_ctx, r->interested_parties,
- args->pollset_set);
+ grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
}
grpc_backoff_init(
&r->backoff_state, GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000,
@@ -404,9 +391,8 @@ static void dns_ares_factory_ref(grpc_resolver_factory* factory) {}
static void dns_ares_factory_unref(grpc_resolver_factory* factory) {}
static grpc_resolver* dns_factory_create_resolver(
- grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory,
- grpc_resolver_args* args) {
- return dns_ares_create(exec_ctx, args, "https");
+ grpc_resolver_factory* factory, grpc_resolver_args* args) {
+ return dns_ares_create(args, "https");
}
static char* dns_ares_factory_get_default_host_name(
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
index 03ea36bfcc..ba7dad63cf 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
@@ -28,8 +28,7 @@ typedef struct grpc_ares_ev_driver grpc_ares_ev_driver;
/* Start \a ev_driver. It will keep working until all IO on its ares_channel is
done, or grpc_ares_ev_driver_destroy() is called. It may notify the callbacks
bound to its ares_channel when necessary. */
-void grpc_ares_ev_driver_start(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver);
+void grpc_ares_ev_driver_start(grpc_ares_ev_driver* ev_driver);
/* Returns the ares_channel owned by \a ev_driver. To bind a c-ares query to
\a ev_driver, use the ares_channel owned by \a ev_driver as the arg of the
@@ -47,8 +46,7 @@ grpc_error* grpc_ares_ev_driver_create(grpc_ares_ev_driver** ev_driver,
void grpc_ares_ev_driver_destroy(grpc_ares_ev_driver* ev_driver);
/* Shutdown all the grpc_fds used by \a ev_driver */
-void grpc_ares_ev_driver_shutdown(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver);
+void grpc_ares_ev_driver_shutdown(grpc_ares_ev_driver* ev_driver);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H \
*/
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
index 4cb068a41d..40e264504c 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
@@ -77,8 +77,7 @@ struct grpc_ares_ev_driver {
bool shutting_down;
};
-static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver);
+static void grpc_ares_notify_on_event_locked(grpc_ares_ev_driver* ev_driver);
static grpc_ares_ev_driver* grpc_ares_ev_driver_ref(
grpc_ares_ev_driver* ev_driver) {
@@ -98,7 +97,7 @@ static void grpc_ares_ev_driver_unref(grpc_ares_ev_driver* ev_driver) {
}
}
-static void fd_node_destroy(grpc_exec_ctx* exec_ctx, fd_node* fdn) {
+static void fd_node_destroy(fd_node* fdn) {
gpr_log(GPR_DEBUG, "delete fd: %d", grpc_fd_wrapped_fd(fdn->fd));
GPR_ASSERT(!fdn->readable_registered);
GPR_ASSERT(!fdn->writable_registered);
@@ -106,21 +105,20 @@ static void fd_node_destroy(grpc_exec_ctx* exec_ctx, fd_node* fdn) {
/* c-ares library has closed the fd inside grpc_fd. This fd may be picked up
immediately by another thread, and should not be closed by the following
grpc_fd_orphan. */
- grpc_fd_orphan(exec_ctx, fdn->fd, nullptr, nullptr, true /* already_closed */,
+ grpc_fd_orphan(fdn->fd, nullptr, nullptr, true /* already_closed */,
"c-ares query finished");
gpr_free(fdn);
}
-static void fd_node_shutdown(grpc_exec_ctx* exec_ctx, fd_node* fdn) {
+static void fd_node_shutdown(fd_node* fdn) {
gpr_mu_lock(&fdn->mu);
fdn->shutting_down = true;
if (!fdn->readable_registered && !fdn->writable_registered) {
gpr_mu_unlock(&fdn->mu);
- fd_node_destroy(exec_ctx, fdn);
+ fd_node_destroy(fdn);
} else {
grpc_fd_shutdown(
- exec_ctx, fdn->fd,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("c-ares fd shutdown"));
+ fdn->fd, GRPC_ERROR_CREATE_FROM_STATIC_STRING("c-ares fd shutdown"));
gpr_mu_unlock(&fdn->mu);
}
}
@@ -160,15 +158,13 @@ void grpc_ares_ev_driver_destroy(grpc_ares_ev_driver* ev_driver) {
grpc_ares_ev_driver_unref(ev_driver);
}
-void grpc_ares_ev_driver_shutdown(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver) {
+void grpc_ares_ev_driver_shutdown(grpc_ares_ev_driver* ev_driver) {
gpr_mu_lock(&ev_driver->mu);
ev_driver->shutting_down = true;
fd_node* fn = ev_driver->fds;
while (fn != nullptr) {
- grpc_fd_shutdown(
- exec_ctx, fn->fd,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("grpc_ares_ev_driver_shutdown"));
+ grpc_fd_shutdown(fn->fd, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "grpc_ares_ev_driver_shutdown"));
fn = fn->next;
}
gpr_mu_unlock(&ev_driver->mu);
@@ -199,8 +195,7 @@ static bool grpc_ares_is_fd_still_readable(grpc_ares_ev_driver* ev_driver,
return ioctl(fd, FIONREAD, &bytes_available) == 0 && bytes_available > 0;
}
-static void on_readable_cb(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_readable_cb(void* arg, grpc_error* error) {
fd_node* fdn = (fd_node*)arg;
grpc_ares_ev_driver* ev_driver = fdn->ev_driver;
gpr_mu_lock(&fdn->mu);
@@ -208,7 +203,7 @@ static void on_readable_cb(grpc_exec_ctx* exec_ctx, void* arg,
fdn->readable_registered = false;
if (fdn->shutting_down && !fdn->writable_registered) {
gpr_mu_unlock(&fdn->mu);
- fd_node_destroy(exec_ctx, fdn);
+ fd_node_destroy(fdn);
grpc_ares_ev_driver_unref(ev_driver);
return;
}
@@ -229,13 +224,12 @@ static void on_readable_cb(grpc_exec_ctx* exec_ctx, void* arg,
ares_cancel(ev_driver->channel);
}
gpr_mu_lock(&ev_driver->mu);
- grpc_ares_notify_on_event_locked(exec_ctx, ev_driver);
+ grpc_ares_notify_on_event_locked(ev_driver);
gpr_mu_unlock(&ev_driver->mu);
grpc_ares_ev_driver_unref(ev_driver);
}
-static void on_writable_cb(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_writable_cb(void* arg, grpc_error* error) {
fd_node* fdn = (fd_node*)arg;
grpc_ares_ev_driver* ev_driver = fdn->ev_driver;
gpr_mu_lock(&fdn->mu);
@@ -243,7 +237,7 @@ static void on_writable_cb(grpc_exec_ctx* exec_ctx, void* arg,
fdn->writable_registered = false;
if (fdn->shutting_down && !fdn->readable_registered) {
gpr_mu_unlock(&fdn->mu);
- fd_node_destroy(exec_ctx, fdn);
+ fd_node_destroy(fdn);
grpc_ares_ev_driver_unref(ev_driver);
return;
}
@@ -262,7 +256,7 @@ static void on_writable_cb(grpc_exec_ctx* exec_ctx, void* arg,
ares_cancel(ev_driver->channel);
}
gpr_mu_lock(&ev_driver->mu);
- grpc_ares_notify_on_event_locked(exec_ctx, ev_driver);
+ grpc_ares_notify_on_event_locked(ev_driver);
gpr_mu_unlock(&ev_driver->mu);
grpc_ares_ev_driver_unref(ev_driver);
}
@@ -273,8 +267,7 @@ ares_channel* grpc_ares_ev_driver_get_channel(grpc_ares_ev_driver* ev_driver) {
// Get the file descriptors used by the ev_driver's ares channel, register
// driver_closure with these filedescriptors.
-static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver) {
+static void grpc_ares_notify_on_event_locked(grpc_ares_ev_driver* ev_driver) {
fd_node* new_list = nullptr;
if (!ev_driver->shutting_down) {
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
@@ -300,7 +293,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&fdn->write_closure, on_writable_cb, fdn,
grpc_schedule_on_exec_ctx);
- grpc_pollset_set_add_fd(exec_ctx, ev_driver->pollset_set, fdn->fd);
+ grpc_pollset_set_add_fd(ev_driver->pollset_set, fdn->fd);
gpr_free(fd_name);
}
fdn->next = new_list;
@@ -312,7 +305,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
!fdn->readable_registered) {
grpc_ares_ev_driver_ref(ev_driver);
gpr_log(GPR_DEBUG, "notify read on: %d", grpc_fd_wrapped_fd(fdn->fd));
- grpc_fd_notify_on_read(exec_ctx, fdn->fd, &fdn->read_closure);
+ grpc_fd_notify_on_read(fdn->fd, &fdn->read_closure);
fdn->readable_registered = true;
}
// Register write_closure if the socket is writable and write_closure
@@ -322,7 +315,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "notify write on: %d",
grpc_fd_wrapped_fd(fdn->fd));
grpc_ares_ev_driver_ref(ev_driver);
- grpc_fd_notify_on_write(exec_ctx, fdn->fd, &fdn->write_closure);
+ grpc_fd_notify_on_write(fdn->fd, &fdn->write_closure);
fdn->writable_registered = true;
}
gpr_mu_unlock(&fdn->mu);
@@ -335,7 +328,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
while (ev_driver->fds != nullptr) {
fd_node* cur = ev_driver->fds;
ev_driver->fds = ev_driver->fds->next;
- fd_node_shutdown(exec_ctx, cur);
+ fd_node_shutdown(cur);
}
ev_driver->fds = new_list;
// If the ev driver has no working fd, all the tasks are done.
@@ -345,12 +338,11 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
}
}
-void grpc_ares_ev_driver_start(grpc_exec_ctx* exec_ctx,
- grpc_ares_ev_driver* ev_driver) {
+void grpc_ares_ev_driver_start(grpc_ares_ev_driver* ev_driver) {
gpr_mu_lock(&ev_driver->mu);
if (!ev_driver->working) {
ev_driver->working = true;
- grpc_ares_notify_on_event_locked(exec_ctx, ev_driver);
+ grpc_ares_notify_on_event_locked(ev_driver);
}
gpr_mu_unlock(&ev_driver->mu);
}
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index 7846576c11..3a870b2d06 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -96,24 +96,12 @@ static void grpc_ares_request_ref(grpc_ares_request* r) {
gpr_ref(&r->pending_queries);
}
-static void grpc_ares_request_unref(grpc_exec_ctx* exec_ctx,
- grpc_ares_request* r) {
+static void grpc_ares_request_unref(grpc_ares_request* r) {
/* If there are no pending queries, invoke on_done callback and destroy the
request */
if (gpr_unref(&r->pending_queries)) {
/* TODO(zyc): Sort results with RFC6724 before invoking on_done. */
- if (exec_ctx == nullptr) {
- /* A new exec_ctx is created here, as the c-ares interface does not
- provide one in ares_host_callback. It's safe to schedule on_done with
- the newly created exec_ctx, since the caller has been warned not to
- acquire locks in on_done. ares_dns_resolver is using combiner to
- protect resources needed by on_done. */
- grpc_exec_ctx new_exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CLOSURE_SCHED(&new_exec_ctx, r->on_done, r->error);
- grpc_exec_ctx_finish(&new_exec_ctx);
- } else {
- GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, r->error);
- }
+ GRPC_CLOSURE_SCHED(r->on_done, r->error);
gpr_mu_destroy(&r->mu);
grpc_ares_ev_driver_destroy(r->ev_driver);
gpr_free(r);
@@ -133,9 +121,8 @@ static grpc_ares_hostbyname_request* create_hostbyname_request(
return hr;
}
-static void destroy_hostbyname_request(grpc_exec_ctx* exec_ctx,
- grpc_ares_hostbyname_request* hr) {
- grpc_ares_request_unref(exec_ctx, hr->parent_request);
+static void destroy_hostbyname_request(grpc_ares_hostbyname_request* hr) {
+ grpc_ares_request_unref(hr->parent_request);
gpr_free(hr->host);
gpr_free(hr);
}
@@ -220,13 +207,13 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
}
}
gpr_mu_unlock(&r->mu);
- destroy_hostbyname_request(nullptr, hr);
+ destroy_hostbyname_request(hr);
}
static void on_srv_query_done_cb(void* arg, int status, int timeouts,
unsigned char* abuf, int alen) {
grpc_ares_request* r = (grpc_ares_request*)arg;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
gpr_log(GPR_DEBUG, "on_query_srv_done_cb");
if (status == ARES_SUCCESS) {
gpr_log(GPR_DEBUG, "on_query_srv_done_cb ARES_SUCCESS");
@@ -246,7 +233,7 @@ static void on_srv_query_done_cb(void* arg, int status, int timeouts,
r, srv_it->host, htons(srv_it->port), true /* is_balancer */);
ares_gethostbyname(*channel, hr->host, AF_INET, on_hostbyname_done_cb,
hr);
- grpc_ares_ev_driver_start(&exec_ctx, r->ev_driver);
+ grpc_ares_ev_driver_start(r->ev_driver);
}
}
if (reply != nullptr) {
@@ -264,8 +251,7 @@ static void on_srv_query_done_cb(void* arg, int status, int timeouts,
r->error = grpc_error_add_child(error, r->error);
}
}
- grpc_ares_request_unref(&exec_ctx, r);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_ares_request_unref(r);
}
static const char g_service_config_attribute_prefix[] = "grpc_config=";
@@ -323,14 +309,13 @@ fail:
}
done:
gpr_mu_unlock(&r->mu);
- grpc_ares_request_unref(nullptr, r);
+ grpc_ares_request_unref(r);
}
static grpc_ares_request* grpc_dns_lookup_ares_impl(
- grpc_exec_ctx* exec_ctx, const char* dns_server, const char* name,
- const char* default_port, grpc_pollset_set* interested_parties,
- grpc_closure* on_done, grpc_lb_addresses** addrs, bool check_grpclb,
- char** service_config_json) {
+ const char* dns_server, const char* name, const char* default_port,
+ grpc_pollset_set* interested_parties, grpc_closure* on_done,
+ grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json) {
grpc_error* error = GRPC_ERROR_NONE;
grpc_ares_hostbyname_request* hr = nullptr;
grpc_ares_request* r = nullptr;
@@ -437,28 +422,28 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
gpr_free(config_name);
}
/* TODO(zyc): Handle CNAME records here. */
- grpc_ares_ev_driver_start(exec_ctx, r->ev_driver);
- grpc_ares_request_unref(exec_ctx, r);
+ grpc_ares_ev_driver_start(r->ev_driver);
+ grpc_ares_request_unref(r);
gpr_free(host);
gpr_free(port);
return r;
error_cleanup:
- GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
+ GRPC_CLOSURE_SCHED(on_done, error);
gpr_free(host);
gpr_free(port);
return nullptr;
}
grpc_ares_request* (*grpc_dns_lookup_ares)(
- grpc_exec_ctx* exec_ctx, const char* dns_server, const char* name,
- const char* default_port, grpc_pollset_set* interested_parties,
- grpc_closure* on_done, grpc_lb_addresses** addrs, bool check_grpclb,
+ const char* dns_server, const char* name, const char* default_port,
+ grpc_pollset_set* interested_parties, grpc_closure* on_done,
+ grpc_lb_addresses** addrs, bool check_grpclb,
char** service_config_json) = grpc_dns_lookup_ares_impl;
-void grpc_cancel_ares_request(grpc_exec_ctx* exec_ctx, grpc_ares_request* r) {
+void grpc_cancel_ares_request(grpc_ares_request* r) {
if (grpc_dns_lookup_ares == grpc_dns_lookup_ares_impl) {
- grpc_ares_ev_driver_shutdown(exec_ctx, r->ev_driver);
+ grpc_ares_ev_driver_shutdown(r->ev_driver);
}
}
@@ -501,8 +486,7 @@ typedef struct grpc_resolve_address_ares_request {
grpc_closure on_dns_lookup_done;
} grpc_resolve_address_ares_request;
-static void on_dns_lookup_done_cb(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_dns_lookup_done_cb(void* arg, grpc_error* error) {
grpc_resolve_address_ares_request* r =
(grpc_resolve_address_ares_request*)arg;
grpc_resolved_addresses** resolved_addresses = r->addrs_out;
@@ -520,14 +504,12 @@ static void on_dns_lookup_done_cb(grpc_exec_ctx* exec_ctx, void* arg,
&r->lb_addrs->addresses[i].address, sizeof(grpc_resolved_address));
}
}
- GRPC_CLOSURE_SCHED(exec_ctx, r->on_resolve_address_done,
- GRPC_ERROR_REF(error));
- grpc_lb_addresses_destroy(exec_ctx, r->lb_addrs);
+ GRPC_CLOSURE_SCHED(r->on_resolve_address_done, GRPC_ERROR_REF(error));
+ grpc_lb_addresses_destroy(r->lb_addrs);
gpr_free(r);
}
-static void grpc_resolve_address_ares_impl(grpc_exec_ctx* exec_ctx,
- const char* name,
+static void grpc_resolve_address_ares_impl(const char* name,
const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
@@ -539,14 +521,14 @@ static void grpc_resolve_address_ares_impl(grpc_exec_ctx* exec_ctx,
r->on_resolve_address_done = on_done;
GRPC_CLOSURE_INIT(&r->on_dns_lookup_done, on_dns_lookup_done_cb, r,
grpc_schedule_on_exec_ctx);
- grpc_dns_lookup_ares(exec_ctx, nullptr /* dns_server */, name, default_port,
+ grpc_dns_lookup_ares(nullptr /* dns_server */, name, default_port,
interested_parties, &r->on_dns_lookup_done, &r->lb_addrs,
false /* check_grpclb */,
nullptr /* service_config_json */);
}
void (*grpc_resolve_address_ares)(
- grpc_exec_ctx* exec_ctx, const char* name, const char* default_port,
+ const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_resolved_addresses** addrs) = grpc_resolve_address_ares_impl;
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h
index 72db622954..86d870e0a6 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h
@@ -32,8 +32,7 @@ typedef struct grpc_ares_request grpc_ares_request;
must be called at least once before this function. \a on_done may be
called directly in this function without being scheduled with \a exec_ctx,
so it must not try to acquire locks that are being held by the caller. */
-extern void (*grpc_resolve_address_ares)(grpc_exec_ctx* exec_ctx,
- const char* name,
+extern void (*grpc_resolve_address_ares)(const char* name,
const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
@@ -47,14 +46,13 @@ extern void (*grpc_resolve_address_ares)(grpc_exec_ctx* exec_ctx,
scheduled with \a exec_ctx, so it must not try to acquire locks that are
being held by the caller. */
extern grpc_ares_request* (*grpc_dns_lookup_ares)(
- grpc_exec_ctx* exec_ctx, const char* dns_server, const char* name,
- const char* default_port, grpc_pollset_set* interested_parties,
- grpc_closure* on_done, grpc_lb_addresses** addresses, bool check_grpclb,
+ const char* dns_server, const char* name, const char* default_port,
+ grpc_pollset_set* interested_parties, grpc_closure* on_done,
+ grpc_lb_addresses** addresses, bool check_grpclb,
char** service_config_json);
/* Cancel the pending grpc_ares_request \a request */
-void grpc_cancel_ares_request(grpc_exec_ctx* exec_ctx,
- grpc_ares_request* request);
+void grpc_cancel_ares_request(grpc_ares_request* request);
/* Initialize gRPC ares wrapper. Must be called at least once before
grpc_resolve_address_ares(). */
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc
index a68a7c47fb..a184cf2d57 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc
@@ -26,34 +26,32 @@ struct grpc_ares_request {
};
static grpc_ares_request* grpc_dns_lookup_ares_impl(
- grpc_exec_ctx* exec_ctx, const char* dns_server, const char* name,
- const char* default_port, grpc_pollset_set* interested_parties,
- grpc_closure* on_done, grpc_lb_addresses** addrs, bool check_grpclb,
- char** service_config_json) {
+ const char* dns_server, const char* name, const char* default_port,
+ grpc_pollset_set* interested_parties, grpc_closure* on_done,
+ grpc_lb_addresses** addrs, bool check_grpclb, char** service_config_json) {
return NULL;
}
grpc_ares_request* (*grpc_dns_lookup_ares)(
- grpc_exec_ctx* exec_ctx, const char* dns_server, const char* name,
- const char* default_port, grpc_pollset_set* interested_parties,
- grpc_closure* on_done, grpc_lb_addresses** addrs, bool check_grpclb,
+ const char* dns_server, const char* name, const char* default_port,
+ grpc_pollset_set* interested_parties, grpc_closure* on_done,
+ grpc_lb_addresses** addrs, bool check_grpclb,
char** service_config_json) = grpc_dns_lookup_ares_impl;
-void grpc_cancel_ares_request(grpc_exec_ctx* exec_ctx, grpc_ares_request* r) {}
+void grpc_cancel_ares_request(grpc_ares_request* r) {}
grpc_error* grpc_ares_init(void) { return GRPC_ERROR_NONE; }
void grpc_ares_cleanup(void) {}
-static void grpc_resolve_address_ares_impl(grpc_exec_ctx* exec_ctx,
- const char* name,
+static void grpc_resolve_address_ares_impl(const char* name,
const char* default_port,
grpc_pollset_set* interested_parties,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {}
void (*grpc_resolve_address_ares)(
- grpc_exec_ctx* exec_ctx, const char* name, const char* default_port,
+ const char* name, const char* default_port,
grpc_pollset_set* interested_parties, grpc_closure* on_done,
grpc_resolved_addresses** addrs) = grpc_resolve_address_ares_impl;
diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
index fc40ce6966..77698e97aa 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
@@ -76,49 +76,42 @@ typedef struct {
grpc_resolved_addresses* addresses;
} dns_resolver;
-static void dns_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
+static void dns_destroy(grpc_resolver* r);
-static void dns_start_resolving_locked(grpc_exec_ctx* exec_ctx,
- dns_resolver* r);
-static void dns_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- dns_resolver* r);
+static void dns_start_resolving_locked(dns_resolver* r);
+static void dns_maybe_finish_next_locked(dns_resolver* r);
-static void dns_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
-static void dns_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* r);
-static void dns_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r,
- grpc_channel_args** target_result,
+static void dns_shutdown_locked(grpc_resolver* r);
+static void dns_channel_saw_error_locked(grpc_resolver* r);
+static void dns_next_locked(grpc_resolver* r, grpc_channel_args** target_result,
grpc_closure* on_complete);
static const grpc_resolver_vtable dns_resolver_vtable = {
dns_destroy, dns_shutdown_locked, dns_channel_saw_error_locked,
dns_next_locked};
-static void dns_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void dns_shutdown_locked(grpc_resolver* resolver) {
dns_resolver* r = (dns_resolver*)resolver;
if (r->have_retry_timer) {
- grpc_timer_cancel(exec_ctx, &r->retry_timer);
+ grpc_timer_cancel(&r->retry_timer);
}
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
- GRPC_CLOSURE_SCHED(
- exec_ctx, r->next_completion,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Resolver Shutdown"));
r->next_completion = nullptr;
}
}
-static void dns_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void dns_channel_saw_error_locked(grpc_resolver* resolver) {
dns_resolver* r = (dns_resolver*)resolver;
if (!r->resolving) {
grpc_backoff_reset(&r->backoff_state);
- dns_start_resolving_locked(exec_ctx, r);
+ dns_start_resolving_locked(r);
}
}
-static void dns_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
+static void dns_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
dns_resolver* r = (dns_resolver*)resolver;
@@ -127,28 +120,26 @@ static void dns_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* resolver,
r->target_result = target_result;
if (r->resolved_version == 0 && !r->resolving) {
grpc_backoff_reset(&r->backoff_state);
- dns_start_resolving_locked(exec_ctx, r);
+ dns_start_resolving_locked(r);
} else {
- dns_maybe_finish_next_locked(exec_ctx, r);
+ dns_maybe_finish_next_locked(r);
}
}
-static void dns_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void dns_on_retry_timer_locked(void* arg, grpc_error* error) {
dns_resolver* r = (dns_resolver*)arg;
r->have_retry_timer = false;
if (error == GRPC_ERROR_NONE) {
if (!r->resolving) {
- dns_start_resolving_locked(exec_ctx, r);
+ dns_start_resolving_locked(r);
}
}
- GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "retry-timer");
+ GRPC_RESOLVER_UNREF(&r->base, "retry-timer");
}
-static void dns_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void dns_on_resolved_locked(void* arg, grpc_error* error) {
dns_resolver* r = (dns_resolver*)arg;
grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
@@ -168,11 +159,11 @@ static void dns_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
grpc_resolved_addresses_destroy(r->addresses);
- grpc_lb_addresses_destroy(exec_ctx, addresses);
+ grpc_lb_addresses_destroy(addresses);
} else {
grpc_millis next_try =
- grpc_backoff_step(exec_ctx, &r->backoff_state).next_attempt_start_time;
- grpc_millis timeout = next_try - grpc_exec_ctx_now(exec_ctx);
+ grpc_backoff_step(&r->backoff_state).next_attempt_start_time;
+ grpc_millis timeout = next_try - grpc_core::ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_retry_timer);
@@ -185,59 +176,56 @@ static void dns_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
GRPC_CLOSURE_INIT(&r->on_retry, dns_on_retry_timer_locked, r,
grpc_combiner_scheduler(r->base.combiner));
- grpc_timer_init(exec_ctx, &r->retry_timer, next_try, &r->on_retry);
+ grpc_timer_init(&r->retry_timer, next_try, &r->on_retry);
}
if (r->resolved_result != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->resolved_result);
+ grpc_channel_args_destroy(r->resolved_result);
}
r->resolved_result = result;
r->resolved_version++;
- dns_maybe_finish_next_locked(exec_ctx, r);
+ dns_maybe_finish_next_locked(r);
GRPC_ERROR_UNREF(error);
- GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "dns-resolving");
+ GRPC_RESOLVER_UNREF(&r->base, "dns-resolving");
}
-static void dns_start_resolving_locked(grpc_exec_ctx* exec_ctx,
- dns_resolver* r) {
+static void dns_start_resolving_locked(dns_resolver* r) {
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
r->addresses = nullptr;
grpc_resolve_address(
- exec_ctx, r->name_to_resolve, r->default_port, r->interested_parties,
+ r->name_to_resolve, r->default_port, r->interested_parties,
GRPC_CLOSURE_CREATE(dns_on_resolved_locked, r,
grpc_combiner_scheduler(r->base.combiner)),
&r->addresses);
}
-static void dns_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- dns_resolver* r) {
+static void dns_maybe_finish_next_locked(dns_resolver* r) {
if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
*r->target_result = r->resolved_result == nullptr
? nullptr
: grpc_channel_args_copy(r->resolved_result);
- GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
r->published_version = r->resolved_version;
}
}
-static void dns_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
+static void dns_destroy(grpc_resolver* gr) {
dns_resolver* r = (dns_resolver*)gr;
if (r->resolved_result != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->resolved_result);
+ grpc_channel_args_destroy(r->resolved_result);
}
- grpc_pollset_set_destroy(exec_ctx, r->interested_parties);
+ grpc_pollset_set_destroy(r->interested_parties);
gpr_free(r->name_to_resolve);
gpr_free(r->default_port);
- grpc_channel_args_destroy(exec_ctx, r->channel_args);
+ grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
-static grpc_resolver* dns_create(grpc_exec_ctx* exec_ctx,
- grpc_resolver_args* args,
+static grpc_resolver* dns_create(grpc_resolver_args* args,
const char* default_port) {
if (0 != strcmp(args->uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
@@ -254,8 +242,7 @@ static grpc_resolver* dns_create(grpc_exec_ctx* exec_ctx,
r->channel_args = grpc_channel_args_copy(args->args);
r->interested_parties = grpc_pollset_set_create();
if (args->pollset_set != nullptr) {
- grpc_pollset_set_add_pollset_set(exec_ctx, r->interested_parties,
- args->pollset_set);
+ grpc_pollset_set_add_pollset_set(r->interested_parties, args->pollset_set);
}
grpc_backoff_init(
&r->backoff_state, GRPC_DNS_INITIAL_CONNECT_BACKOFF_SECONDS * 1000,
@@ -274,9 +261,8 @@ static void dns_factory_ref(grpc_resolver_factory* factory) {}
static void dns_factory_unref(grpc_resolver_factory* factory) {}
static grpc_resolver* dns_factory_create_resolver(
- grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory,
- grpc_resolver_args* args) {
- return dns_create(exec_ctx, args, "https");
+ grpc_resolver_factory* factory, grpc_resolver_args* args) {
+ return dns_create(args, "https");
}
static char* dns_factory_get_default_host_name(grpc_resolver_factory* factory,
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
index 44798ca434..fe3ad1403c 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
@@ -67,57 +67,52 @@ typedef struct {
grpc_channel_args** target_result;
} fake_resolver;
-static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
+static void fake_resolver_destroy(grpc_resolver* gr) {
fake_resolver* r = (fake_resolver*)gr;
- grpc_channel_args_destroy(exec_ctx, r->next_results);
- grpc_channel_args_destroy(exec_ctx, r->results_upon_error);
- grpc_channel_args_destroy(exec_ctx, r->channel_args);
+ grpc_channel_args_destroy(r->next_results);
+ grpc_channel_args_destroy(r->results_upon_error);
+ grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
-static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void fake_resolver_shutdown_locked(grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
- GRPC_CLOSURE_SCHED(
- exec_ctx, r->next_completion,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Resolver Shutdown"));
r->next_completion = nullptr;
}
}
-static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- fake_resolver* r) {
+static void fake_resolver_maybe_finish_next_locked(fake_resolver* r) {
if (r->next_completion != nullptr && r->next_results != nullptr) {
*r->target_result =
grpc_channel_args_union(r->next_results, r->channel_args);
- grpc_channel_args_destroy(exec_ctx, r->next_results);
+ grpc_channel_args_destroy(r->next_results);
r->next_results = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
}
}
-static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void fake_resolver_channel_saw_error_locked(grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
if (r->next_results == nullptr && r->results_upon_error != nullptr) {
// Pretend we re-resolved.
r->next_results = grpc_channel_args_copy(r->results_upon_error);
}
- fake_resolver_maybe_finish_next_locked(exec_ctx, r);
+ fake_resolver_maybe_finish_next_locked(r);
}
-static void fake_resolver_next_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver,
+static void fake_resolver_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
fake_resolver* r = (fake_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
- fake_resolver_maybe_finish_next_locked(exec_ctx, r);
+ fake_resolver_maybe_finish_next_locked(r);
}
static const grpc_resolver_vtable fake_resolver_vtable = {
@@ -157,33 +152,31 @@ typedef struct set_response_closure_arg {
grpc_channel_args* next_response;
} set_response_closure_arg;
-static void set_response_closure_fn(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void set_response_closure_fn(void* arg, grpc_error* error) {
set_response_closure_arg* closure_arg = (set_response_closure_arg*)arg;
grpc_fake_resolver_response_generator* generator = closure_arg->generator;
fake_resolver* r = generator->resolver;
if (r->next_results != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->next_results);
+ grpc_channel_args_destroy(r->next_results);
}
r->next_results = closure_arg->next_response;
if (r->results_upon_error != nullptr) {
- grpc_channel_args_destroy(exec_ctx, r->results_upon_error);
+ grpc_channel_args_destroy(r->results_upon_error);
}
r->results_upon_error = grpc_channel_args_copy(closure_arg->next_response);
gpr_free(closure_arg);
- fake_resolver_maybe_finish_next_locked(exec_ctx, r);
+ fake_resolver_maybe_finish_next_locked(r);
}
void grpc_fake_resolver_response_generator_set_response(
- grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator,
+ grpc_fake_resolver_response_generator* generator,
grpc_channel_args* next_response) {
GPR_ASSERT(generator->resolver != nullptr);
set_response_closure_arg* closure_arg =
(set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
closure_arg->generator = generator;
closure_arg->next_response = grpc_channel_args_copy(next_response);
- GRPC_CLOSURE_SCHED(exec_ctx,
- GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&closure_arg->set_response_closure,
set_response_closure_fn, closure_arg,
grpc_combiner_scheduler(
generator->resolver->base.combiner)),
@@ -195,7 +188,7 @@ static void* response_generator_arg_copy(void* p) {
(grpc_fake_resolver_response_generator*)p);
}
-static void response_generator_arg_destroy(grpc_exec_ctx* exec_ctx, void* p) {
+static void response_generator_arg_destroy(void* p) {
grpc_fake_resolver_response_generator_unref(
(grpc_fake_resolver_response_generator*)p);
}
@@ -232,8 +225,7 @@ static void fake_resolver_factory_ref(grpc_resolver_factory* factory) {}
static void fake_resolver_factory_unref(grpc_resolver_factory* factory) {}
-static grpc_resolver* fake_resolver_create(grpc_exec_ctx* exec_ctx,
- grpc_resolver_factory* factory,
+static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory,
grpc_resolver_args* args) {
fake_resolver* r = (fake_resolver*)gpr_zalloc(sizeof(*r));
r->channel_args = grpc_channel_args_copy(args->args);
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
index 7035cdda01..a8977e5980 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h
@@ -39,7 +39,7 @@ grpc_fake_resolver_response_generator_create();
// Instruct the fake resolver associated with the \a response_generator instance
// to trigger a new resolution for \a uri and \a args.
void grpc_fake_resolver_response_generator_set_response(
- grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator,
+ grpc_fake_resolver_response_generator* generator,
grpc_channel_args* next_response);
// Return a \a grpc_arg for a \a grpc_fake_resolver_response_generator instance.
diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
index f0934b5943..7d1e283fa3 100644
--- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
@@ -52,15 +52,13 @@ typedef struct {
grpc_channel_args** target_result;
} sockaddr_resolver;
-static void sockaddr_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
+static void sockaddr_destroy(grpc_resolver* r);
-static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- sockaddr_resolver* r);
+static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r);
-static void sockaddr_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r);
-static void sockaddr_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* r);
-static void sockaddr_next_locked(grpc_exec_ctx* exec_ctx, grpc_resolver* r,
+static void sockaddr_shutdown_locked(grpc_resolver* r);
+static void sockaddr_channel_saw_error_locked(grpc_resolver* r);
+static void sockaddr_next_locked(grpc_resolver* r,
grpc_channel_args** target_result,
grpc_closure* on_complete);
@@ -68,52 +66,47 @@ static const grpc_resolver_vtable sockaddr_resolver_vtable = {
sockaddr_destroy, sockaddr_shutdown_locked,
sockaddr_channel_saw_error_locked, sockaddr_next_locked};
-static void sockaddr_shutdown_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void sockaddr_shutdown_locked(grpc_resolver* resolver) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
if (r->next_completion != nullptr) {
*r->target_result = nullptr;
- GRPC_CLOSURE_SCHED(
- exec_ctx, r->next_completion,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Resolver Shutdown"));
r->next_completion = nullptr;
}
}
-static void sockaddr_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver) {
+static void sockaddr_channel_saw_error_locked(grpc_resolver* resolver) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
r->published = false;
- sockaddr_maybe_finish_next_locked(exec_ctx, r);
+ sockaddr_maybe_finish_next_locked(r);
}
-static void sockaddr_next_locked(grpc_exec_ctx* exec_ctx,
- grpc_resolver* resolver,
+static void sockaddr_next_locked(grpc_resolver* resolver,
grpc_channel_args** target_result,
grpc_closure* on_complete) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
GPR_ASSERT(!r->next_completion);
r->next_completion = on_complete;
r->target_result = target_result;
- sockaddr_maybe_finish_next_locked(exec_ctx, r);
+ sockaddr_maybe_finish_next_locked(r);
}
-static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
- sockaddr_resolver* r) {
+static void sockaddr_maybe_finish_next_locked(sockaddr_resolver* r) {
if (r->next_completion != nullptr && !r->published) {
r->published = true;
grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses);
*r->target_result =
grpc_channel_args_copy_and_add(r->channel_args, &arg, 1);
- GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(r->next_completion, GRPC_ERROR_NONE);
r->next_completion = nullptr;
}
}
-static void sockaddr_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
+static void sockaddr_destroy(grpc_resolver* gr) {
sockaddr_resolver* r = (sockaddr_resolver*)gr;
- grpc_lb_addresses_destroy(exec_ctx, r->addresses);
- grpc_channel_args_destroy(exec_ctx, r->channel_args);
+ grpc_lb_addresses_destroy(r->addresses);
+ grpc_channel_args_destroy(r->channel_args);
gpr_free(r);
}
@@ -142,8 +135,7 @@ char* unix_get_default_authority(grpc_resolver_factory* factory,
static void do_nothing(void* ignored) {}
-static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx,
- grpc_resolver_args* args,
+static grpc_resolver* sockaddr_create(grpc_resolver_args* args,
bool parse(const grpc_uri* uri,
grpc_resolved_address* dst)) {
if (0 != strcmp(args->uri->authority, "")) {
@@ -170,10 +162,10 @@ static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx,
gpr_free(part_str);
if (errors_found) break;
}
- grpc_slice_buffer_destroy_internal(exec_ctx, &path_parts);
- grpc_slice_unref_internal(exec_ctx, path_slice);
+ grpc_slice_buffer_destroy_internal(&path_parts);
+ grpc_slice_unref_internal(path_slice);
if (errors_found) {
- grpc_lb_addresses_destroy(exec_ctx, addresses);
+ grpc_lb_addresses_destroy(addresses);
return nullptr;
}
/* Instantiate resolver. */
@@ -195,9 +187,8 @@ static void sockaddr_factory_unref(grpc_resolver_factory* factory) {}
#define DECL_FACTORY(name) \
static grpc_resolver* name##_factory_create_resolver( \
- grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory, \
- grpc_resolver_args* args) { \
- return sockaddr_create(exec_ctx, args, grpc_parse_##name); \
+ grpc_resolver_factory* factory, grpc_resolver_args* args) { \
+ return sockaddr_create(args, grpc_parse_##name); \
} \
static const grpc_resolver_factory_vtable name##_factory_vtable = { \
sockaddr_factory_ref, sockaddr_factory_unref, \
diff --git a/src/core/ext/filters/client_channel/resolver_factory.cc b/src/core/ext/filters/client_channel/resolver_factory.cc
index 1a289d9771..9b3ec2f1c4 100644
--- a/src/core/ext/filters/client_channel/resolver_factory.cc
+++ b/src/core/ext/filters/client_channel/resolver_factory.cc
@@ -28,10 +28,9 @@ void grpc_resolver_factory_unref(grpc_resolver_factory* factory) {
/** Create a resolver instance for a name */
grpc_resolver* grpc_resolver_factory_create_resolver(
- grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory,
- grpc_resolver_args* args) {
+ grpc_resolver_factory* factory, grpc_resolver_args* args) {
if (factory == nullptr) return nullptr;
- return factory->vtable->create_resolver(exec_ctx, factory, args);
+ return factory->vtable->create_resolver(factory, args);
}
char* grpc_resolver_factory_get_default_authority(
diff --git a/src/core/ext/filters/client_channel/resolver_factory.h b/src/core/ext/filters/client_channel/resolver_factory.h
index fcf8ec425e..170ecc0b48 100644
--- a/src/core/ext/filters/client_channel/resolver_factory.h
+++ b/src/core/ext/filters/client_channel/resolver_factory.h
@@ -43,8 +43,7 @@ struct grpc_resolver_factory_vtable {
void (*unref)(grpc_resolver_factory* factory);
/** Implementation of grpc_resolver_factory_create_resolver */
- grpc_resolver* (*create_resolver)(grpc_exec_ctx* exec_ctx,
- grpc_resolver_factory* factory,
+ grpc_resolver* (*create_resolver)(grpc_resolver_factory* factory,
grpc_resolver_args* args);
/** Implementation of grpc_resolver_factory_get_default_authority */
@@ -59,8 +58,7 @@ void grpc_resolver_factory_unref(grpc_resolver_factory* resolver);
/** Create a resolver instance for a name */
grpc_resolver* grpc_resolver_factory_create_resolver(
- grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory,
- grpc_resolver_args* args);
+ grpc_resolver_factory* factory, grpc_resolver_args* args);
/** Return a (freshly allocated with gpr_malloc) string representing
the default authority to use for this scheme. */
diff --git a/src/core/ext/filters/client_channel/resolver_registry.cc b/src/core/ext/filters/client_channel/resolver_registry.cc
index 5da6114a3d..3f8451de6b 100644
--- a/src/core/ext/filters/client_channel/resolver_registry.cc
+++ b/src/core/ext/filters/client_channel/resolver_registry.cc
@@ -92,23 +92,22 @@ static grpc_resolver_factory* lookup_factory_by_uri(grpc_uri* uri) {
return lookup_factory(uri->scheme);
}
-static grpc_resolver_factory* resolve_factory(grpc_exec_ctx* exec_ctx,
- const char* target,
+static grpc_resolver_factory* resolve_factory(const char* target,
grpc_uri** uri,
char** canonical_target) {
grpc_resolver_factory* factory = nullptr;
GPR_ASSERT(uri != nullptr);
- *uri = grpc_uri_parse(exec_ctx, target, 1);
+ *uri = grpc_uri_parse(target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == nullptr) {
grpc_uri_destroy(*uri);
gpr_asprintf(canonical_target, "%s%s", g_default_resolver_prefix, target);
- *uri = grpc_uri_parse(exec_ctx, *canonical_target, 1);
+ *uri = grpc_uri_parse(*canonical_target, 1);
factory = lookup_factory_by_uri(*uri);
if (factory == nullptr) {
- grpc_uri_destroy(grpc_uri_parse(exec_ctx, target, 0));
- grpc_uri_destroy(grpc_uri_parse(exec_ctx, *canonical_target, 0));
+ grpc_uri_destroy(grpc_uri_parse(target, 0));
+ grpc_uri_destroy(grpc_uri_parse(*canonical_target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
*canonical_target);
}
@@ -116,14 +115,14 @@ static grpc_resolver_factory* resolve_factory(grpc_exec_ctx* exec_ctx,
return factory;
}
-grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
+grpc_resolver* grpc_resolver_create(const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner) {
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
grpc_resolver_factory* factory =
- resolve_factory(exec_ctx, target, &uri, &canonical_target);
+ resolve_factory(target, &uri, &canonical_target);
grpc_resolver* resolver;
grpc_resolver_args resolver_args;
memset(&resolver_args, 0, sizeof(resolver_args));
@@ -131,29 +130,27 @@ grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
resolver_args.args = args;
resolver_args.pollset_set = pollset_set;
resolver_args.combiner = combiner;
- resolver =
- grpc_resolver_factory_create_resolver(exec_ctx, factory, &resolver_args);
+ resolver = grpc_resolver_factory_create_resolver(factory, &resolver_args);
grpc_uri_destroy(uri);
gpr_free(canonical_target);
return resolver;
}
-char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target) {
+char* grpc_get_default_authority(const char* target) {
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
grpc_resolver_factory* factory =
- resolve_factory(exec_ctx, target, &uri, &canonical_target);
+ resolve_factory(target, &uri, &canonical_target);
char* authority = grpc_resolver_factory_get_default_authority(factory, uri);
grpc_uri_destroy(uri);
gpr_free(canonical_target);
return authority;
}
-char* grpc_resolver_factory_add_default_prefix_if_needed(
- grpc_exec_ctx* exec_ctx, const char* target) {
+char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target) {
grpc_uri* uri = nullptr;
char* canonical_target = nullptr;
- resolve_factory(exec_ctx, target, &uri, &canonical_target);
+ resolve_factory(target, &uri, &canonical_target);
grpc_uri_destroy(uri);
return canonical_target == nullptr ? gpr_strdup(target) : canonical_target;
}
diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h
index ecc9f824e8..bbd30df8da 100644
--- a/src/core/ext/filters/client_channel/resolver_registry.h
+++ b/src/core/ext/filters/client_channel/resolver_registry.h
@@ -48,7 +48,7 @@ void grpc_register_resolver_type(grpc_resolver_factory* factory);
(typically the set of arguments passed in from the client API).
\a pollset_set is used to drive IO in the name resolution process, it
should not be NULL. */
-grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
+grpc_resolver* grpc_resolver_create(const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner);
@@ -59,11 +59,10 @@ grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name);
/** Given a target, return a (freshly allocated with gpr_malloc) string
representing the default authority to pass from a client. */
-char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target);
+char* grpc_get_default_authority(const char* target);
/** Returns a newly allocated string containing \a target, adding the
default prefix if needed. */
-char* grpc_resolver_factory_add_default_prefix_if_needed(
- grpc_exec_ctx* exec_ctx, const char* target);
+char* grpc_resolver_factory_add_default_prefix_if_needed(const char* target);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_REGISTRY_H */
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 58e294d597..0d2be2a3f7 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -139,8 +139,7 @@ struct grpc_subchannel_call {
#define CALLSTACK_TO_SUBCHANNEL_CALL(callstack) \
(((grpc_subchannel_call*)(callstack)) - 1)
-static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* subchannel,
- grpc_error* error);
+static void subchannel_connected(void* subchannel, grpc_error* error);
#ifndef NDEBUG
#define REF_REASON reason
@@ -157,10 +156,9 @@ static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* subchannel,
* connection implementation
*/
-static void connection_destroy(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void connection_destroy(void* arg, grpc_error* error) {
grpc_connected_subchannel* c = (grpc_connected_subchannel*)arg;
- grpc_channel_stack_destroy(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c));
+ grpc_channel_stack_destroy(CHANNEL_STACK_FROM_CONNECTION(c));
gpr_free(c);
}
@@ -170,26 +168,23 @@ grpc_connected_subchannel* grpc_connected_subchannel_ref(
return c;
}
-void grpc_connected_subchannel_unref(grpc_exec_ctx* exec_ctx,
- grpc_connected_subchannel* c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, CHANNEL_STACK_FROM_CONNECTION(c),
- REF_REASON);
+void grpc_connected_subchannel_unref(
+ grpc_connected_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+ GRPC_CHANNEL_STACK_UNREF(CHANNEL_STACK_FROM_CONNECTION(c), REF_REASON);
}
/*
* grpc_subchannel implementation
*/
-static void subchannel_destroy(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void subchannel_destroy(void* arg, grpc_error* error) {
grpc_subchannel* c = (grpc_subchannel*)arg;
gpr_free((void*)c->filters);
- grpc_channel_args_destroy(exec_ctx, c->args);
- grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker);
- grpc_connector_unref(exec_ctx, c->connector);
- grpc_pollset_set_destroy(exec_ctx, c->pollset_set);
- grpc_subchannel_key_destroy(exec_ctx, c->key);
+ grpc_channel_args_destroy(c->args);
+ grpc_connectivity_state_destroy(&c->state_tracker);
+ grpc_connector_unref(c->connector);
+ grpc_pollset_set_destroy(c->pollset_set);
+ grpc_subchannel_key_destroy(c->key);
gpr_mu_destroy(&c->mu);
gpr_free(c);
}
@@ -241,59 +236,54 @@ grpc_subchannel* grpc_subchannel_ref_from_weak_ref(
}
}
-static void disconnect(grpc_exec_ctx* exec_ctx, grpc_subchannel* c) {
+static void disconnect(grpc_subchannel* c) {
grpc_connected_subchannel* con;
- grpc_subchannel_index_unregister(exec_ctx, c->key, c);
+ grpc_subchannel_index_unregister(c->key, c);
gpr_mu_lock(&c->mu);
GPR_ASSERT(!c->disconnected);
c->disconnected = true;
- grpc_connector_shutdown(
- exec_ctx, c->connector,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
+ grpc_connector_shutdown(c->connector, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
+ "Subchannel disconnected"));
con = GET_CONNECTED_SUBCHANNEL(c, no_barrier);
if (con != nullptr) {
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, con, "connection");
+ GRPC_CONNECTED_SUBCHANNEL_UNREF(con, "connection");
gpr_atm_no_barrier_store(&c->connected_subchannel, (gpr_atm)0xdeadbeef);
}
gpr_mu_unlock(&c->mu);
}
-void grpc_subchannel_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+void grpc_subchannel_unref(grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
// add a weak ref and subtract a strong ref (atomically)
old_refs = ref_mutate(c, (gpr_atm)1 - (gpr_atm)(1 << INTERNAL_REF_BITS),
1 REF_MUTATE_PURPOSE("STRONG_UNREF"));
if ((old_refs & STRONG_REF_MASK) == (1 << INTERNAL_REF_BITS)) {
- disconnect(exec_ctx, c);
+ disconnect(c);
}
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "strong-unref");
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "strong-unref");
}
-void grpc_subchannel_weak_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+void grpc_subchannel_weak_unref(
+ grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
old_refs = ref_mutate(c, -(gpr_atm)1, 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
if (old_refs == 1) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_CREATE(subchannel_destroy, c, grpc_schedule_on_exec_ctx),
GRPC_ERROR_NONE);
}
}
-grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
- grpc_connector* connector,
+grpc_subchannel* grpc_subchannel_create(grpc_connector* connector,
const grpc_subchannel_args* args) {
grpc_subchannel_key* key = grpc_subchannel_key_create(args);
- grpc_subchannel* c = grpc_subchannel_index_find(exec_ctx, key);
+ grpc_subchannel* c = grpc_subchannel_index_find(key);
if (c) {
- grpc_subchannel_key_destroy(exec_ctx, key);
+ grpc_subchannel_key_destroy(key);
return c;
}
- GRPC_STATS_INC_CLIENT_SUBCHANNELS_CREATED(exec_ctx);
+ GRPC_STATS_INC_CLIENT_SUBCHANNELS_CREATED();
c = (grpc_subchannel*)gpr_zalloc(sizeof(*c));
c->key = key;
gpr_atm_no_barrier_store(&c->ref_pair, 1 << INTERNAL_REF_BITS);
@@ -311,10 +301,10 @@ grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
c->pollset_set = grpc_pollset_set_create();
grpc_resolved_address* addr =
(grpc_resolved_address*)gpr_malloc(sizeof(*addr));
- grpc_get_subchannel_address_arg(exec_ctx, args->args, addr);
+ grpc_get_subchannel_address_arg(args->args, addr);
grpc_resolved_address* new_address = nullptr;
grpc_channel_args* new_args = nullptr;
- if (grpc_proxy_mappers_map_address(exec_ctx, addr, args->args, &new_address,
+ if (grpc_proxy_mappers_map_address(addr, args->args, &new_address,
&new_args)) {
GPR_ASSERT(new_address != nullptr);
gpr_free(addr);
@@ -327,7 +317,7 @@ grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
new_args != nullptr ? new_args : args->args, keys_to_remove,
GPR_ARRAY_SIZE(keys_to_remove), &new_arg, 1);
gpr_free(new_arg.value.string);
- if (new_args != nullptr) grpc_channel_args_destroy(exec_ctx, new_args);
+ if (new_args != nullptr) grpc_channel_args_destroy(new_args);
c->root_external_state_watcher.next = c->root_external_state_watcher.prev =
&c->root_external_state_watcher;
GRPC_CLOSURE_INIT(&c->connected, subchannel_connected, c,
@@ -373,21 +363,19 @@ grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
min_backoff_ms, max_backoff_ms);
gpr_mu_init(&c->mu);
- return grpc_subchannel_index_register(exec_ctx, key, c);
+ return grpc_subchannel_index_register(key, c);
}
-static void continue_connect_locked(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* c) {
+static void continue_connect_locked(grpc_subchannel* c) {
grpc_connect_in_args args;
args.interested_parties = c->pollset_set;
args.deadline = c->backoff_result.current_deadline;
args.channel_args = c->args;
- grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
- GRPC_CHANNEL_CONNECTING, GRPC_ERROR_NONE,
- "state_change");
- grpc_connector_connect(exec_ctx, c->connector, &args, &c->connecting_result,
+ grpc_connectivity_state_set(&c->state_tracker, GRPC_CHANNEL_CONNECTING,
+ GRPC_ERROR_NONE, "state_change");
+ grpc_connector_connect(c->connector, &args, &c->connecting_result,
&c->connected);
}
@@ -400,24 +388,23 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(grpc_subchannel* c,
return state;
}
-static void on_external_state_watcher_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_external_state_watcher_done(void* arg, grpc_error* error) {
external_state_watcher* w = (external_state_watcher*)arg;
grpc_closure* follow_up = w->notify;
if (w->pollset_set != nullptr) {
- grpc_pollset_set_del_pollset_set(exec_ctx, w->subchannel->pollset_set,
+ grpc_pollset_set_del_pollset_set(w->subchannel->pollset_set,
w->pollset_set);
}
gpr_mu_lock(&w->subchannel->mu);
w->next->prev = w->prev;
w->prev->next = w->next;
gpr_mu_unlock(&w->subchannel->mu);
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, w->subchannel, "external_state_watcher");
+ GRPC_SUBCHANNEL_WEAK_UNREF(w->subchannel, "external_state_watcher");
gpr_free(w);
- GRPC_CLOSURE_RUN(exec_ctx, follow_up, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_RUN(follow_up, GRPC_ERROR_REF(error));
}
-static void on_alarm(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void on_alarm(void* arg, grpc_error* error) {
grpc_subchannel* c = (grpc_subchannel*)arg;
gpr_mu_lock(&c->mu);
c->have_alarm = false;
@@ -429,18 +416,17 @@ static void on_alarm(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
}
if (error == GRPC_ERROR_NONE) {
gpr_log(GPR_INFO, "Failed to connect to channel, retrying");
- c->backoff_result = grpc_backoff_step(exec_ctx, &c->backoff_state);
- continue_connect_locked(exec_ctx, c);
+ c->backoff_result = grpc_backoff_step(&c->backoff_state);
+ continue_connect_locked(c);
gpr_mu_unlock(&c->mu);
} else {
gpr_mu_unlock(&c->mu);
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "connecting");
}
GRPC_ERROR_UNREF(error);
}
-static void maybe_start_connecting_locked(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* c) {
+static void maybe_start_connecting_locked(grpc_subchannel* c) {
if (c->disconnected) {
/* Don't try to connect if we're already disconnected */
return;
@@ -466,28 +452,28 @@ static void maybe_start_connecting_locked(grpc_exec_ctx* exec_ctx,
if (!c->backoff_begun) {
c->backoff_begun = true;
- c->backoff_result = grpc_backoff_begin(exec_ctx, &c->backoff_state);
- continue_connect_locked(exec_ctx, c);
+ c->backoff_result = grpc_backoff_begin(&c->backoff_state);
+ continue_connect_locked(c);
} else {
GPR_ASSERT(!c->have_alarm);
c->have_alarm = true;
const grpc_millis time_til_next =
- c->backoff_result.next_attempt_start_time - grpc_exec_ctx_now(exec_ctx);
+ c->backoff_result.next_attempt_start_time -
+ grpc_core::ExecCtx::Get()->Now();
if (time_til_next <= 0) {
gpr_log(GPR_INFO, "Retry immediately");
} else {
gpr_log(GPR_INFO, "Retry in %" PRIdPTR " milliseconds", time_til_next);
}
GRPC_CLOSURE_INIT(&c->on_alarm, on_alarm, c, grpc_schedule_on_exec_ctx);
- grpc_timer_init(exec_ctx, &c->alarm,
- c->backoff_result.next_attempt_start_time, &c->on_alarm);
+ grpc_timer_init(&c->alarm, c->backoff_result.next_attempt_start_time,
+ &c->on_alarm);
}
}
void grpc_subchannel_notify_on_state_change(
- grpc_exec_ctx* exec_ctx, grpc_subchannel* c,
- grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
- grpc_closure* notify) {
+ grpc_subchannel* c, grpc_pollset_set* interested_parties,
+ grpc_connectivity_state* state, grpc_closure* notify) {
external_state_watcher* w;
if (state == nullptr) {
@@ -495,8 +481,8 @@ void grpc_subchannel_notify_on_state_change(
for (w = c->root_external_state_watcher.next;
w != &c->root_external_state_watcher; w = w->next) {
if (w->notify == notify) {
- grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &c->state_tracker, nullptr, &w->closure);
+ grpc_connectivity_state_notify_on_state_change(&c->state_tracker,
+ nullptr, &w->closure);
}
}
gpr_mu_unlock(&c->mu);
@@ -508,31 +494,28 @@ void grpc_subchannel_notify_on_state_change(
GRPC_CLOSURE_INIT(&w->closure, on_external_state_watcher_done, w,
grpc_schedule_on_exec_ctx);
if (interested_parties != nullptr) {
- grpc_pollset_set_add_pollset_set(exec_ctx, c->pollset_set,
- interested_parties);
+ grpc_pollset_set_add_pollset_set(c->pollset_set, interested_parties);
}
GRPC_SUBCHANNEL_WEAK_REF(c, "external_state_watcher");
gpr_mu_lock(&c->mu);
w->next = &c->root_external_state_watcher;
w->prev = w->next->prev;
w->next->prev = w->prev->next = w;
- grpc_connectivity_state_notify_on_state_change(exec_ctx, &c->state_tracker,
- state, &w->closure);
- maybe_start_connecting_locked(exec_ctx, c);
+ grpc_connectivity_state_notify_on_state_change(&c->state_tracker, state,
+ &w->closure);
+ maybe_start_connecting_locked(c);
gpr_mu_unlock(&c->mu);
}
}
void grpc_connected_subchannel_process_transport_op(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
- grpc_transport_op* op) {
+ grpc_connected_subchannel* con, grpc_transport_op* op) {
grpc_channel_stack* channel_stack = CHANNEL_STACK_FROM_CONNECTION(con);
grpc_channel_element* top_elem = grpc_channel_stack_element(channel_stack, 0);
- top_elem->filter->start_transport_op(exec_ctx, top_elem, op);
+ top_elem->filter->start_transport_op(top_elem, op);
}
-static void subchannel_on_child_state_changed(grpc_exec_ctx* exec_ctx, void* p,
- grpc_error* error) {
+static void subchannel_on_child_state_changed(void* p, grpc_error* error) {
state_watcher* sw = (state_watcher*)p;
grpc_subchannel* c = sw->subchannel;
gpr_mu* mu = &c->mu;
@@ -544,24 +527,22 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx* exec_ctx, void* p,
/* any errors on a subchannel ==> we're done, create a new one */
sw->connectivity_state = GRPC_CHANNEL_SHUTDOWN;
}
- grpc_connectivity_state_set(exec_ctx, &c->state_tracker,
- sw->connectivity_state, GRPC_ERROR_REF(error),
- "reflect_child");
+ grpc_connectivity_state_set(&c->state_tracker, sw->connectivity_state,
+ GRPC_ERROR_REF(error), "reflect_child");
if (sw->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
grpc_connected_subchannel_notify_on_state_change(
- exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), nullptr,
+ GET_CONNECTED_SUBCHANNEL(c, no_barrier), nullptr,
&sw->connectivity_state, &sw->closure);
GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
sw = nullptr;
}
gpr_mu_unlock(mu);
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "state_watcher");
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "state_watcher");
gpr_free(sw);
}
-static void connected_subchannel_state_op(grpc_exec_ctx* exec_ctx,
- grpc_connected_subchannel* con,
+static void connected_subchannel_state_op(grpc_connected_subchannel* con,
grpc_pollset_set* interested_parties,
grpc_connectivity_state* state,
grpc_closure* closure) {
@@ -571,29 +552,25 @@ static void connected_subchannel_state_op(grpc_exec_ctx* exec_ctx,
op->on_connectivity_state_change = closure;
op->bind_pollset_set = interested_parties;
elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CONNECTION(con), 0);
- elem->filter->start_transport_op(exec_ctx, elem, op);
+ elem->filter->start_transport_op(elem, op);
}
void grpc_connected_subchannel_notify_on_state_change(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
- grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
- grpc_closure* closure) {
- connected_subchannel_state_op(exec_ctx, con, interested_parties, state,
- closure);
+ grpc_connected_subchannel* con, grpc_pollset_set* interested_parties,
+ grpc_connectivity_state* state, grpc_closure* closure) {
+ connected_subchannel_state_op(con, interested_parties, state, closure);
}
-void grpc_connected_subchannel_ping(grpc_exec_ctx* exec_ctx,
- grpc_connected_subchannel* con,
+void grpc_connected_subchannel_ping(grpc_connected_subchannel* con,
grpc_closure* closure) {
grpc_transport_op* op = grpc_make_transport_op(nullptr);
grpc_channel_element* elem;
op->send_ping = closure;
elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CONNECTION(con), 0);
- elem->filter->start_transport_op(exec_ctx, elem, op);
+ elem->filter->start_transport_op(elem, op);
}
-static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* c) {
+static bool publish_transport_locked(grpc_subchannel* c) {
grpc_connected_subchannel* con;
grpc_channel_stack* stk;
state_watcher* sw_subchannel;
@@ -601,19 +578,18 @@ static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
/* construct channel stack */
grpc_channel_stack_builder* builder = grpc_channel_stack_builder_create();
grpc_channel_stack_builder_set_channel_arguments(
- exec_ctx, builder, c->connecting_result.channel_args);
+ builder, c->connecting_result.channel_args);
grpc_channel_stack_builder_set_transport(builder,
c->connecting_result.transport);
- if (!grpc_channel_init_create_stack(exec_ctx, builder,
- GRPC_CLIENT_SUBCHANNEL)) {
- grpc_channel_stack_builder_destroy(exec_ctx, builder);
+ if (!grpc_channel_init_create_stack(builder, GRPC_CLIENT_SUBCHANNEL)) {
+ grpc_channel_stack_builder_destroy(builder);
return false;
}
grpc_error* error = grpc_channel_stack_builder_finish(
- exec_ctx, builder, 0, 1, connection_destroy, nullptr, (void**)&con);
+ builder, 0, 1, connection_destroy, nullptr, (void**)&con);
if (error != GRPC_ERROR_NONE) {
- grpc_transport_destroy(exec_ctx, c->connecting_result.transport);
+ grpc_transport_destroy(c->connecting_result.transport);
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
grpc_error_string(error));
GRPC_ERROR_UNREF(error);
@@ -631,7 +607,7 @@ static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
if (c->disconnected) {
gpr_free(sw_subchannel);
- grpc_channel_stack_destroy(exec_ctx, stk);
+ grpc_channel_stack_destroy(stk);
gpr_free(con);
return false;
}
@@ -647,19 +623,18 @@ static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
/* setup subchannel watching connected subchannel for changes; subchannel
ref for connecting is donated to the state watcher */
GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "connecting");
grpc_connected_subchannel_notify_on_state_change(
- exec_ctx, con, c->pollset_set, &sw_subchannel->connectivity_state,
+ con, c->pollset_set, &sw_subchannel->connectivity_state,
&sw_subchannel->closure);
/* signal completion */
- grpc_connectivity_state_set(exec_ctx, &c->state_tracker, GRPC_CHANNEL_READY,
+ grpc_connectivity_state_set(&c->state_tracker, GRPC_CHANNEL_READY,
GRPC_ERROR_NONE, "connected");
return true;
}
-static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void subchannel_connected(void* arg, grpc_error* error) {
grpc_subchannel* c = (grpc_subchannel*)arg;
grpc_channel_args* delete_channel_args = c->connecting_result.channel_args;
@@ -667,13 +642,13 @@ static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
gpr_mu_lock(&c->mu);
c->connecting = false;
if (c->connecting_result.transport != nullptr &&
- publish_transport_locked(exec_ctx, c)) {
+ publish_transport_locked(c)) {
/* do nothing, transport was published */
} else if (c->disconnected) {
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "connecting");
} else {
grpc_connectivity_state_set(
- exec_ctx, &c->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ &c->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
grpc_error_set_int(GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Connect Failed", &error, 1),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE),
@@ -682,27 +657,26 @@ static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
const char* errmsg = grpc_error_string(error);
gpr_log(GPR_INFO, "Connect failed: %s", errmsg);
- maybe_start_connecting_locked(exec_ctx, c);
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connecting");
+ maybe_start_connecting_locked(c);
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "connecting");
}
gpr_mu_unlock(&c->mu);
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, c, "connected");
- grpc_channel_args_destroy(exec_ctx, delete_channel_args);
+ GRPC_SUBCHANNEL_WEAK_UNREF(c, "connected");
+ grpc_channel_args_destroy(delete_channel_args);
}
/*
* grpc_subchannel_call implementation
*/
-static void subchannel_call_destroy(grpc_exec_ctx* exec_ctx, void* call,
- grpc_error* error) {
+static void subchannel_call_destroy(void* call, grpc_error* error) {
grpc_subchannel_call* c = (grpc_subchannel_call*)call;
GPR_ASSERT(c->schedule_closure_after_destroy != nullptr);
GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
grpc_connected_subchannel* connection = c->connection;
- grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), nullptr,
+ grpc_call_stack_destroy(SUBCHANNEL_CALL_TO_CALL_STACK(c), nullptr,
c->schedule_closure_after_destroy);
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, connection, "subchannel_call");
+ GRPC_CONNECTED_SUBCHANNEL_UNREF(connection, "subchannel_call");
GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
}
@@ -718,20 +692,18 @@ void grpc_subchannel_call_ref(
GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
}
-void grpc_subchannel_call_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_call* c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
- GRPC_CALL_STACK_UNREF(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
+void grpc_subchannel_call_unref(
+ grpc_subchannel_call* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+ GRPC_CALL_STACK_UNREF(SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
}
-void grpc_subchannel_call_process_op(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_call* call,
+void grpc_subchannel_call_process_op(grpc_subchannel_call* call,
grpc_transport_stream_op_batch* batch) {
GPR_TIMER_BEGIN("grpc_subchannel_call_process_op", 0);
grpc_call_stack* call_stack = SUBCHANNEL_CALL_TO_CALL_STACK(call);
grpc_call_element* top_elem = grpc_call_stack_element(call_stack, 0);
GRPC_CALL_LOG_OP(GPR_INFO, top_elem, batch);
- top_elem->filter->start_transport_stream_op_batch(exec_ctx, top_elem, batch);
+ top_elem->filter->start_transport_stream_op_batch(top_elem, batch);
GPR_TIMER_END("grpc_subchannel_call_process_op", 0);
}
@@ -746,7 +718,7 @@ const grpc_subchannel_key* grpc_subchannel_get_key(
}
grpc_error* grpc_connected_subchannel_create_call(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* con,
+ grpc_connected_subchannel* con,
const grpc_connected_subchannel_call_args* args,
grpc_subchannel_call** call) {
grpc_channel_stack* chanstk = CHANNEL_STACK_FROM_CONNECTION(con);
@@ -764,14 +736,14 @@ grpc_error* grpc_connected_subchannel_create_call(
args->arena, /* arena */
args->call_combiner /* call_combiner */
};
- grpc_error* error = grpc_call_stack_init(
- exec_ctx, chanstk, 1, subchannel_call_destroy, *call, &call_args);
+ grpc_error* error = grpc_call_stack_init(chanstk, 1, subchannel_call_destroy,
+ *call, &call_args);
if (error != GRPC_ERROR_NONE) {
const char* error_string = grpc_error_string(error);
gpr_log(GPR_ERROR, "error: %s", error_string);
return error;
}
- grpc_call_stack_set_pollset_or_pollset_set(exec_ctx, callstk, args->pollent);
+ grpc_call_stack_set_pollset_or_pollset_set(callstk, args->pollent);
return GRPC_ERROR_NONE;
}
@@ -780,21 +752,20 @@ grpc_call_stack* grpc_subchannel_call_get_call_stack(
return SUBCHANNEL_CALL_TO_CALL_STACK(subchannel_call);
}
-static void grpc_uri_to_sockaddr(grpc_exec_ctx* exec_ctx, const char* uri_str,
+static void grpc_uri_to_sockaddr(const char* uri_str,
grpc_resolved_address* addr) {
- grpc_uri* uri = grpc_uri_parse(exec_ctx, uri_str, 0 /* suppress_errors */);
+ grpc_uri* uri = grpc_uri_parse(uri_str, 0 /* suppress_errors */);
GPR_ASSERT(uri != nullptr);
if (!grpc_parse_uri(uri, addr)) memset(addr, 0, sizeof(*addr));
grpc_uri_destroy(uri);
}
-void grpc_get_subchannel_address_arg(grpc_exec_ctx* exec_ctx,
- const grpc_channel_args* args,
+void grpc_get_subchannel_address_arg(const grpc_channel_args* args,
grpc_resolved_address* addr) {
const char* addr_uri_str = grpc_get_subchannel_address_uri_arg(args);
memset(addr, 0, sizeof(*addr));
if (*addr_uri_str != '\0') {
- grpc_uri_to_sockaddr(exec_ctx, addr_uri_str, addr);
+ grpc_uri_to_sockaddr(addr_uri_str, addr);
}
}
diff --git a/src/core/ext/filters/client_channel/subchannel.h b/src/core/ext/filters/client_channel/subchannel.h
index 1f326fc1d2..84d9fa27a1 100644
--- a/src/core/ext/filters/client_channel/subchannel.h
+++ b/src/core/ext/filters/client_channel/subchannel.h
@@ -42,36 +42,34 @@ typedef struct grpc_subchannel_key grpc_subchannel_key;
grpc_subchannel_ref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r) \
grpc_subchannel_ref_from_weak_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_SUBCHANNEL_UNREF(cl, p, r) \
- grpc_subchannel_unref((cl), (p), __FILE__, __LINE__, (r))
+#define GRPC_SUBCHANNEL_UNREF(p, r) \
+ grpc_subchannel_unref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_WEAK_REF(p, r) \
grpc_subchannel_weak_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_SUBCHANNEL_WEAK_UNREF(cl, p, r) \
- grpc_subchannel_weak_unref((cl), (p), __FILE__, __LINE__, (r))
+#define GRPC_SUBCHANNEL_WEAK_UNREF(p, r) \
+ grpc_subchannel_weak_unref((p), __FILE__, __LINE__, (r))
#define GRPC_CONNECTED_SUBCHANNEL_REF(p, r) \
grpc_connected_subchannel_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_CONNECTED_SUBCHANNEL_UNREF(cl, p, r) \
- grpc_connected_subchannel_unref((cl), (p), __FILE__, __LINE__, (r))
+#define GRPC_CONNECTED_SUBCHANNEL_UNREF(p, r) \
+ grpc_connected_subchannel_unref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_CALL_REF(p, r) \
grpc_subchannel_call_ref((p), __FILE__, __LINE__, (r))
-#define GRPC_SUBCHANNEL_CALL_UNREF(cl, p, r) \
- grpc_subchannel_call_unref((cl), (p), __FILE__, __LINE__, (r))
+#define GRPC_SUBCHANNEL_CALL_UNREF(p, r) \
+ grpc_subchannel_call_unref((p), __FILE__, __LINE__, (r))
#define GRPC_SUBCHANNEL_REF_EXTRA_ARGS \
, const char *file, int line, const char *reason
#else
#define GRPC_SUBCHANNEL_REF(p, r) grpc_subchannel_ref((p))
#define GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(p, r) \
grpc_subchannel_ref_from_weak_ref((p))
-#define GRPC_SUBCHANNEL_UNREF(cl, p, r) grpc_subchannel_unref((cl), (p))
+#define GRPC_SUBCHANNEL_UNREF(p, r) grpc_subchannel_unref((p))
#define GRPC_SUBCHANNEL_WEAK_REF(p, r) grpc_subchannel_weak_ref((p))
-#define GRPC_SUBCHANNEL_WEAK_UNREF(cl, p, r) \
- grpc_subchannel_weak_unref((cl), (p))
+#define GRPC_SUBCHANNEL_WEAK_UNREF(p, r) grpc_subchannel_weak_unref((p))
#define GRPC_CONNECTED_SUBCHANNEL_REF(p, r) grpc_connected_subchannel_ref((p))
-#define GRPC_CONNECTED_SUBCHANNEL_UNREF(cl, p, r) \
- grpc_connected_subchannel_unref((cl), (p))
+#define GRPC_CONNECTED_SUBCHANNEL_UNREF(p, r) \
+ grpc_connected_subchannel_unref((p))
#define GRPC_SUBCHANNEL_CALL_REF(p, r) grpc_subchannel_call_ref((p))
-#define GRPC_SUBCHANNEL_CALL_UNREF(cl, p, r) \
- grpc_subchannel_call_unref((cl), (p))
+#define GRPC_SUBCHANNEL_CALL_UNREF(p, r) grpc_subchannel_call_unref((p))
#define GRPC_SUBCHANNEL_REF_EXTRA_ARGS
#endif
@@ -79,24 +77,20 @@ grpc_subchannel* grpc_subchannel_ref(
grpc_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
grpc_subchannel* grpc_subchannel_ref_from_weak_ref(
grpc_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_subchannel_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_subchannel_unref(
+ grpc_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
grpc_subchannel* grpc_subchannel_weak_ref(
grpc_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_subchannel_weak_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel* channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_subchannel_weak_unref(
+ grpc_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
grpc_connected_subchannel* grpc_connected_subchannel_ref(
grpc_connected_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_connected_subchannel_unref(grpc_exec_ctx* exec_ctx,
- grpc_connected_subchannel* channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_connected_subchannel_unref(
+ grpc_connected_subchannel* channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_call_ref(
grpc_subchannel_call* call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_subchannel_call_unref(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_call* call
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_subchannel_call_unref(
+ grpc_subchannel_call* call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
/** construct a subchannel call */
typedef struct {
@@ -110,14 +104,13 @@ typedef struct {
} grpc_connected_subchannel_call_args;
grpc_error* grpc_connected_subchannel_create_call(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* connected_subchannel,
+ grpc_connected_subchannel* connected_subchannel,
const grpc_connected_subchannel_call_args* args,
grpc_subchannel_call** subchannel_call);
/** process a transport level op */
void grpc_connected_subchannel_process_transport_op(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* subchannel,
- grpc_transport_op* op);
+ grpc_connected_subchannel* subchannel, grpc_transport_op* op);
/** poll the current connectivity state of a channel */
grpc_connectivity_state grpc_subchannel_check_connectivity(
@@ -126,15 +119,12 @@ grpc_connectivity_state grpc_subchannel_check_connectivity(
/** Calls notify when the connectivity state of a channel becomes different
from *state. Updates *state with the new state of the channel. */
void grpc_subchannel_notify_on_state_change(
- grpc_exec_ctx* exec_ctx, grpc_subchannel* channel,
- grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
- grpc_closure* notify);
+ grpc_subchannel* channel, grpc_pollset_set* interested_parties,
+ grpc_connectivity_state* state, grpc_closure* notify);
void grpc_connected_subchannel_notify_on_state_change(
- grpc_exec_ctx* exec_ctx, grpc_connected_subchannel* channel,
- grpc_pollset_set* interested_parties, grpc_connectivity_state* state,
- grpc_closure* notify);
-void grpc_connected_subchannel_ping(grpc_exec_ctx* exec_ctx,
- grpc_connected_subchannel* channel,
+ grpc_connected_subchannel* channel, grpc_pollset_set* interested_parties,
+ grpc_connectivity_state* state, grpc_closure* notify);
+void grpc_connected_subchannel_ping(grpc_connected_subchannel* channel,
grpc_closure* notify);
/** retrieve the grpc_connected_subchannel - or NULL if called before
@@ -147,8 +137,7 @@ const grpc_subchannel_key* grpc_subchannel_get_key(
const grpc_subchannel* subchannel);
/** continue processing a transport op */
-void grpc_subchannel_call_process_op(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_call* subchannel_call,
+void grpc_subchannel_call_process_op(grpc_subchannel_call* subchannel_call,
grpc_transport_stream_op_batch* op);
/** Must be called once per call. Sets the 'then_schedule_closure' argument for
@@ -172,13 +161,11 @@ struct grpc_subchannel_args {
};
/** create a subchannel given a connector */
-grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
- grpc_connector* connector,
+grpc_subchannel* grpc_subchannel_create(grpc_connector* connector,
const grpc_subchannel_args* args);
/// Sets \a addr from \a args.
-void grpc_get_subchannel_address_arg(grpc_exec_ctx* exec_ctx,
- const grpc_channel_args* args,
+void grpc_get_subchannel_address_arg(const grpc_channel_args* args,
grpc_resolved_address* addr);
/// Returns the URI string for the address to connect to.
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index 1624643d0b..052b047f43 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -81,16 +81,14 @@ int grpc_subchannel_key_compare(const grpc_subchannel_key* a,
return grpc_channel_args_compare(a->args.args, b->args.args);
}
-void grpc_subchannel_key_destroy(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* k) {
+void grpc_subchannel_key_destroy(grpc_subchannel_key* k) {
gpr_free((grpc_channel_args*)k->args.filters);
- grpc_channel_args_destroy(exec_ctx, (grpc_channel_args*)k->args.args);
+ grpc_channel_args_destroy((grpc_channel_args*)k->args.args);
gpr_free(k);
}
static void sck_avl_destroy(void* p, void* user_data) {
- grpc_exec_ctx* exec_ctx = (grpc_exec_ctx*)user_data;
- grpc_subchannel_key_destroy(exec_ctx, (grpc_subchannel_key*)p);
+ grpc_subchannel_key_destroy((grpc_subchannel_key*)p);
}
static void* sck_avl_copy(void* p, void* unused) {
@@ -103,8 +101,7 @@ static long sck_avl_compare(void* a, void* b, void* unused) {
}
static void scv_avl_destroy(void* p, void* user_data) {
- grpc_exec_ctx* exec_ctx = (grpc_exec_ctx*)user_data;
- GRPC_SUBCHANNEL_WEAK_UNREF(exec_ctx, (grpc_subchannel*)p, "subchannel_index");
+ GRPC_SUBCHANNEL_WEAK_UNREF((grpc_subchannel*)p, "subchannel_index");
}
static void* scv_avl_copy(void* p, void* unused) {
@@ -135,32 +132,29 @@ void grpc_subchannel_index_shutdown(void) {
void grpc_subchannel_index_unref(void) {
if (gpr_unref(&g_refcount)) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
gpr_mu_destroy(&g_mu);
- gpr_avl_unref(g_subchannel_index, &exec_ctx);
- grpc_exec_ctx_finish(&exec_ctx);
+ gpr_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get());
}
}
void grpc_subchannel_index_ref(void) { gpr_ref_non_zero(&g_refcount); }
-grpc_subchannel* grpc_subchannel_index_find(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key) {
+grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key) {
// Lock, and take a reference to the subchannel index.
// We don't need to do the search under a lock as avl's are immutable.
gpr_mu_lock(&g_mu);
- gpr_avl index = gpr_avl_ref(g_subchannel_index, exec_ctx);
+ gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
gpr_mu_unlock(&g_mu);
grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(
- (grpc_subchannel*)gpr_avl_get(index, key, exec_ctx), "index_find");
- gpr_avl_unref(index, exec_ctx);
+ (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()),
+ "index_find");
+ gpr_avl_unref(index, grpc_core::ExecCtx::Get());
return c;
}
-grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key,
+grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
grpc_subchannel* constructed) {
grpc_subchannel* c = nullptr;
bool need_to_unref_constructed = false;
@@ -171,11 +165,11 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
// Compare and swap loop:
// - take a reference to the current index
gpr_mu_lock(&g_mu);
- gpr_avl index = gpr_avl_ref(g_subchannel_index, exec_ctx);
+ gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
gpr_mu_unlock(&g_mu);
// - Check to see if a subchannel already exists
- c = (grpc_subchannel*)gpr_avl_get(index, key, exec_ctx);
+ c = (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
if (c != nullptr) {
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
}
@@ -184,9 +178,11 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
need_to_unref_constructed = true;
} else {
// no -> update the avl and compare/swap
- gpr_avl updated = gpr_avl_add(
- gpr_avl_ref(index, exec_ctx), subchannel_key_copy(key),
- GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), exec_ctx);
+ gpr_avl updated =
+ gpr_avl_add(gpr_avl_ref(index, grpc_core::ExecCtx::Get()),
+ subchannel_key_copy(key),
+ GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
+ grpc_core::ExecCtx::Get());
// it may happen (but it's expected to be unlikely)
// that some other thread has changed the index:
@@ -198,41 +194,42 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
}
gpr_mu_unlock(&g_mu);
- gpr_avl_unref(updated, exec_ctx);
+ gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
}
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(index, grpc_core::ExecCtx::Get());
}
if (need_to_unref_constructed) {
- GRPC_SUBCHANNEL_UNREF(exec_ctx, constructed, "index_register");
+ GRPC_SUBCHANNEL_UNREF(constructed, "index_register");
}
return c;
}
-void grpc_subchannel_index_unregister(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key,
+void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
grpc_subchannel* constructed) {
bool done = false;
while (!done) {
// Compare and swap loop:
// - take a reference to the current index
gpr_mu_lock(&g_mu);
- gpr_avl index = gpr_avl_ref(g_subchannel_index, exec_ctx);
+ gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get());
gpr_mu_unlock(&g_mu);
// Check to see if this key still refers to the previously
// registered subchannel
- grpc_subchannel* c = (grpc_subchannel*)gpr_avl_get(index, key, exec_ctx);
+ grpc_subchannel* c =
+ (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get());
if (c != constructed) {
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(index, grpc_core::ExecCtx::Get());
break;
}
// compare and swap the update (some other thread may have
// mutated the index behind us)
gpr_avl updated =
- gpr_avl_remove(gpr_avl_ref(index, exec_ctx), key, exec_ctx);
+ gpr_avl_remove(gpr_avl_ref(index, grpc_core::ExecCtx::Get()), key,
+ grpc_core::ExecCtx::Get());
gpr_mu_lock(&g_mu);
if (index.root == g_subchannel_index.root) {
@@ -241,8 +238,8 @@ void grpc_subchannel_index_unregister(grpc_exec_ctx* exec_ctx,
}
gpr_mu_unlock(&g_mu);
- gpr_avl_unref(updated, exec_ctx);
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(updated, grpc_core::ExecCtx::Get());
+ gpr_avl_unref(index, grpc_core::ExecCtx::Get());
}
}
diff --git a/src/core/ext/filters/client_channel/subchannel_index.h b/src/core/ext/filters/client_channel/subchannel_index.h
index 6a4d06ef8f..bd160a3b13 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.h
+++ b/src/core/ext/filters/client_channel/subchannel_index.h
@@ -29,26 +29,22 @@ grpc_subchannel_key* grpc_subchannel_key_create(
const grpc_subchannel_args* args);
/** Destroy a subchannel key */
-void grpc_subchannel_key_destroy(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key);
+void grpc_subchannel_key_destroy(grpc_subchannel_key* key);
/** Given a subchannel key, find the subchannel registered for it.
Returns NULL if no such channel exists.
Thread-safe. */
-grpc_subchannel* grpc_subchannel_index_find(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key);
+grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key);
/** Register a subchannel against a key.
Takes ownership of \a constructed.
Returns the registered subchannel. This may be different from
\a constructed in the case of a registration race. */
-grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key,
+grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
grpc_subchannel* constructed);
/** Remove \a constructed as the registered subchannel for \a key. */
-void grpc_subchannel_index_unregister(grpc_exec_ctx* exec_ctx,
- grpc_subchannel_key* key,
+void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
grpc_subchannel* constructed);
int grpc_subchannel_key_compare(const grpc_subchannel_key* a,
diff --git a/src/core/ext/filters/client_channel/uri_parser.cc b/src/core/ext/filters/client_channel/uri_parser.cc
index b76dcbe4e3..3428f4b54c 100644
--- a/src/core/ext/filters/client_channel/uri_parser.cc
+++ b/src/core/ext/filters/client_channel/uri_parser.cc
@@ -56,8 +56,8 @@ static grpc_uri* bad_uri(const char* uri_text, size_t pos, const char* section,
}
/** Returns a copy of percent decoded \a src[begin, end) */
-static char* decode_and_copy_component(grpc_exec_ctx* exec_ctx, const char* src,
- size_t begin, size_t end) {
+static char* decode_and_copy_component(const char* src, size_t begin,
+ size_t end) {
grpc_slice component =
(begin == NOT_SET || end == NOT_SET)
? grpc_empty_slice()
@@ -65,8 +65,8 @@ static char* decode_and_copy_component(grpc_exec_ctx* exec_ctx, const char* src,
grpc_slice decoded_component =
grpc_permissive_percent_decode_slice(component);
char* out = grpc_dump_slice(decoded_component, GPR_DUMP_ASCII);
- grpc_slice_unref_internal(exec_ctx, component);
- grpc_slice_unref_internal(exec_ctx, decoded_component);
+ grpc_slice_unref_internal(component);
+ grpc_slice_unref_internal(decoded_component);
return out;
}
@@ -184,8 +184,7 @@ static void parse_query_parts(grpc_uri* uri) {
}
}
-grpc_uri* grpc_uri_parse(grpc_exec_ctx* exec_ctx, const char* uri_text,
- bool suppress_errors) {
+grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors) {
grpc_uri* uri;
size_t scheme_begin = 0;
size_t scheme_end = NOT_SET;
@@ -273,16 +272,13 @@ grpc_uri* grpc_uri_parse(grpc_exec_ctx* exec_ctx, const char* uri_text,
}
uri = (grpc_uri*)gpr_zalloc(sizeof(*uri));
- uri->scheme =
- decode_and_copy_component(exec_ctx, uri_text, scheme_begin, scheme_end);
- uri->authority = decode_and_copy_component(exec_ctx, uri_text,
- authority_begin, authority_end);
- uri->path =
- decode_and_copy_component(exec_ctx, uri_text, path_begin, path_end);
- uri->query =
- decode_and_copy_component(exec_ctx, uri_text, query_begin, query_end);
- uri->fragment = decode_and_copy_component(exec_ctx, uri_text, fragment_begin,
- fragment_end);
+ uri->scheme = decode_and_copy_component(uri_text, scheme_begin, scheme_end);
+ uri->authority =
+ decode_and_copy_component(uri_text, authority_begin, authority_end);
+ uri->path = decode_and_copy_component(uri_text, path_begin, path_end);
+ uri->query = decode_and_copy_component(uri_text, query_begin, query_end);
+ uri->fragment =
+ decode_and_copy_component(uri_text, fragment_begin, fragment_end);
parse_query_parts(uri);
return uri;
diff --git a/src/core/ext/filters/client_channel/uri_parser.h b/src/core/ext/filters/client_channel/uri_parser.h
index 84752905e8..24ff06c0b5 100644
--- a/src/core/ext/filters/client_channel/uri_parser.h
+++ b/src/core/ext/filters/client_channel/uri_parser.h
@@ -37,8 +37,7 @@ typedef struct {
} grpc_uri;
/** parse a uri, return NULL on failure */
-grpc_uri* grpc_uri_parse(grpc_exec_ctx* exec_ctx, const char* uri_text,
- bool suppress_errors);
+grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors);
/** return the part of a query string after the '=' in "?key=xxx&...", or NULL
* if key is not present */
diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc
index 5db7584a59..c430f3d2d4 100644
--- a/src/core/ext/filters/deadline/deadline_filter.cc
+++ b/src/core/ext/filters/deadline/deadline_filter.cc
@@ -36,18 +36,16 @@
// The on_complete callback used when sending a cancel_error batch down the
// filter stack. Yields the call combiner when the batch returns.
-static void yield_call_combiner(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* ignored) {
+static void yield_call_combiner(void* arg, grpc_error* ignored) {
grpc_deadline_state* deadline_state = (grpc_deadline_state*)arg;
- GRPC_CALL_COMBINER_STOP(exec_ctx, deadline_state->call_combiner,
+ GRPC_CALL_COMBINER_STOP(deadline_state->call_combiner,
"got on_complete from cancel_stream batch");
- GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack, "deadline_timer");
+ GRPC_CALL_STACK_UNREF(deadline_state->call_stack, "deadline_timer");
}
// This is called via the call combiner, so access to deadline_state is
// synchronized.
-static void send_cancel_op_in_call_combiner(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void send_cancel_op_in_call_combiner(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
grpc_transport_stream_op_batch* batch = grpc_make_transport_stream_op(
@@ -55,37 +53,34 @@ static void send_cancel_op_in_call_combiner(grpc_exec_ctx* exec_ctx, void* arg,
deadline_state, grpc_schedule_on_exec_ctx));
batch->cancel_stream = true;
batch->payload->cancel_stream.cancel_error = GRPC_ERROR_REF(error);
- elem->filter->start_transport_stream_op_batch(exec_ctx, elem, batch);
+ elem->filter->start_transport_stream_op_batch(elem, batch);
}
// Timer callback.
-static void timer_callback(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void timer_callback(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
if (error != GRPC_ERROR_CANCELLED) {
error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Deadline Exceeded"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_DEADLINE_EXCEEDED);
- grpc_call_combiner_cancel(exec_ctx, deadline_state->call_combiner,
+ grpc_call_combiner_cancel(deadline_state->call_combiner,
GRPC_ERROR_REF(error));
GRPC_CLOSURE_INIT(&deadline_state->timer_callback,
send_cancel_op_in_call_combiner, elem,
grpc_schedule_on_exec_ctx);
- GRPC_CALL_COMBINER_START(exec_ctx, deadline_state->call_combiner,
+ GRPC_CALL_COMBINER_START(deadline_state->call_combiner,
&deadline_state->timer_callback, error,
"deadline exceeded -- sending cancel_stream op");
} else {
- GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack,
- "deadline_timer");
+ GRPC_CALL_STACK_UNREF(deadline_state->call_stack, "deadline_timer");
}
}
// Starts the deadline timer.
// This is called via the call combiner, so access to deadline_state is
// synchronized.
-static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static void start_timer_if_needed(grpc_call_element* elem,
grpc_millis deadline) {
if (deadline == GRPC_MILLIS_INF_FUTURE) {
return;
@@ -113,17 +108,16 @@ static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,
}
GPR_ASSERT(closure != nullptr);
GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer");
- grpc_timer_init(exec_ctx, &deadline_state->timer, deadline, closure);
+ grpc_timer_init(&deadline_state->timer, deadline, closure);
}
// Cancels the deadline timer.
// This is called via the call combiner, so access to deadline_state is
// synchronized.
-static void cancel_timer_if_needed(grpc_exec_ctx* exec_ctx,
- grpc_deadline_state* deadline_state) {
+static void cancel_timer_if_needed(grpc_deadline_state* deadline_state) {
if (deadline_state->timer_state == GRPC_DEADLINE_STATE_PENDING) {
deadline_state->timer_state = GRPC_DEADLINE_STATE_FINISHED;
- grpc_timer_cancel(exec_ctx, &deadline_state->timer);
+ grpc_timer_cancel(&deadline_state->timer);
} else {
// timer was either in STATE_INITAL (nothing to cancel)
// OR in STATE_FINISHED (again nothing to cancel)
@@ -131,12 +125,11 @@ static void cancel_timer_if_needed(grpc_exec_ctx* exec_ctx,
}
// Callback run when the call is complete.
-static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void on_complete(void* arg, grpc_error* error) {
grpc_deadline_state* deadline_state = (grpc_deadline_state*)arg;
- cancel_timer_if_needed(exec_ctx, deadline_state);
+ cancel_timer_if_needed(deadline_state);
// Invoke the next callback.
- GRPC_CLOSURE_RUN(exec_ctx, deadline_state->next_on_complete,
- GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_RUN(deadline_state->next_on_complete, GRPC_ERROR_REF(error));
}
// Inject our own on_complete callback into op.
@@ -156,8 +149,7 @@ struct start_timer_after_init_state {
grpc_millis deadline;
grpc_closure closure;
};
-static void start_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void start_timer_after_init(void* arg, grpc_error* error) {
struct start_timer_after_init_state* state =
(struct start_timer_after_init_state*)arg;
grpc_deadline_state* deadline_state =
@@ -166,18 +158,18 @@ static void start_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
// We are initially called without holding the call combiner, so we
// need to bounce ourselves into it.
state->in_call_combiner = true;
- GRPC_CALL_COMBINER_START(exec_ctx, deadline_state->call_combiner,
- &state->closure, GRPC_ERROR_REF(error),
+ GRPC_CALL_COMBINER_START(deadline_state->call_combiner, &state->closure,
+ GRPC_ERROR_REF(error),
"scheduling deadline timer");
return;
}
- start_timer_if_needed(exec_ctx, state->elem, state->deadline);
+ start_timer_if_needed(state->elem, state->deadline);
gpr_free(state);
- GRPC_CALL_COMBINER_STOP(exec_ctx, deadline_state->call_combiner,
+ GRPC_CALL_COMBINER_STOP(deadline_state->call_combiner,
"done scheduling deadline timer");
}
-void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+void grpc_deadline_state_init(grpc_call_element* elem,
grpc_call_stack* call_stack,
grpc_call_combiner* call_combiner,
grpc_millis deadline) {
@@ -200,29 +192,27 @@ void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
state->deadline = deadline;
GRPC_CLOSURE_INIT(&state->closure, start_timer_after_init, state,
grpc_schedule_on_exec_ctx);
- GRPC_CLOSURE_SCHED(exec_ctx, &state->closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(&state->closure, GRPC_ERROR_NONE);
}
}
-void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+void grpc_deadline_state_destroy(grpc_call_element* elem) {
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
- cancel_timer_if_needed(exec_ctx, deadline_state);
+ cancel_timer_if_needed(deadline_state);
}
-void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+void grpc_deadline_state_reset(grpc_call_element* elem,
grpc_millis new_deadline) {
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
- cancel_timer_if_needed(exec_ctx, deadline_state);
- start_timer_if_needed(exec_ctx, elem, new_deadline);
+ cancel_timer_if_needed(deadline_state);
+ start_timer_if_needed(elem, new_deadline);
}
void grpc_deadline_state_client_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
if (op->cancel_stream) {
- cancel_timer_if_needed(exec_ctx, deadline_state);
+ cancel_timer_if_needed(deadline_state);
} else {
// Make sure we know when the call is complete, so that we can cancel
// the timer.
@@ -237,16 +227,14 @@ void grpc_deadline_state_client_start_transport_stream_op_batch(
//
// Constructor for channel_data. Used for both client and server filters.
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(!args->is_last);
return GRPC_ERROR_NONE;
}
// Destructor for channel_data. Used for both client and server filters.
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
// Call data used for both client and server filter.
typedef struct base_call_data {
@@ -266,50 +254,45 @@ typedef struct server_call_data {
} server_call_data;
// Constructor for call_data. Used for both client and server filters.
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
- grpc_deadline_state_init(exec_ctx, elem, args->call_stack,
- args->call_combiner, args->deadline);
+ grpc_deadline_state_init(elem, args->call_stack, args->call_combiner,
+ args->deadline);
return GRPC_ERROR_NONE;
}
// Destructor for call_data. Used for both client and server filters.
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
- grpc_deadline_state_destroy(exec_ctx, elem);
+ grpc_deadline_state_destroy(elem);
}
// Method for starting a call op for client filter.
static void client_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
- grpc_deadline_state_client_start_transport_stream_op_batch(exec_ctx, elem,
- op);
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
+ grpc_deadline_state_client_start_transport_stream_op_batch(elem, op);
// Chain to next filter.
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
// Callback for receiving initial metadata on the server.
-static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
server_call_data* calld = (server_call_data*)elem->call_data;
// Get deadline from metadata and start the timer if needed.
- start_timer_if_needed(exec_ctx, elem, calld->recv_initial_metadata->deadline);
+ start_timer_if_needed(elem, calld->recv_initial_metadata->deadline);
// Invoke the next callback.
calld->next_recv_initial_metadata_ready->cb(
- exec_ctx, calld->next_recv_initial_metadata_ready->cb_arg, error);
+ calld->next_recv_initial_metadata_ready->cb_arg, error);
}
// Method for starting a call op for server filter.
static void server_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
server_call_data* calld = (server_call_data*)elem->call_data;
if (op->cancel_stream) {
- cancel_timer_if_needed(exec_ctx, &calld->base.deadline_state);
+ cancel_timer_if_needed(&calld->base.deadline_state);
} else {
// If we're receiving initial metadata, we need to get the deadline
// from the recv_initial_metadata_ready callback. So we inject our
@@ -335,7 +318,7 @@ static void server_start_transport_stream_op_batch(
}
}
// Chain to next filter.
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
const grpc_channel_filter grpc_client_deadline_filter = {
@@ -372,8 +355,7 @@ bool grpc_deadline_checking_enabled(const grpc_channel_args* channel_args) {
!grpc_channel_args_want_minimal_stack(channel_args));
}
-static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool maybe_add_deadline_filter(grpc_channel_stack_builder* builder,
void* arg) {
return grpc_deadline_checking_enabled(
grpc_channel_stack_builder_get_channel_arguments(builder))
diff --git a/src/core/ext/filters/deadline/deadline_filter.h b/src/core/ext/filters/deadline/deadline_filter.h
index 8d835d0382..4de817ef54 100644
--- a/src/core/ext/filters/deadline/deadline_filter.h
+++ b/src/core/ext/filters/deadline/deadline_filter.h
@@ -49,13 +49,12 @@ typedef struct grpc_deadline_state {
//
// assumes elem->call_data is zero'd
-void grpc_deadline_state_init(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+void grpc_deadline_state_init(grpc_call_element* elem,
grpc_call_stack* call_stack,
grpc_call_combiner* call_combiner,
grpc_millis deadline);
-void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem);
+void grpc_deadline_state_destroy(grpc_call_element* elem);
// Cancels the existing timer and starts a new one with new_deadline.
//
@@ -66,7 +65,7 @@ void grpc_deadline_state_destroy(grpc_exec_ctx* exec_ctx,
// deadline may result in the timer being called twice.
//
// Note: Must be called while holding the call combiner.
-void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+void grpc_deadline_state_reset(grpc_call_element* elem,
grpc_millis new_deadline);
// To be called from the client-side filter's start_transport_stream_op_batch()
@@ -78,8 +77,7 @@ void grpc_deadline_state_reset(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
//
// Note: Must be called while holding the call combiner.
void grpc_deadline_state_client_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op);
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op);
// Should deadline checking be performed (according to channel args)
bool grpc_deadline_checking_enabled(const grpc_channel_args* args);
diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc
index a625369b02..a1fb10f5b8 100644
--- a/src/core/ext/filters/http/client/http_client_filter.cc
+++ b/src/core/ext/filters/http/client/http_client_filter.cc
@@ -68,12 +68,11 @@ typedef struct channel_data {
size_t max_payload_size_for_get;
} channel_data;
-static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem,
grpc_metadata_batch* b) {
if (b->idx.named.status != nullptr) {
if (grpc_mdelem_eq(b->idx.named.status->md, GRPC_MDELEM_STATUS_200)) {
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.status);
+ grpc_metadata_batch_remove(b, b->idx.named.status);
} else {
char* val = grpc_dump_slice(GRPC_MDVALUE(b->idx.named.status->md),
GPR_DUMP_ASCII);
@@ -98,10 +97,9 @@ static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_MDVALUE(b->idx.named.grpc_message->md));
if (grpc_slice_is_equivalent(pct_decoded_msg,
GRPC_MDVALUE(b->idx.named.grpc_message->md))) {
- grpc_slice_unref_internal(exec_ctx, pct_decoded_msg);
+ grpc_slice_unref_internal(pct_decoded_msg);
} else {
- grpc_metadata_batch_set_value(exec_ctx, b->idx.named.grpc_message,
- pct_decoded_msg);
+ grpc_metadata_batch_set_value(b->idx.named.grpc_message, pct_decoded_msg);
}
}
@@ -131,60 +129,53 @@ static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
gpr_free(val);
}
}
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.content_type);
+ grpc_metadata_batch_remove(b, b->idx.named.content_type);
}
return GRPC_ERROR_NONE;
}
-static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx,
- void* user_data, grpc_error* error) {
+static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
if (error == GRPC_ERROR_NONE) {
- error = client_filter_incoming_metadata(exec_ctx, elem,
- calld->recv_initial_metadata);
+ error = client_filter_incoming_metadata(elem, calld->recv_initial_metadata);
} else {
GRPC_ERROR_REF(error);
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_recv_initial_metadata_ready,
- error);
+ GRPC_CLOSURE_RUN(calld->original_recv_initial_metadata_ready, error);
}
-static void recv_trailing_metadata_on_complete(grpc_exec_ctx* exec_ctx,
- void* user_data,
+static void recv_trailing_metadata_on_complete(void* user_data,
grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
if (error == GRPC_ERROR_NONE) {
- error = client_filter_incoming_metadata(exec_ctx, elem,
- calld->recv_trailing_metadata);
+ error =
+ client_filter_incoming_metadata(elem, calld->recv_trailing_metadata);
} else {
GRPC_ERROR_REF(error);
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_recv_trailing_metadata_on_complete,
- error);
+ GRPC_CLOSURE_RUN(calld->original_recv_trailing_metadata_on_complete, error);
}
-static void send_message_on_complete(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void send_message_on_complete(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
- grpc_byte_stream_cache_destroy(exec_ctx, &calld->send_message_cache);
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_send_message_on_complete,
+ grpc_byte_stream_cache_destroy(&calld->send_message_cache);
+ GRPC_CLOSURE_RUN(calld->original_send_message_on_complete,
GRPC_ERROR_REF(error));
}
// Pulls a slice from the send_message byte stream, updating
// calld->send_message_bytes_read.
-static grpc_error* pull_slice_from_send_message(grpc_exec_ctx* exec_ctx,
- call_data* calld) {
+static grpc_error* pull_slice_from_send_message(call_data* calld) {
grpc_slice incoming_slice;
grpc_error* error = grpc_byte_stream_pull(
- exec_ctx, &calld->send_message_caching_stream.base, &incoming_slice);
+ &calld->send_message_caching_stream.base, &incoming_slice);
if (error == GRPC_ERROR_NONE) {
calld->send_message_bytes_read += GRPC_SLICE_LENGTH(incoming_slice);
- grpc_slice_unref_internal(exec_ctx, incoming_slice);
+ grpc_slice_unref_internal(incoming_slice);
}
return error;
}
@@ -194,12 +185,10 @@ static grpc_error* pull_slice_from_send_message(grpc_exec_ctx* exec_ctx,
// calld->send_message_caching_stream.base.length, then we have completed
// reading from the byte stream; otherwise, an async read has been dispatched
// and on_send_message_next_done() will be invoked when it is complete.
-static grpc_error* read_all_available_send_message_data(grpc_exec_ctx* exec_ctx,
- call_data* calld) {
- while (grpc_byte_stream_next(exec_ctx,
- &calld->send_message_caching_stream.base,
+static grpc_error* read_all_available_send_message_data(call_data* calld) {
+ while (grpc_byte_stream_next(&calld->send_message_caching_stream.base,
~(size_t)0, &calld->on_send_message_next_done)) {
- grpc_error* error = pull_slice_from_send_message(exec_ctx, calld);
+ grpc_error* error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) return error;
if (calld->send_message_bytes_read ==
calld->send_message_caching_stream.base.length) {
@@ -210,19 +199,18 @@ static grpc_error* read_all_available_send_message_data(grpc_exec_ctx* exec_ctx,
}
// Async callback for grpc_byte_stream_next().
-static void on_send_message_next_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_send_message_next_done(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
if (error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, calld->send_message_batch, error, calld->call_combiner);
+ calld->send_message_batch, error, calld->call_combiner);
return;
}
- error = pull_slice_from_send_message(exec_ctx, calld);
+ error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, calld->send_message_batch, error, calld->call_combiner);
+ calld->send_message_batch, error, calld->call_combiner);
return;
}
// There may or may not be more to read, but we don't care. If we got
@@ -230,7 +218,7 @@ static void on_send_message_next_done(grpc_exec_ctx* exec_ctx, void* arg,
// synchronously, so we were not able to do a cached call. Instead,
// we just reset the byte stream and then send down the batch as-is.
grpc_caching_byte_stream_reset(&calld->send_message_caching_stream);
- grpc_call_next_op(exec_ctx, elem, calld->send_message_batch);
+ grpc_call_next_op(elem, calld->send_message_batch);
}
static char* slice_buffer_to_string(grpc_slice_buffer* slice_buffer) {
@@ -248,8 +236,7 @@ static char* slice_buffer_to_string(grpc_slice_buffer* slice_buffer) {
// Modifies the path entry in the batch's send_initial_metadata to
// append the base64-encoded query for a GET request.
-static grpc_error* update_path_for_get(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* update_path_for_get(grpc_call_element* elem,
grpc_transport_stream_op_batch* batch) {
call_data* calld = (call_data*)elem->call_data;
grpc_slice path_slice =
@@ -282,24 +269,22 @@ static grpc_error* update_path_for_get(grpc_exec_ctx* exec_ctx,
grpc_slice_sub_no_ref(path_with_query_slice, 0, strlen(t));
/* substitute previous path with the new path+query */
grpc_mdelem mdelem_path_and_query =
- grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH, path_with_query_slice);
+ grpc_mdelem_from_slices(GRPC_MDSTR_PATH, path_with_query_slice);
grpc_metadata_batch* b =
batch->payload->send_initial_metadata.send_initial_metadata;
- return grpc_metadata_batch_substitute(exec_ctx, b, b->idx.named.path,
+ return grpc_metadata_batch_substitute(b, b->idx.named.path,
mdelem_path_and_query);
}
-static void remove_if_present(grpc_exec_ctx* exec_ctx,
- grpc_metadata_batch* batch,
+static void remove_if_present(grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx) {
if (batch->idx.array[idx] != nullptr) {
- grpc_metadata_batch_remove(exec_ctx, batch, batch->idx.array[idx]);
+ grpc_metadata_batch_remove(batch, batch->idx.array[idx]);
}
}
static void hc_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* batch) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
call_data* calld = (call_data*)elem->call_data;
channel_data* channeld = (channel_data*)elem->channel_data;
GPR_TIMER_BEGIN("hc_start_transport_stream_op_batch", 0);
@@ -345,17 +330,16 @@ static void hc_start_transport_stream_op_batch(
calld->original_send_message_on_complete = batch->on_complete;
batch->on_complete = &calld->send_message_on_complete;
calld->send_message_batch = batch;
- error = read_all_available_send_message_data(exec_ctx, calld);
+ error = read_all_available_send_message_data(calld);
if (error != GRPC_ERROR_NONE) goto done;
// If all the data has been read, then we can use GET.
if (calld->send_message_bytes_read ==
calld->send_message_caching_stream.base.length) {
method = GRPC_MDELEM_METHOD_GET;
- error = update_path_for_get(exec_ctx, elem, batch);
+ error = update_path_for_get(elem, batch);
if (error != GRPC_ERROR_NONE) goto done;
batch->send_message = false;
- grpc_byte_stream_destroy(exec_ctx,
- &calld->send_message_caching_stream.base);
+ grpc_byte_stream_destroy(&calld->send_message_caching_stream.base);
} else {
// Not all data is available. The batch will be sent down
// asynchronously in on_send_message_next_done().
@@ -372,41 +356,41 @@ static void hc_start_transport_stream_op_batch(
}
remove_if_present(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_METHOD);
remove_if_present(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_SCHEME);
remove_if_present(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_TE);
remove_if_present(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_CONTENT_TYPE);
remove_if_present(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
GRPC_BATCH_USER_AGENT);
/* Send : prefixed headers, which have to be before any application
layer headers. */
error = grpc_metadata_batch_add_head(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
&calld->method, method);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_head(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
&calld->scheme, channeld->static_scheme);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
&calld->te_trailers, GRPC_MDELEM_TE_TRAILERS);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
&calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
- exec_ctx, batch->payload->send_initial_metadata.send_initial_metadata,
+ batch->payload->send_initial_metadata.send_initial_metadata,
&calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent));
if (error != GRPC_ERROR_NONE) goto done;
}
@@ -414,16 +398,15 @@ static void hc_start_transport_stream_op_batch(
done:
if (error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, calld->send_message_batch, error, calld->call_combiner);
+ calld->send_message_batch, error, calld->call_combiner);
} else if (!batch_will_be_handled_asynchronously) {
- grpc_call_next_op(exec_ctx, elem, batch);
+ grpc_call_next_op(elem, batch);
}
GPR_TIMER_END("hc_start_transport_stream_op_batch", 0);
}
/* Constructor for call_data */
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
calld->call_combiner = args->call_combiner;
@@ -441,7 +424,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for call_data */
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {}
@@ -533,8 +516,7 @@ static grpc_slice user_agent_from_args(const grpc_channel_args* args,
}
/* Constructor for channel_data */
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(!args->is_last);
@@ -543,17 +525,16 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
chand->max_payload_size_for_get =
max_payload_size_from_args(args->channel_args);
chand->user_agent = grpc_mdelem_from_slices(
- exec_ctx, GRPC_MDSTR_USER_AGENT,
+ GRPC_MDSTR_USER_AGENT,
user_agent_from_args(args->channel_args,
args->optional_transport->vtable->name));
return GRPC_ERROR_NONE;
}
/* Destructor for channel data */
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {
+static void destroy_channel_elem(grpc_channel_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
- GRPC_MDELEM_UNREF(exec_ctx, chand->user_agent);
+ GRPC_MDELEM_UNREF(chand->user_agent);
}
const grpc_channel_filter grpc_http_client_filter = {
diff --git a/src/core/ext/filters/http/http_filters_plugin.cc b/src/core/ext/filters/http/http_filters_plugin.cc
index 483eb021e8..deec77c96f 100644
--- a/src/core/ext/filters/http/http_filters_plugin.cc
+++ b/src/core/ext/filters/http/http_filters_plugin.cc
@@ -40,8 +40,7 @@ static bool is_building_http_like_transport(
return t != nullptr && strstr(t->vtable->name, "http");
}
-static bool maybe_add_optional_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool maybe_add_optional_filter(grpc_channel_stack_builder* builder,
void* arg) {
if (!is_building_http_like_transport(builder)) return true;
optional_filter* filtarg = (optional_filter*)arg;
@@ -55,8 +54,7 @@ static bool maybe_add_optional_filter(grpc_exec_ctx* exec_ctx,
: true;
}
-static bool maybe_add_required_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool maybe_add_required_filter(grpc_channel_stack_builder* builder,
void* arg) {
return is_building_http_like_transport(builder)
? grpc_channel_stack_builder_prepend_filter(
diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
index d070b56b6a..9ae13d2ed2 100644
--- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc
+++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
@@ -100,12 +100,11 @@ static bool skip_compression(grpc_call_element* elem, uint32_t flags,
/** Filter initial metadata */
static grpc_error* process_send_initial_metadata(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_metadata_batch* initial_metadata,
+ grpc_call_element* elem, grpc_metadata_batch* initial_metadata,
bool* has_compression_algorithm) GRPC_MUST_USE_RESULT;
static grpc_error* process_send_initial_metadata(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_metadata_batch* initial_metadata, bool* has_compression_algorithm) {
+ grpc_call_element* elem, grpc_metadata_batch* initial_metadata,
+ bool* has_compression_algorithm) {
call_data* calld = (call_data*)elem->call_data;
channel_data* channeld = (channel_data*)elem->channel_data;
*has_compression_algorithm = false;
@@ -137,13 +136,13 @@ static grpc_error* process_send_initial_metadata(
}
*has_compression_algorithm = true;
grpc_metadata_batch_remove(
- exec_ctx, initial_metadata,
+ initial_metadata,
initial_metadata->idx.named.grpc_internal_stream_encoding_request);
/* Disable message-wise compression */
calld->compression_algorithm = GRPC_COMPRESS_NONE;
if (initial_metadata->idx.named.grpc_internal_encoding_request != nullptr) {
grpc_metadata_batch_remove(
- exec_ctx, initial_metadata,
+ initial_metadata,
initial_metadata->idx.named.grpc_internal_encoding_request);
}
} else if (initial_metadata->idx.named.grpc_internal_encoding_request !=
@@ -160,7 +159,7 @@ static grpc_error* process_send_initial_metadata(
}
*has_compression_algorithm = true;
grpc_metadata_batch_remove(
- exec_ctx, initial_metadata,
+ initial_metadata,
initial_metadata->idx.named.grpc_internal_encoding_request);
} else {
/* If no algorithm was found in the metadata and we aren't
@@ -181,12 +180,11 @@ static grpc_error* process_send_initial_metadata(
/* hint compression algorithm */
if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) {
error = grpc_metadata_batch_add_tail(
- exec_ctx, initial_metadata,
- &calld->stream_compression_algorithm_storage,
+ initial_metadata, &calld->stream_compression_algorithm_storage,
grpc_stream_compression_encoding_mdelem(stream_compression_algorithm));
} else if (calld->compression_algorithm != GRPC_COMPRESS_NONE) {
error = grpc_metadata_batch_add_tail(
- exec_ctx, initial_metadata, &calld->compression_algorithm_storage,
+ initial_metadata, &calld->compression_algorithm_storage,
grpc_compression_encoding_mdelem(calld->compression_algorithm));
}
@@ -194,7 +192,7 @@ static grpc_error* process_send_initial_metadata(
/* convey supported compression algorithms */
error = grpc_metadata_batch_add_tail(
- exec_ctx, initial_metadata, &calld->accept_encoding_storage,
+ initial_metadata, &calld->accept_encoding_storage,
GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(
channeld->supported_compression_algorithms));
@@ -203,7 +201,7 @@ static grpc_error* process_send_initial_metadata(
/* Do not overwrite accept-encoding header if it already presents. */
if (!initial_metadata->idx.named.accept_encoding) {
error = grpc_metadata_batch_add_tail(
- exec_ctx, initial_metadata, &calld->accept_stream_encoding_storage,
+ initial_metadata, &calld->accept_stream_encoding_storage,
GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(
channeld->supported_stream_compression_algorithms));
}
@@ -211,17 +209,15 @@ static grpc_error* process_send_initial_metadata(
return error;
}
-static void send_message_on_complete(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void send_message_on_complete(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &calld->slices);
- GRPC_CLOSURE_RUN(exec_ctx, calld->original_send_message_on_complete,
+ grpc_slice_buffer_reset_and_unref_internal(&calld->slices);
+ GRPC_CLOSURE_RUN(calld->original_send_message_on_complete,
GRPC_ERROR_REF(error));
}
-static void send_message_batch_continue(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void send_message_batch_continue(grpc_call_element* elem) {
call_data* calld = (call_data*)elem->call_data;
// Note: The call to grpc_call_next_op() results in yielding the
// call combiner, so we need to clear calld->send_message_batch
@@ -229,19 +225,18 @@ static void send_message_batch_continue(grpc_exec_ctx* exec_ctx,
grpc_transport_stream_op_batch* send_message_batch =
calld->send_message_batch;
calld->send_message_batch = nullptr;
- grpc_call_next_op(exec_ctx, elem, send_message_batch);
+ grpc_call_next_op(elem, send_message_batch);
}
-static void finish_send_message(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void finish_send_message(grpc_call_element* elem) {
call_data* calld = (call_data*)elem->call_data;
// Compress the data if appropriate.
grpc_slice_buffer tmp;
grpc_slice_buffer_init(&tmp);
uint32_t send_flags =
calld->send_message_batch->payload->send_message.send_message->flags;
- bool did_compress = grpc_msg_compress(exec_ctx, calld->compression_algorithm,
- &calld->slices, &tmp);
+ bool did_compress =
+ grpc_msg_compress(calld->compression_algorithm, &calld->slices, &tmp);
if (did_compress) {
if (grpc_compression_trace.enabled()) {
const char* algo_name;
@@ -268,11 +263,11 @@ static void finish_send_message(grpc_exec_ctx* exec_ctx,
algo_name, calld->slices.length);
}
}
- grpc_slice_buffer_destroy_internal(exec_ctx, &tmp);
+ grpc_slice_buffer_destroy_internal(&tmp);
// Swap out the original byte stream with our new one and send the
// batch down.
grpc_byte_stream_destroy(
- exec_ctx, calld->send_message_batch->payload->send_message.send_message);
+ calld->send_message_batch->payload->send_message.send_message);
grpc_slice_buffer_stream_init(&calld->replacement_stream, &calld->slices,
send_flags);
calld->send_message_batch->payload->send_message.send_message =
@@ -280,27 +275,24 @@ static void finish_send_message(grpc_exec_ctx* exec_ctx,
calld->original_send_message_on_complete =
calld->send_message_batch->on_complete;
calld->send_message_batch->on_complete = &calld->send_message_on_complete;
- send_message_batch_continue(exec_ctx, elem);
+ send_message_batch_continue(elem);
}
-static void fail_send_message_batch_in_call_combiner(grpc_exec_ctx* exec_ctx,
- void* arg,
+static void fail_send_message_batch_in_call_combiner(void* arg,
grpc_error* error) {
call_data* calld = (call_data*)arg;
if (calld->send_message_batch != nullptr) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, calld->send_message_batch, GRPC_ERROR_REF(error),
- calld->call_combiner);
+ calld->send_message_batch, GRPC_ERROR_REF(error), calld->call_combiner);
calld->send_message_batch = nullptr;
}
}
// Pulls a slice from the send_message byte stream and adds it to calld->slices.
-static grpc_error* pull_slice_from_send_message(grpc_exec_ctx* exec_ctx,
- call_data* calld) {
+static grpc_error* pull_slice_from_send_message(call_data* calld) {
grpc_slice incoming_slice;
grpc_error* error = grpc_byte_stream_pull(
- exec_ctx, calld->send_message_batch->payload->send_message.send_message,
+ calld->send_message_batch->payload->send_message.send_message,
&incoming_slice);
if (error == GRPC_ERROR_NONE) {
grpc_slice_buffer_add(&calld->slices, incoming_slice);
@@ -312,69 +304,65 @@ static grpc_error* pull_slice_from_send_message(grpc_exec_ctx* exec_ctx,
// If all data has been read, invokes finish_send_message(). Otherwise,
// an async call to grpc_byte_stream_next() has been started, which will
// eventually result in calling on_send_message_next_done().
-static void continue_reading_send_message(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem) {
+static void continue_reading_send_message(grpc_call_element* elem) {
call_data* calld = (call_data*)elem->call_data;
while (grpc_byte_stream_next(
- exec_ctx, calld->send_message_batch->payload->send_message.send_message,
- ~(size_t)0, &calld->on_send_message_next_done)) {
- grpc_error* error = pull_slice_from_send_message(exec_ctx, calld);
+ calld->send_message_batch->payload->send_message.send_message, ~(size_t)0,
+ &calld->on_send_message_next_done)) {
+ grpc_error* error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) {
// Closure callback; does not take ownership of error.
- fail_send_message_batch_in_call_combiner(exec_ctx, calld, error);
+ fail_send_message_batch_in_call_combiner(calld, error);
GRPC_ERROR_UNREF(error);
return;
}
if (calld->slices.length ==
calld->send_message_batch->payload->send_message.send_message->length) {
- finish_send_message(exec_ctx, elem);
+ finish_send_message(elem);
break;
}
}
}
// Async callback for grpc_byte_stream_next().
-static void on_send_message_next_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_send_message_next_done(void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
if (error != GRPC_ERROR_NONE) {
// Closure callback; does not take ownership of error.
- fail_send_message_batch_in_call_combiner(exec_ctx, calld, error);
+ fail_send_message_batch_in_call_combiner(calld, error);
return;
}
- error = pull_slice_from_send_message(exec_ctx, calld);
+ error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) {
// Closure callback; does not take ownership of error.
- fail_send_message_batch_in_call_combiner(exec_ctx, calld, error);
+ fail_send_message_batch_in_call_combiner(calld, error);
GRPC_ERROR_UNREF(error);
return;
}
if (calld->slices.length ==
calld->send_message_batch->payload->send_message.send_message->length) {
- finish_send_message(exec_ctx, elem);
+ finish_send_message(elem);
} else {
- continue_reading_send_message(exec_ctx, elem);
+ continue_reading_send_message(elem);
}
}
-static void start_send_message_batch(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* unused) {
+static void start_send_message_batch(void* arg, grpc_error* unused) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
if (skip_compression(
elem,
calld->send_message_batch->payload->send_message.send_message->flags,
calld->send_initial_metadata_state == HAS_COMPRESSION_ALGORITHM)) {
- send_message_batch_continue(exec_ctx, elem);
+ send_message_batch_continue(elem);
} else {
- continue_reading_send_message(exec_ctx, elem);
+ continue_reading_send_message(elem);
}
}
static void compress_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* batch) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* batch) {
call_data* calld = (call_data*)elem->call_data;
GPR_TIMER_BEGIN("compress_start_transport_stream_op_batch", 0);
// Handle cancel_stream.
@@ -385,21 +373,19 @@ static void compress_start_transport_stream_op_batch(
if (calld->send_message_batch != nullptr) {
if (calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN) {
GRPC_CALL_COMBINER_START(
- exec_ctx, calld->call_combiner,
+ calld->call_combiner,
GRPC_CLOSURE_CREATE(fail_send_message_batch_in_call_combiner, calld,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_REF(calld->cancel_error), "failing send_message op");
} else {
grpc_byte_stream_shutdown(
- exec_ctx,
calld->send_message_batch->payload->send_message.send_message,
GRPC_ERROR_REF(calld->cancel_error));
}
}
} else if (calld->cancel_error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, batch, GRPC_ERROR_REF(calld->cancel_error),
- calld->call_combiner);
+ batch, GRPC_ERROR_REF(calld->cancel_error), calld->call_combiner);
goto done;
}
// Handle send_initial_metadata.
@@ -407,11 +393,10 @@ static void compress_start_transport_stream_op_batch(
GPR_ASSERT(calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN);
bool has_compression_algorithm;
grpc_error* error = process_send_initial_metadata(
- exec_ctx, elem,
- batch->payload->send_initial_metadata.send_initial_metadata,
+ elem, batch->payload->send_initial_metadata.send_initial_metadata,
&has_compression_algorithm);
if (error != GRPC_ERROR_NONE) {
- grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, batch, error,
+ grpc_transport_stream_op_batch_finish_with_failure(batch, error,
calld->call_combiner);
goto done;
}
@@ -425,7 +410,7 @@ static void compress_start_transport_stream_op_batch(
// the call stack) will release the call combiner for each batch it sees.
if (calld->send_message_batch != nullptr) {
GRPC_CALL_COMBINER_START(
- exec_ctx, calld->call_combiner,
+ calld->call_combiner,
&calld->start_send_message_batch_in_call_combiner, GRPC_ERROR_NONE,
"starting send_message after send_initial_metadata");
}
@@ -440,22 +425,21 @@ static void compress_start_transport_stream_op_batch(
// send_initial_metadata.
if (calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN) {
GRPC_CALL_COMBINER_STOP(
- exec_ctx, calld->call_combiner,
+ calld->call_combiner,
"send_message batch pending send_initial_metadata");
goto done;
}
- start_send_message_batch(exec_ctx, elem, GRPC_ERROR_NONE);
+ start_send_message_batch(elem, GRPC_ERROR_NONE);
} else {
// Pass control down the stack.
- grpc_call_next_op(exec_ctx, elem, batch);
+ grpc_call_next_op(elem, batch);
}
done:
GPR_TIMER_END("compress_start_transport_stream_op_batch", 0);
}
/* Constructor for call_data */
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
calld->call_combiner = args->call_combiner;
@@ -471,17 +455,16 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for call_data */
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
call_data* calld = (call_data*)elem->call_data;
- grpc_slice_buffer_destroy_internal(exec_ctx, &calld->slices);
+ grpc_slice_buffer_destroy_internal(&calld->slices);
GRPC_ERROR_UNREF(calld->cancel_error);
}
/* Constructor for channel_data */
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
channel_data* channeld = (channel_data*)elem->channel_data;
@@ -531,8 +514,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for channel data */
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
const grpc_channel_filter grpc_message_compress_filter = {
compress_start_transport_stream_op_batch,
diff --git a/src/core/ext/filters/http/server/http_server_filter.cc b/src/core/ext/filters/http/server/http_server_filter.cc
index 4f3897915c..b872dc98f5 100644
--- a/src/core/ext/filters/http/server/http_server_filter.cc
+++ b/src/core/ext/filters/http/server/http_server_filter.cc
@@ -66,8 +66,7 @@ typedef struct channel_data {
uint8_t unused;
} channel_data;
-static grpc_error* server_filter_outgoing_metadata(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* server_filter_outgoing_metadata(grpc_call_element* elem,
grpc_metadata_batch* b) {
if (b->idx.named.grpc_message != nullptr) {
grpc_slice pct_encoded_msg = grpc_percent_encode_slice(
@@ -75,10 +74,9 @@ static grpc_error* server_filter_outgoing_metadata(grpc_exec_ctx* exec_ctx,
grpc_compatible_percent_encoding_unreserved_bytes);
if (grpc_slice_is_equivalent(pct_encoded_msg,
GRPC_MDVALUE(b->idx.named.grpc_message->md))) {
- grpc_slice_unref_internal(exec_ctx, pct_encoded_msg);
+ grpc_slice_unref_internal(pct_encoded_msg);
} else {
- grpc_metadata_batch_set_value(exec_ctx, b->idx.named.grpc_message,
- pct_encoded_msg);
+ grpc_metadata_batch_set_value(b->idx.named.grpc_message, pct_encoded_msg);
}
}
return GRPC_ERROR_NONE;
@@ -93,8 +91,7 @@ static void add_error(const char* error_name, grpc_error** cumulative,
*cumulative = grpc_error_add_child(*cumulative, new_err);
}
-static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* server_filter_incoming_metadata(grpc_call_element* elem,
grpc_metadata_batch* b) {
call_data* calld = (call_data*)elem->call_data;
grpc_error* error = GRPC_ERROR_NONE;
@@ -123,7 +120,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.method->md));
}
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.method);
+ grpc_metadata_batch_remove(b, b->idx.named.method);
} else {
add_error(
error_name, &error,
@@ -139,7 +136,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.te->md));
}
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.te);
+ grpc_metadata_batch_remove(b, b->idx.named.te);
} else {
add_error(error_name, &error,
grpc_error_set_str(
@@ -156,7 +153,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.scheme->md));
}
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.scheme);
+ grpc_metadata_batch_remove(b, b->idx.named.scheme);
} else {
add_error(
error_name, &error,
@@ -191,7 +188,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
gpr_free(val);
}
}
- grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.content_type);
+ grpc_metadata_batch_remove(b, b->idx.named.content_type);
}
if (b->idx.named.path == nullptr) {
@@ -218,22 +215,21 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
/* substitute path metadata with just the path (not query) */
grpc_mdelem mdelem_path_without_query = grpc_mdelem_from_slices(
- exec_ctx, GRPC_MDSTR_PATH, grpc_slice_sub(path_slice, 0, offset));
+ GRPC_MDSTR_PATH, grpc_slice_sub(path_slice, 0, offset));
- grpc_metadata_batch_substitute(exec_ctx, b, b->idx.named.path,
+ grpc_metadata_batch_substitute(b, b->idx.named.path,
mdelem_path_without_query);
/* decode payload from query and add to the slice buffer to be returned */
const int k_url_safe = 1;
- grpc_slice_buffer_add(
- &calld->read_slice_buffer,
- grpc_base64_decode_with_len(
- exec_ctx, (const char*)GRPC_SLICE_START_PTR(query_slice),
- GRPC_SLICE_LENGTH(query_slice), k_url_safe));
+ grpc_slice_buffer_add(&calld->read_slice_buffer,
+ grpc_base64_decode_with_len(
+ (const char*)GRPC_SLICE_START_PTR(query_slice),
+ GRPC_SLICE_LENGTH(query_slice), k_url_safe));
grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0);
calld->seen_path_with_query = true;
- grpc_slice_unref_internal(exec_ctx, query_slice);
+ grpc_slice_unref_internal(query_slice);
} else {
gpr_log(GPR_ERROR, "GET request without QUERY");
}
@@ -242,14 +238,14 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
if (b->idx.named.host != nullptr && b->idx.named.authority == nullptr) {
grpc_linked_mdelem* el = b->idx.named.host;
grpc_mdelem md = GRPC_MDELEM_REF(el->md);
- grpc_metadata_batch_remove(exec_ctx, b, el);
+ grpc_metadata_batch_remove(b, el);
add_error(error_name, &error,
grpc_metadata_batch_add_head(
- exec_ctx, b, el,
+ b, el,
grpc_mdelem_from_slices(
- exec_ctx, GRPC_MDSTR_AUTHORITY,
+ GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(GRPC_MDVALUE(md)))));
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
}
if (b->idx.named.authority == nullptr) {
@@ -263,21 +259,18 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
return error;
}
-static void hs_on_recv(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_error* err) {
+static void hs_on_recv(void* user_data, grpc_error* err) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
if (err == GRPC_ERROR_NONE) {
- err = server_filter_incoming_metadata(exec_ctx, elem,
- calld->recv_initial_metadata);
+ err = server_filter_incoming_metadata(elem, calld->recv_initial_metadata);
} else {
GRPC_ERROR_REF(err);
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv, err);
+ GRPC_CLOSURE_RUN(calld->on_done_recv, err);
}
-static void hs_on_complete(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_error* err) {
+static void hs_on_complete(void* user_data, grpc_error* err) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
/* Call recv_message_ready if we got the payload via the path field */
@@ -287,17 +280,16 @@ static void hs_on_complete(grpc_exec_ctx* exec_ctx, void* user_data,
: (grpc_byte_stream*)&calld->read_stream;
// Re-enter call combiner for recv_message_ready, since the surface
// code will release the call combiner for each callback it receives.
- GRPC_CALL_COMBINER_START(exec_ctx, calld->call_combiner,
- calld->recv_message_ready, GRPC_ERROR_REF(err),
+ GRPC_CALL_COMBINER_START(calld->call_combiner, calld->recv_message_ready,
+ GRPC_ERROR_REF(err),
"resuming recv_message_ready from on_complete");
calld->recv_message_ready = nullptr;
calld->payload_bin_delivered = true;
}
- GRPC_CLOSURE_RUN(exec_ctx, calld->on_complete, GRPC_ERROR_REF(err));
+ GRPC_CLOSURE_RUN(calld->on_complete, GRPC_ERROR_REF(err));
}
-static void hs_recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_error* err) {
+static void hs_recv_message_ready(void* user_data, grpc_error* err) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
if (calld->seen_path_with_query) {
@@ -305,15 +297,14 @@ static void hs_recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
// returned in hs_on_complete callback.
// Note that we release the call combiner here, so that other
// callbacks can run.
- GRPC_CALL_COMBINER_STOP(exec_ctx, calld->call_combiner,
+ GRPC_CALL_COMBINER_STOP(calld->call_combiner,
"pausing recv_message_ready until on_complete");
} else {
- GRPC_CLOSURE_RUN(exec_ctx, calld->recv_message_ready, GRPC_ERROR_REF(err));
+ GRPC_CLOSURE_RUN(calld->recv_message_ready, GRPC_ERROR_REF(err));
}
}
-static grpc_error* hs_mutate_op(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* hs_mutate_op(grpc_call_element* elem,
grpc_transport_stream_op_batch* op) {
/* grab pointers to our data from the call element */
call_data* calld = (call_data*)elem->call_data;
@@ -321,21 +312,19 @@ static grpc_error* hs_mutate_op(grpc_exec_ctx* exec_ctx,
if (op->send_initial_metadata) {
grpc_error* error = GRPC_ERROR_NONE;
static const char* error_name = "Failed sending initial metadata";
+ add_error(error_name, &error,
+ grpc_metadata_batch_add_head(
+ op->payload->send_initial_metadata.send_initial_metadata,
+ &calld->status, GRPC_MDELEM_STATUS_200));
+ add_error(error_name, &error,
+ grpc_metadata_batch_add_tail(
+ op->payload->send_initial_metadata.send_initial_metadata,
+ &calld->content_type,
+ GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC));
add_error(
error_name, &error,
- grpc_metadata_batch_add_head(
- exec_ctx, op->payload->send_initial_metadata.send_initial_metadata,
- &calld->status, GRPC_MDELEM_STATUS_200));
- add_error(
- error_name, &error,
- grpc_metadata_batch_add_tail(
- exec_ctx, op->payload->send_initial_metadata.send_initial_metadata,
- &calld->content_type,
- GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC));
- add_error(error_name, &error,
- server_filter_outgoing_metadata(
- exec_ctx, elem,
- op->payload->send_initial_metadata.send_initial_metadata));
+ server_filter_outgoing_metadata(
+ elem, op->payload->send_initial_metadata.send_initial_metadata));
if (error != GRPC_ERROR_NONE) return error;
}
@@ -367,8 +356,7 @@ static grpc_error* hs_mutate_op(grpc_exec_ctx* exec_ctx,
if (op->send_trailing_metadata) {
grpc_error* error = server_filter_outgoing_metadata(
- exec_ctx, elem,
- op->payload->send_trailing_metadata.send_trailing_metadata);
+ elem, op->payload->send_trailing_metadata.send_trailing_metadata);
if (error != GRPC_ERROR_NONE) return error;
}
@@ -376,23 +364,21 @@ static grpc_error* hs_mutate_op(grpc_exec_ctx* exec_ctx,
}
static void hs_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
call_data* calld = (call_data*)elem->call_data;
GPR_TIMER_BEGIN("hs_start_transport_stream_op_batch", 0);
- grpc_error* error = hs_mutate_op(exec_ctx, elem, op);
+ grpc_error* error = hs_mutate_op(elem, op);
if (error != GRPC_ERROR_NONE) {
- grpc_transport_stream_op_batch_finish_with_failure(exec_ctx, op, error,
+ grpc_transport_stream_op_batch_finish_with_failure(op, error,
calld->call_combiner);
} else {
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
GPR_TIMER_END("hs_start_transport_stream_op_batch", 0);
}
/* Constructor for call_data */
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
/* grab pointers to our data from the call element */
call_data* calld = (call_data*)elem->call_data;
@@ -409,24 +395,22 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for call_data */
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
call_data* calld = (call_data*)elem->call_data;
- grpc_slice_buffer_destroy_internal(exec_ctx, &calld->read_slice_buffer);
+ grpc_slice_buffer_destroy_internal(&calld->read_slice_buffer);
}
/* Constructor for channel_data */
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(!args->is_last);
return GRPC_ERROR_NONE;
}
/* Destructor for channel data */
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
const grpc_channel_filter grpc_http_server_filter = {
hs_start_transport_stream_op_batch,
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
index 762198f034..f50a928fcd 100644
--- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
+++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
@@ -54,8 +54,7 @@ typedef struct channel_data {
intptr_t id; /**< an id unique to the channel */
} channel_data;
-static void on_initial_md_ready(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_error* err) {
+static void on_initial_md_ready(void* user_data, grpc_error* err) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
@@ -73,20 +72,19 @@ static void on_initial_md_ready(grpc_exec_ctx* exec_ctx, void* user_data,
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.lb_token->md));
calld->have_initial_md_string = true;
grpc_metadata_batch_remove(
- exec_ctx, calld->recv_initial_metadata,
+ calld->recv_initial_metadata,
calld->recv_initial_metadata->idx.named.lb_token);
}
} else {
GRPC_ERROR_REF(err);
}
calld->ops_recv_initial_metadata_ready->cb(
- exec_ctx, calld->ops_recv_initial_metadata_ready->cb_arg, err);
+ calld->ops_recv_initial_metadata_ready->cb_arg, err);
GRPC_ERROR_UNREF(err);
}
/* Constructor for call_data */
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
calld->id = (intptr_t)args->call_stack;
@@ -108,7 +106,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for call_data */
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
call_data* calld = (call_data*)elem->call_data;
@@ -125,19 +123,18 @@ static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
*/
if (calld->have_initial_md_string) {
- grpc_slice_unref_internal(exec_ctx, calld->initial_md_string);
+ grpc_slice_unref_internal(calld->initial_md_string);
}
if (calld->have_trailing_md_string) {
- grpc_slice_unref_internal(exec_ctx, calld->trailing_md_string);
+ grpc_slice_unref_internal(calld->trailing_md_string);
}
if (calld->have_service_method) {
- grpc_slice_unref_internal(exec_ctx, calld->service_method);
+ grpc_slice_unref_internal(calld->service_method);
}
}
/* Constructor for channel_data */
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(!args->is_last);
@@ -158,8 +155,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
}
/* Destructor for channel data */
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {
+static void destroy_channel_elem(grpc_channel_element* elem) {
/* TODO(dgq): do something with the data
channel_data *chand = elem->channel_data;
grpc_load_reporting_call_data lr_call_data = {
@@ -173,8 +169,7 @@ static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
*/
}
-static grpc_filtered_mdelem lr_trailing_md_filter(grpc_exec_ctx* exec_ctx,
- void* user_data,
+static grpc_filtered_mdelem lr_trailing_md_filter(void* user_data,
grpc_mdelem md) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
@@ -186,8 +181,7 @@ static grpc_filtered_mdelem lr_trailing_md_filter(grpc_exec_ctx* exec_ctx,
}
static void lr_start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
GPR_TIMER_BEGIN("lr_start_transport_stream_op_batch", 0);
call_data* calld = (call_data*)elem->call_data;
@@ -203,12 +197,11 @@ static void lr_start_transport_stream_op_batch(
GRPC_LOG_IF_ERROR(
"grpc_metadata_batch_filter",
grpc_metadata_batch_filter(
- exec_ctx,
op->payload->send_trailing_metadata.send_trailing_metadata,
lr_trailing_md_filter, elem,
"LR trailing metadata filtering error"));
}
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
GPR_TIMER_END("lr_start_transport_stream_op_batch", 0);
}
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
index accb7797dd..9d1dfcbb4c 100644
--- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
+++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
@@ -38,7 +38,7 @@ static bool is_load_reporting_enabled(const grpc_channel_args* a) {
}
static bool maybe_add_server_load_reporting_filter(
- grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
+ grpc_channel_stack_builder* builder, void* arg) {
const grpc_channel_args* args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_channel_filter* filter = (const grpc_channel_filter*)arg;
diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc
index 917fbd9198..0499c6ecfc 100644
--- a/src/core/ext/filters/max_age/max_age_filter.cc
+++ b/src/core/ext/filters/max_age/max_age_filter.cc
@@ -88,73 +88,69 @@ typedef struct channel_data {
/* Increase the nubmer of active calls. Before the increasement, if there are no
calls, the max_idle_timer should be cancelled. */
-static void increase_call_count(grpc_exec_ctx* exec_ctx, channel_data* chand) {
+static void increase_call_count(channel_data* chand) {
if (gpr_atm_full_fetch_add(&chand->call_count, 1) == 0) {
- grpc_timer_cancel(exec_ctx, &chand->max_idle_timer);
+ grpc_timer_cancel(&chand->max_idle_timer);
}
}
/* Decrease the nubmer of active calls. After the decrement, if there are no
calls, the max_idle_timer should be started. */
-static void decrease_call_count(grpc_exec_ctx* exec_ctx, channel_data* chand) {
+static void decrease_call_count(channel_data* chand) {
if (gpr_atm_full_fetch_add(&chand->call_count, -1) == 1) {
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_idle_timer");
- grpc_timer_init(exec_ctx, &chand->max_idle_timer,
- grpc_exec_ctx_now(exec_ctx) + chand->max_connection_idle,
- &chand->close_max_idle_channel);
+ grpc_timer_init(
+ &chand->max_idle_timer,
+ grpc_core::ExecCtx::Get()->Now() + chand->max_connection_idle,
+ &chand->close_max_idle_channel);
}
}
-static void start_max_idle_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void start_max_idle_timer_after_init(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
/* Decrease call_count. If there are no active calls at this time,
max_idle_timer will start here. If the number of active calls is not 0,
max_idle_timer will start after all the active calls end. */
- decrease_call_count(exec_ctx, chand);
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
+ decrease_call_count(chand);
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack,
"max_age start_max_idle_timer_after_init");
}
-static void start_max_age_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void start_max_age_timer_after_init(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
gpr_mu_lock(&chand->max_age_timer_mu);
chand->max_age_timer_pending = true;
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_age_timer");
- grpc_timer_init(exec_ctx, &chand->max_age_timer,
- grpc_exec_ctx_now(exec_ctx) + chand->max_connection_age,
+ grpc_timer_init(&chand->max_age_timer,
+ grpc_core::ExecCtx::Get()->Now() + chand->max_connection_age,
&chand->close_max_age_channel);
gpr_mu_unlock(&chand->max_age_timer_mu);
grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->on_connectivity_state_change = &chand->channel_connectivity_changed;
op->connectivity_state = &chand->connectivity_state;
- grpc_channel_next_op(exec_ctx,
- grpc_channel_stack_element(chand->channel_stack, 0), op);
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
+ grpc_channel_next_op(grpc_channel_stack_element(chand->channel_stack, 0), op);
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack,
"max_age start_max_age_timer_after_init");
}
-static void start_max_age_grace_timer_after_goaway_op(grpc_exec_ctx* exec_ctx,
- void* arg,
+static void start_max_age_grace_timer_after_goaway_op(void* arg,
grpc_error* error) {
channel_data* chand = (channel_data*)arg;
gpr_mu_lock(&chand->max_age_timer_mu);
chand->max_age_grace_timer_pending = true;
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_age_grace_timer");
grpc_timer_init(
- exec_ctx, &chand->max_age_grace_timer,
+ &chand->max_age_grace_timer,
chand->max_connection_age_grace == GRPC_MILLIS_INF_FUTURE
? GRPC_MILLIS_INF_FUTURE
- : grpc_exec_ctx_now(exec_ctx) + chand->max_connection_age_grace,
+ : grpc_core::ExecCtx::Get()->Now() + chand->max_connection_age_grace,
&chand->force_close_max_age_channel);
gpr_mu_unlock(&chand->max_age_timer_mu);
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack,
"max_age start_max_age_grace_timer_after_goaway_op");
}
-static void close_max_idle_channel(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void close_max_idle_channel(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
if (error == GRPC_ERROR_NONE) {
/* Prevent the max idle timer from being set again */
@@ -165,16 +161,14 @@ static void close_max_idle_channel(grpc_exec_ctx* exec_ctx, void* arg,
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_NO_ERROR);
grpc_channel_element* elem =
grpc_channel_stack_element(chand->channel_stack, 0);
- elem->filter->start_transport_op(exec_ctx, elem, op);
+ elem->filter->start_transport_op(elem, op);
} else if (error != GRPC_ERROR_CANCELLED) {
GRPC_LOG_IF_ERROR("close_max_idle_channel", error);
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
- "max_age max_idle_timer");
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_idle_timer");
}
-static void close_max_age_channel(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void close_max_age_channel(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
gpr_mu_lock(&chand->max_age_timer_mu);
chand->max_age_timer_pending = false;
@@ -189,16 +183,14 @@ static void close_max_age_channel(grpc_exec_ctx* exec_ctx, void* arg,
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_NO_ERROR);
grpc_channel_element* elem =
grpc_channel_stack_element(chand->channel_stack, 0);
- elem->filter->start_transport_op(exec_ctx, elem, op);
+ elem->filter->start_transport_op(elem, op);
} else if (error != GRPC_ERROR_CANCELLED) {
GRPC_LOG_IF_ERROR("close_max_age_channel", error);
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
- "max_age max_age_timer");
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_age_timer");
}
-static void force_close_max_age_channel(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void force_close_max_age_channel(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
gpr_mu_lock(&chand->max_age_timer_mu);
chand->max_age_grace_timer_pending = false;
@@ -209,38 +201,36 @@ static void force_close_max_age_channel(grpc_exec_ctx* exec_ctx, void* arg,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel reaches max age");
grpc_channel_element* elem =
grpc_channel_stack_element(chand->channel_stack, 0);
- elem->filter->start_transport_op(exec_ctx, elem, op);
+ elem->filter->start_transport_op(elem, op);
} else if (error != GRPC_ERROR_CANCELLED) {
GRPC_LOG_IF_ERROR("force_close_max_age_channel", error);
}
- GRPC_CHANNEL_STACK_UNREF(exec_ctx, chand->channel_stack,
- "max_age max_age_grace_timer");
+ GRPC_CHANNEL_STACK_UNREF(chand->channel_stack, "max_age max_age_grace_timer");
}
-static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void channel_connectivity_changed(void* arg, grpc_error* error) {
channel_data* chand = (channel_data*)arg;
if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->on_connectivity_state_change = &chand->channel_connectivity_changed;
op->connectivity_state = &chand->connectivity_state;
- grpc_channel_next_op(
- exec_ctx, grpc_channel_stack_element(chand->channel_stack, 0), op);
+ grpc_channel_next_op(grpc_channel_stack_element(chand->channel_stack, 0),
+ op);
} else {
gpr_mu_lock(&chand->max_age_timer_mu);
if (chand->max_age_timer_pending) {
- grpc_timer_cancel(exec_ctx, &chand->max_age_timer);
+ grpc_timer_cancel(&chand->max_age_timer);
chand->max_age_timer_pending = false;
}
if (chand->max_age_grace_timer_pending) {
- grpc_timer_cancel(exec_ctx, &chand->max_age_grace_timer);
+ grpc_timer_cancel(&chand->max_age_grace_timer);
chand->max_age_grace_timer_pending = false;
}
gpr_mu_unlock(&chand->max_age_timer_mu);
/* If there are no active calls, this increasement will cancel
max_idle_timer, and prevent max_idle_timer from being started in the
future. */
- increase_call_count(exec_ctx, chand);
+ increase_call_count(chand);
}
}
@@ -263,25 +253,23 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) {
}
/* Constructor for call_data. */
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
- increase_call_count(exec_ctx, chand);
+ increase_call_count(chand);
return GRPC_ERROR_NONE;
}
/* Destructor for call_data. */
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {
channel_data* chand = (channel_data*)elem->channel_data;
- decrease_call_count(exec_ctx, chand);
+ decrease_call_count(chand);
}
/* Constructor for channel_data. */
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
gpr_mu_init(&chand->max_age_timer_mu);
@@ -351,8 +339,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
initialization is done. */
GRPC_CHANNEL_STACK_REF(chand->channel_stack,
"max_age start_max_age_timer_after_init");
- GRPC_CLOSURE_SCHED(exec_ctx, &chand->start_max_age_timer_after_init,
- GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(&chand->start_max_age_timer_after_init, GRPC_ERROR_NONE);
}
/* Initialize the number of calls as 1, so that the max_idle_timer will not
@@ -361,15 +348,14 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
if (chand->max_connection_idle != GRPC_MILLIS_INF_FUTURE) {
GRPC_CHANNEL_STACK_REF(chand->channel_stack,
"max_age start_max_idle_timer_after_init");
- GRPC_CLOSURE_SCHED(exec_ctx, &chand->start_max_idle_timer_after_init,
+ GRPC_CLOSURE_SCHED(&chand->start_max_idle_timer_after_init,
GRPC_ERROR_NONE);
}
return GRPC_ERROR_NONE;
}
/* Destructor for channel_data. */
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
const grpc_channel_filter grpc_max_age_filter = {
grpc_call_next_op,
@@ -384,8 +370,7 @@ const grpc_channel_filter grpc_max_age_filter = {
grpc_channel_next_get_info,
"max_age"};
-static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool maybe_add_max_age_filter(grpc_channel_stack_builder* builder,
void* arg) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc
index 3d2252af2e..f8487f9a9e 100644
--- a/src/core/ext/filters/message_size/message_size_filter.cc
+++ b/src/core/ext/filters/message_size/message_size_filter.cc
@@ -47,8 +47,7 @@ static void* refcounted_message_size_limits_ref(void* value) {
return value;
}
-static void refcounted_message_size_limits_unref(grpc_exec_ctx* exec_ctx,
- void* value) {
+static void refcounted_message_size_limits_unref(void* value) {
refcounted_message_size_limits* limits =
(refcounted_message_size_limits*)value;
if (gpr_unref(&limits->refs)) {
@@ -108,8 +107,7 @@ typedef struct channel_data {
// Callback invoked when we receive a message. Here we check the max
// receive message size.
-static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_error* error) {
+static void recv_message_ready(void* user_data, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
if (*calld->recv_message != nullptr && calld->limits.max_recv_size >= 0 &&
@@ -132,13 +130,12 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
GRPC_ERROR_REF(error);
}
// Invoke the next callback.
- GRPC_CLOSURE_RUN(exec_ctx, calld->next_recv_message_ready, error);
+ GRPC_CLOSURE_RUN(calld->next_recv_message_ready, error);
}
// Start transport stream op.
static void start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
call_data* calld = (call_data*)elem->call_data;
// Check max send message size.
if (op->send_message && calld->limits.max_send_size >= 0 &&
@@ -149,7 +146,7 @@ static void start_transport_stream_op_batch(
op->payload->send_message.send_message->length,
calld->limits.max_send_size);
grpc_transport_stream_op_batch_finish_with_failure(
- exec_ctx, op,
+ op,
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(message_string),
GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_RESOURCE_EXHAUSTED),
@@ -165,12 +162,11 @@ static void start_transport_stream_op_batch(
op->payload->recv_message.recv_message_ready = &calld->recv_message_ready;
}
// Chain to the next filter.
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
// Constructor for call_data.
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
@@ -186,7 +182,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
if (chand->method_limit_table != nullptr) {
refcounted_message_size_limits* limits =
(refcounted_message_size_limits*)grpc_method_config_table_get(
- exec_ctx, chand->method_limit_table, args->path);
+ chand->method_limit_table, args->path);
if (limits != nullptr) {
if (limits->limits.max_send_size >= 0 &&
(limits->limits.max_send_size < calld->limits.max_send_size ||
@@ -204,7 +200,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
// Destructor for call_data.
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {}
@@ -241,8 +237,7 @@ message_size_limits get_message_size_limits(
}
// Constructor for channel_data.
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
GPR_ASSERT(!args->is_last);
channel_data* chand = (channel_data*)elem->channel_data;
@@ -257,8 +252,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
if (service_config != nullptr) {
chand->method_limit_table =
grpc_service_config_create_method_config_table(
- exec_ctx, service_config,
- refcounted_message_size_limits_create_from_json,
+ service_config, refcounted_message_size_limits_create_from_json,
refcounted_message_size_limits_ref,
refcounted_message_size_limits_unref);
grpc_service_config_destroy(service_config);
@@ -268,10 +262,9 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
}
// Destructor for channel_data.
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {
+static void destroy_channel_elem(grpc_channel_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
- grpc_slice_hash_table_unref(exec_ctx, chand->method_limit_table);
+ grpc_slice_hash_table_unref(chand->method_limit_table);
}
const grpc_channel_filter grpc_message_size_filter = {
@@ -287,8 +280,7 @@ const grpc_channel_filter grpc_message_size_filter = {
grpc_channel_next_get_info,
"message_size"};
-static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx,
- grpc_channel_stack_builder* builder,
+static bool maybe_add_message_size_filter(grpc_channel_stack_builder* builder,
void* arg) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
index 4ab1ee4e79..555a9134a2 100644
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
+++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
@@ -50,8 +50,7 @@ static bool get_user_agent_mdelem(const grpc_metadata_batch* batch,
}
// Callback invoked when we receive an initial metadata.
-static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx,
- void* user_data, grpc_error* error) {
+static void recv_initial_metadata_ready(void* user_data, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
@@ -67,14 +66,13 @@ static void recv_initial_metadata_ready(grpc_exec_ctx* exec_ctx,
}
// Invoke the next callback.
- GRPC_CLOSURE_RUN(exec_ctx, calld->next_recv_initial_metadata_ready,
+ GRPC_CLOSURE_RUN(calld->next_recv_initial_metadata_ready,
GRPC_ERROR_REF(error));
}
// Start transport stream op.
static void start_transport_stream_op_batch(
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
- grpc_transport_stream_op_batch* op) {
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
call_data* calld = (call_data*)elem->call_data;
// Inject callback for receiving initial metadata
@@ -96,12 +94,11 @@ static void start_transport_stream_op_batch(
}
// Chain to the next filter.
- grpc_call_next_op(exec_ctx, elem, op);
+ grpc_call_next_op(elem, op);
}
// Constructor for call_data.
-static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
- grpc_call_element* elem,
+static grpc_error* init_call_elem(grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
calld->next_recv_initial_metadata_ready = nullptr;
@@ -113,20 +110,18 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
}
// Destructor for call_data.
-static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
+static void destroy_call_elem(grpc_call_element* elem,
const grpc_call_final_info* final_info,
grpc_closure* ignored) {}
// Constructor for channel_data.
-static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem,
+static grpc_error* init_channel_elem(grpc_channel_element* elem,
grpc_channel_element_args* args) {
return GRPC_ERROR_NONE;
}
// Destructor for channel_data.
-static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
- grpc_channel_element* elem) {}
+static void destroy_channel_elem(grpc_channel_element* elem) {}
// Parse the user agent
static bool parse_user_agent(grpc_mdelem md) {
@@ -181,7 +176,7 @@ const grpc_channel_filter grpc_workaround_cronet_compression_filter = {
"workaround_cronet_compression"};
static bool register_workaround_cronet_compression(
- grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
+ grpc_channel_stack_builder* builder, void* arg) {
const grpc_channel_args* channel_args =
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* a = grpc_channel_args_find(
diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc
index 819f66aec3..db5962e7fd 100644
--- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc
+++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc
@@ -61,38 +61,34 @@ static void chttp2_connector_ref(grpc_connector* con) {
gpr_ref(&c->refs);
}
-static void chttp2_connector_unref(grpc_exec_ctx* exec_ctx,
- grpc_connector* con) {
+static void chttp2_connector_unref(grpc_connector* con) {
chttp2_connector* c = (chttp2_connector*)con;
if (gpr_unref(&c->refs)) {
gpr_mu_destroy(&c->mu);
// If handshaking is not yet in progress, destroy the endpoint.
// Otherwise, the handshaker will do this for us.
- if (c->endpoint != nullptr) grpc_endpoint_destroy(exec_ctx, c->endpoint);
+ if (c->endpoint != nullptr) grpc_endpoint_destroy(c->endpoint);
gpr_free(c);
}
}
-static void chttp2_connector_shutdown(grpc_exec_ctx* exec_ctx,
- grpc_connector* con, grpc_error* why) {
+static void chttp2_connector_shutdown(grpc_connector* con, grpc_error* why) {
chttp2_connector* c = (chttp2_connector*)con;
gpr_mu_lock(&c->mu);
c->shutdown = true;
if (c->handshake_mgr != nullptr) {
- grpc_handshake_manager_shutdown(exec_ctx, c->handshake_mgr,
- GRPC_ERROR_REF(why));
+ grpc_handshake_manager_shutdown(c->handshake_mgr, GRPC_ERROR_REF(why));
}
// If handshaking is not yet in progress, shutdown the endpoint.
// Otherwise, the handshaker will do this for us.
if (!c->connecting && c->endpoint != nullptr) {
- grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(why));
+ grpc_endpoint_shutdown(c->endpoint, GRPC_ERROR_REF(why));
}
gpr_mu_unlock(&c->mu);
GRPC_ERROR_UNREF(why);
}
-static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_handshake_done(void* arg, grpc_error* error) {
grpc_handshaker_args* args = (grpc_handshaker_args*)arg;
chttp2_connector* c = (chttp2_connector*)args->user_data;
gpr_mu_lock(&c->mu);
@@ -105,20 +101,20 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
// before destroying them, even if we know that there are no
// pending read/write callbacks. This should be fixed, at which
// point this can be removed.
- grpc_endpoint_shutdown(exec_ctx, args->endpoint, GRPC_ERROR_REF(error));
- grpc_endpoint_destroy(exec_ctx, args->endpoint);
- grpc_channel_args_destroy(exec_ctx, args->args);
- grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
+ grpc_endpoint_shutdown(args->endpoint, GRPC_ERROR_REF(error));
+ grpc_endpoint_destroy(args->endpoint);
+ grpc_channel_args_destroy(args->args);
+ grpc_slice_buffer_destroy_internal(args->read_buffer);
gpr_free(args->read_buffer);
} else {
error = GRPC_ERROR_REF(error);
}
memset(c->result, 0, sizeof(*c->result));
} else {
- grpc_endpoint_delete_from_pollset_set(exec_ctx, args->endpoint,
+ grpc_endpoint_delete_from_pollset_set(args->endpoint,
c->args.interested_parties);
- c->result->transport = grpc_create_chttp2_transport(exec_ctx, args->args,
- args->endpoint, true);
+ c->result->transport =
+ grpc_create_chttp2_transport(args->args, args->endpoint, true);
GPR_ASSERT(c->result->transport);
// TODO(roth): We ideally want to wait until we receive HTTP/2
// settings from the server before we consider the connection
@@ -144,34 +140,32 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
// so until after transparent retries is implemented. Otherwise, any
// RPC that we attempt to send on the connection before the timeout
// would fail instead of being retried on a subsequent attempt.
- grpc_chttp2_transport_start_reading(exec_ctx, c->result->transport,
- args->read_buffer, nullptr);
+ grpc_chttp2_transport_start_reading(c->result->transport, args->read_buffer,
+ nullptr);
c->result->channel_args = args->args;
}
grpc_closure* notify = c->notify;
c->notify = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, notify, error);
- grpc_handshake_manager_destroy(exec_ctx, c->handshake_mgr);
+ GRPC_CLOSURE_SCHED(notify, error);
+ grpc_handshake_manager_destroy(c->handshake_mgr);
c->handshake_mgr = nullptr;
gpr_mu_unlock(&c->mu);
- chttp2_connector_unref(exec_ctx, (grpc_connector*)c);
+ chttp2_connector_unref((grpc_connector*)c);
}
-static void start_handshake_locked(grpc_exec_ctx* exec_ctx,
- chttp2_connector* c) {
+static void start_handshake_locked(chttp2_connector* c) {
c->handshake_mgr = grpc_handshake_manager_create();
- grpc_handshakers_add(exec_ctx, HANDSHAKER_CLIENT, c->args.channel_args,
+ grpc_handshakers_add(HANDSHAKER_CLIENT, c->args.channel_args,
c->handshake_mgr);
- grpc_endpoint_add_to_pollset_set(exec_ctx, c->endpoint,
- c->args.interested_parties);
+ grpc_endpoint_add_to_pollset_set(c->endpoint, c->args.interested_parties);
grpc_handshake_manager_do_handshake(
- exec_ctx, c->handshake_mgr, c->args.interested_parties, c->endpoint,
+ c->handshake_mgr, c->args.interested_parties, c->endpoint,
c->args.channel_args, c->args.deadline, nullptr /* acceptor */,
on_handshake_done, c);
c->endpoint = nullptr; // Endpoint handed off to handshake manager.
}
-static void connected(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void connected(void* arg, grpc_error* error) {
chttp2_connector* c = (chttp2_connector*)arg;
gpr_mu_lock(&c->mu);
GPR_ASSERT(c->connecting);
@@ -185,27 +179,26 @@ static void connected(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
memset(c->result, 0, sizeof(*c->result));
grpc_closure* notify = c->notify;
c->notify = nullptr;
- GRPC_CLOSURE_SCHED(exec_ctx, notify, error);
+ GRPC_CLOSURE_SCHED(notify, error);
if (c->endpoint != nullptr) {
- grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(c->endpoint, GRPC_ERROR_REF(error));
}
gpr_mu_unlock(&c->mu);
- chttp2_connector_unref(exec_ctx, (grpc_connector*)arg);
+ chttp2_connector_unref((grpc_connector*)arg);
} else {
GPR_ASSERT(c->endpoint != nullptr);
- start_handshake_locked(exec_ctx, c);
+ start_handshake_locked(c);
gpr_mu_unlock(&c->mu);
}
}
-static void chttp2_connector_connect(grpc_exec_ctx* exec_ctx,
- grpc_connector* con,
+static void chttp2_connector_connect(grpc_connector* con,
const grpc_connect_in_args* args,
grpc_connect_out_args* result,
grpc_closure* notify) {
chttp2_connector* c = (chttp2_connector*)con;
grpc_resolved_address addr;
- grpc_get_subchannel_address_arg(exec_ctx, args->channel_args, &addr);
+ grpc_get_subchannel_address_arg(args->channel_args, &addr);
gpr_mu_lock(&c->mu);
GPR_ASSERT(c->notify == nullptr);
c->notify = notify;
@@ -216,9 +209,8 @@ static void chttp2_connector_connect(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&c->connected, connected, c, grpc_schedule_on_exec_ctx);
GPR_ASSERT(!c->connecting);
c->connecting = true;
- grpc_tcp_client_connect(exec_ctx, &c->connected, &c->endpoint,
- args->interested_parties, args->channel_args, &addr,
- args->deadline);
+ grpc_tcp_client_connect(&c->connected, &c->endpoint, args->interested_parties,
+ args->channel_args, &addr, args->deadline);
gpr_mu_unlock(&c->mu);
}
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
index 028b69e5ff..6a1b70964d 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -34,21 +34,19 @@ static void client_channel_factory_ref(
grpc_client_channel_factory* cc_factory) {}
static void client_channel_factory_unref(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory) {}
+ grpc_client_channel_factory* cc_factory) {}
static grpc_subchannel* client_channel_factory_create_subchannel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory,
- const grpc_subchannel_args* args) {
+ grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) {
grpc_connector* connector = grpc_chttp2_connector_create();
- grpc_subchannel* s = grpc_subchannel_create(exec_ctx, connector, args);
- grpc_connector_unref(exec_ctx, connector);
+ grpc_subchannel* s = grpc_subchannel_create(connector, args);
+ grpc_connector_unref(connector);
return s;
}
static grpc_channel* client_channel_factory_create_channel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory,
- const char* target, grpc_client_channel_type type,
- const grpc_channel_args* args) {
+ grpc_client_channel_factory* cc_factory, const char* target,
+ grpc_client_channel_type type, const grpc_channel_args* args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
@@ -56,14 +54,14 @@ static grpc_channel* client_channel_factory_create_channel(
// Add channel arg containing the server URI.
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_SERVER_URI,
- grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target));
+ grpc_resolver_factory_add_default_prefix_if_needed(target));
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
gpr_free(arg.value.string);
- grpc_channel* channel = grpc_channel_create(exec_ctx, target, new_args,
- GRPC_CLIENT_CHANNEL, nullptr);
- grpc_channel_args_destroy(exec_ctx, new_args);
+ grpc_channel* channel =
+ grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
+ grpc_channel_args_destroy(new_args);
return channel;
}
@@ -82,7 +80,7 @@ static grpc_client_channel_factory client_channel_factory = {
grpc_channel* grpc_insecure_channel_create(const char* target,
const grpc_channel_args* args,
void* reserved) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
GRPC_API_TRACE(
"grpc_insecure_channel_create(target=%s, args=%p, reserved=%p)", 3,
(target, args, reserved));
@@ -93,11 +91,11 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
// Create channel.
grpc_channel* channel = client_channel_factory_create_channel(
- &exec_ctx, &client_channel_factory, target,
- GRPC_CLIENT_CHANNEL_TYPE_REGULAR, new_args);
+ &client_channel_factory, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR,
+ new_args);
// Clean up.
- grpc_channel_args_destroy(&exec_ctx, new_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(new_args);
+
return channel != nullptr ? channel
: grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
index c6b149d0b1..0cdea5a94e 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc
@@ -37,7 +37,7 @@
grpc_channel* grpc_insecure_channel_create_from_fd(
const char* target, int fd, const grpc_channel_args* args) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3,
(target, fd, args));
@@ -50,17 +50,17 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
GPR_ASSERT(fcntl(fd, F_SETFL, flags | O_NONBLOCK) == 0);
grpc_endpoint* client = grpc_tcp_client_create_from_fd(
- &exec_ctx, grpc_fd_create(fd, "client"), args, "fd-client");
+ grpc_fd_create(fd, "client"), args, "fd-client");
grpc_transport* transport =
- grpc_create_chttp2_transport(&exec_ctx, final_args, client, true);
+ grpc_create_chttp2_transport(final_args, client, true);
GPR_ASSERT(transport);
grpc_channel* channel = grpc_channel_create(
- &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
- grpc_channel_args_destroy(&exec_ctx, final_args);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
+ target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
+ grpc_channel_args_destroy(final_args);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx::Get()->Flush();
return channel != nullptr ? channel
: grpc_lame_client_channel_create(
@@ -73,7 +73,7 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
grpc_channel* grpc_insecure_channel_create_from_fd(
const char* target, int fd, const grpc_channel_args* args) {
GPR_ASSERT(0);
- return NULL;
+ return nullptr;
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
index dd2bc427a7..27c5b96a4c 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
@@ -41,10 +41,10 @@ static void client_channel_factory_ref(
grpc_client_channel_factory* cc_factory) {}
static void client_channel_factory_unref(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory) {}
+ grpc_client_channel_factory* cc_factory) {}
static grpc_subchannel_args* get_secure_naming_subchannel_args(
- grpc_exec_ctx* exec_ctx, const grpc_subchannel_args* args) {
+ const grpc_subchannel_args* args) {
grpc_channel_credentials* channel_credentials =
grpc_channel_credentials_find_in_args(args->args);
if (channel_credentials == nullptr) {
@@ -68,7 +68,7 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
const char* server_uri_str = server_uri_arg->value.string;
GPR_ASSERT(server_uri_str != nullptr);
grpc_uri* server_uri =
- grpc_uri_parse(exec_ctx, server_uri_str, true /* supress errors */);
+ grpc_uri_parse(server_uri_str, true /* supress errors */);
GPR_ASSERT(server_uri != nullptr);
const char* server_uri_path;
server_uri_path =
@@ -81,7 +81,7 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
const char* target_uri_str =
grpc_get_subchannel_address_uri_arg(args->args);
grpc_uri* target_uri =
- grpc_uri_parse(exec_ctx, target_uri_str, false /* suppress errors */);
+ grpc_uri_parse(target_uri_str, false /* suppress errors */);
GPR_ASSERT(target_uri != nullptr);
if (target_uri->path[0] != '\0') { // "path" may be empty
const grpc_slice key = grpc_slice_from_static_string(
@@ -89,7 +89,7 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
const char* value =
(const char*)grpc_slice_hash_table_get(targets_info, key);
if (value != nullptr) target_name_to_check = gpr_strdup(value);
- grpc_slice_unref_internal(exec_ctx, key);
+ grpc_slice_unref_internal(key);
}
if (target_name_to_check == nullptr) {
// If the target name to check hasn't already been set, fall back to using
@@ -107,7 +107,7 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
grpc_channel_args* new_args_from_connector = nullptr;
const grpc_security_status security_status =
grpc_channel_credentials_create_security_connector(
- exec_ctx, channel_credentials, target_name_to_check, args->args,
+ channel_credentials, target_name_to_check, args->args,
&subchannel_security_connector, &new_args_from_connector);
if (security_status != GRPC_SECURITY_OK) {
gpr_log(GPR_ERROR,
@@ -123,10 +123,10 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(
new_args_from_connector != nullptr ? new_args_from_connector : args->args,
&new_security_connector_arg, 1);
- GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &subchannel_security_connector->base,
+ GRPC_SECURITY_CONNECTOR_UNREF(&subchannel_security_connector->base,
"lb_channel_create");
if (new_args_from_connector != nullptr) {
- grpc_channel_args_destroy(exec_ctx, new_args_from_connector);
+ grpc_channel_args_destroy(new_args_from_connector);
}
grpc_subchannel_args* final_sc_args =
(grpc_subchannel_args*)gpr_malloc(sizeof(*final_sc_args));
@@ -136,10 +136,9 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
}
static grpc_subchannel* client_channel_factory_create_subchannel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory,
- const grpc_subchannel_args* args) {
+ grpc_client_channel_factory* cc_factory, const grpc_subchannel_args* args) {
grpc_subchannel_args* subchannel_args =
- get_secure_naming_subchannel_args(exec_ctx, args);
+ get_secure_naming_subchannel_args(args);
if (subchannel_args == nullptr) {
gpr_log(
GPR_ERROR,
@@ -147,19 +146,16 @@ static grpc_subchannel* client_channel_factory_create_subchannel(
return nullptr;
}
grpc_connector* connector = grpc_chttp2_connector_create();
- grpc_subchannel* s =
- grpc_subchannel_create(exec_ctx, connector, subchannel_args);
- grpc_connector_unref(exec_ctx, connector);
- grpc_channel_args_destroy(exec_ctx,
- (grpc_channel_args*)subchannel_args->args);
+ grpc_subchannel* s = grpc_subchannel_create(connector, subchannel_args);
+ grpc_connector_unref(connector);
+ grpc_channel_args_destroy((grpc_channel_args*)subchannel_args->args);
gpr_free(subchannel_args);
return s;
}
static grpc_channel* client_channel_factory_create_channel(
- grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory,
- const char* target, grpc_client_channel_type type,
- const grpc_channel_args* args) {
+ grpc_client_channel_factory* cc_factory, const char* target,
+ grpc_client_channel_type type, const grpc_channel_args* args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
@@ -167,14 +163,14 @@ static grpc_channel* client_channel_factory_create_channel(
// Add channel arg containing the server URI.
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_SERVER_URI,
- grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target));
+ grpc_resolver_factory_add_default_prefix_if_needed(target));
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
gpr_free(arg.value.string);
- grpc_channel* channel = grpc_channel_create(exec_ctx, target, new_args,
- GRPC_CLIENT_CHANNEL, nullptr);
- grpc_channel_args_destroy(exec_ctx, new_args);
+ grpc_channel* channel =
+ grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
+ grpc_channel_args_destroy(new_args);
return channel;
}
@@ -194,7 +190,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
const char* target,
const grpc_channel_args* args,
void* reserved) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
GRPC_API_TRACE(
"grpc_secure_channel_create(creds=%p, target=%s, args=%p, "
"reserved=%p)",
@@ -211,11 +207,10 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
args, args_to_add, GPR_ARRAY_SIZE(args_to_add));
// Create channel.
channel = client_channel_factory_create_channel(
- &exec_ctx, &client_channel_factory, target,
- GRPC_CLIENT_CHANNEL_TYPE_REGULAR, new_args);
+ &client_channel_factory, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR,
+ new_args);
// Clean up.
- grpc_channel_args_destroy(&exec_ctx, new_args);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_channel_args_destroy(new_args);
}
return channel != nullptr ? channel
: grpc_lame_client_channel_create(
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index 49ee677464..5669fa4090 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -69,17 +69,17 @@ typedef struct {
} server_connection_state;
static void server_connection_state_unref(
- grpc_exec_ctx* exec_ctx, server_connection_state* connection_state) {
+ server_connection_state* connection_state) {
if (gpr_unref(&connection_state->refs)) {
if (connection_state->transport != nullptr) {
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, connection_state->transport,
+ GRPC_CHTTP2_UNREF_TRANSPORT(connection_state->transport,
"receive settings timeout");
}
gpr_free(connection_state);
}
}
-static void on_timeout(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
+static void on_timeout(void* arg, grpc_error* error) {
server_connection_state* connection_state = (server_connection_state*)arg;
// Note that we may be called with GRPC_ERROR_NONE when the timer fires
// or with an error indicating that the timer system is being shut down.
@@ -87,22 +87,20 @@ static void on_timeout(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->disconnect_with_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Did not receive HTTP/2 settings before handshake timeout");
- grpc_transport_perform_op(exec_ctx, &connection_state->transport->base, op);
+ grpc_transport_perform_op(&connection_state->transport->base, op);
}
- server_connection_state_unref(exec_ctx, connection_state);
+ server_connection_state_unref(connection_state);
}
-static void on_receive_settings(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_receive_settings(void* arg, grpc_error* error) {
server_connection_state* connection_state = (server_connection_state*)arg;
if (error == GRPC_ERROR_NONE) {
- grpc_timer_cancel(exec_ctx, &connection_state->timer);
+ grpc_timer_cancel(&connection_state->timer);
}
- server_connection_state_unref(exec_ctx, connection_state);
+ server_connection_state_unref(connection_state);
}
-static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void on_handshake_done(void* arg, grpc_error* error) {
grpc_handshaker_args* args = (grpc_handshaker_args*)arg;
server_connection_state* connection_state =
(server_connection_state*)args->user_data;
@@ -117,10 +115,10 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
// before destroying them, even if we know that there are no
// pending read/write callbacks. This should be fixed, at which
// point this can be removed.
- grpc_endpoint_shutdown(exec_ctx, args->endpoint, GRPC_ERROR_NONE);
- grpc_endpoint_destroy(exec_ctx, args->endpoint);
- grpc_channel_args_destroy(exec_ctx, args->args);
- grpc_slice_buffer_destroy_internal(exec_ctx, args->read_buffer);
+ grpc_endpoint_shutdown(args->endpoint, GRPC_ERROR_NONE);
+ grpc_endpoint_destroy(args->endpoint);
+ grpc_channel_args_destroy(args->args);
+ grpc_slice_buffer_destroy_internal(args->read_buffer);
gpr_free(args->read_buffer);
}
} else {
@@ -128,10 +126,10 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
// handshaker may have handed off the connection to some external
// code, so we can just clean up here without creating a transport.
if (args->endpoint != nullptr) {
- grpc_transport* transport = grpc_create_chttp2_transport(
- exec_ctx, args->args, args->endpoint, false);
+ grpc_transport* transport =
+ grpc_create_chttp2_transport(args->args, args->endpoint, false);
grpc_server_setup_transport(
- exec_ctx, connection_state->svr_state->server, transport,
+ connection_state->svr_state->server, transport,
connection_state->accepting_pollset, args->args);
// Use notify_on_receive_settings callback to enforce the
// handshake deadline.
@@ -141,16 +139,14 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
on_receive_settings, connection_state,
grpc_schedule_on_exec_ctx);
grpc_chttp2_transport_start_reading(
- exec_ctx, transport, args->read_buffer,
- &connection_state->on_receive_settings);
- grpc_channel_args_destroy(exec_ctx, args->args);
+ transport, args->read_buffer, &connection_state->on_receive_settings);
+ grpc_channel_args_destroy(args->args);
gpr_ref(&connection_state->refs);
GRPC_CHTTP2_REF_TRANSPORT((grpc_chttp2_transport*)transport,
"receive settings timeout");
GRPC_CLOSURE_INIT(&connection_state->on_timeout, on_timeout,
connection_state, grpc_schedule_on_exec_ctx);
- grpc_timer_init(exec_ctx, &connection_state->timer,
- connection_state->deadline,
+ grpc_timer_init(&connection_state->timer, connection_state->deadline,
&connection_state->on_timeout);
}
}
@@ -158,21 +154,21 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
&connection_state->svr_state->pending_handshake_mgrs,
connection_state->handshake_mgr);
gpr_mu_unlock(&connection_state->svr_state->mu);
- grpc_handshake_manager_destroy(exec_ctx, connection_state->handshake_mgr);
+ grpc_handshake_manager_destroy(connection_state->handshake_mgr);
gpr_free(connection_state->acceptor);
- grpc_tcp_server_unref(exec_ctx, connection_state->svr_state->tcp_server);
- server_connection_state_unref(exec_ctx, connection_state);
+ grpc_tcp_server_unref(connection_state->svr_state->tcp_server);
+ server_connection_state_unref(connection_state);
}
-static void on_accept(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp,
+static void on_accept(void* arg, grpc_endpoint* tcp,
grpc_pollset* accepting_pollset,
grpc_tcp_server_acceptor* acceptor) {
server_state* state = (server_state*)arg;
gpr_mu_lock(&state->mu);
if (state->shutdown) {
gpr_mu_unlock(&state->mu);
- grpc_endpoint_shutdown(exec_ctx, tcp, GRPC_ERROR_NONE);
- grpc_endpoint_destroy(exec_ctx, tcp);
+ grpc_endpoint_shutdown(tcp, GRPC_ERROR_NONE);
+ grpc_endpoint_destroy(tcp);
gpr_free(acceptor);
return;
}
@@ -188,59 +184,56 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp,
connection_state->accepting_pollset = accepting_pollset;
connection_state->acceptor = acceptor;
connection_state->handshake_mgr = handshake_mgr;
- grpc_handshakers_add(exec_ctx, HANDSHAKER_SERVER, state->args,
+ grpc_handshakers_add(HANDSHAKER_SERVER, state->args,
connection_state->handshake_mgr);
const grpc_arg* timeout_arg =
grpc_channel_args_find(state->args, GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS);
connection_state->deadline =
- grpc_exec_ctx_now(exec_ctx) +
+ grpc_core::ExecCtx::Get()->Now() +
grpc_channel_arg_get_integer(timeout_arg,
{120 * GPR_MS_PER_SEC, 1, INT_MAX});
- grpc_handshake_manager_do_handshake(exec_ctx, connection_state->handshake_mgr,
- nullptr /* interested_parties */, tcp,
- state->args, connection_state->deadline,
- acceptor, on_handshake_done,
- connection_state);
+ grpc_handshake_manager_do_handshake(
+ connection_state->handshake_mgr, nullptr /* interested_parties */, tcp,
+ state->args, connection_state->deadline, acceptor, on_handshake_done,
+ connection_state);
}
/* Server callback: start listening on our ports */
-static void server_start_listener(grpc_exec_ctx* exec_ctx, grpc_server* server,
- void* arg, grpc_pollset** pollsets,
+static void server_start_listener(grpc_server* server, void* arg,
+ grpc_pollset** pollsets,
size_t pollset_count) {
server_state* state = (server_state*)arg;
gpr_mu_lock(&state->mu);
state->shutdown = false;
gpr_mu_unlock(&state->mu);
- grpc_tcp_server_start(exec_ctx, state->tcp_server, pollsets, pollset_count,
- on_accept, state);
+ grpc_tcp_server_start(state->tcp_server, pollsets, pollset_count, on_accept,
+ state);
}
-static void tcp_server_shutdown_complete(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
server_state* state = (server_state*)arg;
/* ensure all threads have unlocked */
gpr_mu_lock(&state->mu);
grpc_closure* destroy_done = state->server_destroy_listener_done;
GPR_ASSERT(state->shutdown);
grpc_handshake_manager_pending_list_shutdown_all(
- exec_ctx, state->pending_handshake_mgrs, GRPC_ERROR_REF(error));
+ state->pending_handshake_mgrs, GRPC_ERROR_REF(error));
gpr_mu_unlock(&state->mu);
// Flush queued work before destroying handshaker factory, since that
// may do a synchronous unref.
- grpc_exec_ctx_flush(exec_ctx);
+ grpc_core::ExecCtx::Get()->Flush();
if (destroy_done != nullptr) {
- destroy_done->cb(exec_ctx, destroy_done->cb_arg, GRPC_ERROR_REF(error));
- grpc_exec_ctx_flush(exec_ctx);
+ destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error));
+ grpc_core::ExecCtx::Get()->Flush();
}
- grpc_channel_args_destroy(exec_ctx, state->args);
+ grpc_channel_args_destroy(state->args);
gpr_mu_destroy(&state->mu);
gpr_free(state);
}
/* Server callback: destroy the tcp listener (so we don't generate further
callbacks) */
-static void server_destroy_listener(grpc_exec_ctx* exec_ctx,
- grpc_server* server, void* arg,
+static void server_destroy_listener(grpc_server* server, void* arg,
grpc_closure* destroy_done) {
server_state* state = (server_state*)arg;
gpr_mu_lock(&state->mu);
@@ -248,12 +241,11 @@ static void server_destroy_listener(grpc_exec_ctx* exec_ctx,
state->server_destroy_listener_done = destroy_done;
grpc_tcp_server* tcp_server = state->tcp_server;
gpr_mu_unlock(&state->mu);
- grpc_tcp_server_shutdown_listeners(exec_ctx, tcp_server);
- grpc_tcp_server_unref(exec_ctx, tcp_server);
+ grpc_tcp_server_shutdown_listeners(tcp_server);
+ grpc_tcp_server_unref(tcp_server);
}
-grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx,
- grpc_server* server, const char* addr,
+grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr,
grpc_channel_args* args,
int* port_num) {
grpc_resolved_addresses* resolved = nullptr;
@@ -277,8 +269,8 @@ grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx,
GRPC_CLOSURE_INIT(&state->tcp_server_shutdown_complete,
tcp_server_shutdown_complete, state,
grpc_schedule_on_exec_ctx);
- err = grpc_tcp_server_create(exec_ctx, &state->tcp_server_shutdown_complete,
- args, &tcp_server);
+ err = grpc_tcp_server_create(&state->tcp_server_shutdown_complete, args,
+ &tcp_server);
if (err != GRPC_ERROR_NONE) {
goto error;
}
@@ -327,7 +319,7 @@ grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx,
grpc_resolved_addresses_destroy(resolved);
/* Register with the server only upon success */
- grpc_server_add_listener(exec_ctx, server, state, server_start_listener,
+ grpc_server_add_listener(server, state, server_start_listener,
server_destroy_listener);
goto done;
@@ -338,9 +330,9 @@ error:
grpc_resolved_addresses_destroy(resolved);
}
if (tcp_server) {
- grpc_tcp_server_unref(exec_ctx, tcp_server);
+ grpc_tcp_server_unref(tcp_server);
} else {
- grpc_channel_args_destroy(exec_ctx, args);
+ grpc_channel_args_destroy(args);
gpr_free(state);
}
*port_num = 0;
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.h b/src/core/ext/transport/chttp2/server/chttp2_server.h
index 68304fd4f7..7de859da42 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.h
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.h
@@ -25,8 +25,7 @@
/// Adds a port to \a server. Sets \a port_num to the port number.
/// Takes ownership of \a args.
-grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx,
- grpc_server* server, const char* addr,
+grpc_error* grpc_chttp2_server_add_port(grpc_server* server, const char* addr,
grpc_channel_args* args, int* port_num);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_SERVER_CHTTP2_SERVER_H */
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
index 8984896538..52c42d056c 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
@@ -26,12 +26,12 @@
#include "src/core/lib/surface/server.h"
int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
int port_num = 0;
GRPC_API_TRACE("grpc_server_add_insecure_http2_port(server=%p, addr=%s)", 2,
(server, addr));
grpc_error* err = grpc_chttp2_server_add_port(
- &exec_ctx, server, addr,
+ server, addr,
grpc_channel_args_copy(grpc_server_get_channel_args(server)), &port_num);
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
@@ -39,6 +39,6 @@ int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) {
GRPC_ERROR_UNREF(err);
}
- grpc_exec_ctx_finish(&exec_ctx);
+
return port_num;
}
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
index 3fe05ce4ef..dafd4af6ce 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
@@ -38,32 +38,29 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
void* reserved, int fd) {
GPR_ASSERT(reserved == nullptr);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
char* name;
gpr_asprintf(&name, "fd:%d", fd);
- grpc_endpoint* server_endpoint =
- grpc_tcp_create(&exec_ctx, grpc_fd_create(fd, name),
- grpc_server_get_channel_args(server), name);
+ grpc_endpoint* server_endpoint = grpc_tcp_create(
+ grpc_fd_create(fd, name), grpc_server_get_channel_args(server), name);
gpr_free(name);
const grpc_channel_args* server_args = grpc_server_get_channel_args(server);
grpc_transport* transport = grpc_create_chttp2_transport(
- &exec_ctx, server_args, server_endpoint, false /* is_client */);
+ server_args, server_endpoint, false /* is_client */);
grpc_pollset** pollsets;
size_t num_pollsets = 0;
grpc_server_get_pollsets(server, &pollsets, &num_pollsets);
for (size_t i = 0; i < num_pollsets; i++) {
- grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, pollsets[i]);
+ grpc_endpoint_add_to_pollset(server_endpoint, pollsets[i]);
}
- grpc_server_setup_transport(&exec_ctx, server, transport, nullptr,
- server_args);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr, nullptr);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_server_setup_transport(server, transport, nullptr, server_args);
+ grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
}
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
index ac3ea40f47..723af97ff0 100644
--- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
@@ -36,7 +36,7 @@
int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
grpc_server_credentials* creds) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
grpc_error* err = GRPC_ERROR_NONE;
grpc_server_security_connector* sc = nullptr;
int port_num = 0;
@@ -52,8 +52,7 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
"No credentials specified for secure server port (creds==NULL)");
goto done;
}
- status =
- grpc_server_credentials_create_security_connector(&exec_ctx, creds, &sc);
+ status = grpc_server_credentials_create_security_connector(creds, &sc);
if (status != GRPC_SECURITY_OK) {
char* msg;
gpr_asprintf(&msg,
@@ -72,12 +71,12 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
grpc_channel_args_copy_and_add(grpc_server_get_channel_args(server),
args_to_add, GPR_ARRAY_SIZE(args_to_add));
// Add server port.
- err = grpc_chttp2_server_add_port(&exec_ctx, server, addr, args, &port_num);
+ err = grpc_chttp2_server_add_port(server, addr, args, &port_num);
done:
if (sc != nullptr) {
- GRPC_SECURITY_CONNECTOR_UNREF(&exec_ctx, &sc->base, "server");
+ GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "server");
}
- grpc_exec_ctx_finish(&exec_ctx);
+
if (err != GRPC_ERROR_NONE) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.cc b/src/core/ext/transport/chttp2/transport/bin_decoder.cc
index 3ccae7afc3..984cd4ca78 100644
--- a/src/core/ext/transport/chttp2/transport/bin_decoder.cc
+++ b/src/core/ext/transport/chttp2/transport/bin_decoder.cc
@@ -130,8 +130,7 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx) {
return true;
}
-grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx,
- grpc_slice input) {
+grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
size_t input_length = GRPC_SLICE_LENGTH(input);
size_t output_length = input_length / 4 * 3;
struct grpc_base64_decode_context ctx;
@@ -167,7 +166,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx,
char* s = grpc_slice_to_c_string(input);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
- grpc_slice_unref_internal(exec_ctx, output);
+ grpc_slice_unref_internal(output);
return grpc_empty_slice();
}
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
@@ -175,8 +174,7 @@ grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx,
return output;
}
-grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
- grpc_slice input,
+grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
size_t output_length) {
size_t input_length = GRPC_SLICE_LENGTH(input);
grpc_slice output = GRPC_SLICE_MALLOC(output_length);
@@ -189,7 +187,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
"grpc_chttp2_base64_decode_with_length has a length of %d, which "
"has a tail of 1 byte.\n",
(int)input_length);
- grpc_slice_unref_internal(exec_ctx, output);
+ grpc_slice_unref_internal(output);
return grpc_empty_slice();
}
@@ -199,7 +197,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
"than the max possible output length %d.\n",
(int)output_length,
(int)(input_length / 4 * 3 + tail_xtra[input_length % 4]));
- grpc_slice_unref_internal(exec_ctx, output);
+ grpc_slice_unref_internal(output);
return grpc_empty_slice();
}
@@ -213,7 +211,7 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
char* s = grpc_slice_to_c_string(input);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
- grpc_slice_unref_internal(exec_ctx, output);
+ grpc_slice_unref_internal(output);
return grpc_empty_slice();
}
GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h
index a78c305766..9cb75ccd81 100644
--- a/src/core/ext/transport/chttp2/transport/bin_decoder.h
+++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h
@@ -40,13 +40,12 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx);
/* base64 decode a slice with pad chars. Returns a new slice, does not take
ownership of the input. Returns an empty slice if decoding is failed. */
-grpc_slice grpc_chttp2_base64_decode(grpc_exec_ctx* exec_ctx, grpc_slice input);
+grpc_slice grpc_chttp2_base64_decode(grpc_slice input);
/* base64 decode a slice without pad chars, data length is needed. Returns a new
slice, does not take ownership of the input. Returns an empty slice if
decoding is failed. */
-grpc_slice grpc_chttp2_base64_decode_with_length(grpc_exec_ctx* exec_ctx,
- grpc_slice input,
+grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
size_t output_length);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */
diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h
index a8f36a345a..93ad0dfdea 100644
--- a/src/core/ext/transport/chttp2/transport/bin_encoder.h
+++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h
@@ -32,7 +32,7 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input);
/* equivalent to:
grpc_slice x = grpc_chttp2_base64_encode(input);
grpc_slice y = grpc_chttp2_huffman_compress(x);
- grpc_slice_unref_internal(exec_ctx, x);
+ grpc_slice_unref_internal( x);
return y; */
grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input);
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index 63ac65ac78..f537fb09c2 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -95,105 +95,77 @@ grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount(false,
"chttp2_refcount");
/* forward declarations of various callbacks that we'll build closures around */
-static void write_action_begin_locked(grpc_exec_ctx* exec_ctx, void* t,
- grpc_error* error);
-static void write_action(grpc_exec_ctx* exec_ctx, void* t, grpc_error* error);
-static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* t,
- grpc_error* error);
+static void write_action_begin_locked(void* t, grpc_error* error);
+static void write_action(void* t, grpc_error* error);
+static void write_action_end_locked(void* t, grpc_error* error);
-static void read_action_locked(grpc_exec_ctx* exec_ctx, void* t,
- grpc_error* error);
+static void read_action_locked(void* t, grpc_error* error);
-static void complete_fetch_locked(grpc_exec_ctx* exec_ctx, void* gs,
- grpc_error* error);
+static void complete_fetch_locked(void* gs, grpc_error* error);
/** Set a transport level setting, and push it to our peer */
-static void queue_setting_update(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void queue_setting_update(grpc_chttp2_transport* t,
grpc_chttp2_setting_id id, uint32_t value);
-static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_error* error);
+static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_error* error);
/** Start new streams that have been created if we can */
-static void maybe_start_some_streams(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
+static void maybe_start_some_streams(grpc_chttp2_transport* t);
-static void connectivity_state_set(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void connectivity_state_set(grpc_chttp2_transport* t,
grpc_connectivity_state state,
grpc_error* error, const char* reason);
-static void incoming_byte_stream_destroy_locked(grpc_exec_ctx* exec_ctx,
- void* byte_stream,
+static void incoming_byte_stream_destroy_locked(void* byte_stream,
grpc_error* error_ignored);
static void incoming_byte_stream_publish_error(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_error* error);
-static void incoming_byte_stream_unref(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_incoming_byte_stream* bs);
-
-static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* t,
- grpc_error* error);
-static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* t,
- grpc_error* error);
-
-static void post_benign_reclaimer(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static void post_destructive_reclaimer(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-
-static void close_transport_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, grpc_error* error);
-static void end_all_the_calls(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error);
-
-static void schedule_bdp_ping_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static void start_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error);
-static void finish_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error);
-static void next_bdp_ping_timer_expired_locked(grpc_exec_ctx* exec_ctx,
- void* tp, grpc_error* error);
-
-static void cancel_pings(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error);
-static void send_ping_locked(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+ grpc_chttp2_incoming_byte_stream* bs, grpc_error* error);
+static void incoming_byte_stream_unref(grpc_chttp2_incoming_byte_stream* bs);
+
+static void benign_reclaimer_locked(void* t, grpc_error* error);
+static void destructive_reclaimer_locked(void* t, grpc_error* error);
+
+static void post_benign_reclaimer(grpc_chttp2_transport* t);
+static void post_destructive_reclaimer(grpc_chttp2_transport* t);
+
+static void close_transport_locked(grpc_chttp2_transport* t, grpc_error* error);
+static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error);
+
+static void schedule_bdp_ping_locked(grpc_chttp2_transport* t);
+static void start_bdp_ping_locked(void* tp, grpc_error* error);
+static void finish_bdp_ping_locked(void* tp, grpc_error* error);
+static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error);
+
+static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error);
+static void send_ping_locked(grpc_chttp2_transport* t,
grpc_closure* on_initiate,
grpc_closure* on_complete);
-static void retry_initiate_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error);
+static void retry_initiate_ping_locked(void* tp, grpc_error* error);
/** keepalive-relevant functions */
-static void init_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-static void start_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-static void finish_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-static void keepalive_watchdog_fired_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
-
-static void reset_byte_stream(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
+static void init_keepalive_ping_locked(void* arg, grpc_error* error);
+static void start_keepalive_ping_locked(void* arg, grpc_error* error);
+static void finish_keepalive_ping_locked(void* arg, grpc_error* error);
+static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error);
+
+static void reset_byte_stream(void* arg, grpc_error* error);
/*******************************************************************************
* CONSTRUCTION/DESTRUCTION/REFCOUNTING
*/
-static void destruct_transport(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void destruct_transport(grpc_chttp2_transport* t) {
size_t i;
- grpc_endpoint_destroy(exec_ctx, t->ep);
+ grpc_endpoint_destroy(t->ep);
- grpc_slice_buffer_destroy_internal(exec_ctx, &t->qbuf);
+ grpc_slice_buffer_destroy_internal(&t->qbuf);
- grpc_slice_buffer_destroy_internal(exec_ctx, &t->outbuf);
- grpc_chttp2_hpack_compressor_destroy(exec_ctx, &t->hpack_compressor);
+ grpc_slice_buffer_destroy_internal(&t->outbuf);
+ grpc_chttp2_hpack_compressor_destroy(&t->hpack_compressor);
- grpc_slice_buffer_destroy_internal(exec_ctx, &t->read_buffer);
- grpc_chttp2_hpack_parser_destroy(exec_ctx, &t->hpack_parser);
+ grpc_slice_buffer_destroy_internal(&t->read_buffer);
+ grpc_chttp2_hpack_parser_destroy(&t->hpack_parser);
grpc_chttp2_goaway_parser_destroy(&t->goaway_parser);
for (i = 0; i < STREAM_LIST_COUNT; i++) {
@@ -206,12 +178,11 @@ static void destruct_transport(grpc_exec_ctx* exec_ctx,
GPR_ASSERT(grpc_chttp2_stream_map_size(&t->stream_map) == 0);
grpc_chttp2_stream_map_destroy(&t->stream_map);
- grpc_connectivity_state_destroy(exec_ctx, &t->channel_callback.state_tracker);
+ grpc_connectivity_state_destroy(&t->channel_callback.state_tracker);
- GRPC_COMBINER_UNREF(exec_ctx, t->combiner, "chttp2_transport");
+ GRPC_COMBINER_UNREF(t->combiner, "chttp2_transport");
- cancel_pings(exec_ctx, t,
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
+ cancel_pings(t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"));
while (t->write_cb_pool) {
grpc_chttp2_write_cb* next = t->write_cb_pool->next;
@@ -228,8 +199,7 @@ static void destruct_transport(grpc_exec_ctx* exec_ctx,
}
#ifndef NDEBUG
-void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, const char* reason,
+void grpc_chttp2_unref_transport(grpc_chttp2_transport* t, const char* reason,
const char* file, int line) {
if (grpc_trace_chttp2_refcount.enabled()) {
gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count);
@@ -237,7 +207,7 @@ void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
t, val, val - 1, reason, file, line);
}
if (!gpr_unref(&t->refs)) return;
- destruct_transport(exec_ctx, t);
+ destruct_transport(t);
}
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t, const char* reason,
@@ -250,10 +220,9 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport* t, const char* reason,
gpr_ref(&t->refs);
}
#else
-void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+void grpc_chttp2_unref_transport(grpc_chttp2_transport* t) {
if (!gpr_unref(&t->refs)) return;
- destruct_transport(exec_ctx, t);
+ destruct_transport(t);
}
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) { gpr_ref(&t->refs); }
@@ -261,7 +230,7 @@ void grpc_chttp2_ref_transport(grpc_chttp2_transport* t) { gpr_ref(&t->refs); }
static const grpc_transport_vtable* get_vtable(void);
-static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+static void init_transport(grpc_chttp2_transport* t,
const grpc_channel_args* channel_args,
grpc_endpoint* ep, bool is_client) {
size_t i;
@@ -320,7 +289,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
t->goaway_error = GRPC_ERROR_NONE;
grpc_chttp2_goaway_parser_init(&t->goaway_parser);
- grpc_chttp2_hpack_parser_init(exec_ctx, &t->hpack_parser);
+ grpc_chttp2_hpack_parser_init(&t->hpack_parser);
grpc_slice_buffer_init(&t->read_buffer);
@@ -351,14 +320,13 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
/* configure http2 the way we like it */
if (is_client) {
- queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
- queue_setting_update(exec_ctx, t,
- GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
+ queue_setting_update(t, GRPC_CHTTP2_SETTINGS_ENABLE_PUSH, 0);
+ queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 0);
}
- queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
+ queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
DEFAULT_MAX_HEADER_LIST_SIZE);
- queue_setting_update(exec_ctx, t,
- GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA, 1);
+ queue_setting_update(t, GRPC_CHTTP2_SETTINGS_GRPC_ALLOW_TRUE_BINARY_METADATA,
+ 1);
t->ping_policy.max_pings_without_data = g_default_max_pings_without_data;
t->ping_policy.min_sent_ping_interval_without_data =
@@ -533,7 +501,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
int value = grpc_channel_arg_get_integer(
&channel_args->args[i], settings_map[j].integer_options);
if (value >= 0) {
- queue_setting_update(exec_ctx, t, settings_map[j].setting_id,
+ queue_setting_update(t, settings_map[j].setting_id,
(uint32_t)value);
}
}
@@ -544,7 +512,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
}
}
- t->flow_control.Init(exec_ctx, t, enable_bdp);
+ t->flow_control.Init(t, enable_bdp);
/* No pings allowed before receiving a header or data frame. */
t->ping_state.pings_before_data_required = 0;
@@ -558,8 +526,8 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
if (t->keepalive_time != GRPC_MILLIS_INF_FUTURE) {
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
- grpc_timer_init(exec_ctx, &t->keepalive_ping_timer,
- grpc_exec_ctx_now(exec_ctx) + t->keepalive_time,
+ grpc_timer_init(&t->keepalive_ping_timer,
+ grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
} else {
/* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
@@ -569,42 +537,37 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
if (enable_bdp) {
GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
- schedule_bdp_ping_locked(exec_ctx, t);
+ schedule_bdp_ping_locked(t);
- grpc_chttp2_act_on_flowctl_action(
- exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, nullptr);
+ grpc_chttp2_act_on_flowctl_action(t->flow_control->PeriodicUpdate(), t,
+ nullptr);
}
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE);
- post_benign_reclaimer(exec_ctx, t);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE);
+ post_benign_reclaimer(t);
}
-static void destroy_transport_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void destroy_transport_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
t->destroying = 1;
close_transport_locked(
- exec_ctx, t,
- grpc_error_set_int(
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"),
- GRPC_ERROR_INT_OCCURRED_DURING_WRITE, t->write_state));
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destroy");
+ t, grpc_error_set_int(
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport destroyed"),
+ GRPC_ERROR_INT_OCCURRED_DURING_WRITE, t->write_state));
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "destroy");
}
-static void destroy_transport(grpc_exec_ctx* exec_ctx, grpc_transport* gt) {
+static void destroy_transport(grpc_transport* gt) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
- GRPC_CLOSURE_SCHED(exec_ctx,
- GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(destroy_transport_locked, t,
grpc_combiner_scheduler(t->combiner)),
GRPC_ERROR_NONE);
}
-static void close_transport_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void close_transport_locked(grpc_chttp2_transport* t,
grpc_error* error) {
- end_all_the_calls(exec_ctx, t, GRPC_ERROR_REF(error));
- cancel_pings(exec_ctx, t, GRPC_ERROR_REF(error));
+ end_all_the_calls(t, GRPC_ERROR_REF(error));
+ cancel_pings(t, GRPC_ERROR_REF(error));
if (t->closed_with_error == GRPC_ERROR_NONE) {
if (!grpc_error_has_clear_grpc_status(error)) {
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
@@ -622,21 +585,21 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
}
GPR_ASSERT(error != GRPC_ERROR_NONE);
t->closed_with_error = GRPC_ERROR_REF(error);
- connectivity_state_set(exec_ctx, t, GRPC_CHANNEL_SHUTDOWN,
- GRPC_ERROR_REF(error), "close_transport");
+ connectivity_state_set(t, GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
+ "close_transport");
if (t->ping_state.is_delayed_ping_timer_set) {
- grpc_timer_cancel(exec_ctx, &t->ping_state.delayed_ping_timer);
+ grpc_timer_cancel(&t->ping_state.delayed_ping_timer);
}
if (t->have_next_bdp_ping_timer) {
- grpc_timer_cancel(exec_ctx, &t->next_bdp_ping_timer);
+ grpc_timer_cancel(&t->next_bdp_ping_timer);
}
switch (t->keepalive_state) {
case GRPC_CHTTP2_KEEPALIVE_STATE_WAITING:
- grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer);
+ grpc_timer_cancel(&t->keepalive_ping_timer);
break;
case GRPC_CHTTP2_KEEPALIVE_STATE_PINGING:
- grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer);
- grpc_timer_cancel(exec_ctx, &t->keepalive_watchdog_timer);
+ grpc_timer_cancel(&t->keepalive_ping_timer);
+ grpc_timer_cancel(&t->keepalive_watchdog_timer);
break;
case GRPC_CHTTP2_KEEPALIVE_STATE_DYING:
case GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED:
@@ -647,14 +610,13 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
/* flush writable stream list to avoid dangling references */
grpc_chttp2_stream* s;
while (grpc_chttp2_list_pop_writable_stream(t, &s)) {
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:close");
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:close");
}
GPR_ASSERT(t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE);
- grpc_endpoint_shutdown(exec_ctx, t->ep, GRPC_ERROR_REF(error));
+ grpc_endpoint_shutdown(t->ep, GRPC_ERROR_REF(error));
}
if (t->notify_on_receive_settings != nullptr) {
- GRPC_CLOSURE_SCHED(exec_ctx, t->notify_on_receive_settings,
- GRPC_ERROR_CANCELLED);
+ GRPC_CLOSURE_SCHED(t->notify_on_receive_settings, GRPC_ERROR_CANCELLED);
t->notify_on_receive_settings = nullptr;
}
GRPC_ERROR_UNREF(error);
@@ -664,22 +626,21 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason) {
grpc_stream_ref(s->refcount, reason);
}
-void grpc_chttp2_stream_unref(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s,
- const char* reason) {
- grpc_stream_unref(exec_ctx, s->refcount, reason);
+void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason) {
+ grpc_stream_unref(s->refcount, reason);
}
#else
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s) {
grpc_stream_ref(s->refcount);
}
-void grpc_chttp2_stream_unref(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s) {
- grpc_stream_unref(exec_ctx, s->refcount);
+void grpc_chttp2_stream_unref(grpc_chttp2_stream* s) {
+ grpc_stream_unref(s->refcount);
}
#endif
-static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_stream_refcount* refcount,
- const void* server_data, gpr_arena* arena) {
+static int init_stream(grpc_transport* gt, grpc_stream* gs,
+ grpc_stream_refcount* refcount, const void* server_data,
+ gpr_arena* arena) {
GPR_TIMER_BEGIN("init_stream", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
grpc_chttp2_stream* s = (grpc_chttp2_stream*)gs;
@@ -713,7 +674,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
s->id = (uint32_t)(uintptr_t)server_data;
*t->accepting_stream = s;
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
- post_destructive_reclaimer(exec_ctx, t);
+ post_destructive_reclaimer(t);
}
s->flow_control.Init(t->flow_control.get(), s);
@@ -722,8 +683,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
return 0;
}
-static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
- grpc_error* error) {
+static void destroy_stream_locked(void* sp, grpc_error* error) {
grpc_chttp2_stream* s = (grpc_chttp2_stream*)sp;
grpc_chttp2_transport* t = s->t;
@@ -734,11 +694,10 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == nullptr);
}
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &s->unprocessed_incoming_frames_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->frame_storage);
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->compressed_data_buffer);
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->decompressed_data_buffer);
+ grpc_slice_buffer_destroy_internal(&s->unprocessed_incoming_frames_buffer);
+ grpc_slice_buffer_destroy_internal(&s->frame_storage);
+ grpc_slice_buffer_destroy_internal(&s->compressed_data_buffer);
+ grpc_slice_buffer_destroy_internal(&s->decompressed_data_buffer);
grpc_chttp2_list_remove_stalled_by_transport(t, s);
grpc_chttp2_list_remove_stalled_by_stream(t, s);
@@ -757,27 +716,24 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
GPR_ASSERT(s->recv_message_ready == nullptr);
GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
- grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser);
- grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx,
- &s->metadata_buffer[0]);
- grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx,
- &s->metadata_buffer[1]);
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->flow_controlled_buffer);
+ grpc_chttp2_data_parser_destroy(&s->data_parser);
+ grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[0]);
+ grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[1]);
+ grpc_slice_buffer_destroy_internal(&s->flow_controlled_buffer);
GRPC_ERROR_UNREF(s->read_closed_error);
GRPC_ERROR_UNREF(s->write_closed_error);
GRPC_ERROR_UNREF(s->byte_stream_error);
s->flow_control.Destroy();
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "stream");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "stream");
GPR_TIMER_END("destroy_stream", 0);
- GRPC_CLOSURE_SCHED(exec_ctx, s->destroy_stream_arg, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(s->destroy_stream_arg, GRPC_ERROR_NONE);
}
-static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_closure* then_schedule_closure) {
GPR_TIMER_BEGIN("destroy_stream", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
@@ -794,7 +750,6 @@ static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
s->destroy_stream_arg = then_schedule_closure;
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&s->destroy_stream, destroy_stream_locked, s,
grpc_combiner_scheduler(t->combiner)),
GRPC_ERROR_NONE);
@@ -806,8 +761,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
return (grpc_chttp2_stream*)grpc_chttp2_stream_map_find(&t->stream_map, id);
}
-grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
uint32_t id) {
if (t->channel_callback.accept_stream == nullptr) {
return nullptr;
@@ -815,8 +769,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_exec_ctx* exec_ctx,
grpc_chttp2_stream* accepting;
GPR_ASSERT(t->accepting_stream == nullptr);
t->accepting_stream = &accepting;
- t->channel_callback.accept_stream(exec_ctx,
- t->channel_callback.accept_stream_user_data,
+ t->channel_callback.accept_stream(t->channel_callback.accept_stream_user_data,
&t->base, (void*)(uintptr_t)id);
t->accepting_stream = nullptr;
return accepting;
@@ -838,7 +791,7 @@ static const char* write_state_name(grpc_chttp2_write_state st) {
GPR_UNREACHABLE_CODE(return "UNKNOWN");
}
-static void set_write_state(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+static void set_write_state(grpc_chttp2_transport* t,
grpc_chttp2_write_state st, const char* reason) {
GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_DEBUG, "W:%p %s state %s -> %s [%s]", t,
t->is_client ? "CLIENT" : "SERVER",
@@ -846,108 +799,100 @@ static void set_write_state(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
write_state_name(st), reason));
t->write_state = st;
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
- GRPC_CLOSURE_LIST_SCHED(exec_ctx, &t->run_after_write);
+ GRPC_CLOSURE_LIST_SCHED(&t->run_after_write);
if (t->close_transport_on_writes_finished != nullptr) {
grpc_error* err = t->close_transport_on_writes_finished;
t->close_transport_on_writes_finished = nullptr;
- close_transport_locked(exec_ctx, t, err);
+ close_transport_locked(t, err);
}
}
}
static void inc_initiate_write_reason(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_initiate_write_reason reason) {
+ grpc_chttp2_initiate_write_reason reason) {
switch (reason) {
case GRPC_CHTTP2_INITIATE_WRITE_INITIAL_WRITE:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_INITIAL_WRITE();
break;
case GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_START_NEW_STREAM();
break;
case GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_MESSAGE();
break;
case GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_INITIAL_METADATA();
break;
case GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_TRAILING_METADATA();
break;
case GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RETRY_SEND_PING();
break;
case GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CONTINUE_PINGS();
break;
case GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_GOAWAY_SENT();
break;
case GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_RST_STREAM();
break;
case GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_CLOSE_FROM_API();
break;
case GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_STREAM_FLOW_CONTROL();
break;
case GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL();
break;
case GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_SEND_SETTINGS();
break;
case GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_SETTING();
break;
case GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FLOW_CONTROL_UNSTALLED_BY_UPDATE();
break;
case GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_APPLICATION_PING();
break;
case GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_KEEPALIVE_PING();
break;
case GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED(
- exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_TRANSPORT_FLOW_CONTROL_UNSTALLED();
break;
case GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_PING_RESPONSE();
break;
case GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM:
- GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM(exec_ctx);
+ GRPC_STATS_INC_HTTP2_INITIATE_WRITE_DUE_TO_FORCE_RST_STREAM();
break;
}
}
-void grpc_chttp2_initiate_write(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
grpc_chttp2_initiate_write_reason reason) {
GPR_TIMER_BEGIN("grpc_chttp2_initiate_write", 0);
switch (t->write_state) {
case GRPC_CHTTP2_WRITE_STATE_IDLE:
- inc_initiate_write_reason(exec_ctx, reason);
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING,
+ inc_initiate_write_reason(reason);
+ set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING,
grpc_chttp2_initiate_write_reason_string(reason));
t->is_first_write_in_batch = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
write_action_begin_locked, t,
grpc_combiner_finally_scheduler(t->combiner)),
GRPC_ERROR_NONE);
break;
case GRPC_CHTTP2_WRITE_STATE_WRITING:
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
+ set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE,
grpc_chttp2_initiate_write_reason_string(reason));
break;
case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
@@ -956,8 +901,7 @@ void grpc_chttp2_initiate_write(grpc_exec_ctx* exec_ctx,
GPR_TIMER_END("grpc_chttp2_initiate_write", 0);
}
-void grpc_chttp2_mark_stream_writable(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
if (t->closed_with_error == GRPC_ERROR_NONE &&
grpc_chttp2_list_add_writable_stream(t, s)) {
@@ -1007,8 +951,7 @@ static const char* begin_writing_desc(bool partial, bool inlined) {
GPR_UNREACHABLE_CODE(return "bad state tuple");
}
-static void write_action_begin_locked(grpc_exec_ctx* exec_ctx, void* gt,
- grpc_error* error_ignored) {
+static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
GPR_TIMER_BEGIN("write_action_begin_locked", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE);
@@ -1016,62 +959,59 @@ static void write_action_begin_locked(grpc_exec_ctx* exec_ctx, void* gt,
if (t->closed_with_error != GRPC_ERROR_NONE) {
r.writing = false;
} else {
- r = grpc_chttp2_begin_write(exec_ctx, t);
+ r = grpc_chttp2_begin_write(t);
}
if (r.writing) {
if (r.partial) {
- GRPC_STATS_INC_HTTP2_PARTIAL_WRITES(exec_ctx);
+ GRPC_STATS_INC_HTTP2_PARTIAL_WRITES();
}
if (!t->is_first_write_in_batch) {
- GRPC_STATS_INC_HTTP2_WRITES_CONTINUED(exec_ctx);
+ GRPC_STATS_INC_HTTP2_WRITES_CONTINUED();
}
grpc_closure_scheduler* scheduler =
write_scheduler(t, r.early_results_scheduled, r.partial);
if (scheduler != grpc_schedule_on_exec_ctx) {
- GRPC_STATS_INC_HTTP2_WRITES_OFFLOADED(exec_ctx);
+ GRPC_STATS_INC_HTTP2_WRITES_OFFLOADED();
}
set_write_state(
- exec_ctx, t,
+ t,
r.partial ? GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE
: GRPC_CHTTP2_WRITE_STATE_WRITING,
begin_writing_desc(r.partial, scheduler == grpc_schedule_on_exec_ctx));
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler),
GRPC_ERROR_NONE);
} else {
- GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN(exec_ctx);
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_IDLE,
- "begin writing nothing");
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "writing");
+ GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN();
+ set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
}
GPR_TIMER_END("write_action_begin_locked", 0);
}
-static void write_action(grpc_exec_ctx* exec_ctx, void* gt, grpc_error* error) {
+static void write_action(void* gt, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
GPR_TIMER_BEGIN("write_action", 0);
grpc_endpoint_write(
- exec_ctx, t->ep, &t->outbuf,
+ t->ep, &t->outbuf,
GRPC_CLOSURE_INIT(&t->write_action_end_locked, write_action_end_locked, t,
grpc_combiner_scheduler(t->combiner)));
GPR_TIMER_END("write_action", 0);
}
-static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void write_action_end_locked(void* tp, grpc_error* error) {
GPR_TIMER_BEGIN("terminate_writing_with_lock", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
if (error != GRPC_ERROR_NONE) {
- close_transport_locked(exec_ctx, t, GRPC_ERROR_REF(error));
+ close_transport_locked(t, GRPC_ERROR_REF(error));
}
if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED) {
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SENT;
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
close_transport_locked(
- exec_ctx, t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
+ t, GRPC_ERROR_CREATE_FROM_STATIC_STRING("goaway sent"));
}
}
@@ -1080,17 +1020,14 @@ static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* tp,
GPR_UNREACHABLE_CODE(break);
case GRPC_CHTTP2_WRITE_STATE_WRITING:
GPR_TIMER_MARK("state=writing", 0);
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_IDLE,
- "finish writing");
+ set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "finish writing");
break;
case GRPC_CHTTP2_WRITE_STATE_WRITING_WITH_MORE:
GPR_TIMER_MARK("state=writing_stale_no_poller", 0);
- set_write_state(exec_ctx, t, GRPC_CHTTP2_WRITE_STATE_WRITING,
- "continue writing");
+ set_write_state(t, GRPC_CHTTP2_WRITE_STATE_WRITING, "continue writing");
t->is_first_write_in_batch = false;
GRPC_CHTTP2_REF_TRANSPORT(t, "writing");
GRPC_CLOSURE_RUN(
- exec_ctx,
GRPC_CLOSURE_INIT(&t->write_action_begin_locked,
write_action_begin_locked, t,
grpc_combiner_finally_scheduler(t->combiner)),
@@ -1098,16 +1035,15 @@ static void write_action_end_locked(grpc_exec_ctx* exec_ctx, void* tp,
break;
}
- grpc_chttp2_end_write(exec_ctx, t, GRPC_ERROR_REF(error));
+ grpc_chttp2_end_write(t, GRPC_ERROR_REF(error));
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "writing");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
GPR_TIMER_END("terminate_writing_with_lock", 0);
}
// Dirties an HTTP2 setting to be sent out next time a writing path occurs.
// If the change needs to occur immediately, manually initiate a write.
-static void queue_setting_update(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void queue_setting_update(grpc_chttp2_transport* t,
grpc_chttp2_setting_id id, uint32_t value) {
const grpc_chttp2_setting_parameters* sp =
&grpc_chttp2_settings_parameters[id];
@@ -1122,8 +1058,7 @@ static void queue_setting_update(grpc_exec_ctx* exec_ctx,
}
}
-void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
uint32_t goaway_error,
grpc_slice goaway_text) {
// GRPC_CHTTP2_IF_TRACING(
@@ -1158,12 +1093,11 @@ void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx* exec_ctx,
/* lie: use transient failure from the transport to indicate goaway has been
* received */
- connectivity_state_set(exec_ctx, t, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(t->goaway_error), "got_goaway");
}
-static void maybe_start_some_streams(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void maybe_start_some_streams(grpc_chttp2_transport* t) {
grpc_chttp2_stream* s;
/* start streams where we have free grpc_chttp2_stream ids and free
* concurrency */
@@ -1183,22 +1117,21 @@ static void maybe_start_some_streams(grpc_exec_ctx* exec_ctx,
if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
connectivity_state_set(
- exec_ctx, t, GRPC_CHANNEL_TRANSIENT_FAILURE,
+ t, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
"no_more_stream_ids");
}
grpc_chttp2_stream_map_add(&t->stream_map, s->id, s);
- post_destructive_reclaimer(exec_ctx, t);
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
+ post_destructive_reclaimer(t);
+ grpc_chttp2_mark_stream_writable(t, s);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
}
/* cancel out streams that will never be started */
while (t->next_stream_id >= MAX_CLIENT_STREAM_ID &&
grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
@@ -1220,15 +1153,13 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
return closure;
}
-static void null_then_run_closure(grpc_exec_ctx* exec_ctx,
- grpc_closure** closure, grpc_error* error) {
+static void null_then_run_closure(grpc_closure** closure, grpc_error* error) {
grpc_closure* c = *closure;
*closure = nullptr;
- GRPC_CLOSURE_RUN(exec_ctx, c, error);
+ GRPC_CLOSURE_RUN(c, error);
}
-void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_closure** pclosure,
grpc_error* error, const char* desc) {
@@ -1268,7 +1199,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
}
if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
!(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
- GRPC_CLOSURE_RUN(exec_ctx, closure, closure->error_data.error);
+ GRPC_CLOSURE_RUN(closure, closure->error_data.error);
} else {
grpc_closure_list_append(&t->run_after_write, closure,
closure->error_data.error);
@@ -1284,28 +1215,24 @@ static bool contains_non_ok_status(grpc_metadata_batch* batch) {
return false;
}
-static void maybe_become_writable_due_to_send_msg(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void maybe_become_writable_due_to_send_msg(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
if (s->id != 0 && (!s->write_buffering ||
s->flow_controlled_buffer.length > t->write_buffer_size)) {
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
+ grpc_chttp2_mark_stream_writable(t, s);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_SEND_MESSAGE);
}
}
-static void add_fetched_slice_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void add_fetched_slice_locked(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
s->fetched_send_message_length +=
(uint32_t)GRPC_SLICE_LENGTH(s->fetching_slice);
grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
- maybe_become_writable_due_to_send_msg(exec_ctx, t, s);
+ maybe_become_writable_due_to_send_msg(t, s);
}
-static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void continue_fetching_send_locked(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
for (;;) {
if (s->fetching_send_message == nullptr) {
@@ -1314,11 +1241,11 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
return; /* early out */
}
if (s->fetched_send_message_length == s->fetching_send_message->length) {
- grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
+ grpc_byte_stream_destroy(s->fetching_send_message);
int64_t notify_offset = s->next_message_end_offset;
if (notify_offset <= s->flow_controlled_bytes_written) {
grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
+ t, s, &s->fetching_send_message_finished, GRPC_ERROR_NONE,
"fetching_send_message_finished");
} else {
grpc_chttp2_write_cb* cb = t->write_cb_pool;
@@ -1339,39 +1266,37 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
}
s->fetching_send_message = nullptr;
return; /* early out */
- } else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message,
- UINT32_MAX, &s->complete_fetch_locked)) {
- grpc_error* error = grpc_byte_stream_pull(
- exec_ctx, s->fetching_send_message, &s->fetching_slice);
+ } else if (grpc_byte_stream_next(s->fetching_send_message, UINT32_MAX,
+ &s->complete_fetch_locked)) {
+ grpc_error* error =
+ grpc_byte_stream_pull(s->fetching_send_message, &s->fetching_slice);
if (error != GRPC_ERROR_NONE) {
- grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
- grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
+ grpc_byte_stream_destroy(s->fetching_send_message);
+ grpc_chttp2_cancel_stream(t, s, error);
} else {
- add_fetched_slice_locked(exec_ctx, t, s);
+ add_fetched_slice_locked(t, s);
}
}
}
}
-static void complete_fetch_locked(grpc_exec_ctx* exec_ctx, void* gs,
- grpc_error* error) {
+static void complete_fetch_locked(void* gs, grpc_error* error) {
grpc_chttp2_stream* s = (grpc_chttp2_stream*)gs;
grpc_chttp2_transport* t = s->t;
if (error == GRPC_ERROR_NONE) {
- error = grpc_byte_stream_pull(exec_ctx, s->fetching_send_message,
- &s->fetching_slice);
+ error = grpc_byte_stream_pull(s->fetching_send_message, &s->fetching_slice);
if (error == GRPC_ERROR_NONE) {
- add_fetched_slice_locked(exec_ctx, t, s);
- continue_fetching_send_locked(exec_ctx, t, s);
+ add_fetched_slice_locked(t, s);
+ continue_fetching_send_locked(t, s);
}
}
if (error != GRPC_ERROR_NONE) {
- grpc_byte_stream_destroy(exec_ctx, s->fetching_send_message);
- grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
+ grpc_byte_stream_destroy(s->fetching_send_message);
+ grpc_chttp2_cancel_stream(t, s, error);
}
}
-static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
+static void do_nothing(void* arg, grpc_error* error) {}
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
bool is_client, bool is_initial) {
@@ -1386,7 +1311,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
}
}
-static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
+static void perform_stream_op_locked(void* stream_op,
grpc_error* error_ignored) {
GPR_TIMER_BEGIN("perform_stream_op_locked", 0);
@@ -1396,7 +1321,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
grpc_transport_stream_op_batch_payload* op_payload = op->payload;
grpc_chttp2_transport* t = s->t;
- GRPC_STATS_INC_HTTP2_OP_BATCHES(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_BATCHES();
if (grpc_http_trace.enabled()) {
char* str = grpc_transport_stream_op_batch_string(op);
@@ -1431,13 +1356,12 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
if (op->cancel_stream) {
- GRPC_STATS_INC_HTTP2_OP_CANCEL(exec_ctx);
- grpc_chttp2_cancel_stream(exec_ctx, t, s,
- op_payload->cancel_stream.cancel_error);
+ GRPC_STATS_INC_HTTP2_OP_CANCEL();
+ grpc_chttp2_cancel_stream(t, s, op_payload->cancel_stream.cancel_error);
}
if (op->send_initial_metadata) {
- GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA();
GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
@@ -1465,7 +1389,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
if (metadata_size > metadata_peer_limit) {
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(
grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@@ -1484,10 +1408,10 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (t->closed_with_error == GRPC_ERROR_NONE) {
GPR_ASSERT(s->id == 0);
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
- maybe_start_some_streams(exec_ctx, t);
+ maybe_start_some_streams(t);
} else {
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Transport closed", &t->closed_with_error, 1),
@@ -1495,18 +1419,18 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
} else {
GPR_ASSERT(s->id != 0);
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
+ grpc_chttp2_mark_stream_writable(t, s);
if (!(op->send_message &&
(op->payload->send_message.send_message->flags &
GRPC_WRITE_BUFFER_HINT))) {
grpc_chttp2_initiate_write(
- exec_ctx, t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
+ t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
}
}
} else {
s->send_initial_metadata = nullptr;
grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->send_initial_metadata_finished,
+ t, s, &s->send_initial_metadata_finished,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Attempt to send initial metadata after stream was closed",
&s->write_closed_error, 1),
@@ -1520,9 +1444,9 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
if (op->send_message) {
- GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_SEND_MESSAGE();
GRPC_STATS_INC_HTTP2_SEND_MESSAGE_SIZE(
- exec_ctx, op->payload->send_message.send_message->length);
+ op->payload->send_message.send_message->length);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
s->fetching_send_message_finished = add_closure_barrier(op->on_complete);
if (s->write_closed) {
@@ -1532,7 +1456,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
// recv_message failure, breaking out of its loop, and then
// starting recv_trailing_metadata.
grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->fetching_send_message_finished,
+ t, s, &s->fetching_send_message_finished,
t->is_client && s->received_trailing_metadata
? GRPC_ERROR_NONE
: GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
@@ -1561,13 +1485,13 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
} else {
s->write_buffering = false;
}
- continue_fetching_send_locked(exec_ctx, t, s);
- maybe_become_writable_due_to_send_msg(exec_ctx, t, s);
+ continue_fetching_send_locked(t, s);
+ maybe_become_writable_due_to_send_msg(t, s);
}
}
if (op->send_trailing_metadata) {
- GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA();
GPR_ASSERT(s->send_trailing_metadata_finished == nullptr);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
s->send_trailing_metadata_finished = add_closure_barrier(on_complete);
@@ -1581,7 +1505,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
[GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
if (metadata_size > metadata_peer_limit) {
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(
grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
@@ -1598,7 +1522,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (s->write_closed) {
s->send_trailing_metadata = nullptr;
grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->send_trailing_metadata_finished,
+ t, s, &s->send_trailing_metadata_finished,
grpc_metadata_batch_is_empty(
op->payload->send_trailing_metadata.send_trailing_metadata)
? GRPC_ERROR_NONE
@@ -1609,15 +1533,15 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
} else if (s->id != 0) {
/* TODO(ctiller): check if there's flow control for any outstanding
bytes before going writable */
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
+ grpc_chttp2_mark_stream_writable(t, s);
grpc_chttp2_initiate_write(
- exec_ctx, t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
+ t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
}
}
}
if (op->recv_initial_metadata) {
- GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA();
GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
s->recv_initial_metadata_ready =
op_payload->recv_initial_metadata.recv_initial_metadata_ready;
@@ -1629,11 +1553,11 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
(gpr_atm)gpr_strdup(t->peer_string));
}
- grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
}
if (op->recv_message) {
- GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE();
size_t already_received;
GPR_ASSERT(s->recv_message_ready == nullptr);
GPR_ASSERT(!s->pending_byte_stream);
@@ -1644,32 +1568,30 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
already_received = s->frame_storage.length;
s->flow_control->IncomingByteStreamUpdate(GRPC_HEADER_SIZE_IN_BYTES,
already_received);
- grpc_chttp2_act_on_flowctl_action(exec_ctx,
- s->flow_control->MakeAction(), t, s);
+ grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
}
}
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_message(t, s);
}
if (op->recv_trailing_metadata) {
- GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA(exec_ctx);
+ GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA();
GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
s->recv_trailing_metadata_finished = add_closure_barrier(on_complete);
s->recv_trailing_metadata =
op_payload->recv_trailing_metadata.recv_trailing_metadata;
s->final_metadata_requested = true;
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
}
- grpc_chttp2_complete_closure_step(exec_ctx, t, s, &on_complete,
- GRPC_ERROR_NONE, "op->on_complete");
+ grpc_chttp2_complete_closure_step(t, s, &on_complete, GRPC_ERROR_NONE,
+ "op->on_complete");
GPR_TIMER_END("perform_stream_op_locked", 0);
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "perform_stream_op");
+ GRPC_CHTTP2_STREAM_UNREF(s, "perform_stream_op");
}
-static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
grpc_transport_stream_op_batch* op) {
GPR_TIMER_BEGIN("perform_stream_op", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
@@ -1697,32 +1619,29 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
op->handler_private.extra_arg = gs;
GRPC_CHTTP2_STREAM_REF(s, "perform_stream_op");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&op->handler_private.closure, perform_stream_op_locked,
op, grpc_combiner_scheduler(t->combiner)),
GRPC_ERROR_NONE);
GPR_TIMER_END("perform_stream_op", 0);
}
-static void cancel_pings(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error) {
+static void cancel_pings(grpc_chttp2_transport* t, grpc_error* error) {
/* callback remaining pings: they're not allowed to call into the transpot,
and maybe they hold resources that need to be freed */
grpc_chttp2_ping_queue* pq = &t->ping_queue;
GPR_ASSERT(error != GRPC_ERROR_NONE);
for (size_t j = 0; j < GRPC_CHTTP2_PCL_COUNT; j++) {
grpc_closure_list_fail_all(&pq->lists[j], GRPC_ERROR_REF(error));
- GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[j]);
+ GRPC_CLOSURE_LIST_SCHED(&pq->lists[j]);
}
GRPC_ERROR_UNREF(error);
}
-static void send_ping_locked(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+static void send_ping_locked(grpc_chttp2_transport* t,
grpc_closure* on_initiate, grpc_closure* on_ack) {
if (t->closed_with_error != GRPC_ERROR_NONE) {
- GRPC_CLOSURE_SCHED(exec_ctx, on_initiate,
- GRPC_ERROR_REF(t->closed_with_error));
- GRPC_CLOSURE_SCHED(exec_ctx, on_ack, GRPC_ERROR_REF(t->closed_with_error));
+ GRPC_CLOSURE_SCHED(on_initiate, GRPC_ERROR_REF(t->closed_with_error));
+ GRPC_CLOSURE_SCHED(on_ack, GRPC_ERROR_REF(t->closed_with_error));
return;
}
grpc_chttp2_ping_queue* pq = &t->ping_queue;
@@ -1732,18 +1651,15 @@ static void send_ping_locked(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
GRPC_ERROR_NONE);
}
-static void retry_initiate_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void retry_initiate_ping_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
t->ping_state.is_delayed_ping_timer_set = false;
if (error == GRPC_ERROR_NONE) {
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RETRY_SEND_PING);
}
}
-void grpc_chttp2_ack_ping(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- uint64_t id) {
+void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id) {
grpc_chttp2_ping_queue* pq = &t->ping_queue;
if (pq->inflight_id != id) {
char* from = grpc_endpoint_get_peer(t->ep);
@@ -1751,54 +1667,48 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
gpr_free(from);
return;
}
- GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
+ GRPC_CLOSURE_LIST_SCHED(&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
if (!grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_NEXT])) {
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CONTINUE_PINGS);
}
}
-static void send_goaway(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error) {
+static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
grpc_http2_error_code http_error;
grpc_slice slice;
- grpc_error_get_status(exec_ctx, error, GRPC_MILLIS_INF_FUTURE, nullptr,
- &slice, &http_error, nullptr);
+ grpc_error_get_status(error, GRPC_MILLIS_INF_FUTURE, nullptr, &slice,
+ &http_error, nullptr);
grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)http_error,
grpc_slice_ref_internal(slice), &t->qbuf);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
GRPC_ERROR_UNREF(error);
}
-void grpc_chttp2_add_ping_strike(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t) {
t->ping_recv_state.ping_strikes++;
if (++t->ping_recv_state.ping_strikes > t->ping_policy.max_ping_strikes &&
t->ping_policy.max_ping_strikes != 0) {
- send_goaway(exec_ctx, t,
+ send_goaway(t,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("too_many_pings"),
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
/*The transport will be closed after the write is done */
close_transport_locked(
- exec_ctx, t,
- grpc_error_set_int(
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many pings"),
- GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
+ t, grpc_error_set_int(
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many pings"),
+ GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
}
}
-static void perform_transport_op_locked(grpc_exec_ctx* exec_ctx,
- void* stream_op,
+static void perform_transport_op_locked(void* stream_op,
grpc_error* error_ignored) {
grpc_transport_op* op = (grpc_transport_op*)stream_op;
grpc_chttp2_transport* t =
(grpc_chttp2_transport*)op->handler_private.extra_arg;
if (op->goaway_error) {
- send_goaway(exec_ctx, t, op->goaway_error);
+ send_goaway(t, op->goaway_error);
}
if (op->set_accept_stream) {
@@ -1808,43 +1718,40 @@ static void perform_transport_op_locked(grpc_exec_ctx* exec_ctx,
}
if (op->bind_pollset) {
- grpc_endpoint_add_to_pollset(exec_ctx, t->ep, op->bind_pollset);
+ grpc_endpoint_add_to_pollset(t->ep, op->bind_pollset);
}
if (op->bind_pollset_set) {
- grpc_endpoint_add_to_pollset_set(exec_ctx, t->ep, op->bind_pollset_set);
+ grpc_endpoint_add_to_pollset_set(t->ep, op->bind_pollset_set);
}
if (op->send_ping) {
- send_ping_locked(exec_ctx, t, nullptr, op->send_ping);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
+ send_ping_locked(t, nullptr, op->send_ping);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
}
if (op->on_connectivity_state_change != nullptr) {
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &t->channel_callback.state_tracker, op->connectivity_state,
+ &t->channel_callback.state_tracker, op->connectivity_state,
op->on_connectivity_state_change);
}
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
- close_transport_locked(exec_ctx, t, op->disconnect_with_error);
+ close_transport_locked(t, op->disconnect_with_error);
}
- GRPC_CLOSURE_RUN(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_RUN(op->on_consumed, GRPC_ERROR_NONE);
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "transport_op");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "transport_op");
}
-static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_transport_op* op) {
+static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
char* msg = grpc_transport_op_string(op);
gpr_free(msg);
op->handler_private.extra_arg = gt;
GRPC_CHTTP2_REF_TRANSPORT(t, "transport_op");
- GRPC_CLOSURE_SCHED(exec_ctx,
- GRPC_CLOSURE_INIT(&op->handler_private.closure,
+ GRPC_CLOSURE_SCHED(GRPC_CLOSURE_INIT(&op->handler_private.closure,
perform_transport_op_locked, op,
grpc_combiner_scheduler(t->combiner)),
GRPC_ERROR_NONE);
@@ -1854,36 +1761,33 @@ static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
* INPUT PROCESSING - GENERAL
*/
-void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
if (s->recv_initial_metadata_ready != nullptr &&
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
if (s->seen_error) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
if (!s->pending_byte_stream) {
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
}
}
- grpc_chttp2_incoming_metadata_buffer_publish(
- exec_ctx, &s->metadata_buffer[0], s->recv_initial_metadata);
- null_then_run_closure(exec_ctx, &s->recv_initial_metadata_ready,
- GRPC_ERROR_NONE);
+ grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[0],
+ s->recv_initial_metadata);
+ null_then_run_closure(&s->recv_initial_metadata_ready, GRPC_ERROR_NONE);
}
}
-void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
grpc_error* error = GRPC_ERROR_NONE;
if (s->recv_message_ready != nullptr) {
*s->recv_message = nullptr;
if (s->final_metadata_requested && s->seen_error) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
if (!s->pending_byte_stream) {
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
}
}
if (!s->pending_byte_stream) {
@@ -1910,10 +1814,9 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
&s->decompressed_data_buffer, nullptr,
GRPC_HEADER_SIZE_IN_BYTES - s->decompressed_header_bytes,
&end_of_context)) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
- &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Stream decompression error.");
} else {
@@ -1922,8 +1825,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
s->decompressed_header_bytes = 0;
}
error = grpc_deframe_unprocessed_incoming_frames(
- exec_ctx, &s->data_parser, s, &s->decompressed_data_buffer,
- nullptr, s->recv_message);
+ &s->data_parser, s, &s->decompressed_data_buffer, nullptr,
+ s->recv_message);
if (end_of_context) {
grpc_stream_compression_context_destroy(
s->stream_decompression_ctx);
@@ -1932,15 +1835,14 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
}
} else {
error = grpc_deframe_unprocessed_incoming_frames(
- exec_ctx, &s->data_parser, s,
- &s->unprocessed_incoming_frames_buffer, nullptr, s->recv_message);
+ &s->data_parser, s, &s->unprocessed_incoming_frames_buffer,
+ nullptr, s->recv_message);
}
if (error != GRPC_ERROR_NONE) {
s->seen_error = true;
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
- &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
break;
} else if (*s->recv_message != nullptr) {
break;
@@ -1948,26 +1850,25 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
}
}
if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
- null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE);
+ null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
*s->recv_message = nullptr;
- null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE);
+ null_then_run_closure(&s->recv_message_ready, GRPC_ERROR_NONE);
}
GRPC_ERROR_UNREF(error);
}
}
-void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_message(t, s);
if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
s->write_closed) {
if (s->seen_error) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
if (!s->pending_byte_stream) {
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
}
}
bool pending_data = s->pending_byte_stream ||
@@ -1985,9 +1886,9 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
s->stream_decompression_ctx, &s->frame_storage,
&s->unprocessed_incoming_frames_buffer, nullptr,
GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
+ grpc_slice_buffer_reset_and_unref_internal(&s->frame_storage);
grpc_slice_buffer_reset_and_unref_internal(
- exec_ctx, &s->unprocessed_incoming_frames_buffer);
+ &s->unprocessed_incoming_frames_buffer);
s->seen_error = true;
} else {
if (s->unprocessed_incoming_frames_buffer.length > 0) {
@@ -2002,23 +1903,23 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
}
if (s->read_closed && s->frame_storage.length == 0 && !pending_data &&
s->recv_trailing_metadata_finished != nullptr) {
- grpc_chttp2_incoming_metadata_buffer_publish(
- exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata);
+ grpc_chttp2_incoming_metadata_buffer_publish(&s->metadata_buffer[1],
+ s->recv_trailing_metadata);
grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->recv_trailing_metadata_finished, GRPC_ERROR_NONE,
+ t, s, &s->recv_trailing_metadata_finished, GRPC_ERROR_NONE,
"recv_trailing_metadata_finished");
}
}
}
-static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- uint32_t id, grpc_error* error) {
+static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
+ grpc_error* error) {
grpc_chttp2_stream* s =
(grpc_chttp2_stream*)grpc_chttp2_stream_map_delete(&t->stream_map, id);
GPR_ASSERT(s);
if (t->incoming_stream == s) {
t->incoming_stream = nullptr;
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_parsing_become_skip_parser(t);
}
if (s->pending_byte_stream) {
if (s->on_next != nullptr) {
@@ -2026,8 +1927,8 @@ static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
if (error == GRPC_ERROR_NONE) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
}
- incoming_byte_stream_publish_error(exec_ctx, bs, error);
- incoming_byte_stream_unref(exec_ctx, bs);
+ incoming_byte_stream_publish_error(bs, error);
+ incoming_byte_stream_unref(bs);
s->data_parser.parsing_frame = nullptr;
} else {
GRPC_ERROR_UNREF(s->byte_stream_error);
@@ -2036,56 +1937,52 @@ static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
}
if (grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
- post_benign_reclaimer(exec_ctx, t);
+ post_benign_reclaimer(t);
if (t->sent_goaway_state == GRPC_CHTTP2_GOAWAY_SENT) {
close_transport_locked(
- exec_ctx, t,
- GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
- "Last stream closed after sending GOAWAY", &error, 1));
+ t, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
+ "Last stream closed after sending GOAWAY", &error, 1));
}
}
if (grpc_chttp2_list_remove_writable_stream(t, s)) {
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:remove_stream");
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:remove_stream");
}
GRPC_ERROR_UNREF(error);
- maybe_start_some_streams(exec_ctx, t);
+ maybe_start_some_streams(t);
}
-void grpc_chttp2_cancel_stream(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_error* due_to_error) {
if (!t->is_client && !s->sent_trailing_metadata &&
grpc_error_has_clear_grpc_status(due_to_error)) {
- close_from_api(exec_ctx, t, s, due_to_error);
+ close_from_api(t, s, due_to_error);
return;
}
if (!s->read_closed || !s->write_closed) {
if (s->id != 0) {
grpc_http2_error_code http_error;
- grpc_error_get_status(exec_ctx, due_to_error, s->deadline, nullptr,
- nullptr, &http_error, nullptr);
+ grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
+ &http_error, nullptr);
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error,
&s->stats.outgoing));
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
}
}
if (due_to_error != GRPC_ERROR_NONE && !s->seen_error) {
s->seen_error = true;
}
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, 1, 1, due_to_error);
+ grpc_chttp2_mark_stream_closed(t, s, 1, 1, due_to_error);
}
-void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_error* error) {
+void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_error* error) {
grpc_status_code status;
grpc_slice slice;
- grpc_error_get_status(exec_ctx, error, s->deadline, &status, &slice, nullptr,
- nullptr);
+ grpc_error_get_status(error, s->deadline, &status, &slice, nullptr, nullptr);
if (status != GRPC_STATUS_OK) {
s->seen_error = true;
}
@@ -2101,20 +1998,20 @@ void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
gpr_ltoa(status, status_string);
GRPC_LOG_IF_ERROR("add_status",
grpc_chttp2_incoming_metadata_buffer_replace_or_add(
- exec_ctx, &s->metadata_buffer[1],
+ &s->metadata_buffer[1],
grpc_mdelem_from_slices(
- exec_ctx, GRPC_MDSTR_GRPC_STATUS,
+ GRPC_MDSTR_GRPC_STATUS,
grpc_slice_from_copied_string(status_string))));
if (!GRPC_SLICE_IS_EMPTY(slice)) {
GRPC_LOG_IF_ERROR(
"add_status_message",
grpc_chttp2_incoming_metadata_buffer_replace_or_add(
- exec_ctx, &s->metadata_buffer[1],
- grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
+ &s->metadata_buffer[1],
+ grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_MESSAGE,
grpc_slice_ref_internal(slice))));
}
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
}
GRPC_ERROR_UNREF(error);
@@ -2147,14 +2044,12 @@ static grpc_error* removal_error(grpc_error* extra_error, grpc_chttp2_stream* s,
return error;
}
-static void flush_write_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_chttp2_write_cb** list,
- grpc_error* error) {
+static void flush_write_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_chttp2_write_cb** list, grpc_error* error) {
while (*list) {
grpc_chttp2_write_cb* cb = *list;
*list = cb->next;
- grpc_chttp2_complete_closure_step(exec_ctx, t, s, &cb->closure,
- GRPC_ERROR_REF(error),
+ grpc_chttp2_complete_closure_step(t, s, &cb->closure, GRPC_ERROR_REF(error),
"on_write_finished_cb");
cb->next = t->write_cb_pool;
t->write_cb_pool = cb;
@@ -2162,37 +2057,34 @@ static void flush_write_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
GRPC_ERROR_UNREF(error);
}
-void grpc_chttp2_fail_pending_writes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, grpc_error* error) {
error =
removal_error(error, s, "Pending writes failed due to stream closure");
s->send_initial_metadata = nullptr;
- grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->send_initial_metadata_finished, GRPC_ERROR_REF(error),
- "send_initial_metadata_finished");
+ grpc_chttp2_complete_closure_step(t, s, &s->send_initial_metadata_finished,
+ GRPC_ERROR_REF(error),
+ "send_initial_metadata_finished");
s->send_trailing_metadata = nullptr;
- grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->send_trailing_metadata_finished,
- GRPC_ERROR_REF(error), "send_trailing_metadata_finished");
+ grpc_chttp2_complete_closure_step(t, s, &s->send_trailing_metadata_finished,
+ GRPC_ERROR_REF(error),
+ "send_trailing_metadata_finished");
s->fetching_send_message = nullptr;
- grpc_chttp2_complete_closure_step(
- exec_ctx, t, s, &s->fetching_send_message_finished, GRPC_ERROR_REF(error),
- "fetching_send_message_finished");
- flush_write_list(exec_ctx, t, s, &s->on_write_finished_cbs,
- GRPC_ERROR_REF(error));
- flush_write_list(exec_ctx, t, s, &s->on_flow_controlled_cbs, error);
+ grpc_chttp2_complete_closure_step(t, s, &s->fetching_send_message_finished,
+ GRPC_ERROR_REF(error),
+ "fetching_send_message_finished");
+ flush_write_list(t, s, &s->on_write_finished_cbs, GRPC_ERROR_REF(error));
+ flush_write_list(t, s, &s->on_flow_controlled_cbs, error);
}
-void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, int close_reads,
int close_writes, grpc_error* error) {
if (s->read_closed && s->write_closed) {
/* already closed */
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
GRPC_ERROR_UNREF(error);
return;
}
@@ -2206,20 +2098,20 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
if (close_writes && !s->write_closed) {
s->write_closed_error = GRPC_ERROR_REF(error);
s->write_closed = true;
- grpc_chttp2_fail_pending_writes(exec_ctx, t, s, GRPC_ERROR_REF(error));
+ grpc_chttp2_fail_pending_writes(t, s, GRPC_ERROR_REF(error));
}
if (s->read_closed && s->write_closed) {
became_closed = true;
grpc_error* overall_error =
removal_error(GRPC_ERROR_REF(error), s, "Stream removed");
if (s->id != 0) {
- remove_stream(exec_ctx, t, s->id, GRPC_ERROR_REF(overall_error));
+ remove_stream(t, s->id, GRPC_ERROR_REF(overall_error));
} else {
/* Purge streams waiting on concurrency still waiting for id assignment */
grpc_chttp2_list_remove_waiting_for_concurrency(t, s);
}
if (overall_error != GRPC_ERROR_NONE) {
- grpc_chttp2_fake_status(exec_ctx, t, s, overall_error);
+ grpc_chttp2_fake_status(t, s, overall_error);
}
}
if (closed_read) {
@@ -2228,18 +2120,18 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
s->published_metadata[i] = GPRC_METADATA_PUBLISHED_AT_CLOSE;
}
}
- grpc_chttp2_maybe_complete_recv_initial_metadata(exec_ctx, t, s);
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_initial_metadata(t, s);
+ grpc_chttp2_maybe_complete_recv_message(t, s);
}
if (became_closed) {
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2");
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2");
}
GRPC_ERROR_UNREF(error);
}
-static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_error* error) {
+static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_error* error) {
grpc_slice hdr;
grpc_slice status_hdr;
grpc_slice http_status_hdr;
@@ -2249,8 +2141,8 @@ static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
uint32_t len = 0;
grpc_status_code grpc_status;
grpc_slice slice;
- grpc_error_get_status(exec_ctx, error, s->deadline, &grpc_status, &slice,
- nullptr, nullptr);
+ grpc_error_get_status(error, s->deadline, &grpc_status, &slice, nullptr,
+ nullptr);
GPR_ASSERT(grpc_status >= 0 && (int)grpc_status < 100);
@@ -2392,13 +2284,11 @@ static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing));
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, 1, 1, error);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
+ grpc_chttp2_mark_stream_closed(t, s, 1, 1, error);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
}
typedef struct {
- grpc_exec_ctx* exec_ctx;
grpc_error* error;
grpc_chttp2_transport* t;
} cancel_stream_cb_args;
@@ -2406,13 +2296,11 @@ typedef struct {
static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
cancel_stream_cb_args* args = (cancel_stream_cb_args*)user_data;
grpc_chttp2_stream* s = (grpc_chttp2_stream*)stream;
- grpc_chttp2_cancel_stream(args->exec_ctx, args->t, s,
- GRPC_ERROR_REF(args->error));
+ grpc_chttp2_cancel_stream(args->t, s, GRPC_ERROR_REF(args->error));
}
-static void end_all_the_calls(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error) {
- cancel_stream_cb_args args = {exec_ctx, error, t};
+static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
+ cancel_stream_cb_args args = {error, t};
grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
GRPC_ERROR_UNREF(error);
}
@@ -2422,14 +2310,14 @@ static void end_all_the_calls(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
*/
template <class F>
-static void WithUrgency(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+static void WithUrgency(grpc_chttp2_transport* t,
grpc_core::chttp2::FlowControlAction::Urgency urgency,
grpc_chttp2_initiate_write_reason reason, F action) {
switch (urgency) {
case grpc_core::chttp2::FlowControlAction::Urgency::NO_ACTION_NEEDED:
break;
case grpc_core::chttp2::FlowControlAction::Urgency::UPDATE_IMMEDIATELY:
- grpc_chttp2_initiate_write(exec_ctx, t, reason);
+ grpc_chttp2_initiate_write(t, reason);
// fallthrough
case grpc_core::chttp2::FlowControlAction::Urgency::QUEUE_UPDATE:
action();
@@ -2438,31 +2326,27 @@ static void WithUrgency(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
}
void grpc_chttp2_act_on_flowctl_action(
- grpc_exec_ctx* exec_ctx, const grpc_core::chttp2::FlowControlAction& action,
+ const grpc_core::chttp2::FlowControlAction& action,
grpc_chttp2_transport* t, grpc_chttp2_stream* s) {
- WithUrgency(
- exec_ctx, t, action.send_stream_update(),
- GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL,
- [exec_ctx, t, s]() { grpc_chttp2_mark_stream_writable(exec_ctx, t, s); });
- WithUrgency(exec_ctx, t, action.send_transport_update(),
+ WithUrgency(t, action.send_stream_update(),
+ GRPC_CHTTP2_INITIATE_WRITE_STREAM_FLOW_CONTROL,
+ [t, s]() { grpc_chttp2_mark_stream_writable(t, s); });
+ WithUrgency(t, action.send_transport_update(),
GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL, []() {});
- WithUrgency(exec_ctx, t, action.send_initial_window_update(),
- GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS,
- [exec_ctx, t, &action]() {
- queue_setting_update(exec_ctx, t,
+ WithUrgency(t, action.send_initial_window_update(),
+ GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS, [t, &action]() {
+ queue_setting_update(t,
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
action.initial_window_size());
});
- WithUrgency(
- exec_ctx, t, action.send_max_frame_size_update(),
- GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS, [exec_ctx, t, &action]() {
- queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
- action.max_frame_size());
- });
+ WithUrgency(t, action.send_max_frame_size_update(),
+ GRPC_CHTTP2_INITIATE_WRITE_SEND_SETTINGS, [t, &action]() {
+ queue_setting_update(t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
+ action.max_frame_size());
+ });
}
-static grpc_error* try_http_parsing(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* try_http_parsing(grpc_chttp2_transport* t) {
grpc_http_parser parser;
size_t i = 0;
grpc_error* error = GRPC_ERROR_NONE;
@@ -2491,8 +2375,7 @@ static grpc_error* try_http_parsing(grpc_exec_ctx* exec_ctx,
return error;
}
-static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void read_action_locked(void* tp, grpc_error* error) {
GPR_TIMER_BEGIN("reading_action_locked", 0);
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
@@ -2516,11 +2399,10 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
t->flow_control->bdp_estimator()->AddIncomingBytes(
(int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
- errors[1] =
- grpc_chttp2_perform_read(exec_ctx, t, t->read_buffer.slices[i]);
+ errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
}
if (errors[1] != GRPC_ERROR_NONE) {
- errors[2] = try_http_parsing(exec_ctx, t);
+ errors[2] = try_http_parsing(t);
GRPC_ERROR_UNREF(error);
error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Failed parsing HTTP/2", errors, GPR_ARRAY_SIZE(errors));
@@ -2535,10 +2417,9 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
if (t->initial_window_update > 0) {
grpc_chttp2_stream* s;
while (grpc_chttp2_list_pop_stalled_by_stream(t, &s)) {
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
+ grpc_chttp2_mark_stream_writable(t, s);
grpc_chttp2_initiate_write(
- exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING);
+ t, GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_SETTING);
}
}
t->initial_window_update = 0;
@@ -2559,22 +2440,21 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
error = grpc_error_add_child(error, GRPC_ERROR_REF(t->goaway_error));
}
- close_transport_locked(exec_ctx, t, GRPC_ERROR_REF(error));
+ close_transport_locked(t, GRPC_ERROR_REF(error));
t->endpoint_reading = 0;
} else if (t->closed_with_error == GRPC_ERROR_NONE) {
keep_reading = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
}
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &t->read_buffer);
+ grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer);
if (keep_reading) {
- grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
- &t->read_action_locked);
- grpc_chttp2_act_on_flowctl_action(exec_ctx, t->flow_control->MakeAction(),
- t, nullptr);
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
+ grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked);
+ grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t,
+ nullptr);
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "keep_reading");
} else {
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
}
GPR_TIMER_END("post_reading_action_locked", 0);
@@ -2586,15 +2466,12 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
// t is reffed prior to calling the first time, and once the callback chain
// that kicks off finishes, it's unreffed
-static void schedule_bdp_ping_locked(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {
t->flow_control->bdp_estimator()->SchedulePing();
- send_ping_locked(exec_ctx, t, &t->start_bdp_ping_locked,
- &t->finish_bdp_ping_locked);
+ send_ping_locked(t, &t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
}
-static void start_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void start_bdp_ping_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG, "%s: Start BDP ping err=%s", t->peer_string,
@@ -2602,42 +2479,39 @@ static void start_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
}
/* Reset the keepalive ping timer */
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
- grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer);
+ grpc_timer_cancel(&t->keepalive_ping_timer);
}
t->flow_control->bdp_estimator()->StartPing();
}
-static void finish_bdp_ping_locked(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_error* error) {
+static void finish_bdp_ping_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
if (grpc_http_trace.enabled()) {
gpr_log(GPR_DEBUG, "%s: Complete BDP ping err=%s", t->peer_string,
grpc_error_string(error));
}
if (error != GRPC_ERROR_NONE) {
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "bdp_ping");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
return;
}
- grpc_millis next_ping =
- t->flow_control->bdp_estimator()->CompletePing(exec_ctx);
- grpc_chttp2_act_on_flowctl_action(
- exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, nullptr);
+ grpc_millis next_ping = t->flow_control->bdp_estimator()->CompletePing();
+ grpc_chttp2_act_on_flowctl_action(t->flow_control->PeriodicUpdate(), t,
+ nullptr);
GPR_ASSERT(!t->have_next_bdp_ping_timer);
t->have_next_bdp_ping_timer = true;
- grpc_timer_init(exec_ctx, &t->next_bdp_ping_timer, next_ping,
+ grpc_timer_init(&t->next_bdp_ping_timer, next_ping,
&t->next_bdp_ping_timer_expired_locked);
}
-static void next_bdp_ping_timer_expired_locked(grpc_exec_ctx* exec_ctx,
- void* tp, grpc_error* error) {
+static void next_bdp_ping_timer_expired_locked(void* tp, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
GPR_ASSERT(t->have_next_bdp_ping_timer);
t->have_next_bdp_ping_timer = false;
if (error != GRPC_ERROR_NONE) {
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "bdp_ping");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "bdp_ping");
return;
}
- schedule_bdp_ping_locked(exec_ctx, t);
+ schedule_bdp_ping_locked(t);
}
void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
@@ -2698,8 +2572,7 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args* args,
}
}
-static void init_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING);
if (t->destroying || t->closed_with_error != GRPC_ERROR_NONE) {
@@ -2709,59 +2582,55 @@ static void init_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_chttp2_stream_map_size(&t->stream_map) > 0) {
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_PINGING;
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive ping end");
- send_ping_locked(exec_ctx, t, &t->start_keepalive_ping_locked,
+ send_ping_locked(t, &t->start_keepalive_ping_locked,
&t->finish_keepalive_ping_locked);
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_KEEPALIVE_PING);
} else {
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
- grpc_timer_init(exec_ctx, &t->keepalive_ping_timer,
- grpc_exec_ctx_now(exec_ctx) + t->keepalive_time,
+ grpc_timer_init(&t->keepalive_ping_timer,
+ grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
} else if (error == GRPC_ERROR_CANCELLED) {
/* The keepalive ping timer may be cancelled by bdp */
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
- grpc_timer_init(exec_ctx, &t->keepalive_ping_timer,
- grpc_exec_ctx_now(exec_ctx) + t->keepalive_time,
+ grpc_timer_init(&t->keepalive_ping_timer,
+ grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "init keepalive ping");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
}
-static void start_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void start_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog");
- grpc_timer_init(exec_ctx, &t->keepalive_watchdog_timer,
- grpc_exec_ctx_now(exec_ctx) + t->keepalive_time,
+ grpc_timer_init(&t->keepalive_watchdog_timer,
+ grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
&t->keepalive_watchdog_fired_locked);
}
-static void finish_keepalive_ping_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
if (error == GRPC_ERROR_NONE) {
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
- grpc_timer_cancel(exec_ctx, &t->keepalive_watchdog_timer);
+ grpc_timer_cancel(&t->keepalive_watchdog_timer);
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
- grpc_timer_init(exec_ctx, &t->keepalive_ping_timer,
- grpc_exec_ctx_now(exec_ctx) + t->keepalive_time,
+ grpc_timer_init(&t->keepalive_ping_timer,
+ grpc_core::ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
}
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keepalive ping end");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive ping end");
}
-static void keepalive_watchdog_fired_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void keepalive_watchdog_fired_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) {
if (error == GRPC_ERROR_NONE) {
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING;
close_transport_locked(
- exec_ctx, t,
+ t,
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"keepalive watchdog timeout"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_INTERNAL));
@@ -2774,71 +2643,67 @@ static void keepalive_watchdog_fired_locked(grpc_exec_ctx* exec_ctx, void* arg,
t->keepalive_state, GRPC_CHTTP2_KEEPALIVE_STATE_PINGING);
}
}
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keepalive watchdog");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "keepalive watchdog");
}
/*******************************************************************************
* CALLBACK LOOP
*/
-static void connectivity_state_set(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void connectivity_state_set(grpc_chttp2_transport* t,
grpc_connectivity_state state,
grpc_error* error, const char* reason) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "set connectivity_state=%d", state));
- grpc_connectivity_state_set(exec_ctx, &t->channel_callback.state_tracker,
- state, error, reason);
+ grpc_connectivity_state_set(&t->channel_callback.state_tracker, state, error,
+ reason);
}
/*******************************************************************************
* POLLSET STUFF
*/
-static void set_pollset(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_pollset* pollset) {
+static void set_pollset(grpc_transport* gt, grpc_stream* gs,
+ grpc_pollset* pollset) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
- grpc_endpoint_add_to_pollset(exec_ctx, t->ep, pollset);
+ grpc_endpoint_add_to_pollset(t->ep, pollset);
}
-static void set_pollset_set(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_pollset_set* pollset_set) {
+static void set_pollset_set(grpc_transport* gt, grpc_stream* gs,
+ grpc_pollset_set* pollset_set) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
- grpc_endpoint_add_to_pollset_set(exec_ctx, t->ep, pollset_set);
+ grpc_endpoint_add_to_pollset_set(t->ep, pollset_set);
}
/*******************************************************************************
* BYTE STREAM
*/
-static void reset_byte_stream(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void reset_byte_stream(void* arg, grpc_error* error) {
grpc_chttp2_stream* s = (grpc_chttp2_stream*)arg;
s->pending_byte_stream = false;
if (error == GRPC_ERROR_NONE) {
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, s->t, s);
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, s->t, s);
+ grpc_chttp2_maybe_complete_recv_message(s->t, s);
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(s->t, s);
} else {
GPR_ASSERT(error != GRPC_ERROR_NONE);
- GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(s->on_next, GRPC_ERROR_REF(error));
s->on_next = nullptr;
GRPC_ERROR_UNREF(s->byte_stream_error);
s->byte_stream_error = GRPC_ERROR_NONE;
- grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error));
+ grpc_chttp2_cancel_stream(s->t, s, GRPC_ERROR_REF(error));
s->byte_stream_error = GRPC_ERROR_REF(error);
}
}
-static void incoming_byte_stream_unref(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_incoming_byte_stream* bs) {
+static void incoming_byte_stream_unref(grpc_chttp2_incoming_byte_stream* bs) {
if (gpr_unref(&bs->refs)) {
gpr_free(bs);
}
}
-static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
- void* argp,
+static void incoming_byte_stream_next_locked(void* argp,
grpc_error* error_ignored) {
grpc_chttp2_incoming_byte_stream* bs =
(grpc_chttp2_incoming_byte_stream*)argp;
@@ -2849,30 +2714,29 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
if (!s->read_closed) {
s->flow_control->IncomingByteStreamUpdate(bs->next_action.max_size_hint,
cur_length);
- grpc_chttp2_act_on_flowctl_action(exec_ctx, s->flow_control->MakeAction(),
- t, s);
+ grpc_chttp2_act_on_flowctl_action(s->flow_control->MakeAction(), t, s);
}
GPR_ASSERT(s->unprocessed_incoming_frames_buffer.length == 0);
if (s->frame_storage.length > 0) {
grpc_slice_buffer_swap(&s->frame_storage,
&s->unprocessed_incoming_frames_buffer);
s->unprocessed_incoming_frames_decompressed = false;
- GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(bs->next_action.on_complete, GRPC_ERROR_NONE);
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
- GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
+ GRPC_CLOSURE_SCHED(bs->next_action.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
if (s->data_parser.parsing_frame != nullptr) {
- incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
+ incoming_byte_stream_unref(s->data_parser.parsing_frame);
s->data_parser.parsing_frame = nullptr;
}
} else if (s->read_closed) {
if (bs->remaining_bytes != 0) {
s->byte_stream_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
- GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
+ GRPC_CLOSURE_SCHED(bs->next_action.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
if (s->data_parser.parsing_frame != nullptr) {
- incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
+ incoming_byte_stream_unref(s->data_parser.parsing_frame);
s->data_parser.parsing_frame = nullptr;
}
} else {
@@ -2882,11 +2746,10 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
} else {
s->on_next = bs->next_action.on_complete;
}
- incoming_byte_stream_unref(exec_ctx, bs);
+ incoming_byte_stream_unref(bs);
}
-static bool incoming_byte_stream_next(grpc_exec_ctx* exec_ctx,
- grpc_byte_stream* byte_stream,
+static bool incoming_byte_stream_next(grpc_byte_stream* byte_stream,
size_t max_size_hint,
grpc_closure* on_complete) {
GPR_TIMER_BEGIN("incoming_byte_stream_next", 0);
@@ -2901,7 +2764,6 @@ static bool incoming_byte_stream_next(grpc_exec_ctx* exec_ctx,
bs->next_action.max_size_hint = max_size_hint;
bs->next_action.on_complete = on_complete;
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&bs->next_action.closure,
incoming_byte_stream_next_locked, bs,
grpc_combiner_scheduler(bs->transport->combiner)),
@@ -2911,8 +2773,7 @@ static bool incoming_byte_stream_next(grpc_exec_ctx* exec_ctx,
}
}
-static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
- grpc_byte_stream* byte_stream,
+static grpc_error* incoming_byte_stream_pull(grpc_byte_stream* byte_stream,
grpc_slice* slice) {
GPR_TIMER_BEGIN("incoming_byte_stream_pull", 0);
grpc_chttp2_incoming_byte_stream* bs =
@@ -2948,31 +2809,28 @@ static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
}
}
error = grpc_deframe_unprocessed_incoming_frames(
- exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer,
- slice, nullptr);
+ &s->data_parser, s, &s->unprocessed_incoming_frames_buffer, slice,
+ nullptr);
if (error != GRPC_ERROR_NONE) {
return error;
}
} else {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
- GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
return error;
}
GPR_TIMER_END("incoming_byte_stream_pull", 0);
return GRPC_ERROR_NONE;
}
-static void incoming_byte_stream_destroy_locked(grpc_exec_ctx* exec_ctx,
- void* byte_stream,
+static void incoming_byte_stream_destroy_locked(void* byte_stream,
grpc_error* error_ignored);
-static void incoming_byte_stream_destroy(grpc_exec_ctx* exec_ctx,
- grpc_byte_stream* byte_stream) {
+static void incoming_byte_stream_destroy(grpc_byte_stream* byte_stream) {
GPR_TIMER_BEGIN("incoming_byte_stream_destroy", 0);
grpc_chttp2_incoming_byte_stream* bs =
(grpc_chttp2_incoming_byte_stream*)byte_stream;
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_INIT(&bs->destroy_action,
incoming_byte_stream_destroy_locked, bs,
grpc_combiner_scheduler(bs->transport->combiner)),
@@ -2981,30 +2839,28 @@ static void incoming_byte_stream_destroy(grpc_exec_ctx* exec_ctx,
}
static void incoming_byte_stream_publish_error(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_error* error) {
+ grpc_chttp2_incoming_byte_stream* bs, grpc_error* error) {
grpc_chttp2_stream* s = bs->stream;
GPR_ASSERT(error != GRPC_ERROR_NONE);
- GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(s->on_next, GRPC_ERROR_REF(error));
s->on_next = nullptr;
GRPC_ERROR_UNREF(s->byte_stream_error);
s->byte_stream_error = GRPC_ERROR_REF(error);
- grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream,
- GRPC_ERROR_REF(error));
+ grpc_chttp2_cancel_stream(bs->transport, bs->stream, GRPC_ERROR_REF(error));
}
grpc_error* grpc_chttp2_incoming_byte_stream_push(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_slice slice, grpc_slice* slice_out) {
+ grpc_chttp2_incoming_byte_stream* bs, grpc_slice slice,
+ grpc_slice* slice_out) {
grpc_chttp2_stream* s = bs->stream;
if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) {
grpc_error* error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Too many bytes in stream");
- GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
- grpc_slice_unref_internal(exec_ctx, slice);
+ GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
+ grpc_slice_unref_internal(slice);
return error;
} else {
bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice);
@@ -3016,8 +2872,8 @@ grpc_error* grpc_chttp2_incoming_byte_stream_push(
}
grpc_error* grpc_chttp2_incoming_byte_stream_finished(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_error* error, bool reset_on_error) {
+ grpc_chttp2_incoming_byte_stream* bs, grpc_error* error,
+ bool reset_on_error) {
grpc_chttp2_stream* s = bs->stream;
if (error == GRPC_ERROR_NONE) {
@@ -3026,27 +2882,25 @@ grpc_error* grpc_chttp2_incoming_byte_stream_finished(
}
}
if (error != GRPC_ERROR_NONE && reset_on_error) {
- GRPC_CLOSURE_SCHED(exec_ctx, &s->reset_byte_stream, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(&s->reset_byte_stream, GRPC_ERROR_REF(error));
}
- incoming_byte_stream_unref(exec_ctx, bs);
+ incoming_byte_stream_unref(bs);
return error;
}
-static void incoming_byte_stream_shutdown(grpc_exec_ctx* exec_ctx,
- grpc_byte_stream* byte_stream,
+static void incoming_byte_stream_shutdown(grpc_byte_stream* byte_stream,
grpc_error* error) {
grpc_chttp2_incoming_byte_stream* bs =
(grpc_chttp2_incoming_byte_stream*)byte_stream;
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
- exec_ctx, bs, error, true /* reset_on_error */));
+ bs, error, true /* reset_on_error */));
}
static const grpc_byte_stream_vtable grpc_chttp2_incoming_byte_stream_vtable = {
incoming_byte_stream_next, incoming_byte_stream_pull,
incoming_byte_stream_shutdown, incoming_byte_stream_destroy};
-static void incoming_byte_stream_destroy_locked(grpc_exec_ctx* exec_ctx,
- void* byte_stream,
+static void incoming_byte_stream_destroy_locked(void* byte_stream,
grpc_error* error_ignored) {
grpc_chttp2_incoming_byte_stream* bs =
(grpc_chttp2_incoming_byte_stream*)byte_stream;
@@ -3054,15 +2908,15 @@ static void incoming_byte_stream_destroy_locked(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t = s->t;
GPR_ASSERT(bs->base.vtable == &grpc_chttp2_incoming_byte_stream_vtable);
- incoming_byte_stream_unref(exec_ctx, bs);
+ incoming_byte_stream_unref(bs);
s->pending_byte_stream = false;
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
- grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_message(t, s);
+ grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s);
}
grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, grpc_chttp2_stream* s,
- uint32_t frame_size, uint32_t flags) {
+ grpc_chttp2_transport* t, grpc_chttp2_stream* s, uint32_t frame_size,
+ uint32_t flags) {
grpc_chttp2_incoming_byte_stream* incoming_byte_stream =
(grpc_chttp2_incoming_byte_stream*)gpr_malloc(
sizeof(*incoming_byte_stream));
@@ -3082,30 +2936,25 @@ grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
* RESOURCE QUOTAS
*/
-static void post_benign_reclaimer(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void post_benign_reclaimer(grpc_chttp2_transport* t) {
if (!t->benign_reclaimer_registered) {
t->benign_reclaimer_registered = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer");
- grpc_resource_user_post_reclaimer(exec_ctx,
- grpc_endpoint_get_resource_user(t->ep),
+ grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
false, &t->benign_reclaimer_locked);
}
}
-static void post_destructive_reclaimer(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void post_destructive_reclaimer(grpc_chttp2_transport* t) {
if (!t->destructive_reclaimer_registered) {
t->destructive_reclaimer_registered = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer");
- grpc_resource_user_post_reclaimer(exec_ctx,
- grpc_endpoint_get_resource_user(t->ep),
+ grpc_resource_user_post_reclaimer(grpc_endpoint_get_resource_user(t->ep),
true, &t->destructive_reclaimer_locked);
}
}
-static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void benign_reclaimer_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
if (error == GRPC_ERROR_NONE &&
grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
@@ -3115,7 +2964,7 @@ static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
gpr_log(GPR_DEBUG, "HTTP2: %s - send goaway to free memory",
t->peer_string);
}
- send_goaway(exec_ctx, t,
+ send_goaway(t,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_ENHANCE_YOUR_CALM));
@@ -3128,13 +2977,12 @@ static void benign_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
t->benign_reclaimer_registered = false;
if (error != GRPC_ERROR_CANCELLED) {
grpc_resource_user_finish_reclamation(
- exec_ctx, grpc_endpoint_get_resource_user(t->ep));
+ grpc_endpoint_get_resource_user(t->ep));
}
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "benign_reclaimer");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "benign_reclaimer");
}
-static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)arg;
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
t->destructive_reclaimer_registered = false;
@@ -3146,7 +2994,7 @@ static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
s->id);
}
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("Buffers full"),
GRPC_ERROR_INT_HTTP2_ERROR,
GRPC_HTTP2_ENHANCE_YOUR_CALM));
@@ -3155,14 +3003,14 @@ static void destructive_reclaimer_locked(grpc_exec_ctx* exec_ctx, void* arg,
there are more streams left, we can immediately post a new
reclaimer in case the resource quota needs to free more
memory */
- post_destructive_reclaimer(exec_ctx, t);
+ post_destructive_reclaimer(t);
}
}
if (error != GRPC_ERROR_CANCELLED) {
grpc_resource_user_finish_reclamation(
- exec_ctx, grpc_endpoint_get_resource_user(t->ep));
+ grpc_endpoint_get_resource_user(t->ep));
}
- GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destructive_reclaimer");
+ GRPC_CHTTP2_UNREF_TRANSPORT(t, "destructive_reclaimer");
}
/*******************************************************************************
@@ -3216,8 +3064,7 @@ const char* grpc_chttp2_initiate_write_reason_string(
GPR_UNREACHABLE_CODE(return "unknown");
}
-static grpc_endpoint* chttp2_get_endpoint(grpc_exec_ctx* exec_ctx,
- grpc_transport* t) {
+static grpc_endpoint* chttp2_get_endpoint(grpc_transport* t) {
return ((grpc_chttp2_transport*)t)->ep;
}
@@ -3235,17 +3082,16 @@ static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream),
static const grpc_transport_vtable* get_vtable(void) { return &vtable; }
grpc_transport* grpc_create_chttp2_transport(
- grpc_exec_ctx* exec_ctx, const grpc_channel_args* channel_args,
- grpc_endpoint* ep, bool is_client) {
+ const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client) {
grpc_chttp2_transport* t =
(grpc_chttp2_transport*)gpr_zalloc(sizeof(grpc_chttp2_transport));
- init_transport(exec_ctx, t, channel_args, ep, is_client);
+ init_transport(t, channel_args, ep, is_client);
return &t->base;
}
void grpc_chttp2_transport_start_reading(
- grpc_exec_ctx* exec_ctx, grpc_transport* transport,
- grpc_slice_buffer* read_buffer, grpc_closure* notify_on_receive_settings) {
+ grpc_transport* transport, grpc_slice_buffer* read_buffer,
+ grpc_closure* notify_on_receive_settings) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)transport;
GRPC_CHTTP2_REF_TRANSPORT(
t, "reading_action"); /* matches unref inside reading_action */
@@ -3254,5 +3100,5 @@ void grpc_chttp2_transport_start_reading(
gpr_free(read_buffer);
}
t->notify_on_receive_settings = notify_on_receive_settings;
- GRPC_CLOSURE_SCHED(exec_ctx, &t->read_action_locked, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(&t->read_action_locked, GRPC_ERROR_NONE);
}
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h
index bd72e07bab..596ababb19 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h
@@ -28,15 +28,14 @@ extern grpc_core::TraceFlag grpc_trace_http2_stream_state;
extern grpc_core::DebugOnlyTraceFlag grpc_trace_chttp2_refcount;
grpc_transport* grpc_create_chttp2_transport(
- grpc_exec_ctx* exec_ctx, const grpc_channel_args* channel_args,
- grpc_endpoint* ep, bool is_client);
+ const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client);
/// Takes ownership of \a read_buffer, which (if non-NULL) contains
/// leftover bytes previously read from the endpoint (e.g., by handshakers).
/// If non-null, \a notify_on_receive_settings will be scheduled when
/// HTTP/2 settings are received from the peer.
void grpc_chttp2_transport_start_reading(
- grpc_exec_ctx* exec_ctx, grpc_transport* transport,
- grpc_slice_buffer* read_buffer, grpc_closure* notify_on_receive_settings);
+ grpc_transport* transport, grpc_slice_buffer* read_buffer,
+ grpc_closure* notify_on_receive_settings);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index 8a057bd9ff..ca48cc7e0a 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -149,8 +149,7 @@ void FlowControlAction::Trace(grpc_chttp2_transport* t) const {
gpr_free(mf_str);
}
-TransportFlowControl::TransportFlowControl(grpc_exec_ctx* exec_ctx,
- const grpc_chttp2_transport* t,
+TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
bool enable_bdp_probe)
: t_(t),
enable_bdp_probe_(enable_bdp_probe),
@@ -163,7 +162,7 @@ TransportFlowControl::TransportFlowControl(grpc_exec_ctx* exec_ctx,
.set_min_control_value(-1)
.set_max_control_value(25)
.set_integral_range(10)),
- last_pid_update_(grpc_exec_ctx_now(exec_ctx)) {}
+ last_pid_update_(grpc_core::ExecCtx::Get()->Now()) {}
uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
FlowControlTrace trace("t updt sent", this, nullptr);
@@ -308,9 +307,8 @@ double TransportFlowControl::TargetLogBdp() {
1 + log2(bdp_estimator_.EstimateBdp()));
}
-double TransportFlowControl::SmoothLogBdp(grpc_exec_ctx* exec_ctx,
- double value) {
- grpc_millis now = grpc_exec_ctx_now(exec_ctx);
+double TransportFlowControl::SmoothLogBdp(double value) {
+ grpc_millis now = grpc_core::ExecCtx::Get()->Now();
double bdp_error = value - pid_controller_.last_control_value();
const double dt = (double)(now - last_pid_update_) * 1e-3;
last_pid_update_ = now;
@@ -331,15 +329,14 @@ FlowControlAction::Urgency TransportFlowControl::DeltaUrgency(
}
}
-FlowControlAction TransportFlowControl::PeriodicUpdate(
- grpc_exec_ctx* exec_ctx) {
+FlowControlAction TransportFlowControl::PeriodicUpdate() {
FlowControlAction action;
if (enable_bdp_probe_) {
// get bdp estimate and update initial_window accordingly.
// target might change based on how much memory pressure we are under
// TODO(ncteisen): experiment with setting target to be huge under low
// memory pressure.
- const double target = pow(2, SmoothLogBdp(exec_ctx, TargetLogBdp()));
+ const double target = pow(2, SmoothLogBdp(TargetLogBdp()));
// Though initial window 'could' drop to 0, we keep the floor at 128
target_initial_window_size_ = (int32_t)GPR_CLAMP(target, 128, INT32_MAX);
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h
index 2515c94309..8306047dbc 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.h
+++ b/src/core/ext/transport/chttp2/transport/flow_control.h
@@ -134,8 +134,7 @@ class FlowControlTrace {
class TransportFlowControl {
public:
- TransportFlowControl(grpc_exec_ctx* exec_ctx, const grpc_chttp2_transport* t,
- bool enable_bdp_probe);
+ TransportFlowControl(const grpc_chttp2_transport* t, bool enable_bdp_probe);
~TransportFlowControl() {}
bool bdp_probe() const { return enable_bdp_probe_; }
@@ -153,7 +152,7 @@ class TransportFlowControl {
// Call periodically (at a low-ish rate, 100ms - 10s makes sense)
// to perform more complex flow control calculations and return an action
// to let chttp2 change its parameters
- FlowControlAction PeriodicUpdate(grpc_exec_ctx* exec_ctx);
+ FlowControlAction PeriodicUpdate();
void StreamSentData(int64_t size) { remote_window_ -= size; }
@@ -212,7 +211,7 @@ class TransportFlowControl {
private:
friend class ::grpc::testing::TrickledCHTTP2;
double TargetLogBdp();
- double SmoothLogBdp(grpc_exec_ctx* exec_ctx, double value);
+ double SmoothLogBdp(double value);
FlowControlAction::Urgency DeltaUrgency(int32_t value,
grpc_chttp2_setting_id setting_id);
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc
index f0c3b55792..9b3a6acc9e 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_data.cc
@@ -36,11 +36,10 @@ grpc_error* grpc_chttp2_data_parser_init(grpc_chttp2_data_parser* parser) {
return GRPC_ERROR_NONE;
}
-void grpc_chttp2_data_parser_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_data_parser* parser) {
+void grpc_chttp2_data_parser_destroy(grpc_chttp2_data_parser* parser) {
if (parser->parsing_frame != nullptr) {
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
- exec_ctx, parser->parsing_frame,
+ parser->parsing_frame,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false));
}
GRPC_ERROR_UNREF(parser->error);
@@ -98,7 +97,7 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
}
grpc_error* grpc_deframe_unprocessed_incoming_frames(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
+ grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
grpc_slice_buffer* slices, grpc_slice* slice_out,
grpc_byte_stream** stream_out) {
grpc_error* error = GRPC_ERROR_NONE;
@@ -118,14 +117,14 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
char* msg;
if (cur == end) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
switch (p->state) {
case GRPC_CHTTP2_DATA_ERROR:
p->state = GRPC_CHTTP2_DATA_ERROR;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_REF(p->error);
case GRPC_CHTTP2_DATA_FH_0:
s->stats.incoming.framing_bytes++;
@@ -150,12 +149,12 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
p->error =
grpc_error_set_int(p->error, GRPC_ERROR_INT_OFFSET, cur - beg);
p->state = GRPC_CHTTP2_DATA_ERROR;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_REF(p->error);
}
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_1;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
/* fallthrough */
@@ -164,7 +163,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
p->frame_size = ((uint32_t)*cur) << 24;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_2;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
/* fallthrough */
@@ -173,7 +172,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
p->frame_size |= ((uint32_t)*cur) << 16;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_3;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
/* fallthrough */
@@ -182,7 +181,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
p->frame_size |= ((uint32_t)*cur) << 8;
if (++cur == end) {
p->state = GRPC_CHTTP2_DATA_FH_4;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
/* fallthrough */
@@ -198,11 +197,11 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
message_flags |= GRPC_WRITE_INTERNAL_COMPRESS;
}
p->parsing_frame = grpc_chttp2_incoming_byte_stream_create(
- exec_ctx, t, s, p->frame_size, message_flags);
+ t, s, p->frame_size, message_flags);
*stream_out = &p->parsing_frame->base;
if (p->parsing_frame->remaining_bytes == 0) {
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
- exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true));
+ p->parsing_frame, GRPC_ERROR_NONE, true));
p->parsing_frame = nullptr;
p->state = GRPC_CHTTP2_DATA_FH_0;
}
@@ -213,64 +212,64 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
slices,
grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
}
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
case GRPC_CHTTP2_DATA_FRAME: {
GPR_ASSERT(p->parsing_frame != nullptr);
GPR_ASSERT(slice_out != nullptr);
if (cur == end) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
continue;
}
uint32_t remaining = (uint32_t)(end - cur);
if (remaining == p->frame_size) {
s->stats.incoming.data_bytes += remaining;
if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push(
- exec_ctx, p->parsing_frame,
+ p->parsing_frame,
grpc_slice_sub(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
slice_out))) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return error;
}
if (GRPC_ERROR_NONE !=
(error = grpc_chttp2_incoming_byte_stream_finished(
- exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ p->parsing_frame, GRPC_ERROR_NONE, true))) {
+ grpc_slice_unref_internal(slice);
return error;
}
p->parsing_frame = nullptr;
p->state = GRPC_CHTTP2_DATA_FH_0;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
} else if (remaining < p->frame_size) {
s->stats.incoming.data_bytes += remaining;
if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push(
- exec_ctx, p->parsing_frame,
+ p->parsing_frame,
grpc_slice_sub(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
slice_out))) {
return error;
}
p->frame_size -= remaining;
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
} else {
GPR_ASSERT(remaining > p->frame_size);
s->stats.incoming.data_bytes += p->frame_size;
if (GRPC_ERROR_NONE !=
(grpc_chttp2_incoming_byte_stream_push(
- exec_ctx, p->parsing_frame,
+ p->parsing_frame,
grpc_slice_sub(slice, (size_t)(cur - beg),
(size_t)(cur + p->frame_size - beg)),
slice_out))) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return error;
}
if (GRPC_ERROR_NONE !=
(error = grpc_chttp2_incoming_byte_stream_finished(
- exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true))) {
- grpc_slice_unref_internal(exec_ctx, slice);
+ p->parsing_frame, GRPC_ERROR_NONE, true))) {
+ grpc_slice_unref_internal(slice);
return error;
}
p->parsing_frame = nullptr;
@@ -279,7 +278,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_slice_buffer_undo_take_first(
slices,
grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
}
}
@@ -289,19 +288,19 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_data_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
+grpc_error* grpc_chttp2_data_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
if (!s->pending_byte_stream) {
grpc_slice_ref_internal(slice);
grpc_slice_buffer_add(&s->frame_storage, slice);
- grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
+ grpc_chttp2_maybe_complete_recv_message(t, s);
} else if (s->on_next) {
GPR_ASSERT(s->frame_storage.length == 0);
grpc_slice_ref_internal(slice);
grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice);
- GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(s->on_next, GRPC_ERROR_NONE);
s->on_next = nullptr;
s->unprocessed_incoming_frames_decompressed = false;
} else {
@@ -310,8 +309,7 @@ grpc_error* grpc_chttp2_data_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
}
if (is_last && s->received_last_frame) {
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false,
- GRPC_ERROR_NONE);
+ grpc_chttp2_mark_stream_closed(t, s, true, false, GRPC_ERROR_NONE);
}
return GRPC_ERROR_NONE;
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h
index 4de553ea42..964cc59b1b 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.h
+++ b/src/core/ext/transport/chttp2/transport/frame_data.h
@@ -54,8 +54,7 @@ typedef struct {
/* initialize per-stream state for data frame parsing */
grpc_error* grpc_chttp2_data_parser_init(grpc_chttp2_data_parser* parser);
-void grpc_chttp2_data_parser_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_data_parser* parser);
+void grpc_chttp2_data_parser_destroy(grpc_chttp2_data_parser* parser);
/* start processing a new data frame */
grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
@@ -65,7 +64,7 @@ grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
/* handle a slice of a data frame - is_last indicates the last slice of a
frame */
-grpc_error* grpc_chttp2_data_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
+grpc_error* grpc_chttp2_data_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
@@ -76,7 +75,7 @@ void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer* inbuf,
grpc_slice_buffer* outbuf);
grpc_error* grpc_deframe_unprocessed_incoming_frames(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
+ grpc_chttp2_data_parser* p, grpc_chttp2_stream* s,
grpc_slice_buffer* slices, grpc_slice* slice_out,
grpc_byte_stream** stream_out);
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.cc b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
index a2ce709a2e..b60b4227fe 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
@@ -52,8 +52,7 @@ grpc_error* grpc_chttp2_goaway_parser_begin_frame(grpc_chttp2_goaway_parser* p,
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_goaway_parser_parse(grpc_exec_ctx* exec_ctx,
- void* parser,
+grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
@@ -135,7 +134,7 @@ grpc_error* grpc_chttp2_goaway_parser_parse(grpc_exec_ctx* exec_ctx,
p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
if (is_last) {
grpc_chttp2_add_incoming_goaway(
- exec_ctx, t, (uint32_t)p->error_code,
+ t, (uint32_t)p->error_code,
grpc_slice_new(p->debug_data, p->debug_length, gpr_free));
p->debug_data = nullptr;
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h
index 743e763342..064d39ac59 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.h
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h
@@ -50,8 +50,7 @@ void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p);
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p);
grpc_error* grpc_chttp2_goaway_parser_begin_frame(
grpc_chttp2_goaway_parser* parser, uint32_t length, uint8_t flags);
-grpc_error* grpc_chttp2_goaway_parser_parse(grpc_exec_ctx* exec_ctx,
- void* parser,
+grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc
index d0feb51922..298a56721a 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc
@@ -68,7 +68,7 @@ grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
+grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
@@ -86,10 +86,10 @@ grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
if (p->byte == 8) {
GPR_ASSERT(is_last);
if (p->is_ack) {
- grpc_chttp2_ack_ping(exec_ctx, t, p->opaque_8bytes);
+ grpc_chttp2_ack_ping(t, p->opaque_8bytes);
} else {
if (!t->is_client) {
- grpc_millis now = grpc_exec_ctx_now(exec_ctx);
+ grpc_millis now = grpc_core::ExecCtx::Get()->Now();
grpc_millis next_allowed_ping =
t->ping_recv_state.last_ping_recv_time +
t->ping_policy.min_recv_ping_interval_without_data;
@@ -104,7 +104,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
}
if (next_allowed_ping > now) {
- grpc_chttp2_add_ping_strike(exec_ctx, t);
+ grpc_chttp2_add_ping_strike(t);
}
t->ping_recv_state.last_ping_recv_time = now;
@@ -116,8 +116,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
t->ping_acks, t->ping_ack_capacity * sizeof(*t->ping_acks));
}
t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes;
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE);
}
}
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h
index 76ca397709..75bacfb1d4 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.h
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.h
@@ -33,7 +33,7 @@ grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint64_t opaque_8bytes);
grpc_error* grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser* parser,
uint32_t length, uint8_t flags);
-grpc_error* grpc_chttp2_ping_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
+grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
index 05a7f056a4..fee576678d 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
@@ -69,8 +69,7 @@ grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx* exec_ctx,
- void* parser,
+grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
@@ -103,7 +102,7 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_INT_HTTP2_ERROR, (intptr_t)reason);
gpr_free(message);
}
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, true, error);
+ grpc_chttp2_mark_stream_closed(t, s, true, true, error);
}
return GRPC_ERROR_NONE;
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
index 7dfc5d4578..e76a3ca841 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
@@ -34,8 +34,7 @@ grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags);
-grpc_error* grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx* exec_ctx,
- void* parser,
+grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc
index de4340fea5..c6c2a6c301 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc
@@ -108,8 +108,7 @@ grpc_error* grpc_chttp2_settings_parser_begin_frame(
}
}
-grpc_error* grpc_chttp2_settings_parser_parse(grpc_exec_ctx* exec_ctx, void* p,
- grpc_chttp2_transport* t,
+grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
grpc_chttp2_settings_parser* parser = (grpc_chttp2_settings_parser*)p;
@@ -132,7 +131,7 @@ grpc_error* grpc_chttp2_settings_parser_parse(grpc_exec_ctx* exec_ctx, void* p,
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
if (t->notify_on_receive_settings != nullptr) {
- GRPC_CLOSURE_SCHED(exec_ctx, t->notify_on_receive_settings,
+ GRPC_CLOSURE_SCHED(t->notify_on_receive_settings,
GRPC_ERROR_NONE);
t->notify_on_receive_settings = nullptr;
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h
index 36e2ca83a0..ce65402815 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.h
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.h
@@ -52,8 +52,7 @@ grpc_slice grpc_chttp2_settings_ack_create(void);
grpc_error* grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_settings_parser* parser, uint32_t length, uint8_t flags,
uint32_t* settings);
-grpc_error* grpc_chttp2_settings_parser_parse(grpc_exec_ctx* exec_ctx,
- void* parser,
+grpc_error* grpc_chttp2_settings_parser_parse(void* parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.cc b/src/core/ext/transport/chttp2/transport/frame_window_update.cc
index 08407a8e67..418ca144ce 100644
--- a/src/core/ext/transport/chttp2/transport/frame_window_update.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_window_update.cc
@@ -64,9 +64,11 @@ grpc_error* grpc_chttp2_window_update_parser_begin_frame(
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_window_update_parser_parse(
- grpc_exec_ctx* exec_ctx, void* parser, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_slice slice, int is_last) {
+grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
+ grpc_chttp2_transport* t,
+ grpc_chttp2_stream* s,
+ grpc_slice slice,
+ int is_last) {
uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
uint8_t* const end = GRPC_SLICE_END_PTR(slice);
uint8_t* cur = beg;
@@ -98,10 +100,9 @@ grpc_error* grpc_chttp2_window_update_parser_parse(
if (s != nullptr) {
s->flow_control->RecvUpdate(received_update);
if (grpc_chttp2_list_remove_stalled_by_stream(t, s)) {
- grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
+ grpc_chttp2_mark_stream_writable(t, s);
grpc_chttp2_initiate_write(
- exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE);
+ t, GRPC_CHTTP2_INITIATE_WRITE_FLOW_CONTROL_UNSTALLED_BY_UPDATE);
}
}
} else {
@@ -110,8 +111,7 @@ grpc_error* grpc_chttp2_window_update_parser_parse(
bool is_zero = t->flow_control->remote_window() <= 0;
if (was_zero && !is_zero) {
grpc_chttp2_initiate_write(
- exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED);
+ t, GRPC_CHTTP2_INITIATE_WRITE_TRANSPORT_FLOW_CONTROL_UNSTALLED);
}
}
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h
index e031b585fa..a32f1a9d11 100644
--- a/src/core/ext/transport/chttp2/transport/frame_window_update.h
+++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h
@@ -35,8 +35,10 @@ grpc_slice grpc_chttp2_window_update_create(
grpc_error* grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_window_update_parser* parser, uint32_t length, uint8_t flags);
-grpc_error* grpc_chttp2_window_update_parser_parse(
- grpc_exec_ctx* exec_ctx, void* parser, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_slice slice, int is_last);
+grpc_error* grpc_chttp2_window_update_parser_parse(void* parser,
+ grpc_chttp2_transport* t,
+ grpc_chttp2_stream* s,
+ grpc_slice slice,
+ int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index e76d92e31d..3a5692a694 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -206,14 +206,12 @@ static uint32_t prepare_space_for_new_elem(grpc_chttp2_hpack_compressor* c,
}
/* dummy function */
-static void add_nothing(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+static void add_nothing(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
size_t elem_size) {}
// Add a key to the dynamic table. Both key and value will be added to table at
// the decoder.
-static void add_key_with_index(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void add_key_with_index(grpc_chttp2_hpack_compressor* c,
grpc_mdelem elem, uint32_t new_index) {
if (new_index == 0) {
return;
@@ -240,14 +238,12 @@ static void add_key_with_index(grpc_exec_ctx* exec_ctx,
c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index;
} else if (c->indices_keys[HASH_FRAGMENT_2(key_hash)] <
c->indices_keys[HASH_FRAGMENT_3(key_hash)]) {
- grpc_slice_unref_internal(exec_ctx,
- c->entries_keys[HASH_FRAGMENT_2(key_hash)]);
+ grpc_slice_unref_internal(c->entries_keys[HASH_FRAGMENT_2(key_hash)]);
c->entries_keys[HASH_FRAGMENT_2(key_hash)] =
grpc_slice_ref_internal(GRPC_MDKEY(elem));
c->indices_keys[HASH_FRAGMENT_2(key_hash)] = new_index;
} else {
- grpc_slice_unref_internal(exec_ctx,
- c->entries_keys[HASH_FRAGMENT_3(key_hash)]);
+ grpc_slice_unref_internal(c->entries_keys[HASH_FRAGMENT_3(key_hash)]);
c->entries_keys[HASH_FRAGMENT_3(key_hash)] =
grpc_slice_ref_internal(GRPC_MDKEY(elem));
c->indices_keys[HASH_FRAGMENT_3(key_hash)] = new_index;
@@ -255,8 +251,7 @@ static void add_key_with_index(grpc_exec_ctx* exec_ctx,
}
/* add an element to the decoder table */
-static void add_elem_with_index(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void add_elem_with_index(grpc_chttp2_hpack_compressor* c,
grpc_mdelem elem, uint32_t new_index) {
if (new_index == 0) {
return;
@@ -286,35 +281,34 @@ static void add_elem_with_index(grpc_exec_ctx* exec_ctx,
} else if (c->indices_elems[HASH_FRAGMENT_2(elem_hash)] <
c->indices_elems[HASH_FRAGMENT_3(elem_hash)]) {
/* not there: replace oldest */
- GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[HASH_FRAGMENT_2(elem_hash)]);
+ GRPC_MDELEM_UNREF(c->entries_elems[HASH_FRAGMENT_2(elem_hash)]);
c->entries_elems[HASH_FRAGMENT_2(elem_hash)] = GRPC_MDELEM_REF(elem);
c->indices_elems[HASH_FRAGMENT_2(elem_hash)] = new_index;
} else {
/* not there: replace oldest */
- GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[HASH_FRAGMENT_3(elem_hash)]);
+ GRPC_MDELEM_UNREF(c->entries_elems[HASH_FRAGMENT_3(elem_hash)]);
c->entries_elems[HASH_FRAGMENT_3(elem_hash)] = GRPC_MDELEM_REF(elem);
c->indices_elems[HASH_FRAGMENT_3(elem_hash)] = new_index;
}
- add_key_with_index(exec_ctx, c, elem, new_index);
+ add_key_with_index(c, elem, new_index);
}
-static void add_elem(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
- grpc_mdelem elem, size_t elem_size) {
+static void add_elem(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+ size_t elem_size) {
uint32_t new_index = prepare_space_for_new_elem(c, elem_size);
- add_elem_with_index(exec_ctx, c, elem, new_index);
+ add_elem_with_index(c, elem, new_index);
}
-static void add_key(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
- grpc_mdelem elem, size_t elem_size) {
+static void add_key(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+ size_t elem_size) {
uint32_t new_index = prepare_space_for_new_elem(c, elem_size);
- add_key_with_index(exec_ctx, c, elem, new_index);
+ add_key_with_index(c, elem, new_index);
}
-static void emit_indexed(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c, uint32_t elem_index,
+static void emit_indexed(grpc_chttp2_hpack_compressor* c, uint32_t elem_index,
framer_state* st) {
- GRPC_STATS_INC_HPACK_SEND_INDEXED(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_INDEXED();
uint32_t len = GRPC_CHTTP2_VARINT_LENGTH(elem_index, 1);
GRPC_CHTTP2_WRITE_VARINT(elem_index, 1, 0x80, add_tiny_header_data(st, len),
len);
@@ -326,18 +320,17 @@ typedef struct {
bool insert_null_before_wire_value;
} wire_value;
-static wire_value get_wire_value(grpc_exec_ctx* exec_ctx, grpc_mdelem elem,
- bool true_binary_enabled) {
+static wire_value get_wire_value(grpc_mdelem elem, bool true_binary_enabled) {
wire_value wire_val;
if (grpc_is_binary_header(GRPC_MDKEY(elem))) {
if (true_binary_enabled) {
- GRPC_STATS_INC_HPACK_SEND_BINARY(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_BINARY();
wire_val.huffman_prefix = 0x00;
wire_val.insert_null_before_wire_value = true;
wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem));
} else {
- GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_BINARY_BASE64();
wire_val.huffman_prefix = 0x80;
wire_val.insert_null_before_wire_value = false;
wire_val.data =
@@ -345,7 +338,7 @@ static wire_value get_wire_value(grpc_exec_ctx* exec_ctx, grpc_mdelem elem,
}
} else {
/* TODO(ctiller): opportunistically compress non-binary headers */
- GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
wire_val.huffman_prefix = 0x00;
wire_val.insert_null_before_wire_value = false;
wire_val.data = grpc_slice_ref_internal(GRPC_MDVALUE(elem));
@@ -362,14 +355,12 @@ static void add_wire_value(framer_state* st, wire_value v) {
add_header_data(st, v.data);
}
-static void emit_lithdr_incidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor* c,
uint32_t key_index, grpc_mdelem elem,
framer_state* st) {
- GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX();
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2);
- wire_value value =
- get_wire_value(exec_ctx, elem, st->use_true_binary_metadata);
+ wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
size_t len_val = wire_value_length(value);
uint32_t len_val_len;
GPR_ASSERT(len_val <= UINT32_MAX);
@@ -381,14 +372,12 @@ static void emit_lithdr_incidx(grpc_exec_ctx* exec_ctx,
add_wire_value(st, value);
}
-static void emit_lithdr_noidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor* c,
uint32_t key_index, grpc_mdelem elem,
framer_state* st) {
- GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX();
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
- wire_value value =
- get_wire_value(exec_ctx, elem, st->use_true_binary_metadata);
+ wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
size_t len_val = wire_value_length(value);
uint32_t len_val_len;
GPR_ASSERT(len_val <= UINT32_MAX);
@@ -400,16 +389,14 @@ static void emit_lithdr_noidx(grpc_exec_ctx* exec_ctx,
add_wire_value(st, value);
}
-static void emit_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor* c,
uint32_t unused_index, grpc_mdelem elem,
framer_state* st) {
GPR_ASSERT(unused_index == 0);
- GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V(exec_ctx);
- GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
+ GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
- wire_value value =
- get_wire_value(exec_ctx, elem, st->use_true_binary_metadata);
+ wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
uint32_t len_val = (uint32_t)wire_value_length(value);
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
@@ -424,16 +411,14 @@ static void emit_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
add_wire_value(st, value);
}
-static void emit_lithdr_noidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor* c,
uint32_t unused_index, grpc_mdelem elem,
framer_state* st) {
GPR_ASSERT(unused_index == 0);
- GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V(exec_ctx);
- GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED(exec_ctx);
+ GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
+ GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
- wire_value value =
- get_wire_value(exec_ctx, elem, st->use_true_binary_metadata);
+ wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
uint32_t len_val = (uint32_t)wire_value_length(value);
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
@@ -462,8 +447,8 @@ static uint32_t dynidx(grpc_chttp2_hpack_compressor* c, uint32_t elem_index) {
}
/* encode an mdelem */
-static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
- grpc_mdelem elem, framer_state* st) {
+static void hpack_enc(grpc_chttp2_hpack_compressor* c, grpc_mdelem elem,
+ framer_state* st) {
GPR_ASSERT(GRPC_SLICE_LENGTH(GRPC_MDKEY(elem)) > 0);
if (GRPC_SLICE_START_PTR(GRPC_MDKEY(elem))[0] != ':') { /* regular header */
st->seen_regular_header = 1;
@@ -496,7 +481,7 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
// Key is not interned, emit literals.
if (!key_interned) {
- emit_lithdr_noidx_v(exec_ctx, c, 0, elem, st);
+ emit_lithdr_noidx_v(c, 0, elem, st);
return;
}
@@ -515,16 +500,16 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
if (grpc_mdelem_eq(c->entries_elems[HASH_FRAGMENT_2(elem_hash)], elem) &&
c->indices_elems[HASH_FRAGMENT_2(elem_hash)] > c->tail_remote_index) {
/* HIT: complete element (first cuckoo hash) */
- emit_indexed(exec_ctx, c,
- dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]), st);
+ emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_2(elem_hash)]),
+ st);
return;
}
if (grpc_mdelem_eq(c->entries_elems[HASH_FRAGMENT_3(elem_hash)], elem) &&
c->indices_elems[HASH_FRAGMENT_3(elem_hash)] > c->tail_remote_index) {
/* HIT: complete element (second cuckoo hash) */
- emit_indexed(exec_ctx, c,
- dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]), st);
+ emit_indexed(c, dynidx(c, c->indices_elems[HASH_FRAGMENT_3(elem_hash)]),
+ st);
return;
}
}
@@ -538,10 +523,10 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
decoder_space_usage < MAX_DECODER_SPACE_USAGE &&
c->filter_elems[HASH_FRAGMENT_1(elem_hash)] >=
c->filter_elems_sum / ONE_ON_ADD_PROBABILITY;
- void (*maybe_add)(grpc_exec_ctx*, grpc_chttp2_hpack_compressor*, grpc_mdelem,
- size_t) = should_add_elem ? add_elem : add_nothing;
- void (*emit)(grpc_exec_ctx*, grpc_chttp2_hpack_compressor*, uint32_t,
- grpc_mdelem, framer_state*) =
+ void (*maybe_add)(grpc_chttp2_hpack_compressor*, grpc_mdelem, size_t) =
+ should_add_elem ? add_elem : add_nothing;
+ void (*emit)(grpc_chttp2_hpack_compressor*, uint32_t, grpc_mdelem,
+ framer_state*) =
should_add_elem ? emit_lithdr_incidx : emit_lithdr_noidx;
/* no hits for the elem... maybe there's a key? */
@@ -550,8 +535,8 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
GRPC_MDKEY(elem)) &&
indices_key > c->tail_remote_index) {
/* HIT: key (first cuckoo hash) */
- emit(exec_ctx, c, dynidx(c, indices_key), elem, st);
- maybe_add(exec_ctx, c, elem, decoder_space_usage);
+ emit(c, dynidx(c, indices_key), elem, st);
+ maybe_add(c, elem, decoder_space_usage);
return;
}
@@ -560,8 +545,8 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
GRPC_MDKEY(elem)) &&
indices_key > c->tail_remote_index) {
/* HIT: key (first cuckoo hash) */
- emit(exec_ctx, c, dynidx(c, indices_key), elem, st);
- maybe_add(exec_ctx, c, elem, decoder_space_usage);
+ emit(c, dynidx(c, indices_key), elem, st);
+ maybe_add(c, elem, decoder_space_usage);
return;
}
@@ -572,24 +557,23 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
: emit_lithdr_noidx_v;
maybe_add =
should_add_elem ? add_elem : (should_add_key ? add_key : add_nothing);
- emit(exec_ctx, c, 0, elem, st);
- maybe_add(exec_ctx, c, elem, decoder_space_usage);
+ emit(c, 0, elem, st);
+ maybe_add(c, elem, decoder_space_usage);
}
#define STRLEN_LIT(x) (sizeof(x) - 1)
#define TIMEOUT_KEY "grpc-timeout"
-static void deadline_enc(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c, grpc_millis deadline,
+static void deadline_enc(grpc_chttp2_hpack_compressor* c, grpc_millis deadline,
framer_state* st) {
char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_mdelem mdelem;
- grpc_http2_encode_timeout(deadline - grpc_exec_ctx_now(exec_ctx),
+ grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(),
timeout_str);
- mdelem = grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_GRPC_TIMEOUT,
+ mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT,
grpc_slice_from_copied_string(timeout_str));
- hpack_enc(exec_ctx, c, mdelem, st);
- GRPC_MDELEM_UNREF(exec_ctx, mdelem);
+ hpack_enc(c, mdelem, st);
+ GRPC_MDELEM_UNREF(mdelem);
}
static uint32_t elems_for_bytes(uint32_t bytes) { return (bytes + 31) / 32; }
@@ -609,14 +593,13 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c) {
}
}
-void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c) {
+void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor* c) {
int i;
for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) {
if (c->entries_keys[i].refcount != &terminal_slice_refcount) {
- grpc_slice_unref_internal(exec_ctx, c->entries_keys[i]);
+ grpc_slice_unref_internal(c->entries_keys[i]);
}
- GRPC_MDELEM_UNREF(exec_ctx, c->entries_elems[i]);
+ GRPC_MDELEM_UNREF(c->entries_elems[i]);
}
gpr_free(c->table_elem_size);
}
@@ -672,8 +655,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
}
}
-void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
grpc_mdelem** extra_headers,
size_t extra_headers_size,
grpc_metadata_batch* metadata,
@@ -699,15 +681,15 @@ void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx,
emit_advertise_table_size_change(c, &st);
}
for (size_t i = 0; i < extra_headers_size; ++i) {
- hpack_enc(exec_ctx, c, *extra_headers[i], &st);
+ hpack_enc(c, *extra_headers[i], &st);
}
grpc_metadata_batch_assert_ok(metadata);
for (grpc_linked_mdelem* l = metadata->list.head; l; l = l->next) {
- hpack_enc(exec_ctx, c, l->md, &st);
+ hpack_enc(c, l->md, &st);
}
grpc_millis deadline = metadata->deadline;
if (deadline != GRPC_MILLIS_INF_FUTURE) {
- deadline_enc(exec_ctx, c, deadline, &st);
+ deadline_enc(c, deadline, &st);
}
finish_frame(&st, 1, options->is_eof);
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h
index 08921b19ec..a26514cab0 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h
@@ -70,8 +70,7 @@ typedef struct {
} grpc_chttp2_hpack_compressor;
void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c);
-void grpc_chttp2_hpack_compressor_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c);
+void grpc_chttp2_hpack_compressor_destroy(grpc_chttp2_hpack_compressor* c);
void grpc_chttp2_hpack_compressor_set_max_table_size(
grpc_chttp2_hpack_compressor* c, uint32_t max_table_size);
void grpc_chttp2_hpack_compressor_set_max_usable_size(
@@ -85,8 +84,7 @@ typedef struct {
grpc_transport_one_way_stats* stats;
} grpc_encode_header_options;
-void grpc_chttp2_encode_header(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_compressor* c,
+void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
grpc_mdelem** extra_headers,
size_t extra_headers_size,
grpc_metadata_batch* metadata,
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 18cb27f199..a395ab234c 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -61,96 +61,69 @@ typedef enum {
a set of indirect jumps, and so not waste stack space. */
/* forward declarations for parsing states */
-static grpc_error* parse_begin(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_begin(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_error(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_error(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end, grpc_error* error);
-static grpc_error* still_parse_error(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* still_parse_error(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_illegal_op(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_illegal_op(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_string_prefix(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_string_prefix(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_key_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
static grpc_error* parse_value_string_with_indexed_key(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
- const uint8_t* end);
+ grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end);
static grpc_error* parse_value_string_with_literal_key(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
- const uint8_t* end);
+ grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_value0(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value0(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_value1(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value1(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_value2(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value2(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_value3(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value3(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_value4(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value4(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_indexed_field(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_indexed_field_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_incidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_lithdr_incidx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_notidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_lithdr_notidx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_lithdr_nvridx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end);
-static grpc_error* parse_max_tbl_size(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
-static grpc_error* parse_max_tbl_size_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end);
/* we translate the first byte of a hpack field into one of these decoding
@@ -649,8 +622,8 @@ static const uint8_t inverse_base64[256] = {
};
/* emission helpers */
-static grpc_error* on_hdr(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p,
- grpc_mdelem md, int add_to_table) {
+static grpc_error* on_hdr(grpc_chttp2_hpack_parser* p, grpc_mdelem md,
+ int add_to_table) {
if (grpc_http_trace.enabled()) {
char* k = grpc_slice_to_c_string(GRPC_MDKEY(md));
char* v = nullptr;
@@ -671,26 +644,25 @@ static grpc_error* on_hdr(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p,
if (add_to_table) {
GPR_ASSERT(GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_INTERNED ||
GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC);
- grpc_error* err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
+ grpc_error* err = grpc_chttp2_hptbl_add(&p->table, md);
if (err != GRPC_ERROR_NONE) return err;
}
if (p->on_header == nullptr) {
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
}
- p->on_header(exec_ctx, p->on_header_user_data, md);
+ p->on_header(p->on_header_user_data, md);
return GRPC_ERROR_NONE;
}
-static grpc_slice take_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_slice take_string(grpc_chttp2_hpack_parser* p,
grpc_chttp2_hpack_parser_string* str,
bool intern) {
grpc_slice s;
if (!str->copied) {
if (intern) {
s = grpc_slice_intern(str->data.referenced);
- grpc_slice_unref_internal(exec_ctx, str->data.referenced);
+ grpc_slice_unref_internal(str->data.referenced);
} else {
s = str->data.referenced;
}
@@ -708,85 +680,77 @@ static grpc_slice take_string(grpc_exec_ctx* exec_ctx,
}
/* jump to the next state */
-static grpc_error* parse_next(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_next(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
p->state = *p->next_state++;
- return p->state(exec_ctx, p, cur, end);
+ return p->state(p, cur, end);
}
/* begin parsing a header: all functionality is encoded into lookup tables
above */
-static grpc_error* parse_begin(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_begin(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
if (cur == end) {
p->state = parse_begin;
return GRPC_ERROR_NONE;
}
- return first_byte_action[first_byte_lut[*cur]](exec_ctx, p, cur, end);
+ return first_byte_action[first_byte_lut[*cur]](p, cur, end);
}
/* stream dependency and prioritization data: we just skip it */
-static grpc_error* parse_stream_weight(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_stream_weight(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_stream_weight;
return GRPC_ERROR_NONE;
}
- return p->after_prioritization(exec_ctx, p, cur + 1, end);
+ return p->after_prioritization(p, cur + 1, end);
}
-static grpc_error* parse_stream_dep3(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_stream_dep3(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_stream_dep3;
return GRPC_ERROR_NONE;
}
- return parse_stream_weight(exec_ctx, p, cur + 1, end);
+ return parse_stream_weight(p, cur + 1, end);
}
-static grpc_error* parse_stream_dep2(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_stream_dep2(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_stream_dep2;
return GRPC_ERROR_NONE;
}
- return parse_stream_dep3(exec_ctx, p, cur + 1, end);
+ return parse_stream_dep3(p, cur + 1, end);
}
-static grpc_error* parse_stream_dep1(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_stream_dep1(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_stream_dep1;
return GRPC_ERROR_NONE;
}
- return parse_stream_dep2(exec_ctx, p, cur + 1, end);
+ return parse_stream_dep2(p, cur + 1, end);
}
-static grpc_error* parse_stream_dep0(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_stream_dep0(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_stream_dep0;
return GRPC_ERROR_NONE;
}
- return parse_stream_dep1(exec_ctx, p, cur + 1, end);
+ return parse_stream_dep1(p, cur + 1, end);
}
/* emit an indexed field; jumps to begin the next field on completion */
-static grpc_error* finish_indexed_field(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_indexed_field(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
@@ -798,24 +762,22 @@ static grpc_error* finish_indexed_field(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
}
GRPC_MDELEM_REF(md);
- GRPC_STATS_INC_HPACK_RECV_INDEXED(exec_ctx);
- grpc_error* err = on_hdr(exec_ctx, p, md, 0);
+ GRPC_STATS_INC_HPACK_RECV_INDEXED();
+ grpc_error* err = on_hdr(p, md, 0);
if (err != GRPC_ERROR_NONE) return err;
- return parse_begin(exec_ctx, p, cur, end);
+ return parse_begin(p, cur, end);
}
/* parse an indexed field with index < 127 */
-static grpc_error* parse_indexed_field(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
p->dynamic_table_update_allowed = 0;
p->index = (*cur) & 0x7f;
- return finish_indexed_field(exec_ctx, p, cur + 1, end);
+ return finish_indexed_field(p, cur + 1, end);
}
/* parse an indexed field with index >= 127 */
-static grpc_error* parse_indexed_field_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -824,56 +786,52 @@ static grpc_error* parse_indexed_field_x(grpc_exec_ctx* exec_ctx,
p->next_state = and_then;
p->index = 0x7f;
p->parsing.value = &p->index;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
}
/* finish a literal header with incremental indexing */
-static grpc_error* finish_lithdr_incidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
- GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
- take_string(exec_ctx, p, &p->value, true)),
- 1);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
+ take_string(p, &p->value, true)),
+ 1);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* finish a literal header with incremental indexing with no index */
-static grpc_error* finish_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
- GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
- take_string(exec_ctx, p, &p->value, true)),
- 1);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX_V();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(take_string(p, &p->key, true),
+ take_string(p, &p->value, true)),
+ 1);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* parse a literal header with incremental indexing; index < 63 */
-static grpc_error* parse_lithdr_incidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
parse_value_string_with_indexed_key, finish_lithdr_incidx};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0x3f;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* parse a literal header with incremental indexing; index >= 63 */
-static grpc_error* parse_lithdr_incidx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -883,12 +841,11 @@ static grpc_error* parse_lithdr_incidx_x(grpc_exec_ctx* exec_ctx,
p->next_state = and_then;
p->index = 0x3f;
p->parsing.value = &p->index;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
}
/* parse a literal header with incremental indexing; index = 0 */
-static grpc_error* parse_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -896,56 +853,52 @@ static grpc_error* parse_lithdr_incidx_v(grpc_exec_ctx* exec_ctx,
parse_value_string_with_literal_key, finish_lithdr_incidx_v};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* finish a literal header without incremental indexing */
-static grpc_error* finish_lithdr_notidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
- GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
- take_string(exec_ctx, p, &p->value, false)),
- 0);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
+ take_string(p, &p->value, false)),
+ 0);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* finish a literal header without incremental indexing with index = 0 */
-static grpc_error* finish_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
- GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
- take_string(exec_ctx, p, &p->value, false)),
- 0);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX_V();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(take_string(p, &p->key, true),
+ take_string(p, &p->value, false)),
+ 0);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* parse a literal header without incremental indexing; index < 15 */
-static grpc_error* parse_lithdr_notidx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
parse_value_string_with_indexed_key, finish_lithdr_notidx};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0xf;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* parse a literal header without incremental indexing; index >= 15 */
-static grpc_error* parse_lithdr_notidx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -955,12 +908,11 @@ static grpc_error* parse_lithdr_notidx_x(grpc_exec_ctx* exec_ctx,
p->next_state = and_then;
p->index = 0xf;
p->parsing.value = &p->index;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
}
/* parse a literal header without incremental indexing; index == 0 */
-static grpc_error* parse_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -968,56 +920,52 @@ static grpc_error* parse_lithdr_notidx_v(grpc_exec_ctx* exec_ctx,
parse_value_string_with_literal_key, finish_lithdr_notidx_v};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* finish a literal header that is never indexed */
-static grpc_error* finish_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
- GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, grpc_slice_ref_internal(GRPC_MDKEY(md)),
- take_string(exec_ctx, p, &p->value, false)),
- 0);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
+ take_string(p, &p->value, false)),
+ 0);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* finish a literal header that is never indexed with an extra value */
-static grpc_error* finish_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
- GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V(exec_ctx);
- grpc_error* err = on_hdr(
- exec_ctx, p,
- grpc_mdelem_from_slices(exec_ctx, take_string(exec_ctx, p, &p->key, true),
- take_string(exec_ctx, p, &p->value, false)),
- 0);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX_V();
+ grpc_error* err =
+ on_hdr(p,
+ grpc_mdelem_from_slices(take_string(p, &p->key, true),
+ take_string(p, &p->value, false)),
+ 0);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* parse a literal header that is never indexed; index < 15 */
-static grpc_error* parse_lithdr_nvridx(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
parse_value_string_with_indexed_key, finish_lithdr_nvridx};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0xf;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* parse a literal header that is never indexed; index >= 15 */
-static grpc_error* parse_lithdr_nvridx_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -1027,12 +975,11 @@ static grpc_error* parse_lithdr_nvridx_x(grpc_exec_ctx* exec_ctx,
p->next_state = and_then;
p->index = 0xf;
p->parsing.value = &p->index;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
}
/* parse a literal header that is never indexed; index == 0 */
-static grpc_error* parse_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_lithdr_nvridx_v(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
@@ -1040,47 +987,44 @@ static grpc_error* parse_lithdr_nvridx_v(grpc_exec_ctx* exec_ctx,
parse_value_string_with_literal_key, finish_lithdr_nvridx_v};
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
- return parse_string_prefix(exec_ctx, p, cur + 1, end);
+ return parse_string_prefix(p, cur + 1, end);
}
/* finish parsing a max table size change */
-static grpc_error* finish_max_tbl_size(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* finish_max_tbl_size(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (grpc_http_trace.enabled()) {
gpr_log(GPR_INFO, "MAX TABLE SIZE: %d", p->index);
}
grpc_error* err =
- grpc_chttp2_hptbl_set_current_table_size(exec_ctx, &p->table, p->index);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_begin(exec_ctx, p, cur, end);
+ grpc_chttp2_hptbl_set_current_table_size(&p->table, p->index);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_begin(p, cur, end);
}
/* parse a max table size change, max size < 15 */
-static grpc_error* parse_max_tbl_size(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (p->dynamic_table_update_allowed == 0) {
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"More than two max table size changes in a single frame"));
}
p->dynamic_table_update_allowed--;
p->index = (*cur) & 0x1f;
- return finish_max_tbl_size(exec_ctx, p, cur + 1, end);
+ return finish_max_tbl_size(p, cur + 1, end);
}
/* parse a max table size change, max size >= 15 */
-static grpc_error* parse_max_tbl_size_x(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
static const grpc_chttp2_hpack_parser_state and_then[] = {
finish_max_tbl_size};
if (p->dynamic_table_update_allowed == 0) {
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"More than two max table size changes in a single frame"));
}
@@ -1088,12 +1032,11 @@ static grpc_error* parse_max_tbl_size_x(grpc_exec_ctx* exec_ctx,
p->next_state = and_then;
p->index = 0x1f;
p->parsing.value = &p->index;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
}
/* a parse error: jam the parse state into parse_error, and return error */
-static grpc_error* parse_error(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_error(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end, grpc_error* err) {
GPR_ASSERT(err != GRPC_ERROR_NONE);
if (p->last_error == GRPC_ERROR_NONE) {
@@ -1103,27 +1046,24 @@ static grpc_error* parse_error(grpc_exec_ctx* exec_ctx,
return err;
}
-static grpc_error* still_parse_error(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* still_parse_error(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
return GRPC_ERROR_REF(p->last_error);
}
-static grpc_error* parse_illegal_op(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_illegal_op(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
GPR_ASSERT(cur != end);
char* msg;
gpr_asprintf(&msg, "Illegal hpack op code %d", *cur);
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- return parse_error(exec_ctx, p, cur, end, err);
+ return parse_error(p, cur, end, err);
}
/* parse the 1st byte of a varint into p->parsing.value
no overflow is possible */
-static grpc_error* parse_value0(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value0(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
if (cur == end) {
p->state = parse_value0;
@@ -1133,16 +1073,15 @@ static grpc_error* parse_value0(grpc_exec_ctx* exec_ctx,
*p->parsing.value += (*cur) & 0x7f;
if ((*cur) & 0x80) {
- return parse_value1(exec_ctx, p, cur + 1, end);
+ return parse_value1(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
}
/* parse the 2nd byte of a varint into p->parsing.value
no overflow is possible */
-static grpc_error* parse_value1(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value1(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
if (cur == end) {
p->state = parse_value1;
@@ -1152,16 +1091,15 @@ static grpc_error* parse_value1(grpc_exec_ctx* exec_ctx,
*p->parsing.value += (((uint32_t)*cur) & 0x7f) << 7;
if ((*cur) & 0x80) {
- return parse_value2(exec_ctx, p, cur + 1, end);
+ return parse_value2(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
}
/* parse the 3rd byte of a varint into p->parsing.value
no overflow is possible */
-static grpc_error* parse_value2(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value2(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
if (cur == end) {
p->state = parse_value2;
@@ -1171,16 +1109,15 @@ static grpc_error* parse_value2(grpc_exec_ctx* exec_ctx,
*p->parsing.value += (((uint32_t)*cur) & 0x7f) << 14;
if ((*cur) & 0x80) {
- return parse_value3(exec_ctx, p, cur + 1, end);
+ return parse_value3(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
}
/* parse the 4th byte of a varint into p->parsing.value
no overflow is possible */
-static grpc_error* parse_value3(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value3(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
if (cur == end) {
p->state = parse_value3;
@@ -1190,16 +1127,15 @@ static grpc_error* parse_value3(grpc_exec_ctx* exec_ctx,
*p->parsing.value += (((uint32_t)*cur) & 0x7f) << 21;
if ((*cur) & 0x80) {
- return parse_value4(exec_ctx, p, cur + 1, end);
+ return parse_value4(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
}
/* parse the 5th byte of a varint into p->parsing.value
depending on the byte, we may overflow, and care must be taken */
-static grpc_error* parse_value4(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_value4(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
uint8_t c;
uint32_t cur_value;
@@ -1225,9 +1161,9 @@ static grpc_error* parse_value4(grpc_exec_ctx* exec_ctx,
*p->parsing.value = cur_value + add_value;
if ((*cur) & 0x80) {
- return parse_value5up(exec_ctx, p, cur + 1, end);
+ return parse_value5up(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
error:
@@ -1237,14 +1173,13 @@ error:
*p->parsing.value, *cur);
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- return parse_error(exec_ctx, p, cur, end, err);
+ return parse_error(p, cur, end, err);
}
/* parse any trailing bytes in a varint: it's possible to append an arbitrary
number of 0x80's and not affect the value - a zero will terminate - and
anything else will overflow */
-static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_value5up(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
while (cur != end && *cur == 0x80) {
++cur;
@@ -1256,7 +1191,7 @@ static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
}
if (*cur == 0) {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
char* msg;
@@ -1266,12 +1201,11 @@ static grpc_error* parse_value5up(grpc_exec_ctx* exec_ctx,
*p->parsing.value, *cur);
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- return parse_error(exec_ctx, p, cur, end, err);
+ return parse_error(p, cur, end, err);
}
/* parse a string prefix */
-static grpc_error* parse_string_prefix(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_string_prefix(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (cur == end) {
p->state = parse_string_prefix;
@@ -1282,9 +1216,9 @@ static grpc_error* parse_string_prefix(grpc_exec_ctx* exec_ctx,
p->huff = (*cur) >> 7;
if (p->strlen == 0x7f) {
p->parsing.value = &p->strlen;
- return parse_value0(exec_ctx, p, cur + 1, end);
+ return parse_value0(p, cur + 1, end);
} else {
- return parse_next(exec_ctx, p, cur + 1, end);
+ return parse_next(p, cur + 1, end);
}
}
@@ -1303,8 +1237,7 @@ static void append_bytes(grpc_chttp2_hpack_parser_string* str,
str->data.copied.length += (uint32_t)length;
}
-static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* append_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
grpc_chttp2_hpack_parser_string* str = p->parsing.str;
uint32_t bits;
@@ -1322,11 +1255,11 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
/* 'true-binary' case */
++cur;
p->binary = NOT_BINARY;
- GRPC_STATS_INC_HPACK_RECV_BINARY(exec_ctx);
+ GRPC_STATS_INC_HPACK_RECV_BINARY();
append_bytes(str, cur, (size_t)(end - cur));
return GRPC_ERROR_NONE;
}
- GRPC_STATS_INC_HPACK_RECV_BINARY_BASE64(exec_ctx);
+ GRPC_STATS_INC_HPACK_RECV_BINARY_BASE64();
/* fallthrough */
b64_byte0:
case B64_BYTE0:
@@ -1338,7 +1271,7 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
++cur;
if (bits == 255)
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
else if (bits == 64)
goto b64_byte0;
@@ -1354,7 +1287,7 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
++cur;
if (bits == 255)
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
else if (bits == 64)
goto b64_byte1;
@@ -1370,7 +1303,7 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
++cur;
if (bits == 255)
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
else if (bits == 64)
goto b64_byte2;
@@ -1386,7 +1319,7 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
++cur;
if (bits == 255)
return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Illegal base64 character"));
else if (bits == 64)
goto b64_byte3;
@@ -1399,12 +1332,11 @@ static grpc_error* append_string(grpc_exec_ctx* exec_ctx,
goto b64_byte0;
}
GPR_UNREACHABLE_CODE(return parse_error(
- exec_ctx, p, cur, end,
+ p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Should never reach here")));
}
-static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* finish_str(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
uint8_t decoded[2];
uint32_t bits;
@@ -1417,7 +1349,7 @@ static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
case B64_BYTE0:
break;
case B64_BYTE1:
- return parse_error(exec_ctx, p, cur, end,
+ return parse_error(p, cur, end,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"illegal base64 encoding")); /* illegal encoding */
case B64_BYTE2:
@@ -1428,7 +1360,7 @@ static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
bits & 0xffff);
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- return parse_error(exec_ctx, p, cur, end, err);
+ return parse_error(p, cur, end, err);
}
decoded[0] = (uint8_t)(bits >> 16);
append_bytes(str, decoded, 1);
@@ -1441,7 +1373,7 @@ static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
bits & 0xff);
grpc_error* err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
- return parse_error(exec_ctx, p, cur, end, err);
+ return parse_error(p, cur, end, err);
}
decoded[0] = (uint8_t)(bits >> 16);
decoded[1] = (uint8_t)(bits >> 8);
@@ -1452,14 +1384,13 @@ static grpc_error* finish_str(grpc_exec_ctx* exec_ctx,
}
/* decode a nibble from a huffman encoded stream */
-static grpc_error* huff_nibble(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, uint8_t nibble) {
+static grpc_error* huff_nibble(grpc_chttp2_hpack_parser* p, uint8_t nibble) {
int16_t emit = emit_sub_tbl[16 * emit_tbl[p->huff_state] + nibble];
int16_t next = next_sub_tbl[16 * next_tbl[p->huff_state] + nibble];
if (emit != -1) {
if (emit >= 0 && emit < 256) {
uint8_t c = (uint8_t)emit;
- grpc_error* err = append_string(exec_ctx, p, &c, (&c) + 1);
+ grpc_error* err = append_string(p, &c, (&c) + 1);
if (err != GRPC_ERROR_NONE) return err;
} else {
assert(emit == 256);
@@ -1470,45 +1401,42 @@ static grpc_error* huff_nibble(grpc_exec_ctx* exec_ctx,
}
/* decode full bytes from a huffman encoded stream */
-static grpc_error* add_huff_bytes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* add_huff_bytes(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
for (; cur != end; ++cur) {
- grpc_error* err = huff_nibble(exec_ctx, p, *cur >> 4);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- err = huff_nibble(exec_ctx, p, *cur & 0xf);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
+ grpc_error* err = huff_nibble(p, *cur >> 4);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ err = huff_nibble(p, *cur & 0xf);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
}
return GRPC_ERROR_NONE;
}
/* decode some string bytes based on the current decoding mode
(huffman or not) */
-static grpc_error* add_str_bytes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* add_str_bytes(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
if (p->huff) {
- return add_huff_bytes(exec_ctx, p, cur, end);
+ return add_huff_bytes(p, cur, end);
} else {
- return append_string(exec_ctx, p, cur, end);
+ return append_string(p, cur, end);
}
}
/* parse a string - tries to do large chunks at a time */
-static grpc_error* parse_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p, const uint8_t* cur,
+static grpc_error* parse_string(grpc_chttp2_hpack_parser* p, const uint8_t* cur,
const uint8_t* end) {
size_t remaining = p->strlen - p->strgot;
size_t given = (size_t)(end - cur);
if (remaining <= given) {
- grpc_error* err = add_str_bytes(exec_ctx, p, cur, cur + remaining);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- err = finish_str(exec_ctx, p, cur + remaining, end);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_next(exec_ctx, p, cur + remaining, end);
+ grpc_error* err = add_str_bytes(p, cur, cur + remaining);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ err = finish_str(p, cur + remaining, end);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_next(p, cur + remaining, end);
} else {
- grpc_error* err = add_str_bytes(exec_ctx, p, cur, cur + given);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
+ grpc_error* err = add_str_bytes(p, cur, cur + given);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
GPR_ASSERT(given <= UINT32_MAX - p->strgot);
p->strgot += (uint32_t)given;
p->state = parse_string;
@@ -1517,20 +1445,19 @@ static grpc_error* parse_string(grpc_exec_ctx* exec_ctx,
}
/* begin parsing a string - performs setup, calls parse_string */
-static grpc_error* begin_parse_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* begin_parse_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end,
uint8_t binary,
grpc_chttp2_hpack_parser_string* str) {
if (!p->huff && binary == NOT_BINARY && (end - cur) >= (intptr_t)p->strlen &&
p->current_slice_refcount != nullptr) {
- GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED(exec_ctx);
+ GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED();
str->copied = false;
str->data.referenced.refcount = p->current_slice_refcount;
str->data.referenced.data.refcounted.bytes = (uint8_t*)cur;
str->data.referenced.data.refcounted.length = p->strlen;
grpc_slice_ref_internal(str->data.referenced);
- return parse_next(exec_ctx, p, cur + p->strlen, end);
+ return parse_next(p, cur + p->strlen, end);
}
p->strgot = 0;
str->copied = true;
@@ -1541,9 +1468,9 @@ static grpc_error* begin_parse_string(grpc_exec_ctx* exec_ctx,
switch (p->binary) {
case NOT_BINARY:
if (p->huff) {
- GRPC_STATS_INC_HPACK_RECV_HUFFMAN(exec_ctx);
+ GRPC_STATS_INC_HPACK_RECV_HUFFMAN();
} else {
- GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED(exec_ctx);
+ GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED();
}
break;
case BINARY_BEGIN:
@@ -1552,14 +1479,13 @@ static grpc_error* begin_parse_string(grpc_exec_ctx* exec_ctx,
default:
abort();
}
- return parse_string(exec_ctx, p, cur, end);
+ return parse_string(p, cur, end);
}
/* parse the key string */
-static grpc_error* parse_key_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_key_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
- return begin_parse_string(exec_ctx, p, cur, end, NOT_BINARY, &p->key);
+ return begin_parse_string(p, cur, end, NOT_BINARY, &p->key);
}
/* check if a key represents a binary header or not */
@@ -1586,33 +1512,29 @@ static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
}
/* parse the value string */
-static grpc_error* parse_value_string(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+static grpc_error* parse_value_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end,
bool is_binary) {
- return begin_parse_string(exec_ctx, p, cur, end,
- is_binary ? BINARY_BEGIN : NOT_BINARY, &p->value);
+ return begin_parse_string(p, cur, end, is_binary ? BINARY_BEGIN : NOT_BINARY,
+ &p->value);
}
static grpc_error* parse_value_string_with_indexed_key(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
- const uint8_t* end) {
+ grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) {
bool is_binary = false;
grpc_error* err = is_binary_indexed_header(p, &is_binary);
- if (err != GRPC_ERROR_NONE) return parse_error(exec_ctx, p, cur, end, err);
- return parse_value_string(exec_ctx, p, cur, end, is_binary);
+ if (err != GRPC_ERROR_NONE) return parse_error(p, cur, end, err);
+ return parse_value_string(p, cur, end, is_binary);
}
static grpc_error* parse_value_string_with_literal_key(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* cur,
- const uint8_t* end) {
- return parse_value_string(exec_ctx, p, cur, end, is_binary_literal_header(p));
+ grpc_chttp2_hpack_parser* p, const uint8_t* cur, const uint8_t* end) {
+ return parse_value_string(p, cur, end, is_binary_literal_header(p));
}
/* PUBLIC INTERFACE */
-void grpc_chttp2_hpack_parser_init(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p) {
+void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p) {
p->on_header = nullptr;
p->on_header_user_data = nullptr;
p->state = parse_begin;
@@ -1626,7 +1548,7 @@ void grpc_chttp2_hpack_parser_init(grpc_exec_ctx* exec_ctx,
p->value.data.copied.length = 0;
p->dynamic_table_update_allowed = 2;
p->last_error = GRPC_ERROR_NONE;
- grpc_chttp2_hptbl_init(exec_ctx, &p->table);
+ grpc_chttp2_hptbl_init(&p->table);
}
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p) {
@@ -1634,18 +1556,16 @@ void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p) {
p->state = parse_stream_dep0;
}
-void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p) {
- grpc_chttp2_hptbl_destroy(exec_ctx, &p->table);
+void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser* p) {
+ grpc_chttp2_hptbl_destroy(&p->table);
GRPC_ERROR_UNREF(p->last_error);
- grpc_slice_unref_internal(exec_ctx, p->key.data.referenced);
- grpc_slice_unref_internal(exec_ctx, p->value.data.referenced);
+ grpc_slice_unref_internal(p->key.data.referenced);
+ grpc_slice_unref_internal(p->value.data.referenced);
gpr_free(p->key.data.copied.str);
gpr_free(p->value.data.copied.str);
}
-grpc_error* grpc_chttp2_hpack_parser_parse(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+grpc_error* grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
grpc_slice slice) {
/* max number of bytes to parse at a time... limits call stack depth on
* compilers without TCO */
@@ -1656,37 +1576,33 @@ grpc_error* grpc_chttp2_hpack_parser_parse(grpc_exec_ctx* exec_ctx,
grpc_error* error = GRPC_ERROR_NONE;
while (start != end && error == GRPC_ERROR_NONE) {
uint8_t* target = start + GPR_MIN(MAX_PARSE_LENGTH, end - start);
- error = p->state(exec_ctx, p, start, target);
+ error = p->state(p, start, target);
start = target;
}
p->current_slice_refcount = nullptr;
return error;
}
-typedef void (*maybe_complete_func_type)(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+typedef void (*maybe_complete_func_type)(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
static const maybe_complete_func_type maybe_complete_funcs[] = {
grpc_chttp2_maybe_complete_recv_initial_metadata,
grpc_chttp2_maybe_complete_recv_trailing_metadata};
-static void force_client_rst_stream(grpc_exec_ctx* exec_ctx, void* sp,
- grpc_error* error) {
+static void force_client_rst_stream(void* sp, grpc_error* error) {
grpc_chttp2_stream* s = (grpc_chttp2_stream*)sp;
grpc_chttp2_transport* t = s->t;
if (!s->write_closed) {
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing));
- grpc_chttp2_initiate_write(exec_ctx, t,
- GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM);
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, true, GRPC_ERROR_NONE);
+ grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM);
+ grpc_chttp2_mark_stream_closed(t, s, true, true, GRPC_ERROR_NONE);
}
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "final_rst");
+ GRPC_CHTTP2_STREAM_UNREF(s, "final_rst");
}
-static void parse_stream_compression_md(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static void parse_stream_compression_md(grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_metadata_batch* initial_metadata) {
if (initial_metadata->idx.named.content_encoding == nullptr ||
@@ -1698,8 +1614,7 @@ static void parse_stream_compression_md(grpc_exec_ctx* exec_ctx,
}
}
-grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
- void* hpack_parser,
+grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
@@ -1708,7 +1623,7 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
if (s != nullptr) {
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
}
- grpc_error* error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
+ grpc_error* error = grpc_chttp2_hpack_parser_parse(parser, slice);
if (error != GRPC_ERROR_NONE) {
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
return error;
@@ -1731,12 +1646,11 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
/* Process stream compression md element if it exists */
if (s->header_frames_received ==
0) { /* Only acts on initial metadata */
- parse_stream_compression_md(exec_ctx, t, s,
- &s->metadata_buffer[0].batch);
+ parse_stream_compression_md(t, s, &s->metadata_buffer[0].batch);
}
s->published_metadata[s->header_frames_received] =
GRPC_METADATA_PUBLISHED_FROM_WIRE;
- maybe_complete_funcs[s->header_frames_received](exec_ctx, t, s);
+ maybe_complete_funcs[s->header_frames_received](t, s);
s->header_frames_received++;
}
if (parser->is_eof) {
@@ -1747,13 +1661,11 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
and can avoid the extra write */
GRPC_CHTTP2_STREAM_REF(s, "final_rst");
GRPC_CLOSURE_SCHED(
- exec_ctx,
GRPC_CLOSURE_CREATE(force_client_rst_stream, s,
grpc_combiner_finally_scheduler(t->combiner)),
GRPC_ERROR_NONE);
}
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false,
- GRPC_ERROR_NONE);
+ grpc_chttp2_mark_stream_closed(t, s, true, false, GRPC_ERROR_NONE);
}
}
parser->on_header = nullptr;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h
index b4a2b14bdb..060bc5ce9d 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h
@@ -30,8 +30,7 @@
typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
typedef grpc_error* (*grpc_chttp2_hpack_parser_state)(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p, const uint8_t* beg,
- const uint8_t* end);
+ grpc_chttp2_hpack_parser* p, const uint8_t* beg, const uint8_t* end);
typedef struct {
bool copied;
@@ -47,7 +46,7 @@ typedef struct {
struct grpc_chttp2_hpack_parser {
/* user specified callback for each header output */
- void (*on_header)(grpc_exec_ctx* exec_ctx, void* user_data, grpc_mdelem md);
+ void (*on_header)(void* user_data, grpc_mdelem md);
void* on_header_user_data;
grpc_error* last_error;
@@ -92,21 +91,17 @@ struct grpc_chttp2_hpack_parser {
grpc_chttp2_hptbl table;
};
-void grpc_chttp2_hpack_parser_init(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p);
-void grpc_chttp2_hpack_parser_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p);
+void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p);
+void grpc_chttp2_hpack_parser_destroy(grpc_chttp2_hpack_parser* p);
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p);
-grpc_error* grpc_chttp2_hpack_parser_parse(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hpack_parser* p,
+grpc_error* grpc_chttp2_hpack_parser_parse(grpc_chttp2_hpack_parser* p,
grpc_slice slice);
/* wraps grpc_chttp2_hpack_parser_parse to provide a frame level parser for
the transport */
-grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
- void* hpack_parser,
+grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last);
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.cc b/src/core/ext/transport/chttp2/transport/hpack_table.cc
index 75b83b80b6..c325465daa 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.cc
@@ -165,7 +165,7 @@ static uint32_t entries_for_bytes(uint32_t bytes) {
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
}
-void grpc_chttp2_hptbl_init(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl) {
+void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl) {
size_t i;
memset(tbl, 0, sizeof(*tbl));
@@ -177,22 +177,19 @@ void grpc_chttp2_hptbl_init(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl) {
memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
tbl->static_ents[i - 1] = grpc_mdelem_from_slices(
- exec_ctx,
grpc_slice_intern(grpc_slice_from_static_string(static_table[i].key)),
grpc_slice_intern(
grpc_slice_from_static_string(static_table[i].value)));
}
}
-void grpc_chttp2_hptbl_destroy(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl) {
+void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl) {
size_t i;
for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
- GRPC_MDELEM_UNREF(exec_ctx, tbl->static_ents[i]);
+ GRPC_MDELEM_UNREF(tbl->static_ents[i]);
}
for (i = 0; i < tbl->num_ents; i++) {
- GRPC_MDELEM_UNREF(exec_ctx,
- tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]);
+ GRPC_MDELEM_UNREF(tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]);
}
gpr_free(tbl->ents);
}
@@ -215,7 +212,7 @@ grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
}
/* Evict one element from the table */
-static void evict1(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl) {
+static void evict1(grpc_chttp2_hptbl* tbl) {
grpc_mdelem first_ent = tbl->ents[tbl->first_ent];
size_t elem_bytes = GRPC_SLICE_LENGTH(GRPC_MDKEY(first_ent)) +
GRPC_SLICE_LENGTH(GRPC_MDVALUE(first_ent)) +
@@ -224,7 +221,7 @@ static void evict1(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl) {
tbl->mem_used -= (uint32_t)elem_bytes;
tbl->first_ent = ((tbl->first_ent + 1) % tbl->cap_entries);
tbl->num_ents--;
- GRPC_MDELEM_UNREF(exec_ctx, first_ent);
+ GRPC_MDELEM_UNREF(first_ent);
}
static void rebuild_ents(grpc_chttp2_hptbl* tbl, uint32_t new_cap) {
@@ -240,8 +237,7 @@ static void rebuild_ents(grpc_chttp2_hptbl* tbl, uint32_t new_cap) {
tbl->first_ent = 0;
}
-void grpc_chttp2_hptbl_set_max_bytes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl,
+void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
uint32_t max_bytes) {
if (tbl->max_bytes == max_bytes) {
return;
@@ -250,13 +246,12 @@ void grpc_chttp2_hptbl_set_max_bytes(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "Update hpack parser max size to %d", max_bytes);
}
while (tbl->mem_used > max_bytes) {
- evict1(exec_ctx, tbl);
+ evict1(tbl);
}
tbl->max_bytes = max_bytes;
}
-grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl,
+grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
uint32_t bytes) {
if (tbl->current_table_bytes == bytes) {
return GRPC_ERROR_NONE;
@@ -274,7 +269,7 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "Update hpack parser table size to %d", bytes);
}
while (tbl->mem_used > bytes) {
- evict1(exec_ctx, tbl);
+ evict1(tbl);
}
tbl->current_table_bytes = bytes;
tbl->max_entries = entries_for_bytes(bytes);
@@ -289,8 +284,7 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-grpc_error* grpc_chttp2_hptbl_add(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl, grpc_mdelem md) {
+grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl, grpc_mdelem md) {
/* determine how many bytes of buffer this entry represents */
size_t elem_bytes = GRPC_SLICE_LENGTH(GRPC_MDKEY(md)) +
GRPC_SLICE_LENGTH(GRPC_MDVALUE(md)) +
@@ -320,14 +314,14 @@ grpc_error* grpc_chttp2_hptbl_add(grpc_exec_ctx* exec_ctx,
* empty table.
*/
while (tbl->num_ents) {
- evict1(exec_ctx, tbl);
+ evict1(tbl);
}
return GRPC_ERROR_NONE;
}
/* evict entries to ensure no overflow */
while (elem_bytes > (size_t)tbl->current_table_bytes - tbl->mem_used) {
- evict1(exec_ctx, tbl);
+ evict1(tbl);
}
/* copy the finalized entry in */
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h
index aed7b13f0b..189ad1c697 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.h
@@ -69,21 +69,18 @@ typedef struct {
} grpc_chttp2_hptbl;
/* initialize a hpack table */
-void grpc_chttp2_hptbl_init(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl);
-void grpc_chttp2_hptbl_destroy(grpc_exec_ctx* exec_ctx, grpc_chttp2_hptbl* tbl);
-void grpc_chttp2_hptbl_set_max_bytes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl,
+void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl);
+void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl);
+void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
uint32_t max_bytes);
-grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl,
+grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
uint32_t bytes);
/* lookup a table entry based on its hpack index */
grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
uint32_t index);
/* add a table entry to the index */
-grpc_error* grpc_chttp2_hptbl_add(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_hptbl* tbl,
+grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
grpc_mdelem md) GRPC_MUST_USE_RESULT;
/* Find a key/value pair in the table... returns the index in the table of the
most similar entry, or 0 if the value was not found */
diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
index 4461f8c12c..ef0c9ed230 100644
--- a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
+++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
@@ -33,33 +33,31 @@ void grpc_chttp2_incoming_metadata_buffer_init(
}
void grpc_chttp2_incoming_metadata_buffer_destroy(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer) {
- grpc_metadata_batch_destroy(exec_ctx, &buffer->batch);
+ grpc_chttp2_incoming_metadata_buffer* buffer) {
+ grpc_metadata_batch_destroy(&buffer->batch);
}
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
- grpc_mdelem elem) {
+ grpc_chttp2_incoming_metadata_buffer* buffer, grpc_mdelem elem) {
buffer->size += GRPC_MDELEM_LENGTH(elem);
return grpc_metadata_batch_add_tail(
- exec_ctx, &buffer->batch,
+ &buffer->batch,
(grpc_linked_mdelem*)gpr_arena_alloc(buffer->arena,
sizeof(grpc_linked_mdelem)),
elem);
}
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
- grpc_mdelem elem) {
+ grpc_chttp2_incoming_metadata_buffer* buffer, grpc_mdelem elem) {
for (grpc_linked_mdelem* l = buffer->batch.list.head; l != nullptr;
l = l->next) {
if (grpc_slice_eq(GRPC_MDKEY(l->md), GRPC_MDKEY(elem))) {
- GRPC_MDELEM_UNREF(exec_ctx, l->md);
+ GRPC_MDELEM_UNREF(l->md);
l->md = elem;
return GRPC_ERROR_NONE;
}
}
- return grpc_chttp2_incoming_metadata_buffer_add(exec_ctx, buffer, elem);
+ return grpc_chttp2_incoming_metadata_buffer_add(buffer, elem);
}
void grpc_chttp2_incoming_metadata_buffer_set_deadline(
@@ -68,8 +66,7 @@ void grpc_chttp2_incoming_metadata_buffer_set_deadline(
}
void grpc_chttp2_incoming_metadata_buffer_publish(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
- grpc_metadata_batch* batch) {
+ grpc_chttp2_incoming_metadata_buffer* buffer, grpc_metadata_batch* batch) {
*batch = buffer->batch;
grpc_metadata_batch_init(&buffer->batch);
}
diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.h b/src/core/ext/transport/chttp2/transport/incoming_metadata.h
index 6f2b81ef6c..b84cd484c4 100644
--- a/src/core/ext/transport/chttp2/transport/incoming_metadata.h
+++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.h
@@ -31,16 +31,15 @@ typedef struct {
void grpc_chttp2_incoming_metadata_buffer_init(
grpc_chttp2_incoming_metadata_buffer* buffer, gpr_arena* arena);
void grpc_chttp2_incoming_metadata_buffer_destroy(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer);
+ grpc_chttp2_incoming_metadata_buffer* buffer);
void grpc_chttp2_incoming_metadata_buffer_publish(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
- grpc_metadata_batch* batch);
+ grpc_chttp2_incoming_metadata_buffer* buffer, grpc_metadata_batch* batch);
grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
+ grpc_chttp2_incoming_metadata_buffer* buffer,
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
+ grpc_chttp2_incoming_metadata_buffer* buffer,
grpc_mdelem elem) GRPC_MUST_USE_RESULT;
void grpc_chttp2_incoming_metadata_buffer_set_deadline(
grpc_chttp2_incoming_metadata_buffer* buffer, grpc_millis deadline);
diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h
index f6fd6795d0..932f5ba83d 100644
--- a/src/core/ext/transport/chttp2/transport/internal.h
+++ b/src/core/ext/transport/chttp2/transport/internal.h
@@ -282,8 +282,8 @@ struct grpc_chttp2_transport {
struct {
/* accept stream callback */
- void (*accept_stream)(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_transport* transport, const void* server_data);
+ void (*accept_stream)(void* user_data, grpc_transport* transport,
+ const void* server_data);
void* accept_stream_user_data;
/** connectivity tracking */
@@ -371,9 +371,8 @@ struct grpc_chttp2_transport {
/* active parser */
void* parser_data;
grpc_chttp2_stream* incoming_stream;
- grpc_error* (*parser)(grpc_exec_ctx* exec_ctx, void* parser_user_data,
- grpc_chttp2_transport* t, grpc_chttp2_stream* s,
- grpc_slice slice, int is_last);
+ grpc_error* (*parser)(void* parser_user_data, grpc_chttp2_transport* t,
+ grpc_chttp2_stream* s, grpc_slice slice, int is_last);
grpc_chttp2_write_cb* write_cb_pool;
@@ -571,8 +570,7 @@ struct grpc_chttp2_stream {
The actual call chain is documented in the implementation of this function.
*/
-void grpc_chttp2_initiate_write(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_initiate_write(grpc_chttp2_transport* t,
grpc_chttp2_initiate_write_reason reason);
typedef struct {
@@ -585,14 +583,12 @@ typedef struct {
} grpc_chttp2_begin_write_result;
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t);
-void grpc_chttp2_end_write(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error);
+ grpc_chttp2_transport* t);
+void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error);
/** Process one slice of incoming data; return 1 if the connection is still
viable after reading, or 0 if the connection should be torn down */
-grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
grpc_slice slice);
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport* t,
@@ -640,27 +636,23 @@ bool grpc_chttp2_list_remove_stalled_by_stream(grpc_chttp2_transport* t,
// Takes in a flow control action and performs all the needed operations.
void grpc_chttp2_act_on_flowctl_action(
- grpc_exec_ctx* exec_ctx, const grpc_core::chttp2::FlowControlAction& action,
+ const grpc_core::chttp2::FlowControlAction& action,
grpc_chttp2_transport* t, grpc_chttp2_stream* s);
/********* End of Flow Control ***************/
grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
uint32_t id);
-grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
uint32_t id);
-void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
uint32_t goaway_error,
grpc_slice goaway_text);
-void grpc_chttp2_parsing_become_skip_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
+void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport* t);
-void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_closure** pclosure,
grpc_error* error, const char* desc);
@@ -681,94 +673,80 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
else \
stmt
-void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
+void grpc_chttp2_fake_status(grpc_chttp2_transport* t,
grpc_chttp2_stream* stream, grpc_error* error);
-void grpc_chttp2_mark_stream_closed(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_mark_stream_closed(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, int close_reads,
int close_writes, grpc_error* error);
-void grpc_chttp2_start_writing(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
+void grpc_chttp2_start_writing(grpc_chttp2_transport* t);
#ifndef NDEBUG
#define GRPC_CHTTP2_STREAM_REF(stream, reason) \
grpc_chttp2_stream_ref(stream, reason)
-#define GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream, reason) \
- grpc_chttp2_stream_unref(exec_ctx, stream, reason)
+#define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
+ grpc_chttp2_stream_unref(stream, reason)
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s, const char* reason);
-void grpc_chttp2_stream_unref(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s,
- const char* reason);
+void grpc_chttp2_stream_unref(grpc_chttp2_stream* s, const char* reason);
#else
#define GRPC_CHTTP2_STREAM_REF(stream, reason) grpc_chttp2_stream_ref(stream)
-#define GRPC_CHTTP2_STREAM_UNREF(exec_ctx, stream, reason) \
- grpc_chttp2_stream_unref(exec_ctx, stream)
+#define GRPC_CHTTP2_STREAM_UNREF(stream, reason) \
+ grpc_chttp2_stream_unref(stream)
void grpc_chttp2_stream_ref(grpc_chttp2_stream* s);
-void grpc_chttp2_stream_unref(grpc_exec_ctx* exec_ctx, grpc_chttp2_stream* s);
+void grpc_chttp2_stream_unref(grpc_chttp2_stream* s);
#endif
#ifndef NDEBUG
#define GRPC_CHTTP2_REF_TRANSPORT(t, r) \
grpc_chttp2_ref_transport(t, r, __FILE__, __LINE__)
-#define GRPC_CHTTP2_UNREF_TRANSPORT(cl, t, r) \
- grpc_chttp2_unref_transport(cl, t, r, __FILE__, __LINE__)
-void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, const char* reason,
+#define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) \
+ grpc_chttp2_unref_transport(t, r, __FILE__, __LINE__)
+void grpc_chttp2_unref_transport(grpc_chttp2_transport* t, const char* reason,
const char* file, int line);
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t, const char* reason,
const char* file, int line);
#else
#define GRPC_CHTTP2_REF_TRANSPORT(t, r) grpc_chttp2_ref_transport(t)
-#define GRPC_CHTTP2_UNREF_TRANSPORT(cl, t, r) grpc_chttp2_unref_transport(cl, t)
-void grpc_chttp2_unref_transport(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
+#define GRPC_CHTTP2_UNREF_TRANSPORT(t, r) grpc_chttp2_unref_transport(t)
+void grpc_chttp2_unref_transport(grpc_chttp2_transport* t);
void grpc_chttp2_ref_transport(grpc_chttp2_transport* t);
#endif
grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, grpc_chttp2_stream* s,
- uint32_t frame_size, uint32_t flags);
+ grpc_chttp2_transport* t, grpc_chttp2_stream* s, uint32_t frame_size,
+ uint32_t flags);
grpc_error* grpc_chttp2_incoming_byte_stream_push(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_slice slice, grpc_slice* slice_out);
+ grpc_chttp2_incoming_byte_stream* bs, grpc_slice slice,
+ grpc_slice* slice_out);
grpc_error* grpc_chttp2_incoming_byte_stream_finished(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_error* error, bool reset_on_error);
+ grpc_chttp2_incoming_byte_stream* bs, grpc_error* error,
+ bool reset_on_error);
void grpc_chttp2_incoming_byte_stream_notify(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_byte_stream* bs,
- grpc_error* error);
+ grpc_chttp2_incoming_byte_stream* bs, grpc_error* error);
-void grpc_chttp2_ack_ping(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- uint64_t id);
+void grpc_chttp2_ack_ping(grpc_chttp2_transport* t, uint64_t id);
/** Add a new ping strike to ping_recv_state.ping_strikes. If
ping_recv_state.ping_strikes > ping_policy.max_ping_strikes, it sends GOAWAY
with error code ENHANCE_YOUR_CALM and additional debug data resembling
"too_many_pings" followed by immediately closing the connection. */
-void grpc_chttp2_add_ping_strike(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
+void grpc_chttp2_add_ping_strike(grpc_chttp2_transport* t);
/** add a ref to the stream and add it to the writable list;
ref will be dropped in writing.c */
-void grpc_chttp2_mark_stream_writable(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_mark_stream_writable(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-void grpc_chttp2_cancel_stream(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_error* due_to_error);
-void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_message(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
grpc_chttp2_stream* s);
-void grpc_chttp2_fail_pending_writes(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+void grpc_chttp2_fail_pending_writes(grpc_chttp2_transport* t,
grpc_chttp2_stream* s, grpc_error* error);
/** Set the default keepalive configurations, must only be called at
diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc
index 46ec3fbaa6..a56f89cc75 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.cc
+++ b/src/core/ext/transport/chttp2/transport/parsing.cc
@@ -31,33 +31,22 @@
#include "src/core/lib/transport/status_conversion.h"
#include "src/core/lib/transport/timeout_encoding.h"
-static grpc_error* init_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static grpc_error* init_frame_parser(grpc_chttp2_transport* t);
+static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
int is_continuation);
-static grpc_error* init_data_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_rst_stream_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_settings_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_window_update_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_ping_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_goaway_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t);
-static grpc_error* init_skip_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static grpc_error* init_data_frame_parser(grpc_chttp2_transport* t);
+static grpc_error* init_rst_stream_parser(grpc_chttp2_transport* t);
+static grpc_error* init_settings_frame_parser(grpc_chttp2_transport* t);
+static grpc_error* init_window_update_frame_parser(grpc_chttp2_transport* t);
+static grpc_error* init_ping_parser(grpc_chttp2_transport* t);
+static grpc_error* init_goaway_parser(grpc_chttp2_transport* t);
+static grpc_error* init_skip_frame_parser(grpc_chttp2_transport* t,
int is_header);
-static grpc_error* parse_frame_slice(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, grpc_slice slice,
+static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_slice slice,
int is_last);
-grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
grpc_slice slice) {
uint8_t* beg = GRPC_SLICE_START_PTR(slice);
uint8_t* end = GRPC_SLICE_END_PTR(slice);
@@ -182,12 +171,12 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
GPR_ASSERT(cur < end);
t->incoming_stream_id |= ((uint32_t)*cur);
t->deframe_state = GRPC_DTS_FRAME;
- err = init_frame_parser(exec_ctx, t);
+ err = init_frame_parser(t);
if (err != GRPC_ERROR_NONE) {
return err;
}
if (t->incoming_frame_size == 0) {
- err = parse_frame_slice(exec_ctx, t, grpc_empty_slice(), 1);
+ err = parse_frame_slice(t, grpc_empty_slice(), 1);
if (err != GRPC_ERROR_NONE) {
return err;
}
@@ -217,7 +206,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
GPR_ASSERT(cur < end);
if ((uint32_t)(end - cur) == t->incoming_frame_size) {
err =
- parse_frame_slice(exec_ctx, t,
+ parse_frame_slice(t,
grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
1);
@@ -230,7 +219,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
} else if ((uint32_t)(end - cur) > t->incoming_frame_size) {
size_t cur_offset = (size_t)(cur - beg);
err = parse_frame_slice(
- exec_ctx, t,
+ t,
grpc_slice_sub_no_ref(slice, cur_offset,
cur_offset + t->incoming_frame_size),
1);
@@ -242,7 +231,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
goto dts_fh_0; /* loop */
} else {
err =
- parse_frame_slice(exec_ctx, t,
+ parse_frame_slice(t,
grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
(size_t)(end - beg)),
0);
@@ -258,8 +247,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
GPR_UNREACHABLE_CODE(return nullptr);
}
-static grpc_error* init_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_frame_parser(grpc_chttp2_transport* t) {
if (t->is_first_frame &&
t->incoming_frame_type != GRPC_CHTTP2_FRAME_SETTINGS) {
char* msg;
@@ -291,46 +279,43 @@ static grpc_error* init_frame_parser(grpc_exec_ctx* exec_ctx,
gpr_free(msg);
return err;
}
- return init_header_frame_parser(exec_ctx, t, 1);
+ return init_header_frame_parser(t, 1);
}
switch (t->incoming_frame_type) {
case GRPC_CHTTP2_FRAME_DATA:
- return init_data_frame_parser(exec_ctx, t);
+ return init_data_frame_parser(t);
case GRPC_CHTTP2_FRAME_HEADER:
- return init_header_frame_parser(exec_ctx, t, 0);
+ return init_header_frame_parser(t, 0);
case GRPC_CHTTP2_FRAME_CONTINUATION:
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Unexpected CONTINUATION frame");
case GRPC_CHTTP2_FRAME_RST_STREAM:
- return init_rst_stream_parser(exec_ctx, t);
+ return init_rst_stream_parser(t);
case GRPC_CHTTP2_FRAME_SETTINGS:
- return init_settings_frame_parser(exec_ctx, t);
+ return init_settings_frame_parser(t);
case GRPC_CHTTP2_FRAME_WINDOW_UPDATE:
- return init_window_update_frame_parser(exec_ctx, t);
+ return init_window_update_frame_parser(t);
case GRPC_CHTTP2_FRAME_PING:
- return init_ping_parser(exec_ctx, t);
+ return init_ping_parser(t);
case GRPC_CHTTP2_FRAME_GOAWAY:
- return init_goaway_parser(exec_ctx, t);
+ return init_goaway_parser(t);
default:
if (grpc_http_trace.enabled()) {
gpr_log(GPR_ERROR, "Unknown frame type %02x", t->incoming_frame_type);
}
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
}
}
-static grpc_error* skip_parser(grpc_exec_ctx* exec_ctx, void* parser,
- grpc_chttp2_transport* t, grpc_chttp2_stream* s,
- grpc_slice slice, int is_last) {
+static grpc_error* skip_parser(void* parser, grpc_chttp2_transport* t,
+ grpc_chttp2_stream* s, grpc_slice slice,
+ int is_last) {
return GRPC_ERROR_NONE;
}
-static void skip_header(grpc_exec_ctx* exec_ctx, void* tp, grpc_mdelem md) {
- GRPC_MDELEM_UNREF(exec_ctx, md);
-}
+static void skip_header(void* tp, grpc_mdelem md) { GRPC_MDELEM_UNREF(md); }
-static grpc_error* init_skip_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static grpc_error* init_skip_frame_parser(grpc_chttp2_transport* t,
int is_header) {
if (is_header) {
uint8_t is_eoh = t->expect_continuation_stream_id != 0;
@@ -346,14 +331,11 @@ static grpc_error* init_skip_frame_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-void grpc_chttp2_parsing_become_skip_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
- init_skip_frame_parser(exec_ctx, t,
- t->parser == grpc_chttp2_header_parser_parse);
+void grpc_chttp2_parsing_become_skip_parser(grpc_chttp2_transport* t) {
+ init_skip_frame_parser(t, t->parser == grpc_chttp2_header_parser_parse);
}
-static grpc_error* init_data_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_data_frame_parser(grpc_chttp2_transport* t) {
grpc_chttp2_stream* s =
grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
grpc_error* err = GRPC_ERROR_NONE;
@@ -365,17 +347,17 @@ static grpc_error* init_data_frame_parser(grpc_exec_ctx* exec_ctx,
err = s->flow_control->RecvData(t->incoming_frame_size);
action = s->flow_control->MakeAction();
}
- grpc_chttp2_act_on_flowctl_action(exec_ctx, action, t, s);
+ grpc_chttp2_act_on_flowctl_action(action, t, s);
if (err != GRPC_ERROR_NONE) {
goto error_handler;
}
if (s == nullptr) {
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
}
s->received_bytes += t->incoming_frame_size;
s->stats.incoming.framing_bytes += 9;
if (err == GRPC_ERROR_NONE && s->read_closed) {
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
}
if (err == GRPC_ERROR_NONE) {
err = grpc_chttp2_data_parser_begin_frame(
@@ -394,13 +376,13 @@ error_handler:
} else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
/* handle stream errors by closing the stream */
if (s != nullptr) {
- grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, err);
+ grpc_chttp2_mark_stream_closed(t, s, true, false, err);
}
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing));
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
} else {
return err;
}
@@ -408,8 +390,7 @@ error_handler:
static void free_timeout(void* p) { gpr_free(p); }
-static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_mdelem md) {
+static void on_initial_header(void* tp, grpc_mdelem md) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
grpc_chttp2_stream* s = t->incoming_stream;
@@ -455,9 +436,9 @@ static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
}
if (timeout != GRPC_MILLIS_INF_FUTURE) {
grpc_chttp2_incoming_metadata_buffer_set_deadline(
- &s->metadata_buffer[0], grpc_exec_ctx_now(exec_ctx) + timeout);
+ &s->metadata_buffer[0], grpc_core::ExecCtx::Get()->Now() + timeout);
}
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
} else {
const size_t new_size = s->metadata_buffer[0].size + GRPC_MDELEM_LENGTH(md);
const size_t metadata_size_limit =
@@ -469,22 +450,22 @@ static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
" vs. %" PRIuPTR ")",
new_size, metadata_size_limit);
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"received initial metadata size exceeds limit"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_parsing_become_skip_parser(t);
s->seen_error = true;
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
} else {
- grpc_error* error = grpc_chttp2_incoming_metadata_buffer_add(
- exec_ctx, &s->metadata_buffer[0], md);
+ grpc_error* error =
+ grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[0], md);
if (error != GRPC_ERROR_NONE) {
- grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_cancel_stream(t, s, error);
+ grpc_chttp2_parsing_become_skip_parser(t);
s->seen_error = true;
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
}
}
}
@@ -492,8 +473,7 @@ static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
GPR_TIMER_END("on_initial_header", 0);
}
-static void on_trailing_header(grpc_exec_ctx* exec_ctx, void* tp,
- grpc_mdelem md) {
+static void on_trailing_header(void* tp, grpc_mdelem md) {
grpc_chttp2_transport* t = (grpc_chttp2_transport*)tp;
grpc_chttp2_stream* s = t->incoming_stream;
@@ -527,30 +507,29 @@ static void on_trailing_header(grpc_exec_ctx* exec_ctx, void* tp,
" vs. %" PRIuPTR ")",
new_size, metadata_size_limit);
grpc_chttp2_cancel_stream(
- exec_ctx, t, s,
+ t, s,
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"received trailing metadata size exceeds limit"),
GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_RESOURCE_EXHAUSTED));
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_parsing_become_skip_parser(t);
s->seen_error = true;
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
} else {
- grpc_error* error = grpc_chttp2_incoming_metadata_buffer_add(
- exec_ctx, &s->metadata_buffer[1], md);
+ grpc_error* error =
+ grpc_chttp2_incoming_metadata_buffer_add(&s->metadata_buffer[1], md);
if (error != GRPC_ERROR_NONE) {
- grpc_chttp2_cancel_stream(exec_ctx, t, s, error);
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_cancel_stream(t, s, error);
+ grpc_chttp2_parsing_become_skip_parser(t);
s->seen_error = true;
- GRPC_MDELEM_UNREF(exec_ctx, md);
+ GRPC_MDELEM_UNREF(md);
}
}
GPR_TIMER_END("on_trailing_header", 0);
}
-static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t,
+static grpc_error* init_header_frame_parser(grpc_chttp2_transport* t,
int is_continuation) {
uint8_t is_eoh =
(t->incoming_frame_flags & GRPC_CHTTP2_DATA_FLAG_END_HEADERS) != 0;
@@ -580,7 +559,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_ERROR,
"grpc_chttp2_stream disbanded before CONTINUATION received"));
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
}
if (t->is_client) {
if ((t->incoming_stream_id & 1) &&
@@ -590,7 +569,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_ERROR, "ignoring new grpc_chttp2_stream creation on client"));
}
- grpc_error* err = init_skip_frame_parser(exec_ctx, t, 1);
+ grpc_error* err = init_skip_frame_parser(t, 1);
if (t->incoming_frame_flags & GRPC_CHTTP2_FLAG_HAS_PRIORITY) {
grpc_chttp2_hpack_parser_set_has_priority(&t->hpack_parser);
}
@@ -602,13 +581,13 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
"last grpc_chttp2_stream "
"id=%d, new grpc_chttp2_stream id=%d",
t->last_new_stream_id, t->incoming_stream_id));
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
} else if ((t->incoming_stream_id & 1) == 0) {
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_ERROR,
"ignoring grpc_chttp2_stream with non-client generated index %d",
t->incoming_stream_id));
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
} else if (grpc_chttp2_stream_map_size(&t->stream_map) >=
t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS]) {
@@ -616,11 +595,11 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
}
t->last_new_stream_id = t->incoming_stream_id;
s = t->incoming_stream =
- grpc_chttp2_parsing_accept_stream(exec_ctx, t, t->incoming_stream_id);
+ grpc_chttp2_parsing_accept_stream(t, t->incoming_stream_id);
if (s == nullptr) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
}
} else {
t->incoming_stream = s;
@@ -631,7 +610,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
t->incoming_stream = nullptr;
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
}
t->parser = grpc_chttp2_header_parser_parse;
t->parser_data = &t->hpack_parser;
@@ -656,7 +635,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
break;
case 2:
gpr_log(GPR_ERROR, "too many header frames received");
- return init_skip_frame_parser(exec_ctx, t, 1);
+ return init_skip_frame_parser(t, 1);
}
t->hpack_parser.on_header_user_data = t;
t->hpack_parser.is_boundary = is_eoh;
@@ -668,8 +647,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* init_window_update_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_window_update_frame_parser(grpc_chttp2_transport* t) {
grpc_error* err = grpc_chttp2_window_update_parser_begin_frame(
&t->simple.window_update, t->incoming_frame_size,
t->incoming_frame_flags);
@@ -678,7 +656,7 @@ static grpc_error* init_window_update_frame_parser(grpc_exec_ctx* exec_ctx,
grpc_chttp2_stream* s = t->incoming_stream =
grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
if (s == nullptr) {
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
}
s->stats.incoming.framing_bytes += 9;
}
@@ -687,8 +665,7 @@ static grpc_error* init_window_update_frame_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* init_ping_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_ping_parser(grpc_chttp2_transport* t) {
grpc_error* err = grpc_chttp2_ping_parser_begin_frame(
&t->simple.ping, t->incoming_frame_size, t->incoming_frame_flags);
if (err != GRPC_ERROR_NONE) return err;
@@ -697,15 +674,14 @@ static grpc_error* init_ping_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* init_rst_stream_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_rst_stream_parser(grpc_chttp2_transport* t) {
grpc_error* err = grpc_chttp2_rst_stream_parser_begin_frame(
&t->simple.rst_stream, t->incoming_frame_size, t->incoming_frame_flags);
if (err != GRPC_ERROR_NONE) return err;
grpc_chttp2_stream* s = t->incoming_stream =
grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
if (!t->incoming_stream) {
- return init_skip_frame_parser(exec_ctx, t, 0);
+ return init_skip_frame_parser(t, 0);
}
s->stats.incoming.framing_bytes += 9;
t->parser = grpc_chttp2_rst_stream_parser_parse;
@@ -713,8 +689,7 @@ static grpc_error* init_rst_stream_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* init_goaway_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_goaway_parser(grpc_chttp2_transport* t) {
grpc_error* err = grpc_chttp2_goaway_parser_begin_frame(
&t->goaway_parser, t->incoming_frame_size, t->incoming_frame_flags);
if (err != GRPC_ERROR_NONE) return err;
@@ -723,8 +698,7 @@ static grpc_error* init_goaway_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* init_settings_frame_parser(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static grpc_error* init_settings_frame_parser(grpc_chttp2_transport* t) {
if (t->incoming_stream_id != 0) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Settings frame received for grpc_chttp2_stream");
@@ -740,7 +714,7 @@ static grpc_error* init_settings_frame_parser(grpc_exec_ctx* exec_ctx,
memcpy(t->settings[GRPC_ACKED_SETTINGS], t->settings[GRPC_SENT_SETTINGS],
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
grpc_chttp2_hptbl_set_max_bytes(
- exec_ctx, &t->hpack_parser.table,
+ &t->hpack_parser.table,
t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_HEADER_TABLE_SIZE]);
t->sent_local_settings = 0;
@@ -750,11 +724,10 @@ static grpc_error* init_settings_frame_parser(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_NONE;
}
-static grpc_error* parse_frame_slice(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t, grpc_slice slice,
+static grpc_error* parse_frame_slice(grpc_chttp2_transport* t, grpc_slice slice,
int is_last) {
grpc_chttp2_stream* s = t->incoming_stream;
- grpc_error* err = t->parser(exec_ctx, t->parser_data, t, s, slice, is_last);
+ grpc_error* err = t->parser(t->parser_data, t, s, slice, is_last);
if (err == GRPC_ERROR_NONE) {
return err;
} else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
@@ -762,7 +735,7 @@ static grpc_error* parse_frame_slice(grpc_exec_ctx* exec_ctx,
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
}
- grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
+ grpc_chttp2_parsing_become_skip_parser(t);
if (s) {
s->forced_close_error = err;
grpc_slice_buffer_add(
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 204b5a7708..3310f35f5f 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -33,17 +33,15 @@ static void add_to_write_list(grpc_chttp2_write_cb** list,
*list = cb;
}
-static void finish_write_cb(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, grpc_chttp2_write_cb* cb,
- grpc_error* error) {
- grpc_chttp2_complete_closure_step(exec_ctx, t, s, &cb->closure, error,
+static void finish_write_cb(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ grpc_chttp2_write_cb* cb, grpc_error* error) {
+ grpc_chttp2_complete_closure_step(t, s, &cb->closure, error,
"finish_write_cb");
cb->next = t->write_cb_pool;
t->write_cb_pool = cb;
}
-static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
- grpc_chttp2_transport* t) {
+static void maybe_initiate_ping(grpc_chttp2_transport* t) {
grpc_chttp2_ping_queue* pq = &t->ping_queue;
if (grpc_closure_list_empty(pq->lists[GRPC_CHTTP2_PCL_NEXT])) {
/* no ping needed: wait */
@@ -68,7 +66,7 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
}
return;
}
- grpc_millis now = grpc_exec_ctx_now(exec_ctx);
+ grpc_millis now = grpc_core::ExecCtx::Get()->Now();
grpc_millis next_allowed_ping =
t->ping_state.last_ping_sent_time +
t->ping_policy.min_sent_ping_interval_without_data;
@@ -89,20 +87,20 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
}
if (!t->ping_state.is_delayed_ping_timer_set) {
t->ping_state.is_delayed_ping_timer_set = true;
- grpc_timer_init(exec_ctx, &t->ping_state.delayed_ping_timer,
- next_allowed_ping, &t->retry_initiate_ping_locked);
+ grpc_timer_init(&t->ping_state.delayed_ping_timer, next_allowed_ping,
+ &t->retry_initiate_ping_locked);
}
return;
}
pq->inflight_id = t->ping_ctr;
t->ping_ctr++;
- GRPC_CLOSURE_LIST_SCHED(exec_ctx, &pq->lists[GRPC_CHTTP2_PCL_INITIATE]);
+ GRPC_CLOSURE_LIST_SCHED(&pq->lists[GRPC_CHTTP2_PCL_INITIATE]);
grpc_closure_list_move(&pq->lists[GRPC_CHTTP2_PCL_NEXT],
&pq->lists[GRPC_CHTTP2_PCL_INFLIGHT]);
grpc_slice_buffer_add(&t->outbuf,
grpc_chttp2_ping_create(false, pq->inflight_id));
- GRPC_STATS_INC_HTTP2_PINGS_SENT(exec_ctx);
+ GRPC_STATS_INC_HTTP2_PINGS_SENT();
t->ping_state.last_ping_sent_time = now;
if (grpc_http_trace.enabled() || grpc_bdp_estimator_trace.enabled()) {
gpr_log(GPR_DEBUG, "%s: Ping sent [%p]: %d/%d",
@@ -114,10 +112,9 @@ static void maybe_initiate_ping(grpc_exec_ctx* exec_ctx,
(t->ping_state.pings_before_data_required != 0);
}
-static bool update_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_chttp2_stream* s, int64_t send_bytes,
- grpc_chttp2_write_cb** list, int64_t* ctr,
- grpc_error* error) {
+static bool update_list(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
+ int64_t send_bytes, grpc_chttp2_write_cb** list,
+ int64_t* ctr, grpc_error* error) {
bool sched_any = false;
grpc_chttp2_write_cb* cb = *list;
*list = nullptr;
@@ -126,7 +123,7 @@ static bool update_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
grpc_chttp2_write_cb* next = cb->next;
if (cb->call_at_byte <= *ctr) {
sched_any = true;
- finish_write_cb(exec_ctx, t, s, cb, GRPC_ERROR_REF(error));
+ finish_write_cb(t, s, cb, GRPC_ERROR_REF(error));
} else {
add_to_write_list(list, cb);
}
@@ -179,22 +176,22 @@ class StreamWriteContext;
class WriteContext {
public:
- WriteContext(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t) : t_(t) {
- GRPC_STATS_INC_HTTP2_WRITES_BEGUN(exec_ctx);
+ WriteContext(grpc_chttp2_transport* t) : t_(t) {
+ GRPC_STATS_INC_HTTP2_WRITES_BEGUN();
GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0);
}
// TODO(ctiller): make this the destructor
- void FlushStats(grpc_exec_ctx* exec_ctx) {
+ void FlushStats() {
GRPC_STATS_INC_HTTP2_SEND_INITIAL_METADATA_PER_WRITE(
- exec_ctx, initial_metadata_writes_);
- GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(exec_ctx, message_writes_);
+ initial_metadata_writes_);
+ GRPC_STATS_INC_HTTP2_SEND_MESSAGE_PER_WRITE(message_writes_);
GRPC_STATS_INC_HTTP2_SEND_TRAILING_METADATA_PER_WRITE(
- exec_ctx, trailing_metadata_writes_);
- GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(exec_ctx, flow_control_writes_);
+ trailing_metadata_writes_);
+ GRPC_STATS_INC_HTTP2_SEND_FLOWCTL_PER_WRITE(flow_control_writes_);
}
- void FlushSettings(grpc_exec_ctx* exec_ctx) {
+ void FlushSettings() {
if (t_->dirtied_local_settings && !t_->sent_local_settings) {
grpc_slice_buffer_add(
&t_->outbuf, grpc_chttp2_settings_create(
@@ -204,17 +201,17 @@ class WriteContext {
t_->force_send_settings = false;
t_->dirtied_local_settings = false;
t_->sent_local_settings = true;
- GRPC_STATS_INC_HTTP2_SETTINGS_WRITES(exec_ctx);
+ GRPC_STATS_INC_HTTP2_SETTINGS_WRITES();
}
}
- void FlushQueuedBuffers(grpc_exec_ctx* exec_ctx) {
+ void FlushQueuedBuffers() {
/* simple writes are queued to qbuf, and flushed here */
grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf);
GPR_ASSERT(t_->qbuf.count == 0);
}
- void FlushWindowUpdates(grpc_exec_ctx* exec_ctx) {
+ void FlushWindowUpdates() {
uint32_t transport_announce =
t_->flow_control->MaybeSendUpdate(t_->outbuf.count > 0);
if (transport_announce) {
@@ -234,7 +231,7 @@ class WriteContext {
t_->ping_ack_count = 0;
}
- void EnactHpackSettings(grpc_exec_ctx* exec_ctx) {
+ void EnactHpackSettings() {
grpc_chttp2_hpack_compressor_set_max_table_size(
&t_->hpack_compressor,
t_->settings[GRPC_PEER_SETTINGS]
@@ -374,8 +371,8 @@ class DataSendContext {
bool is_last_frame() const { return is_last_frame_; }
- void CallCallbacks(grpc_exec_ctx* exec_ctx) {
- if (update_list(exec_ctx, t_, s_,
+ void CallCallbacks() {
+ if (update_list(t_, s_,
(int64_t)(s_->sending_bytes - sending_bytes_before_),
&s_->on_flow_controlled_cbs,
&s_->flow_controlled_bytes_flowed, GRPC_ERROR_NONE)) {
@@ -403,7 +400,7 @@ class StreamWriteContext {
s->flow_control->announced_window_delta())));
}
- void FlushInitialMetadata(grpc_exec_ctx* exec_ctx) {
+ void FlushInitialMetadata() {
/* send initial metadata if it's available */
if (s_->sent_initial_metadata) return;
if (s_->send_initial_metadata == nullptr) return;
@@ -430,7 +427,7 @@ class StreamWriteContext {
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size
&s_->stats.outgoing // stats
};
- grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, nullptr, 0,
+ grpc_chttp2_encode_header(&t_->hpack_compressor, nullptr, 0,
s_->send_initial_metadata, &hopt, &t_->outbuf);
write_context_->ResetPingRecvClock();
write_context_->IncInitialMetadataWrites();
@@ -440,11 +437,11 @@ class StreamWriteContext {
s_->sent_initial_metadata = true;
write_context_->NoteScheduledResults();
grpc_chttp2_complete_closure_step(
- exec_ctx, t_, s_, &s_->send_initial_metadata_finished, GRPC_ERROR_NONE,
+ t_, s_, &s_->send_initial_metadata_finished, GRPC_ERROR_NONE,
"send_initial_metadata_finished");
}
- void FlushWindowUpdates(grpc_exec_ctx* exec_ctx) {
+ void FlushWindowUpdates() {
/* send any window updates */
const uint32_t stream_announce = s_->flow_control->MaybeSendUpdate();
if (stream_announce == 0) return;
@@ -456,7 +453,7 @@ class StreamWriteContext {
write_context_->IncWindowUpdateWrites();
}
- void FlushData(grpc_exec_ctx* exec_ctx) {
+ void FlushData() {
if (!s_->sent_initial_metadata) return;
if (s_->flow_controlled_buffer.length == 0 &&
@@ -488,9 +485,9 @@ class StreamWriteContext {
}
write_context_->ResetPingRecvClock();
if (data_send_context.is_last_frame()) {
- SentLastFrame(exec_ctx);
+ SentLastFrame();
}
- data_send_context.CallCallbacks(exec_ctx);
+ data_send_context.CallCallbacks();
stream_became_writable_ = true;
if (s_->flow_controlled_buffer.length > 0 ||
s_->compressed_data_buffer.length > 0) {
@@ -500,7 +497,7 @@ class StreamWriteContext {
write_context_->IncMessageWrites();
}
- void FlushTrailingMetadata(grpc_exec_ctx* exec_ctx) {
+ void FlushTrailingMetadata() {
if (!s_->sent_initial_metadata) return;
if (s_->send_trailing_metadata == nullptr) return;
@@ -521,18 +518,18 @@ class StreamWriteContext {
t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
&s_->stats.outgoing};
- grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor,
+ grpc_chttp2_encode_header(&t_->hpack_compressor,
extra_headers_for_trailing_metadata_,
num_extra_headers_for_trailing_metadata_,
s_->send_trailing_metadata, &hopt, &t_->outbuf);
}
write_context_->IncTrailingMetadataWrites();
write_context_->ResetPingRecvClock();
- SentLastFrame(exec_ctx);
+ SentLastFrame();
write_context_->NoteScheduledResults();
grpc_chttp2_complete_closure_step(
- exec_ctx, t_, s_, &s_->send_trailing_metadata_finished, GRPC_ERROR_NONE,
+ t_, s_, &s_->send_trailing_metadata_finished, GRPC_ERROR_NONE,
"send_trailing_metadata_finished");
}
@@ -556,7 +553,7 @@ class StreamWriteContext {
}
}
- void SentLastFrame(grpc_exec_ctx* exec_ctx) {
+ void SentLastFrame() {
s_->send_trailing_metadata = nullptr;
s_->sent_trailing_metadata = true;
@@ -565,7 +562,7 @@ class StreamWriteContext {
&t_->outbuf, grpc_chttp2_rst_stream_create(
s_->id, GRPC_HTTP2_NO_ERROR, &s_->stats.outgoing));
}
- grpc_chttp2_mark_stream_closed(exec_ctx, t_, s_, !t_->is_client, true,
+ grpc_chttp2_mark_stream_closed(t_, s_, !t_->is_client, true,
GRPC_ERROR_NONE);
}
@@ -579,12 +576,12 @@ class StreamWriteContext {
} // namespace
grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
- grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t) {
- WriteContext ctx(exec_ctx, t);
- ctx.FlushSettings(exec_ctx);
+ grpc_chttp2_transport* t) {
+ WriteContext ctx(t);
+ ctx.FlushSettings();
ctx.FlushPingAcks();
- ctx.FlushQueuedBuffers(exec_ctx);
- ctx.EnactHpackSettings(exec_ctx);
+ ctx.FlushQueuedBuffers();
+ ctx.EnactHpackSettings();
if (t->flow_control->remote_window() > 0) {
ctx.UpdateStreamsNoLongerStalled();
@@ -594,47 +591,45 @@ grpc_chttp2_begin_write_result grpc_chttp2_begin_write(
(according to available window sizes) and add to the output buffer */
while (grpc_chttp2_stream* s = ctx.NextStream()) {
StreamWriteContext stream_ctx(&ctx, s);
- stream_ctx.FlushInitialMetadata(exec_ctx);
- stream_ctx.FlushWindowUpdates(exec_ctx);
- stream_ctx.FlushData(exec_ctx);
- stream_ctx.FlushTrailingMetadata(exec_ctx);
+ stream_ctx.FlushInitialMetadata();
+ stream_ctx.FlushWindowUpdates();
+ stream_ctx.FlushData();
+ stream_ctx.FlushTrailingMetadata();
if (stream_ctx.stream_became_writable()) {
if (!grpc_chttp2_list_add_writing_stream(t, s)) {
/* already in writing list: drop ref */
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:already_writing");
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:already_writing");
} else {
/* ref will be dropped at end of write */
}
} else {
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:no_write");
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:no_write");
}
}
- ctx.FlushWindowUpdates(exec_ctx);
+ ctx.FlushWindowUpdates();
- maybe_initiate_ping(exec_ctx, t);
+ maybe_initiate_ping(t);
GPR_TIMER_END("grpc_chttp2_begin_write", 0);
return ctx.Result();
}
-void grpc_chttp2_end_write(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
- grpc_error* error) {
+void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error) {
GPR_TIMER_BEGIN("grpc_chttp2_end_write", 0);
grpc_chttp2_stream* s;
while (grpc_chttp2_list_pop_writing_stream(t, &s)) {
if (s->sending_bytes != 0) {
- update_list(exec_ctx, t, s, (int64_t)s->sending_bytes,
- &s->on_write_finished_cbs, &s->flow_controlled_bytes_written,
- GRPC_ERROR_REF(error));
+ update_list(t, s, (int64_t)s->sending_bytes, &s->on_write_finished_cbs,
+ &s->flow_controlled_bytes_written, GRPC_ERROR_REF(error));
s->sending_bytes = 0;
}
- GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:end");
+ GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:end");
}
- grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &t->outbuf);
+ grpc_slice_buffer_reset_and_unref_internal(&t->outbuf);
GRPC_ERROR_UNREF(error);
GPR_TIMER_END("grpc_chttp2_end_write", 0);
}
diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
index d590ba0371..40a30e4a31 100644
--- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
+++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
@@ -49,7 +49,6 @@ GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
grpc_transport* ct =
grpc_create_cronet_transport(engine, target, args, reserved);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- return grpc_channel_create(&exec_ctx, target, args,
- GRPC_CLIENT_DIRECT_CHANNEL, ct);
+ grpc_core::ExecCtx exec_ctx;
+ return grpc_channel_create(target, args, GRPC_CLIENT_DIRECT_CHANNEL, ct);
}
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index 4d24efe47b..c9fd94176b 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -197,27 +197,23 @@ typedef struct stream_obj stream_obj;
#ifndef NDEBUG
#define GRPC_CRONET_STREAM_REF(stream, reason) \
grpc_cronet_stream_ref((stream), (reason))
-#define GRPC_CRONET_STREAM_UNREF(exec_ctx, stream, reason) \
- grpc_cronet_stream_unref((exec_ctx), (stream), (reason))
+#define GRPC_CRONET_STREAM_UNREF(stream, reason) \
+ grpc_cronet_stream_unref((stream), (reason))
void grpc_cronet_stream_ref(stream_obj* s, const char* reason) {
grpc_stream_ref(s->refcount, reason);
}
-void grpc_cronet_stream_unref(grpc_exec_ctx* exec_ctx, stream_obj* s,
- const char* reason) {
- grpc_stream_unref(exec_ctx, s->refcount, reason);
+void grpc_cronet_stream_unref(stream_obj* s, const char* reason) {
+ grpc_stream_unref(s->refcount, reason);
}
#else
#define GRPC_CRONET_STREAM_REF(stream, reason) grpc_cronet_stream_ref((stream))
-#define GRPC_CRONET_STREAM_UNREF(exec_ctx, stream, reason) \
- grpc_cronet_stream_unref((exec_ctx), (stream))
+#define GRPC_CRONET_STREAM_UNREF(stream, reason) \
+ grpc_cronet_stream_unref((stream))
void grpc_cronet_stream_ref(stream_obj* s) { grpc_stream_ref(s->refcount); }
-void grpc_cronet_stream_unref(grpc_exec_ctx* exec_ctx, stream_obj* s) {
- grpc_stream_unref(exec_ctx, s->refcount);
-}
+void grpc_cronet_stream_unref(stream_obj* s) { grpc_stream_unref(s->refcount); }
#endif
-static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
- struct op_and_state* oas);
+static enum e_op_result execute_stream_op(struct op_and_state* oas);
/*
Utility function to translate enum into string for printing
@@ -373,12 +369,12 @@ static void remove_from_storage(struct stream_obj* s,
This can get executed from the Cronet network thread via cronet callback
or on the application supplied thread via the perform_stream_op function.
*/
-static void execute_from_storage(grpc_exec_ctx* exec_ctx, stream_obj* s) {
+static void execute_from_storage(stream_obj* s) {
gpr_mu_lock(&s->mu);
for (struct op_and_state* curr = s->storage.head; curr != nullptr;) {
CRONET_LOG(GPR_DEBUG, "calling op at %p. done = %d", curr, curr->done);
GPR_ASSERT(curr->done == 0);
- enum e_op_result result = execute_stream_op(exec_ctx, curr);
+ enum e_op_result result = execute_stream_op(curr);
CRONET_LOG(GPR_DEBUG, "execute_stream_op[%p] returns %s", curr,
op_result_string(result));
/* if this op is done, then remove it and free memory */
@@ -402,7 +398,7 @@ static void execute_from_storage(grpc_exec_ctx* exec_ctx, stream_obj* s) {
*/
static void on_failed(bidirectional_stream* stream, int net_error) {
CRONET_LOG(GPR_DEBUG, "on_failed(%p, %d)", stream, net_error);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
gpr_mu_lock(&s->mu);
@@ -419,9 +415,8 @@ static void on_failed(bidirectional_stream* stream, int net_error) {
}
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- GRPC_CRONET_STREAM_UNREF(&exec_ctx, s, "cronet transport");
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
+ GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
}
/*
@@ -429,7 +424,7 @@ static void on_failed(bidirectional_stream* stream, int net_error) {
*/
static void on_canceled(bidirectional_stream* stream) {
CRONET_LOG(GPR_DEBUG, "on_canceled(%p)", stream);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
gpr_mu_lock(&s->mu);
@@ -446,9 +441,8 @@ static void on_canceled(bidirectional_stream* stream) {
}
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- GRPC_CRONET_STREAM_UNREF(&exec_ctx, s, "cronet transport");
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
+ GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
}
/*
@@ -456,7 +450,7 @@ static void on_canceled(bidirectional_stream* stream) {
*/
static void on_succeeded(bidirectional_stream* stream) {
CRONET_LOG(GPR_DEBUG, "on_succeeded(%p)", stream);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
gpr_mu_lock(&s->mu);
@@ -465,9 +459,8 @@ static void on_succeeded(bidirectional_stream* stream) {
s->cbs = nullptr;
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- GRPC_CRONET_STREAM_UNREF(&exec_ctx, s, "cronet transport");
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
+ GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
}
/*
@@ -475,7 +468,7 @@ static void on_succeeded(bidirectional_stream* stream) {
*/
static void on_stream_ready(bidirectional_stream* stream) {
CRONET_LOG(GPR_DEBUG, "W: on_stream_ready(%p)", stream);
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
grpc_cronet_transport* t = (grpc_cronet_transport*)s->curr_ct;
gpr_mu_lock(&s->mu);
@@ -495,8 +488,7 @@ static void on_stream_ready(bidirectional_stream* stream) {
}
}
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
}
/*
@@ -506,7 +498,7 @@ static void on_response_headers_received(
bidirectional_stream* stream,
const bidirectional_stream_header_array* headers,
const char* negotiated_protocol) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
CRONET_LOG(GPR_DEBUG, "R: on_response_headers_received(%p, %p, %s)", stream,
headers, negotiated_protocol);
stream_obj* s = (stream_obj*)stream->annotation;
@@ -528,9 +520,8 @@ static void on_response_headers_received(
for (size_t i = 0; i < headers->count; i++) {
GRPC_LOG_IF_ERROR("on_response_headers_received",
grpc_chttp2_incoming_metadata_buffer_add(
- &exec_ctx, &s->state.rs.initial_metadata,
+ &s->state.rs.initial_metadata,
grpc_mdelem_from_slices(
- &exec_ctx,
grpc_slice_intern(grpc_slice_from_static_string(
headers->headers[i].key)),
grpc_slice_intern(grpc_slice_from_static_string(
@@ -552,15 +543,14 @@ static void on_response_headers_received(
s->state.pending_read_from_cronet = true;
}
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
}
/*
Cronet callback
*/
static void on_write_completed(bidirectional_stream* stream, const char* data) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
CRONET_LOG(GPR_DEBUG, "W: on_write_completed(%p, %s)", stream, data);
gpr_mu_lock(&s->mu);
@@ -570,8 +560,7 @@ static void on_write_completed(bidirectional_stream* stream, const char* data) {
}
s->state.state_callback_received[OP_SEND_MESSAGE] = true;
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
- grpc_exec_ctx_finish(&exec_ctx);
+ execute_from_storage(s);
}
/*
@@ -579,7 +568,7 @@ static void on_write_completed(bidirectional_stream* stream, const char* data) {
*/
static void on_read_completed(bidirectional_stream* stream, char* data,
int count) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
stream_obj* s = (stream_obj*)stream->annotation;
CRONET_LOG(GPR_DEBUG, "R: on_read_completed(%p, %p, %d)", stream, data,
count);
@@ -605,15 +594,14 @@ static void on_read_completed(bidirectional_stream* stream, char* data,
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
+ execute_from_storage(s);
}
} else {
null_and_maybe_free_read_buffer(s);
s->state.rs.read_stream_closed = true;
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
+ execute_from_storage(s);
}
- grpc_exec_ctx_finish(&exec_ctx);
}
/*
@@ -622,7 +610,7 @@ static void on_read_completed(bidirectional_stream* stream, char* data,
static void on_response_trailers_received(
bidirectional_stream* stream,
const bidirectional_stream_header_array* trailers) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream,
trailers);
stream_obj* s = (stream_obj*)stream->annotation;
@@ -638,9 +626,8 @@ static void on_response_trailers_received(
trailers->headers[i].value);
GRPC_LOG_IF_ERROR("on_response_trailers_received",
grpc_chttp2_incoming_metadata_buffer_add(
- &exec_ctx, &s->state.rs.trailing_metadata,
+ &s->state.rs.trailing_metadata,
grpc_mdelem_from_slices(
- &exec_ctx,
grpc_slice_intern(grpc_slice_from_static_string(
trailers->headers[i].key)),
grpc_slice_intern(grpc_slice_from_static_string(
@@ -670,17 +657,15 @@ static void on_response_trailers_received(
gpr_mu_unlock(&s->mu);
} else {
gpr_mu_unlock(&s->mu);
- execute_from_storage(&exec_ctx, s);
+ execute_from_storage(s);
}
- grpc_exec_ctx_finish(&exec_ctx);
}
/*
Utility function that takes the data from s->write_slice_buffer and assembles
into a contiguous byte stream with 5 byte gRPC header prepended.
*/
-static void create_grpc_frame(grpc_exec_ctx* exec_ctx,
- grpc_slice_buffer* write_slice_buffer,
+static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer,
char** pp_write_buffer,
size_t* p_write_buffer_size, uint32_t flags) {
grpc_slice slice = grpc_slice_buffer_take_first(write_slice_buffer);
@@ -700,7 +685,7 @@ static void create_grpc_frame(grpc_exec_ctx* exec_ctx,
*p++ = (uint8_t)(length);
/* append actual data */
memcpy(p, GRPC_SLICE_START_PTR(slice), length);
- grpc_slice_unref_internal(exec_ctx, slice);
+ grpc_slice_unref_internal(slice);
}
/*
@@ -981,8 +966,7 @@ static bool op_can_be_run(grpc_transport_stream_op_batch* curr_op,
/*
TODO (makdharma): Break down this function in smaller chunks for readability.
*/
-static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
- struct op_and_state* oas) {
+static enum e_op_result execute_stream_op(struct op_and_state* oas) {
grpc_transport_stream_op_batch* stream_op = &oas->op;
struct stream_obj* s = oas->s;
grpc_cronet_transport* t = (grpc_cronet_transport*)s->curr_ct;
@@ -1040,15 +1024,14 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
grpc_slice slice;
grpc_slice_buffer_init(&write_slice_buffer);
if (1 != grpc_byte_stream_next(
- exec_ctx, stream_op->payload->send_message.send_message,
+ stream_op->payload->send_message.send_message,
stream_op->payload->send_message.send_message->length,
nullptr)) {
/* Should never reach here */
GPR_ASSERT(false);
}
if (GRPC_ERROR_NONE !=
- grpc_byte_stream_pull(exec_ctx,
- stream_op->payload->send_message.send_message,
+ grpc_byte_stream_pull(stream_op->payload->send_message.send_message,
&slice)) {
/* Should never reach here */
GPR_ASSERT(false);
@@ -1061,15 +1044,15 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
}
if (write_slice_buffer.count > 0) {
size_t write_buffer_size;
- create_grpc_frame(exec_ctx, &write_slice_buffer,
- &stream_state->ws.write_buffer, &write_buffer_size,
+ create_grpc_frame(&write_slice_buffer, &stream_state->ws.write_buffer,
+ &write_buffer_size,
stream_op->payload->send_message.send_message->flags);
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_write (%p, %p)", s->cbs,
stream_state->ws.write_buffer);
stream_state->state_callback_received[OP_SEND_MESSAGE] = false;
bidirectional_stream_write(s->cbs, stream_state->ws.write_buffer,
(int)write_buffer_size, false);
- grpc_slice_buffer_destroy_internal(exec_ctx, &write_slice_buffer);
+ grpc_slice_buffer_destroy_internal(&write_slice_buffer);
if (t->use_packet_coalescing) {
if (!stream_op->send_trailing_metadata) {
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_flush (%p)", s->cbs);
@@ -1112,25 +1095,21 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_INITIAL_METADATA", oas);
if (stream_state->state_op_done[OP_CANCEL_ERROR]) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_NONE);
} else if (stream_state->state_callback_received[OP_FAILED]) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_NONE);
} else if (stream_state->state_op_done[OP_RECV_TRAILING_METADATA]) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_NONE);
} else {
grpc_chttp2_incoming_metadata_buffer_publish(
- exec_ctx, &oas->s->state.rs.initial_metadata,
+ &oas->s->state.rs.initial_metadata,
stream_op->payload->recv_initial_metadata.recv_initial_metadata);
GRPC_CLOSURE_SCHED(
- exec_ctx,
stream_op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_NONE);
}
@@ -1141,16 +1120,14 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_MESSAGE", oas);
if (stream_state->state_op_done[OP_CANCEL_ERROR]) {
CRONET_LOG(GPR_DEBUG, "Stream is cancelled.");
- GRPC_CLOSURE_SCHED(exec_ctx,
- stream_op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
result = ACTION_TAKEN_NO_CALLBACK;
} else if (stream_state->state_callback_received[OP_FAILED]) {
CRONET_LOG(GPR_DEBUG, "Stream failed.");
- GRPC_CLOSURE_SCHED(exec_ctx,
- stream_op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
@@ -1158,16 +1135,14 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
} else if (stream_state->rs.read_stream_closed == true) {
/* No more data will be received */
CRONET_LOG(GPR_DEBUG, "read stream closed");
- GRPC_CLOSURE_SCHED(exec_ctx,
- stream_op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
result = ACTION_TAKEN_NO_CALLBACK;
} else if (stream_state->flush_read) {
CRONET_LOG(GPR_DEBUG, "flush read");
- GRPC_CLOSURE_SCHED(exec_ctx,
- stream_op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
@@ -1200,7 +1175,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
CRONET_LOG(GPR_DEBUG, "read operation complete. Empty response.");
/* Clean up read_slice_buffer in case there is unread data. */
grpc_slice_buffer_destroy_internal(
- exec_ctx, &stream_state->rs.read_slice_buffer);
+ &stream_state->rs.read_slice_buffer);
grpc_slice_buffer_init(&stream_state->rs.read_slice_buffer);
grpc_slice_buffer_stream_init(&stream_state->rs.sbs,
&stream_state->rs.read_slice_buffer, 0);
@@ -1210,7 +1185,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
*((grpc_byte_buffer**)stream_op->payload->recv_message.recv_message) =
(grpc_byte_buffer*)&stream_state->rs.sbs;
GRPC_CLOSURE_SCHED(
- exec_ctx, stream_op->payload->recv_message.recv_message_ready,
+ stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
@@ -1254,8 +1229,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
(size_t)stream_state->rs.length_field);
null_and_maybe_free_read_buffer(s);
/* Clean up read_slice_buffer in case there is unread data. */
- grpc_slice_buffer_destroy_internal(exec_ctx,
- &stream_state->rs.read_slice_buffer);
+ grpc_slice_buffer_destroy_internal(&stream_state->rs.read_slice_buffer);
grpc_slice_buffer_init(&stream_state->rs.read_slice_buffer);
grpc_slice_buffer_add(&stream_state->rs.read_slice_buffer,
read_data_slice);
@@ -1266,8 +1240,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
}
*((grpc_byte_buffer**)stream_op->payload->recv_message.recv_message) =
(grpc_byte_buffer*)&stream_state->rs.sbs;
- GRPC_CLOSURE_SCHED(exec_ctx,
- stream_op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
stream_state->state_op_done[OP_RECV_MESSAGE] = true;
oas->state.state_op_done[OP_RECV_MESSAGE] = true;
@@ -1290,7 +1263,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_TRAILING_METADATA", oas);
if (oas->s->state.rs.trailing_metadata_valid) {
grpc_chttp2_incoming_metadata_buffer_publish(
- exec_ctx, &oas->s->state.rs.trailing_metadata,
+ &oas->s->state.rs.trailing_metadata,
stream_op->payload->recv_trailing_metadata.recv_trailing_metadata);
stream_state->rs.trailing_metadata_valid = false;
}
@@ -1315,17 +1288,17 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
op_can_be_run(stream_op, s, &oas->state, OP_ON_COMPLETE)) {
CRONET_LOG(GPR_DEBUG, "running: %p OP_ON_COMPLETE", oas);
if (stream_state->state_op_done[OP_CANCEL_ERROR]) {
- GRPC_CLOSURE_SCHED(exec_ctx, stream_op->on_complete,
+ GRPC_CLOSURE_SCHED(stream_op->on_complete,
GRPC_ERROR_REF(stream_state->cancel_error));
} else if (stream_state->state_callback_received[OP_FAILED]) {
GRPC_CLOSURE_SCHED(
- exec_ctx, stream_op->on_complete,
+ stream_op->on_complete,
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."));
} else {
/* All actions in this stream_op are complete. Call the on_complete
* callback
*/
- GRPC_CLOSURE_SCHED(exec_ctx, stream_op->on_complete, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(stream_op->on_complete, GRPC_ERROR_NONE);
}
oas->state.state_op_done[OP_ON_COMPLETE] = true;
oas->done = true;
@@ -1350,9 +1323,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
Functions used by upper layers to access transport functionality.
*/
-static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_stream_refcount* refcount,
- const void* server_data, gpr_arena* arena) {
+static int init_stream(grpc_transport* gt, grpc_stream* gs,
+ grpc_stream_refcount* refcount, const void* server_data,
+ gpr_arena* arena) {
stream_obj* s = (stream_obj*)gs;
s->refcount = refcount;
@@ -1383,15 +1356,13 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
return 0;
}
-static void set_pollset_do_nothing(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_pollset* pollset) {}
+static void set_pollset_do_nothing(grpc_transport* gt, grpc_stream* gs,
+ grpc_pollset* pollset) {}
-static void set_pollset_set_do_nothing(grpc_exec_ctx* exec_ctx,
- grpc_transport* gt, grpc_stream* gs,
+static void set_pollset_set_do_nothing(grpc_transport* gt, grpc_stream* gs,
grpc_pollset_set* pollset_set) {}
-static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
grpc_transport_stream_op_batch* op) {
CRONET_LOG(GPR_DEBUG, "perform_stream_op");
if (op->send_initial_metadata &&
@@ -1401,42 +1372,36 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
this field is present in metadata */
if (op->recv_initial_metadata) {
GRPC_CLOSURE_SCHED(
- exec_ctx,
op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_CANCELLED);
}
if (op->recv_message) {
- GRPC_CLOSURE_SCHED(exec_ctx, op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(op->payload->recv_message.recv_message_ready,
GRPC_ERROR_CANCELLED);
}
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_CANCELLED);
+ GRPC_CLOSURE_SCHED(op->on_complete, GRPC_ERROR_CANCELLED);
return;
}
stream_obj* s = (stream_obj*)gs;
add_to_storage(s, op);
- execute_from_storage(exec_ctx, s);
+ execute_from_storage(s);
}
-static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_closure* then_schedule_closure) {
stream_obj* s = (stream_obj*)gs;
null_and_maybe_free_read_buffer(s);
/* Clean up read_slice_buffer in case there is unread data. */
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->state.rs.read_slice_buffer);
+ grpc_slice_buffer_destroy_internal(&s->state.rs.read_slice_buffer);
GRPC_ERROR_UNREF(s->state.cancel_error);
- GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE);
}
-static void destroy_transport(grpc_exec_ctx* exec_ctx, grpc_transport* gt) {}
+static void destroy_transport(grpc_transport* gt) {}
-static grpc_endpoint* get_endpoint(grpc_exec_ctx* exec_ctx,
- grpc_transport* gt) {
- return nullptr;
-}
+static grpc_endpoint* get_endpoint(grpc_transport* gt) { return nullptr; }
-static void perform_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_transport_op* op) {}
+static void perform_op(grpc_transport* gt, grpc_transport_op* op) {}
static const grpc_transport_vtable grpc_cronet_vtable = {
sizeof(stream_obj),
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index d8d753e459..8dd0b7dce2 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -54,8 +54,8 @@ typedef struct inproc_transport {
gpr_refcount refs;
bool is_client;
grpc_connectivity_state_tracker connectivity;
- void (*accept_stream_cb)(grpc_exec_ctx* exec_ctx, void* user_data,
- grpc_transport* transport, const void* server_data);
+ void (*accept_stream_cb)(void* user_data, grpc_transport* transport,
+ const void* server_data);
void* accept_stream_data;
bool is_closed;
struct inproc_transport* other_side;
@@ -118,39 +118,36 @@ typedef struct inproc_stream {
} inproc_stream;
static grpc_closure do_nothing_closure;
-static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
- grpc_error* error);
-static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error);
+static bool cancel_stream_locked(inproc_stream* s, grpc_error* error);
+static void op_state_machine(void* arg, grpc_error* error);
static void ref_transport(inproc_transport* t) {
INPROC_LOG(GPR_DEBUG, "ref_transport %p", t);
gpr_ref(&t->refs);
}
-static void really_destroy_transport(grpc_exec_ctx* exec_ctx,
- inproc_transport* t) {
+static void really_destroy_transport(inproc_transport* t) {
INPROC_LOG(GPR_DEBUG, "really_destroy_transport %p", t);
- grpc_connectivity_state_destroy(exec_ctx, &t->connectivity);
+ grpc_connectivity_state_destroy(&t->connectivity);
if (gpr_unref(&t->mu->refs)) {
gpr_free(t->mu);
}
gpr_free(t);
}
-static void unref_transport(grpc_exec_ctx* exec_ctx, inproc_transport* t) {
+static void unref_transport(inproc_transport* t) {
INPROC_LOG(GPR_DEBUG, "unref_transport %p", t);
if (gpr_unref(&t->refs)) {
- really_destroy_transport(exec_ctx, t);
+ really_destroy_transport(t);
}
}
#ifndef NDEBUG
#define STREAM_REF(refs, reason) grpc_stream_ref(refs, reason)
-#define STREAM_UNREF(e, refs, reason) grpc_stream_unref(e, refs, reason)
+#define STREAM_UNREF(refs, reason) grpc_stream_unref(refs, reason)
#else
#define STREAM_REF(refs, reason) grpc_stream_ref(refs)
-#define STREAM_UNREF(e, refs, reason) grpc_stream_unref(e, refs)
+#define STREAM_UNREF(refs, reason) grpc_stream_unref(refs)
#endif
static void ref_stream(inproc_stream* s, const char* reason) {
@@ -158,13 +155,12 @@ static void ref_stream(inproc_stream* s, const char* reason) {
STREAM_REF(s->refs, reason);
}
-static void unref_stream(grpc_exec_ctx* exec_ctx, inproc_stream* s,
- const char* reason) {
+static void unref_stream(inproc_stream* s, const char* reason) {
INPROC_LOG(GPR_DEBUG, "unref_stream %p %s", s, reason);
- STREAM_UNREF(exec_ctx, s->refs, reason);
+ STREAM_UNREF(s->refs, reason);
}
-static void really_destroy_stream(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
+static void really_destroy_stream(inproc_stream* s) {
INPROC_LOG(GPR_DEBUG, "really_destroy_stream %p", s);
GRPC_ERROR_UNREF(s->write_buffer_cancel_error);
@@ -172,13 +168,13 @@ static void really_destroy_stream(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
GRPC_ERROR_UNREF(s->cancel_other_error);
if (s->recv_inited) {
- grpc_slice_buffer_destroy_internal(exec_ctx, &s->recv_message);
+ grpc_slice_buffer_destroy_internal(&s->recv_message);
}
- unref_transport(exec_ctx, s->t);
+ unref_transport(s->t);
if (s->closure_at_destroy) {
- GRPC_CLOSURE_SCHED(exec_ctx, s->closure_at_destroy, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(s->closure_at_destroy, GRPC_ERROR_NONE);
}
}
@@ -195,7 +191,7 @@ static void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
}
}
-static grpc_error* fill_in_metadata(grpc_exec_ctx* exec_ctx, inproc_stream* s,
+static grpc_error* fill_in_metadata(inproc_stream* s,
const grpc_metadata_batch* metadata,
uint32_t flags, grpc_metadata_batch* out_md,
uint32_t* outflags, bool* markfilled) {
@@ -214,18 +210,18 @@ static grpc_error* fill_in_metadata(grpc_exec_ctx* exec_ctx, inproc_stream* s,
(elem != nullptr) && (error == GRPC_ERROR_NONE); elem = elem->next) {
grpc_linked_mdelem* nelem =
(grpc_linked_mdelem*)gpr_arena_alloc(s->arena, sizeof(*nelem));
- nelem->md = grpc_mdelem_from_slices(
- exec_ctx, grpc_slice_intern(GRPC_MDKEY(elem->md)),
- grpc_slice_intern(GRPC_MDVALUE(elem->md)));
+ nelem->md =
+ grpc_mdelem_from_slices(grpc_slice_intern(GRPC_MDKEY(elem->md)),
+ grpc_slice_intern(GRPC_MDVALUE(elem->md)));
- error = grpc_metadata_batch_link_tail(exec_ctx, out_md, nelem);
+ error = grpc_metadata_batch_link_tail(out_md, nelem);
}
return error;
}
-static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_stream_refcount* refcount,
- const void* server_data, gpr_arena* arena) {
+static int init_stream(grpc_transport* gt, grpc_stream* gs,
+ grpc_stream_refcount* refcount, const void* server_data,
+ gpr_arena* arena) {
INPROC_LOG(GPR_DEBUG, "init_stream %p %p %p", gt, gs, server_data);
inproc_transport* t = (inproc_transport*)gt;
inproc_stream* s = (inproc_stream*)gs;
@@ -285,8 +281,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
// side to avoid destruction
INPROC_LOG(GPR_DEBUG, "calling accept stream cb %p %p",
st->accept_stream_cb, st->accept_stream_data);
- (*st->accept_stream_cb)(exec_ctx, st->accept_stream_data, &st->base,
- (void*)s);
+ (*st->accept_stream_cb)(st->accept_stream_data, &st->base, (void*)s);
} else {
// This is the server-side and is being called through accept_stream_cb
inproc_stream* cs = (inproc_stream*)server_data;
@@ -301,19 +296,19 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
// Now transfer from the other side's write_buffer if any to the to_read
// buffer
if (cs->write_buffer_initial_md_filled) {
- fill_in_metadata(exec_ctx, s, &cs->write_buffer_initial_md,
+ fill_in_metadata(s, &cs->write_buffer_initial_md,
cs->write_buffer_initial_md_flags,
&s->to_read_initial_md, &s->to_read_initial_md_flags,
&s->to_read_initial_md_filled);
s->deadline = GPR_MIN(s->deadline, cs->write_buffer_deadline);
- grpc_metadata_batch_clear(exec_ctx, &cs->write_buffer_initial_md);
+ grpc_metadata_batch_clear(&cs->write_buffer_initial_md);
cs->write_buffer_initial_md_filled = false;
}
if (cs->write_buffer_trailing_md_filled) {
- fill_in_metadata(exec_ctx, s, &cs->write_buffer_trailing_md, 0,
+ fill_in_metadata(s, &cs->write_buffer_trailing_md, 0,
&s->to_read_trailing_md, nullptr,
&s->to_read_trailing_md_filled);
- grpc_metadata_batch_clear(exec_ctx, &cs->write_buffer_trailing_md);
+ grpc_metadata_batch_clear(&cs->write_buffer_trailing_md);
cs->write_buffer_trailing_md_filled = false;
}
if (cs->write_buffer_cancel_error != GRPC_ERROR_NONE) {
@@ -326,11 +321,11 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
return 0; // return value is not important
}
-static void close_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
+static void close_stream_locked(inproc_stream* s) {
if (!s->closed) {
// Release the metadata that we would have written out
- grpc_metadata_batch_destroy(exec_ctx, &s->write_buffer_initial_md);
- grpc_metadata_batch_destroy(exec_ctx, &s->write_buffer_trailing_md);
+ grpc_metadata_batch_destroy(&s->write_buffer_initial_md);
+ grpc_metadata_batch_destroy(&s->write_buffer_trailing_md);
if (s->listed) {
inproc_stream* p = s->stream_list_prev;
@@ -344,22 +339,21 @@ static void close_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
n->stream_list_prev = p;
}
s->listed = false;
- unref_stream(exec_ctx, s, "close_stream:list");
+ unref_stream(s, "close_stream:list");
}
s->closed = true;
- unref_stream(exec_ctx, s, "close_stream:closing");
+ unref_stream(s, "close_stream:closing");
}
}
// This function means that we are done talking/listening to the other side
-static void close_other_side_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
- const char* reason) {
+static void close_other_side_locked(inproc_stream* s, const char* reason) {
if (s->other_side != nullptr) {
// First release the metadata that came from the other side's arena
- grpc_metadata_batch_destroy(exec_ctx, &s->to_read_initial_md);
- grpc_metadata_batch_destroy(exec_ctx, &s->to_read_trailing_md);
+ grpc_metadata_batch_destroy(&s->to_read_initial_md);
+ grpc_metadata_batch_destroy(&s->to_read_trailing_md);
- unref_stream(exec_ctx, s->other_side, reason);
+ unref_stream(s->other_side, reason);
s->other_side_closed = true;
s->other_side = nullptr;
} else if (!s->other_side_closed) {
@@ -371,8 +365,7 @@ static void close_other_side_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
// this stream_op_batch is only one of the pending operations for this
// stream. This is called when one of the pending operations for the stream
// is done and about to be NULLed out
-static void complete_if_batch_end_locked(grpc_exec_ctx* exec_ctx,
- inproc_stream* s, grpc_error* error,
+static void complete_if_batch_end_locked(inproc_stream* s, grpc_error* error,
grpc_transport_stream_op_batch* op,
const char* msg) {
int is_sm = (int)(op == s->send_message_op);
@@ -383,22 +376,20 @@ static void complete_if_batch_end_locked(grpc_exec_ctx* exec_ctx,
if ((is_sm + is_stm + is_rim + is_rm + is_rtm) == 1) {
INPROC_LOG(GPR_DEBUG, "%s %p %p %p", msg, s, op, error);
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_complete, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(op->on_complete, GRPC_ERROR_REF(error));
}
}
-static void maybe_schedule_op_closure_locked(grpc_exec_ctx* exec_ctx,
- inproc_stream* s,
+static void maybe_schedule_op_closure_locked(inproc_stream* s,
grpc_error* error) {
if (s && s->ops_needed && !s->op_closure_scheduled) {
- GRPC_CLOSURE_SCHED(exec_ctx, &s->op_closure, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(&s->op_closure, GRPC_ERROR_REF(error));
s->op_closure_scheduled = true;
s->ops_needed = false;
}
}
-static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
- grpc_error* error) {
+static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
INPROC_LOG(GPR_DEBUG, "op_state_machine %p fail_helper", s);
// If we're failing this side, we need to make sure that
// we also send or have already sent trailing metadata
@@ -415,14 +406,14 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
: &other->to_read_trailing_md;
bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled
: &other->to_read_trailing_md_filled;
- fill_in_metadata(exec_ctx, s, &fake_md, 0, dest, nullptr, destfilled);
- grpc_metadata_batch_destroy(exec_ctx, &fake_md);
+ fill_in_metadata(s, &fake_md, 0, dest, nullptr, destfilled);
+ grpc_metadata_batch_destroy(&fake_md);
if (other != nullptr) {
if (other->cancel_other_error == GRPC_ERROR_NONE) {
other->cancel_other_error = GRPC_ERROR_REF(error);
}
- maybe_schedule_op_closure_locked(exec_ctx, other, error);
+ maybe_schedule_op_closure_locked(other, error);
} else if (s->write_buffer_cancel_error == GRPC_ERROR_NONE) {
s->write_buffer_cancel_error = GRPC_ERROR_REF(error);
}
@@ -436,24 +427,22 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
grpc_metadata_batch_init(&fake_md);
grpc_linked_mdelem* path_md =
(grpc_linked_mdelem*)gpr_arena_alloc(s->arena, sizeof(*path_md));
- path_md->md =
- grpc_mdelem_from_slices(exec_ctx, g_fake_path_key, g_fake_path_value);
- GPR_ASSERT(grpc_metadata_batch_link_tail(exec_ctx, &fake_md, path_md) ==
+ path_md->md = grpc_mdelem_from_slices(g_fake_path_key, g_fake_path_value);
+ GPR_ASSERT(grpc_metadata_batch_link_tail(&fake_md, path_md) ==
GRPC_ERROR_NONE);
grpc_linked_mdelem* auth_md =
(grpc_linked_mdelem*)gpr_arena_alloc(s->arena, sizeof(*auth_md));
- auth_md->md =
- grpc_mdelem_from_slices(exec_ctx, g_fake_auth_key, g_fake_auth_value);
- GPR_ASSERT(grpc_metadata_batch_link_tail(exec_ctx, &fake_md, auth_md) ==
+ auth_md->md = grpc_mdelem_from_slices(g_fake_auth_key, g_fake_auth_value);
+ GPR_ASSERT(grpc_metadata_batch_link_tail(&fake_md, auth_md) ==
GRPC_ERROR_NONE);
fill_in_metadata(
- exec_ctx, s, &fake_md, 0,
+ s, &fake_md, 0,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata,
s->recv_initial_md_op->payload->recv_initial_metadata.recv_flags,
nullptr);
- grpc_metadata_batch_destroy(exec_ctx, &fake_md);
+ grpc_metadata_batch_destroy(&fake_md);
err = GRPC_ERROR_NONE;
} else {
err = GRPC_ERROR_REF(error);
@@ -469,14 +458,13 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
INPROC_LOG(GPR_DEBUG,
"fail_helper %p scheduling initial-metadata-ready %p %p", s,
error, err);
- GRPC_CLOSURE_SCHED(exec_ctx,
- s->recv_initial_md_op->payload->recv_initial_metadata
+ GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata_ready,
err);
// Last use of err so no need to REF and then UNREF it
complete_if_batch_end_locked(
- exec_ctx, s, error, s->recv_initial_md_op,
+ s, error, s->recv_initial_md_op,
"fail_helper scheduling recv-initial-metadata-on-complete");
s->recv_initial_md_op = nullptr;
}
@@ -484,22 +472,22 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
INPROC_LOG(GPR_DEBUG, "fail_helper %p scheduling message-ready %p", s,
error);
GRPC_CLOSURE_SCHED(
- exec_ctx, s->recv_message_op->payload->recv_message.recv_message_ready,
+ s->recv_message_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_REF(error));
complete_if_batch_end_locked(
- exec_ctx, s, error, s->recv_message_op,
+ s, error, s->recv_message_op,
"fail_helper scheduling recv-message-on-complete");
s->recv_message_op = nullptr;
}
if (s->send_message_op) {
complete_if_batch_end_locked(
- exec_ctx, s, error, s->send_message_op,
+ s, error, s->send_message_op,
"fail_helper scheduling send-message-on-complete");
s->send_message_op = nullptr;
}
if (s->send_trailing_md_op) {
complete_if_batch_end_locked(
- exec_ctx, s, error, s->send_trailing_md_op,
+ s, error, s->send_trailing_md_op,
"fail_helper scheduling send-trailng-md-on-complete");
s->send_trailing_md_op = nullptr;
}
@@ -508,23 +496,22 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
"fail_helper %p scheduling trailing-md-on-complete %p", s,
error);
complete_if_batch_end_locked(
- exec_ctx, s, error, s->recv_trailing_md_op,
+ s, error, s->recv_trailing_md_op,
"fail_helper scheduling recv-trailing-metadata-on-complete");
s->recv_trailing_md_op = nullptr;
}
- close_other_side_locked(exec_ctx, s, "fail_helper:other_side");
- close_stream_locked(exec_ctx, s);
+ close_other_side_locked(s, "fail_helper:other_side");
+ close_stream_locked(s);
GRPC_ERROR_UNREF(error);
}
-static void message_transfer_locked(grpc_exec_ctx* exec_ctx,
- inproc_stream* sender,
+static void message_transfer_locked(inproc_stream* sender,
inproc_stream* receiver) {
size_t remaining =
sender->send_message_op->payload->send_message.send_message->length;
if (receiver->recv_inited) {
- grpc_slice_buffer_destroy_internal(exec_ctx, &receiver->recv_message);
+ grpc_slice_buffer_destroy_internal(&receiver->recv_message);
}
grpc_slice_buffer_init(&receiver->recv_message);
receiver->recv_inited = true;
@@ -532,13 +519,13 @@ static void message_transfer_locked(grpc_exec_ctx* exec_ctx,
grpc_slice message_slice;
grpc_closure unused;
GPR_ASSERT(grpc_byte_stream_next(
- exec_ctx, sender->send_message_op->payload->send_message.send_message,
- SIZE_MAX, &unused));
+ sender->send_message_op->payload->send_message.send_message, SIZE_MAX,
+ &unused));
grpc_error* error = grpc_byte_stream_pull(
- exec_ctx, sender->send_message_op->payload->send_message.send_message,
+ sender->send_message_op->payload->send_message.send_message,
&message_slice);
if (error != GRPC_ERROR_NONE) {
- cancel_stream_locked(exec_ctx, sender, GRPC_ERROR_REF(error));
+ cancel_stream_locked(sender, GRPC_ERROR_REF(error));
break;
}
GPR_ASSERT(error == GRPC_ERROR_NONE);
@@ -553,22 +540,20 @@ static void message_transfer_locked(grpc_exec_ctx* exec_ctx,
INPROC_LOG(GPR_DEBUG, "message_transfer_locked %p scheduling message-ready",
receiver);
GRPC_CLOSURE_SCHED(
- exec_ctx,
receiver->recv_message_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
complete_if_batch_end_locked(
- exec_ctx, sender, GRPC_ERROR_NONE, sender->send_message_op,
+ sender, GRPC_ERROR_NONE, sender->send_message_op,
"message_transfer scheduling sender on_complete");
complete_if_batch_end_locked(
- exec_ctx, receiver, GRPC_ERROR_NONE, receiver->recv_message_op,
+ receiver, GRPC_ERROR_NONE, receiver->recv_message_op,
"message_transfer scheduling receiver on_complete");
receiver->recv_message_op = nullptr;
sender->send_message_op = nullptr;
}
-static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
- grpc_error* error) {
+static void op_state_machine(void* arg, grpc_error* error) {
// This function gets called when we have contents in the unprocessed reads
// Get what we want based on our ops wanted
// Schedule our appropriate closures
@@ -589,26 +574,26 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
inproc_stream* other = s->other_side;
if (s->cancel_self_error != GRPC_ERROR_NONE) {
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(s->cancel_self_error));
+ fail_helper_locked(s, GRPC_ERROR_REF(s->cancel_self_error));
goto done;
} else if (s->cancel_other_error != GRPC_ERROR_NONE) {
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(s->cancel_other_error));
+ fail_helper_locked(s, GRPC_ERROR_REF(s->cancel_other_error));
goto done;
} else if (error != GRPC_ERROR_NONE) {
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(error));
+ fail_helper_locked(s, GRPC_ERROR_REF(error));
goto done;
}
if (s->send_message_op && other) {
if (other->recv_message_op) {
- message_transfer_locked(exec_ctx, s, other);
- maybe_schedule_op_closure_locked(exec_ctx, other, GRPC_ERROR_NONE);
+ message_transfer_locked(s, other);
+ maybe_schedule_op_closure_locked(other, GRPC_ERROR_NONE);
} else if (!s->t->is_client &&
(s->trailing_md_sent || other->recv_trailing_md_op)) {
// A server send will never be matched if the client is waiting
// for trailing metadata already
complete_if_batch_end_locked(
- exec_ctx, s, GRPC_ERROR_NONE, s->send_message_op,
+ s, GRPC_ERROR_NONE, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
s->send_message_op = nullptr;
}
@@ -630,11 +615,11 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// The buffer is already in use; that's an error!
INPROC_LOG(GPR_DEBUG, "Extra trailing metadata %p", s);
new_err = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Extra trailing metadata");
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(new_err));
+ fail_helper_locked(s, GRPC_ERROR_REF(new_err));
goto done;
} else {
if (!other || !other->closed) {
- fill_in_metadata(exec_ctx, s,
+ fill_in_metadata(s,
s->send_trailing_md_op->payload->send_trailing_metadata
.send_trailing_metadata,
0, dest, nullptr, destfilled);
@@ -643,15 +628,15 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) {
INPROC_LOG(GPR_DEBUG,
"op_state_machine %p scheduling trailing-md-on-complete", s);
- GRPC_CLOSURE_SCHED(exec_ctx, s->recv_trailing_md_op->on_complete,
+ GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete,
GRPC_ERROR_NONE);
s->recv_trailing_md_op = nullptr;
needs_close = true;
}
}
- maybe_schedule_op_closure_locked(exec_ctx, other, GRPC_ERROR_NONE);
+ maybe_schedule_op_closure_locked(other, GRPC_ERROR_NONE);
complete_if_batch_end_locked(
- exec_ctx, s, GRPC_ERROR_NONE, s->send_trailing_md_op,
+ s, GRPC_ERROR_NONE, s->send_trailing_md_op,
"op_state_machine scheduling send-trailing-metadata-on-complete");
s->send_trailing_md_op = nullptr;
}
@@ -664,14 +649,14 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
"op_state_machine %p scheduling on_complete errors for already "
"recvd initial md %p",
s, new_err);
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(new_err));
+ fail_helper_locked(s, GRPC_ERROR_REF(new_err));
goto done;
}
if (s->to_read_initial_md_filled) {
s->initial_md_recvd = true;
new_err = fill_in_metadata(
- exec_ctx, s, &s->to_read_initial_md, s->to_read_initial_md_flags,
+ s, &s->to_read_initial_md, s->to_read_initial_md_flags,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata,
s->recv_initial_md_op->payload->recv_initial_metadata.recv_flags,
@@ -684,17 +669,16 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
.trailing_metadata_available =
(other != nullptr && other->send_trailing_md_op != nullptr);
}
- grpc_metadata_batch_clear(exec_ctx, &s->to_read_initial_md);
+ grpc_metadata_batch_clear(&s->to_read_initial_md);
s->to_read_initial_md_filled = false;
INPROC_LOG(GPR_DEBUG,
"op_state_machine %p scheduling initial-metadata-ready %p", s,
new_err);
- GRPC_CLOSURE_SCHED(exec_ctx,
- s->recv_initial_md_op->payload->recv_initial_metadata
+ GRPC_CLOSURE_SCHED(s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata_ready,
GRPC_ERROR_REF(new_err));
complete_if_batch_end_locked(
- exec_ctx, s, new_err, s->recv_initial_md_op,
+ s, new_err, s->recv_initial_md_op,
"op_state_machine scheduling recv-initial-metadata-on-complete");
s->recv_initial_md_op = nullptr;
@@ -702,20 +686,20 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
INPROC_LOG(GPR_DEBUG,
"op_state_machine %p scheduling on_complete errors2 %p", s,
new_err);
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(new_err));
+ fail_helper_locked(s, GRPC_ERROR_REF(new_err));
goto done;
}
}
}
if (s->recv_message_op) {
if (other && other->send_message_op) {
- message_transfer_locked(exec_ctx, other, s);
- maybe_schedule_op_closure_locked(exec_ctx, other, GRPC_ERROR_NONE);
+ message_transfer_locked(other, s);
+ maybe_schedule_op_closure_locked(other, GRPC_ERROR_NONE);
}
}
if (s->recv_trailing_md_op && s->t->is_client && other &&
other->send_message_op) {
- maybe_schedule_op_closure_locked(exec_ctx, other, GRPC_ERROR_NONE);
+ maybe_schedule_op_closure_locked(other, GRPC_ERROR_NONE);
}
if (s->to_read_trailing_md_filled) {
if (s->trailing_md_recvd) {
@@ -726,7 +710,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
"op_state_machine %p scheduling on_complete errors for already "
"recvd trailing md %p",
s, new_err);
- fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(new_err));
+ fail_helper_locked(s, GRPC_ERROR_REF(new_err));
goto done;
}
if (s->recv_message_op != nullptr) {
@@ -734,11 +718,10 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// satisfied
INPROC_LOG(GPR_DEBUG, "op_state_machine %p scheduling message-ready", s);
GRPC_CLOSURE_SCHED(
- exec_ctx,
s->recv_message_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
complete_if_batch_end_locked(
- exec_ctx, s, new_err, s->recv_message_op,
+ s, new_err, s->recv_message_op,
"op_state_machine scheduling recv-message-on-complete");
s->recv_message_op = nullptr;
}
@@ -746,7 +729,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// Nothing further will try to receive from this stream, so finish off
// any outstanding send_message op
complete_if_batch_end_locked(
- exec_ctx, s, new_err, s->send_message_op,
+ s, new_err, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
s->send_message_op = nullptr;
}
@@ -754,11 +737,11 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// We wanted trailing metadata and we got it
s->trailing_md_recvd = true;
new_err =
- fill_in_metadata(exec_ctx, s, &s->to_read_trailing_md, 0,
+ fill_in_metadata(s, &s->to_read_trailing_md, 0,
s->recv_trailing_md_op->payload
->recv_trailing_metadata.recv_trailing_metadata,
nullptr, nullptr);
- grpc_metadata_batch_clear(exec_ctx, &s->to_read_trailing_md);
+ grpc_metadata_batch_clear(&s->to_read_trailing_md);
s->to_read_trailing_md_filled = false;
// We should schedule the recv_trailing_md_op completion if
@@ -770,7 +753,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
INPROC_LOG(GPR_DEBUG,
"op_state_machine %p scheduling trailing-md-on-complete %p",
s, new_err);
- GRPC_CLOSURE_SCHED(exec_ctx, s->recv_trailing_md_op->on_complete,
+ GRPC_CLOSURE_SCHED(s->recv_trailing_md_op->on_complete,
GRPC_ERROR_REF(new_err));
s->recv_trailing_md_op = nullptr;
needs_close = true;
@@ -791,10 +774,10 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// recv_message_op
INPROC_LOG(GPR_DEBUG, "op_state_machine %p scheduling message-ready", s);
GRPC_CLOSURE_SCHED(
- exec_ctx, s->recv_message_op->payload->recv_message.recv_message_ready,
+ s->recv_message_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
complete_if_batch_end_locked(
- exec_ctx, s, new_err, s->recv_message_op,
+ s, new_err, s->recv_message_op,
"op_state_machine scheduling recv-message-on-complete");
s->recv_message_op = nullptr;
}
@@ -803,7 +786,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
// Nothing further will try to receive from this stream, so finish off
// any outstanding send_message op
complete_if_batch_end_locked(
- exec_ctx, s, new_err, s->send_message_op,
+ s, new_err, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
s->send_message_op = nullptr;
}
@@ -819,22 +802,21 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
}
done:
if (needs_close) {
- close_other_side_locked(exec_ctx, s, "op_state_machine");
- close_stream_locked(exec_ctx, s);
+ close_other_side_locked(s, "op_state_machine");
+ close_stream_locked(s);
}
gpr_mu_unlock(mu);
GRPC_ERROR_UNREF(new_err);
}
-static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
- grpc_error* error) {
+static bool cancel_stream_locked(inproc_stream* s, grpc_error* error) {
bool ret = false; // was the cancel accepted
INPROC_LOG(GPR_DEBUG, "cancel_stream %p with %s", s,
grpc_error_string(error));
if (s->cancel_self_error == GRPC_ERROR_NONE) {
ret = true;
s->cancel_self_error = GRPC_ERROR_REF(error);
- maybe_schedule_op_closure_locked(exec_ctx, s, s->cancel_self_error);
+ maybe_schedule_op_closure_locked(s, s->cancel_self_error);
// Send trailing md to the other side indicating cancellation, even if we
// already have
s->trailing_md_sent = true;
@@ -848,15 +830,14 @@ static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
: &other->to_read_trailing_md;
bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled
: &other->to_read_trailing_md_filled;
- fill_in_metadata(exec_ctx, s, &cancel_md, 0, dest, nullptr, destfilled);
- grpc_metadata_batch_destroy(exec_ctx, &cancel_md);
+ fill_in_metadata(s, &cancel_md, 0, dest, nullptr, destfilled);
+ grpc_metadata_batch_destroy(&cancel_md);
if (other != nullptr) {
if (other->cancel_other_error == GRPC_ERROR_NONE) {
other->cancel_other_error = GRPC_ERROR_REF(s->cancel_self_error);
}
- maybe_schedule_op_closure_locked(exec_ctx, other,
- other->cancel_other_error);
+ maybe_schedule_op_closure_locked(other, other->cancel_other_error);
} else if (s->write_buffer_cancel_error == GRPC_ERROR_NONE) {
s->write_buffer_cancel_error = GRPC_ERROR_REF(s->cancel_self_error);
}
@@ -866,21 +847,20 @@ static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
// md, now's the chance
if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) {
complete_if_batch_end_locked(
- exec_ctx, s, s->cancel_self_error, s->recv_trailing_md_op,
+ s, s->cancel_self_error, s->recv_trailing_md_op,
"cancel_stream scheduling trailing-md-on-complete");
s->recv_trailing_md_op = nullptr;
}
}
- close_other_side_locked(exec_ctx, s, "cancel_stream:other_side");
- close_stream_locked(exec_ctx, s);
+ close_other_side_locked(s, "cancel_stream:other_side");
+ close_stream_locked(s);
GRPC_ERROR_UNREF(error);
return ret;
}
-static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void perform_stream_op(grpc_transport* gt, grpc_stream* gs,
grpc_transport_stream_op_batch* op) {
INPROC_LOG(GPR_DEBUG, "perform_stream_op %p %p %p", gt, gs, op);
inproc_stream* s = (inproc_stream*)gs;
@@ -906,7 +886,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
if (op->cancel_stream) {
// Call cancel_stream_locked without ref'ing the cancel_error because
// this function is responsible to make sure that that field gets unref'ed
- cancel_stream_locked(exec_ctx, s, op->payload->cancel_stream.cancel_error);
+ cancel_stream_locked(s, op->payload->cancel_stream.cancel_error);
// this op can complete without an error
} else if (s->cancel_self_error != GRPC_ERROR_NONE) {
// already self-canceled so still give it an error
@@ -946,8 +926,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
} else {
if (!other || !other->closed) {
fill_in_metadata(
- exec_ctx, s,
- op->payload->send_initial_metadata.send_initial_metadata,
+ s, op->payload->send_initial_metadata.send_initial_metadata,
op->payload->send_initial_metadata.send_initial_metadata_flags,
dest, destflags, destfilled);
}
@@ -959,7 +938,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
s->initial_md_sent = true;
}
}
- maybe_schedule_op_closure_locked(exec_ctx, other, error);
+ maybe_schedule_op_closure_locked(other, error);
}
}
@@ -999,7 +978,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
(op->recv_message && other && (other->send_message_op != nullptr)) ||
(s->to_read_trailing_md_filled || s->trailing_md_recvd)) {
if (!s->op_closure_scheduled) {
- GRPC_CLOSURE_SCHED(exec_ctx, &s->op_closure, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(&s->op_closure, GRPC_ERROR_NONE);
s->op_closure_scheduled = true;
}
} else {
@@ -1023,7 +1002,6 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
"perform_stream_op error %p scheduling initial-metadata-ready %p",
s, error);
GRPC_CLOSURE_SCHED(
- exec_ctx,
op->payload->recv_initial_metadata.recv_initial_metadata_ready,
GRPC_ERROR_REF(error));
}
@@ -1032,28 +1010,26 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
GPR_DEBUG,
"perform_stream_op error %p scheduling recv message-ready %p", s,
error);
- GRPC_CLOSURE_SCHED(exec_ctx,
- op->payload->recv_message.recv_message_ready,
+ GRPC_CLOSURE_SCHED(op->payload->recv_message.recv_message_ready,
GRPC_ERROR_REF(error));
}
}
INPROC_LOG(GPR_DEBUG, "perform_stream_op %p scheduling on_complete %p", s,
error);
- GRPC_CLOSURE_SCHED(exec_ctx, on_complete, GRPC_ERROR_REF(error));
+ GRPC_CLOSURE_SCHED(on_complete, GRPC_ERROR_REF(error));
}
if (needs_close) {
- close_other_side_locked(exec_ctx, s, "perform_stream_op:other_side");
- close_stream_locked(exec_ctx, s);
+ close_other_side_locked(s, "perform_stream_op:other_side");
+ close_stream_locked(s);
}
gpr_mu_unlock(mu);
GRPC_ERROR_UNREF(error);
}
-static void close_transport_locked(grpc_exec_ctx* exec_ctx,
- inproc_transport* t) {
+static void close_transport_locked(inproc_transport* t) {
INPROC_LOG(GPR_DEBUG, "close_transport %p %d", t, t->is_closed);
grpc_connectivity_state_set(
- exec_ctx, &t->connectivity, GRPC_CHANNEL_SHUTDOWN,
+ &t->connectivity, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Closing transport."),
"close transport");
if (!t->is_closed) {
@@ -1062,7 +1038,7 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
while (t->stream_list != nullptr) {
// cancel_stream_locked also adjusts stream list
cancel_stream_locked(
- exec_ctx, t->stream_list,
+ t->stream_list,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Transport closed"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
@@ -1070,14 +1046,13 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
}
}
-static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_transport_op* op) {
+static void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
inproc_transport* t = (inproc_transport*)gt;
INPROC_LOG(GPR_DEBUG, "perform_transport_op %p %p", t, op);
gpr_mu_lock(&t->mu->mu);
if (op->on_connectivity_state_change) {
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &t->connectivity, op->connectivity_state,
+ &t->connectivity, op->connectivity_state,
op->on_connectivity_state_change);
}
if (op->set_accept_stream) {
@@ -1085,7 +1060,7 @@ static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
t->accept_stream_data = op->set_accept_stream_user_data;
}
if (op->on_consumed) {
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
+ GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
}
bool do_close = false;
@@ -1099,71 +1074,67 @@ static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
}
if (do_close) {
- close_transport_locked(exec_ctx, t);
+ close_transport_locked(t);
}
gpr_mu_unlock(&t->mu->mu);
}
-static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs,
+static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_closure* then_schedule_closure) {
INPROC_LOG(GPR_DEBUG, "destroy_stream %p %p", gs, then_schedule_closure);
inproc_stream* s = (inproc_stream*)gs;
s->closure_at_destroy = then_schedule_closure;
- really_destroy_stream(exec_ctx, s);
+ really_destroy_stream(s);
}
-static void destroy_transport(grpc_exec_ctx* exec_ctx, grpc_transport* gt) {
+static void destroy_transport(grpc_transport* gt) {
inproc_transport* t = (inproc_transport*)gt;
INPROC_LOG(GPR_DEBUG, "destroy_transport %p", t);
gpr_mu_lock(&t->mu->mu);
- close_transport_locked(exec_ctx, t);
+ close_transport_locked(t);
gpr_mu_unlock(&t->mu->mu);
- unref_transport(exec_ctx, t->other_side);
- unref_transport(exec_ctx, t);
+ unref_transport(t->other_side);
+ unref_transport(t);
}
/*******************************************************************************
* INTEGRATION GLUE
*/
-static void set_pollset(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_pollset* pollset) {
+static void set_pollset(grpc_transport* gt, grpc_stream* gs,
+ grpc_pollset* pollset) {
// Nothing to do here
}
-static void set_pollset_set(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
- grpc_stream* gs, grpc_pollset_set* pollset_set) {
+static void set_pollset_set(grpc_transport* gt, grpc_stream* gs,
+ grpc_pollset_set* pollset_set) {
// Nothing to do here
}
-static grpc_endpoint* get_endpoint(grpc_exec_ctx* exec_ctx, grpc_transport* t) {
- return nullptr;
-}
+static grpc_endpoint* get_endpoint(grpc_transport* t) { return nullptr; }
/*******************************************************************************
* GLOBAL INIT AND DESTROY
*/
-static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
+static void do_nothing(void* arg, grpc_error* error) {}
void grpc_inproc_transport_init(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, nullptr,
grpc_schedule_on_exec_ctx);
g_empty_slice = grpc_slice_from_static_buffer(nullptr, 0);
grpc_slice key_tmp = grpc_slice_from_static_string(":path");
g_fake_path_key = grpc_slice_intern(key_tmp);
- grpc_slice_unref_internal(&exec_ctx, key_tmp);
+ grpc_slice_unref_internal(key_tmp);
g_fake_path_value = grpc_slice_from_static_string("/");
grpc_slice auth_tmp = grpc_slice_from_static_string(":authority");
g_fake_auth_key = grpc_slice_intern(auth_tmp);
- grpc_slice_unref_internal(&exec_ctx, auth_tmp);
+ grpc_slice_unref_internal(auth_tmp);
g_fake_auth_value = grpc_slice_from_static_string("inproc-fail");
- grpc_exec_ctx_finish(&exec_ctx);
}
static const grpc_transport_vtable inproc_vtable = {
@@ -1175,8 +1146,7 @@ static const grpc_transport_vtable inproc_vtable = {
/*******************************************************************************
* Main inproc transport functions
*/
-static void inproc_transports_create(grpc_exec_ctx* exec_ctx,
- grpc_transport** server_transport,
+static void inproc_transports_create(grpc_transport** server_transport,
const grpc_channel_args* server_args,
grpc_transport** client_transport,
const grpc_channel_args* client_args) {
@@ -1213,7 +1183,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
GRPC_API_TRACE("grpc_inproc_channel_create(server=%p, args=%p)", 2,
(server, args));
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
+ grpc_core::ExecCtx exec_ctx;
const grpc_channel_args* server_args = grpc_server_get_channel_args(server);
@@ -1228,30 +1198,26 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
grpc_transport* server_transport;
grpc_transport* client_transport;
- inproc_transports_create(&exec_ctx, &server_transport, server_args,
- &client_transport, client_args);
+ inproc_transports_create(&server_transport, server_args, &client_transport,
+ client_args);
- grpc_server_setup_transport(&exec_ctx, server, server_transport, nullptr,
- server_args);
- grpc_channel* channel =
- grpc_channel_create(&exec_ctx, "inproc", client_args,
- GRPC_CLIENT_DIRECT_CHANNEL, client_transport);
+ grpc_server_setup_transport(server, server_transport, nullptr, server_args);
+ grpc_channel* channel = grpc_channel_create(
+ "inproc", client_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport);
// Free up created channel args
- grpc_channel_args_destroy(&exec_ctx, client_args);
+ grpc_channel_args_destroy(client_args);
// Now finish scheduled operations
- grpc_exec_ctx_finish(&exec_ctx);
return channel;
}
void grpc_inproc_transport_shutdown(void) {
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- grpc_slice_unref_internal(&exec_ctx, g_empty_slice);
- grpc_slice_unref_internal(&exec_ctx, g_fake_path_key);
- grpc_slice_unref_internal(&exec_ctx, g_fake_path_value);
- grpc_slice_unref_internal(&exec_ctx, g_fake_auth_key);
- grpc_slice_unref_internal(&exec_ctx, g_fake_auth_value);
- grpc_exec_ctx_finish(&exec_ctx);
+ grpc_core::ExecCtx exec_ctx;
+ grpc_slice_unref_internal(g_empty_slice);
+ grpc_slice_unref_internal(g_fake_path_key);
+ grpc_slice_unref_internal(g_fake_path_value);
+ grpc_slice_unref_internal(g_fake_auth_key);
+ grpc_slice_unref_internal(g_fake_auth_value);
}