aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-11-13 15:37:58 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2017-11-14 01:36:28 -0800
commit75122c23578e24417dcf64081c737571a9fc2dbc (patch)
treef4b8491964ec0508a5826490628c9f87b82c3326 /src/core/ext
parent36cd68f0d543b9024c84eff82319890a791de7f6 (diff)
Address some PR comments
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/filters/client_channel/backup_poller.cc6
-rw-r--r--src/core/ext/filters/client_channel/channel_connectivity.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc8
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc2
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc14
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc2
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc2
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.cc36
-rw-r--r--src/core/ext/filters/max_age/max_age_filter.cc6
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.cc2
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc2
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc1
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc6
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc2
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc1
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc10
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.cc4
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc2
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.cc8
-rw-r--r--src/core/ext/transport/inproc/inproc_transport.cc3
24 files changed, 51 insertions, 80 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc
index 1b42f5d6a0..dbdcd53ef5 100644
--- a/src/core/ext/filters/client_channel/backup_poller.cc
+++ b/src/core/ext/filters/client_channel/backup_poller.cc
@@ -112,10 +112,10 @@ static void run_poller(void* arg, grpc_error* error) {
backup_poller_shutdown_unref(p);
return;
}
- grpc_error* err = grpc_pollset_work(p->pollset, NULL, grpc_exec_ctx_now());
+ grpc_error* err = grpc_pollset_work(p->pollset, NULL, ExecCtx::Get()->Now());
gpr_mu_unlock(p->pollset_mu);
GRPC_LOG_IF_ERROR("Run client channel backup poller", err);
- grpc_timer_init(&p->polling_timer, grpc_exec_ctx_now() + g_poll_interval_ms,
+ grpc_timer_init(&p->polling_timer, ExecCtx::Get()->Now() + g_poll_interval_ms,
&p->run_poller_closure);
}
@@ -137,7 +137,7 @@ void grpc_client_channel_start_backup_polling(
GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
grpc_schedule_on_exec_ctx);
grpc_timer_init(&g_poller->polling_timer,
- grpc_exec_ctx_now() + g_poll_interval_ms,
+ ExecCtx::Get()->Now() + g_poll_interval_ms,
&g_poller->run_poller_closure);
}
diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc
index 3069e66775..0ceedb9f86 100644
--- a/src/core/ext/filters/client_channel/channel_connectivity.cc
+++ b/src/core/ext/filters/client_channel/channel_connectivity.cc
@@ -41,14 +41,14 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
if (client_channel_elem->filter == &grpc_client_channel_filter) {
state = grpc_client_channel_check_connectivity_state(client_channel_elem,
try_to_connect);
- grpc_exec_ctx_finish();
+
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();
+
return GRPC_CHANNEL_SHUTDOWN;
}
@@ -241,6 +241,4 @@ void grpc_channel_watch_connectivity_state(
} else {
abort();
}
-
- grpc_exec_ctx_finish();
}
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 d4c58fb1e0..63cf417c4e 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
@@ -1122,7 +1122,7 @@ static void start_picking_locked(glb_lb_policy* glb_policy) {
if (glb_policy->lb_fallback_timeout_ms > 0 &&
glb_policy->serverlist == NULL && !glb_policy->fallback_timer_active) {
grpc_millis deadline =
- grpc_exec_ctx_now() + glb_policy->lb_fallback_timeout_ms;
+ 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,
@@ -1271,7 +1271,7 @@ static void maybe_restart_lb_call(glb_lb_policy* glb_policy) {
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_DEBUG, "[grpclb %p] Connection to LB server lost...",
glb_policy);
- grpc_millis timeout = next_try - grpc_exec_ctx_now();
+ grpc_millis timeout = next_try - ExecCtx::Get()->Now();
if (timeout > 0) {
gpr_log(GPR_DEBUG,
"[grpclb %p] ... retry_timer_active in %" PRIuPTR "ms.",
@@ -1297,7 +1297,7 @@ static void send_client_load_report_locked(void* arg, grpc_error* error);
static void schedule_next_client_load_report(glb_lb_policy* glb_policy) {
const grpc_millis next_client_load_report_time =
- grpc_exec_ctx_now() + glb_policy->client_stats_report_interval;
+ 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));
@@ -1392,7 +1392,7 @@ static void lb_call_init_locked(glb_lb_policy* glb_policy) {
grpc_millis deadline =
glb_policy->lb_call_timeout_ms == 0
? GRPC_MILLIS_INF_FUTURE
- : grpc_exec_ctx_now() + glb_policy->lb_call_timeout_ms;
+ : ExecCtx::Get()->Now() + glb_policy->lb_call_timeout_ms;
glb_policy->lb_call = grpc_channel_create_pollset_set_call(
glb_policy->lb_channel, NULL, GRPC_PROPAGATE_DEFAULTS,
glb_policy->base.interested_parties,
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 77d790aa38..f0543964ae 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
@@ -265,7 +265,7 @@ static void dns_ares_on_resolved_locked(void* arg, grpc_error* error) {
gpr_log(GPR_DEBUG, "dns resolution failed: %s", msg);
grpc_millis next_try =
grpc_backoff_step(&r->backoff_state).next_attempt_start_time;
- grpc_millis timeout = next_try - grpc_exec_ctx_now();
+ grpc_millis timeout = next_try - ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_retry_timer);
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 c57fac61a4..925223d189 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
@@ -101,18 +101,7 @@ static void grpc_ares_request_unref(grpc_ares_request* r) {
request */
if (gpr_unref(&r->pending_queries)) {
/* TODO(zyc): Sort results with RFC6724 before invoking on_done. */
- if (exec_ctx == NULL) {
- /* 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. */
- ExecCtx _local_exec_ctx;
- GRPC_CLOSURE_SCHED(r->on_done, r->error);
- grpc_exec_ctx_finish();
- } else {
- GRPC_CLOSURE_SCHED(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);
@@ -263,7 +252,6 @@ static void on_srv_query_done_cb(void* arg, int status, int timeouts,
}
}
grpc_ares_request_unref(r);
- grpc_exec_ctx_finish();
}
static const char g_service_config_attribute_prefix[] = "grpc_config=";
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 4463673e1f..10404ec4ef 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
@@ -163,7 +163,7 @@ static void dns_on_resolved_locked(void* arg, grpc_error* error) {
} else {
grpc_millis next_try =
grpc_backoff_step(&r->backoff_state).next_attempt_start_time;
- grpc_millis timeout = next_try - grpc_exec_ctx_now();
+ grpc_millis timeout = next_try - ExecCtx::Get()->Now();
gpr_log(GPR_INFO, "dns resolution failed (will retry): %s",
grpc_error_string(error));
GPR_ASSERT(!r->have_retry_timer);
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index c8583687d5..98f96b5750 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -458,7 +458,7 @@ static void maybe_start_connecting_locked(grpc_subchannel* c) {
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();
+ c->backoff_result.next_attempt_start_time - ExecCtx::Get()->Now();
if (time_til_next <= 0) {
gpr_log(GPR_INFO, "Retry immediately");
} else {
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index cb8e480734..fbab57769c 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -132,10 +132,8 @@ void grpc_subchannel_index_shutdown(void) {
void grpc_subchannel_index_unref(void) {
if (gpr_unref(&g_refcount)) {
- ExecCtx _local_exec_ctx;
gpr_mu_destroy(&g_mu);
- gpr_avl_unref(g_subchannel_index, exec_ctx);
- grpc_exec_ctx_finish();
+ gpr_avl_unref(g_subchannel_index, ExecCtx::Get());
}
}
@@ -145,12 +143,12 @@ 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, 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, ExecCtx::Get()), "index_find");
+ gpr_avl_unref(index, ExecCtx::Get());
return c;
}
@@ -166,11 +164,11 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
// 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, 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, ExecCtx::Get());
if (c != NULL) {
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
}
@@ -180,8 +178,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
} 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_ref(index, ExecCtx::Get()), subchannel_key_copy(key),
+ GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"),
+ ExecCtx::Get());
// it may happen (but it's expected to be unlikely)
// that some other thread has changed the index:
@@ -193,9 +192,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
}
gpr_mu_unlock(&g_mu);
- gpr_avl_unref(updated, exec_ctx);
+ gpr_avl_unref(updated, ExecCtx::Get());
}
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(index, ExecCtx::Get());
}
if (need_to_unref_constructed) {
@@ -212,21 +211,22 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
// 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, 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, ExecCtx::Get());
if (c != constructed) {
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(index, 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, ExecCtx::Get()), key, ExecCtx::Get());
gpr_mu_lock(&g_mu);
if (index.root == g_subchannel_index.root) {
@@ -235,8 +235,8 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
}
gpr_mu_unlock(&g_mu);
- gpr_avl_unref(updated, exec_ctx);
- gpr_avl_unref(index, exec_ctx);
+ gpr_avl_unref(updated, ExecCtx::Get());
+ gpr_avl_unref(index, ExecCtx::Get());
}
}
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 1b9ce3b996..015a3ce124 100644
--- a/src/core/ext/filters/max_age/max_age_filter.cc
+++ b/src/core/ext/filters/max_age/max_age_filter.cc
@@ -100,7 +100,7 @@ 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(&chand->max_idle_timer,
- grpc_exec_ctx_now() + chand->max_connection_idle,
+ ExecCtx::Get()->Now() + chand->max_connection_idle,
&chand->close_max_idle_channel);
}
}
@@ -121,7 +121,7 @@ static void start_max_age_timer_after_init(void* arg, grpc_error* error) {
chand->max_age_timer_pending = true;
GRPC_CHANNEL_STACK_REF(chand->channel_stack, "max_age max_age_timer");
grpc_timer_init(&chand->max_age_timer,
- grpc_exec_ctx_now() + chand->max_connection_age,
+ 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(NULL);
@@ -141,7 +141,7 @@ static void start_max_age_grace_timer_after_goaway_op(void* arg,
grpc_timer_init(&chand->max_age_grace_timer,
chand->max_connection_age_grace == GRPC_MILLIS_INF_FUTURE
? GRPC_MILLIS_INF_FUTURE
- : grpc_exec_ctx_now() + chand->max_connection_age_grace,
+ : 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(chand->channel_stack,
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 e7741f97d4..3afca884ca 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc
@@ -95,7 +95,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
- grpc_exec_ctx_finish();
+
return channel != NULL ? 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 37e6f1f30d..b0eff1c992 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
@@ -60,8 +60,6 @@ grpc_channel* grpc_insecure_channel_create_from_fd(
grpc_channel_args_destroy(final_args);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
-
return channel != NULL ? channel
: grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
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 a5da71a67c..bebc38c248 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
@@ -211,7 +211,6 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
- grpc_exec_ctx_finish();
}
return channel != NULL ? 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 6eb1e3491c..bbcfb1b195 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -132,7 +132,7 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
connection_state->handshake_mgr);
// TODO(roth): We should really get this timeout value from channel
// args instead of hard-coding it.
- const grpc_millis deadline = grpc_exec_ctx_now() + 120 * GPR_MS_PER_SEC;
+ const grpc_millis deadline = ExecCtx::Get()->Now() + 120 * GPR_MS_PER_SEC;
grpc_handshake_manager_do_handshake(connection_state->handshake_mgr, tcp,
state->args, deadline, acceptor,
on_handshake_done, connection_state);
@@ -161,10 +161,10 @@ static void tcp_server_shutdown_complete(void* arg, grpc_error* error) {
gpr_mu_unlock(&state->mu);
// Flush queued work before destroying handshaker factory, since that
// may do a synchronous unref.
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
if (destroy_done != NULL) {
destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error));
- grpc_exec_ctx_flush();
+ ExecCtx::Get()->Flush();
}
grpc_channel_args_destroy(state->args);
gpr_mu_destroy(&state->mu);
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 d7aad110b9..6cbb26a349 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc
@@ -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();
+
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 57a8316a58..e5419e5e6e 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
@@ -61,7 +61,6 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
grpc_server_setup_transport(server, transport, NULL, server_args);
grpc_chttp2_transport_start_reading(transport, NULL);
- grpc_exec_ctx_finish();
}
#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 dc7da96210..aeae8f42e3 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
@@ -76,7 +76,7 @@ done:
if (sc != NULL) {
GRPC_SECURITY_CONNECTOR_UNREF(&sc->base, "server");
}
- grpc_exec_ctx_finish();
+
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/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index ecf3cf69ef..e49e26fc35 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -530,7 +530,7 @@ static void init_transport(grpc_chttp2_transport* t,
t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING;
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
} else {
/* Use GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate there are no
@@ -2585,14 +2585,14 @@ static void init_keepalive_ping_locked(void* arg, grpc_error* error) {
} else {
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ 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(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
GRPC_CHTTP2_UNREF_TRANSPORT(t, "init keepalive ping");
@@ -2602,7 +2602,7 @@ 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(&t->keepalive_watchdog_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->keepalive_watchdog_fired_locked);
}
@@ -2614,7 +2614,7 @@ static void finish_keepalive_ping_locked(void* arg, grpc_error* error) {
grpc_timer_cancel(&t->keepalive_watchdog_timer);
GRPC_CHTTP2_REF_TRANSPORT(t, "init keepalive ping");
grpc_timer_init(&t->keepalive_ping_timer,
- grpc_exec_ctx_now() + t->keepalive_time,
+ ExecCtx::Get()->Now() + t->keepalive_time,
&t->init_keepalive_ping_locked);
}
}
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index 1609fa0532..e54d59b5fa 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -160,7 +160,7 @@ TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
.set_min_control_value(-1)
.set_max_control_value(25)
.set_integral_range(10)),
- last_pid_update_(grpc_exec_ctx_now()) {}
+ last_pid_update_(ExecCtx::Get()->Now()) {}
uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
FlowControlTrace trace("t updt sent", this, nullptr);
@@ -306,7 +306,7 @@ double TransportFlowControl::TargetLogBdp() {
}
double TransportFlowControl::SmoothLogBdp(double value) {
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = 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;
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc
index 1b0dc0dfaa..60172be9cb 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.cc
@@ -89,7 +89,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
grpc_chttp2_ack_ping(t, p->opaque_8bytes);
} else {
if (!t->is_client) {
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = 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;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index e225a0244a..efb6e54ce7 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -570,7 +570,7 @@ 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(), timeout_str);
+ grpc_http2_encode_timeout(deadline - ExecCtx::Get()->Now(), timeout_str);
mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT,
grpc_slice_from_copied_string(timeout_str));
hpack_enc(c, mdelem, st);
diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc
index 5731e9ff78..f7f83c9aee 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.cc
+++ b/src/core/ext/transport/chttp2/transport/parsing.cc
@@ -436,7 +436,7 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
}
if (timeout != GRPC_MILLIS_INF_FUTURE) {
grpc_chttp2_incoming_metadata_buffer_set_deadline(
- &s->metadata_buffer[0], grpc_exec_ctx_now() + timeout);
+ &s->metadata_buffer[0], ExecCtx::Get()->Now() + timeout);
}
GRPC_MDELEM_UNREF(md);
} else {
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index ec83633472..4f76c2eb23 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -68,7 +68,7 @@ static void maybe_initiate_ping(grpc_chttp2_transport* t) {
}
return;
}
- grpc_millis now = grpc_exec_ctx_now();
+ grpc_millis now = ExecCtx::Get()->Now();
grpc_millis next_allowed_ping =
t->ping_state.last_ping_sent_time +
t->ping_policy.min_sent_ping_interval_without_data;
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index bff0fb36ad..3411acc563 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -417,7 +417,6 @@ static void on_failed(bidirectional_stream* stream, int net_error) {
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
- grpc_exec_ctx_finish();
}
/*
@@ -444,7 +443,6 @@ static void on_canceled(bidirectional_stream* stream) {
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
- grpc_exec_ctx_finish();
}
/*
@@ -463,7 +461,6 @@ static void on_succeeded(bidirectional_stream* stream) {
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
GRPC_CRONET_STREAM_UNREF(s, "cronet transport");
- grpc_exec_ctx_finish();
}
/*
@@ -492,7 +489,6 @@ static void on_stream_ready(bidirectional_stream* stream) {
}
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
- grpc_exec_ctx_finish();
}
/*
@@ -548,7 +544,6 @@ static void on_response_headers_received(
}
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
- grpc_exec_ctx_finish();
}
/*
@@ -566,7 +561,6 @@ 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(s);
- grpc_exec_ctx_finish();
}
/*
@@ -608,7 +602,6 @@ static void on_read_completed(bidirectional_stream* stream, char* data,
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
}
- grpc_exec_ctx_finish();
}
/*
@@ -666,7 +659,6 @@ static void on_response_trailers_received(
gpr_mu_unlock(&s->mu);
execute_from_storage(s);
}
- grpc_exec_ctx_finish();
}
/*
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index 1c7f2873d1..a79b2b26b0 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -1107,7 +1107,6 @@ void grpc_inproc_transport_init(void) {
grpc_slice_unref_internal(auth_tmp);
g_fake_auth_value = grpc_slice_from_static_string("inproc-fail");
- grpc_exec_ctx_finish();
}
static const grpc_transport_vtable inproc_vtable = {
@@ -1182,7 +1181,6 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
grpc_channel_args_destroy(client_args);
// Now finish scheduled operations
- grpc_exec_ctx_finish();
return channel;
}
@@ -1194,5 +1192,4 @@ void grpc_inproc_transport_shutdown(void) {
grpc_slice_unref_internal(g_fake_path_value);
grpc_slice_unref_internal(g_fake_auth_key);
grpc_slice_unref_internal(g_fake_auth_value);
- grpc_exec_ctx_finish();
}