diff options
189 files changed, 943 insertions, 882 deletions
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc index dbdcd53ef5..ea9fb2cae1 100644 --- a/src/core/ext/filters/client_channel/backup_poller.cc +++ b/src/core/ext/filters/client_channel/backup_poller.cc @@ -112,10 +112,12 @@ static void run_poller(void* arg, grpc_error* error) { backup_poller_shutdown_unref(p); return; } - grpc_error* err = grpc_pollset_work(p->pollset, NULL, ExecCtx::Get()->Now()); + grpc_error* err = + grpc_pollset_work(p->pollset, NULL, grpc_core::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, ExecCtx::Get()->Now() + g_poll_interval_ms, + grpc_timer_init(&p->polling_timer, + grpc_core::ExecCtx::Get()->Now() + g_poll_interval_ms, &p->run_poller_closure); } @@ -137,7 +139,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, - ExecCtx::Get()->Now() + g_poll_interval_ms, + grpc_core::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 0ceedb9f86..c949e52bd4 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.cc +++ b/src/core/ext/filters/client_channel/channel_connectivity.cc @@ -33,7 +33,7 @@ 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)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_connectivity_state state; GRPC_API_TRACE( "grpc_channel_check_connectivity_state(channel=%p, try_to_connect=%d)", 2, @@ -198,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)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; state_watcher* w = (state_watcher*)gpr_malloc(sizeof(*w)); GRPC_API_TRACE( 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 63cf417c4e..e757777aec 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 = - ExecCtx::Get()->Now() + 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, @@ -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 - ExecCtx::Get()->Now(); + 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.", @@ -1297,7 +1297,8 @@ 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 = - ExecCtx::Get()->Now() + 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)); @@ -1392,7 +1393,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 - : ExecCtx::Get()->Now() + 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( 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 f0543964ae..5ac5d37a54 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 - ExecCtx::Get()->Now(); + 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); 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 925223d189..06af5bf0b2 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 @@ -213,7 +213,7 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts, 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; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_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"); 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 10404ec4ef..82cd28fb2b 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 - ExecCtx::Get()->Now(); + 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); diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index 98f96b5750..61adb984f3 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -458,7 +458,8 @@ 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 - ExecCtx::Get()->Now(); + c->backoff_result.next_attempt_start_time - + grpc_core::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 fbab57769c..b7b7472aff 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.cc +++ b/src/core/ext/filters/client_channel/subchannel_index.cc @@ -133,7 +133,7 @@ void grpc_subchannel_index_shutdown(void) { void grpc_subchannel_index_unref(void) { if (gpr_unref(&g_refcount)) { gpr_mu_destroy(&g_mu); - gpr_avl_unref(g_subchannel_index, ExecCtx::Get()); + gpr_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get()); } } @@ -143,12 +143,13 @@ 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, ExecCtx::Get()); + 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, ExecCtx::Get()), "index_find"); - gpr_avl_unref(index, ExecCtx::Get()); + (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()), + "index_find"); + gpr_avl_unref(index, grpc_core::ExecCtx::Get()); return c; } @@ -164,11 +165,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, ExecCtx::Get()); + 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, ExecCtx::Get()); + c = (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()); if (c != NULL) { c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register"); } @@ -177,10 +178,11 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key, need_to_unref_constructed = true; } else { // no -> update the avl and compare/swap - gpr_avl updated = gpr_avl_add( - gpr_avl_ref(index, ExecCtx::Get()), subchannel_key_copy(key), - GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), - ExecCtx::Get()); + 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: @@ -192,9 +194,9 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key, } gpr_mu_unlock(&g_mu); - gpr_avl_unref(updated, ExecCtx::Get()); + gpr_avl_unref(updated, grpc_core::ExecCtx::Get()); } - gpr_avl_unref(index, ExecCtx::Get()); + gpr_avl_unref(index, grpc_core::ExecCtx::Get()); } if (need_to_unref_constructed) { @@ -211,22 +213,23 @@ 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, ExecCtx::Get()); + 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, ExecCtx::Get()); + (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()); if (c != constructed) { - gpr_avl_unref(index, ExecCtx::Get()); + 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, ExecCtx::Get()), key, ExecCtx::Get()); + 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) { @@ -235,8 +238,8 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key, } gpr_mu_unlock(&g_mu); - gpr_avl_unref(updated, ExecCtx::Get()); - gpr_avl_unref(index, ExecCtx::Get()); + gpr_avl_unref(updated, grpc_core::ExecCtx::Get()); + gpr_avl_unref(index, grpc_core::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 015a3ce124..f89e8c730d 100644 --- a/src/core/ext/filters/max_age/max_age_filter.cc +++ b/src/core/ext/filters/max_age/max_age_filter.cc @@ -99,9 +99,10 @@ static void increase_call_count(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(&chand->max_idle_timer, - ExecCtx::Get()->Now() + 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); } } @@ -121,7 +122,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, - ExecCtx::Get()->Now() + chand->max_connection_age, + 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(NULL); @@ -138,11 +139,12 @@ static void start_max_age_grace_timer_after_goaway_op(void* 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(&chand->max_age_grace_timer, - chand->max_connection_age_grace == GRPC_MILLIS_INF_FUTURE - ? GRPC_MILLIS_INF_FUTURE - : ExecCtx::Get()->Now() + chand->max_connection_age_grace, - &chand->force_close_max_age_channel); + grpc_timer_init( + &chand->max_age_grace_timer, + chand->max_connection_age_grace == GRPC_MILLIS_INF_FUTURE + ? GRPC_MILLIS_INF_FUTURE + : 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(chand->channel_stack, "max_age start_max_age_grace_timer_after_goaway_op"); 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 3afca884ca..fec61281c3 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -80,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) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE( "grpc_insecure_channel_create(target=%s, args=%p, reserved=%p)", 3, (target, args, reserved)); 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 b0eff1c992..c713ce1960 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) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3, (target, fd, args)); 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 bebc38c248..a328126263 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 @@ -190,7 +190,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds, const char* target, const grpc_channel_args* args, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE( "grpc_secure_channel_create(creds=%p, target=%s, args=%p, " "reserved=%p)", diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index bbcfb1b195..97b6ad38de 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -132,7 +132,8 @@ 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 = ExecCtx::Get()->Now() + 120 * GPR_MS_PER_SEC; + const grpc_millis deadline = + grpc_core::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 +162,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. - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); if (destroy_done != NULL) { destroy_done->cb(destroy_done->cb_arg, GRPC_ERROR_REF(error)); - ExecCtx::Get()->Flush(); + grpc_core::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 6cbb26a349..826886c961 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc @@ -26,7 +26,7 @@ #include "src/core/lib/surface/server.h" int grpc_server_add_insecure_http2_port(grpc_server* server, const char* addr) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; int port_num = 0; GRPC_API_TRACE("grpc_server_add_insecure_http2_port(server=%p, addr=%s)", 2, (server, addr)); 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 e5419e5e6e..11b3d710df 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,7 +38,7 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server, void* reserved, int fd) { GPR_ASSERT(reserved == NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; char* name; gpr_asprintf(&name, "fd:%d", 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 aeae8f42e3..827f0020bb 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) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_error* err = GRPC_ERROR_NONE; grpc_server_security_connector* sc = NULL; int port_num = 0; diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index e49e26fc35..a2861dfd6f 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, - ExecCtx::Get()->Now() + t->keepalive_time, + 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 @@ -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, - ExecCtx::Get()->Now() + t->keepalive_time, + 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(&t->keepalive_ping_timer, - ExecCtx::Get()->Now() + t->keepalive_time, + grpc_core::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, - ExecCtx::Get()->Now() + t->keepalive_time, + grpc_core::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, - ExecCtx::Get()->Now() + t->keepalive_time, + grpc_core::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 e54d59b5fa..14f089859e 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_(ExecCtx::Get()->Now()) {} + last_pid_update_(grpc_core::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 = ExecCtx::Get()->Now(); + 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; diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.cc b/src/core/ext/transport/chttp2/transport/frame_ping.cc index 60172be9cb..298a56721a 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 = ExecCtx::Get()->Now(); + 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; diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index efb6e54ce7..2f9849c09a 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -570,7 +570,8 @@ 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 - ExecCtx::Get()->Now(), timeout_str); + grpc_http2_encode_timeout(deadline - grpc_core::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 f7f83c9aee..f73b498d40 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], ExecCtx::Get()->Now() + timeout); + &s->metadata_buffer[0], grpc_core::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 4f76c2eb23..ddcac45d83 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 = ExecCtx::Get()->Now(); + 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; 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 f634627f03..8e1dcc542e 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,6 +49,6 @@ GRPCAPI grpc_channel* grpc_cronet_secure_channel_create( grpc_transport* ct = grpc_create_cronet_transport(engine, target, args, reserved); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_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 3411acc563..971071e387 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -398,7 +398,7 @@ static void execute_from_storage(stream_obj* s) { */ static void on_failed(bidirectional_stream* stream, int net_error) { CRONET_LOG(GPR_DEBUG, "on_failed(%p, %d)", stream, net_error); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; stream_obj* s = (stream_obj*)stream->annotation; gpr_mu_lock(&s->mu); @@ -424,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); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; stream_obj* s = (stream_obj*)stream->annotation; gpr_mu_lock(&s->mu); @@ -450,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); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; stream_obj* s = (stream_obj*)stream->annotation; gpr_mu_lock(&s->mu); @@ -468,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); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; stream_obj* s = (stream_obj*)stream->annotation; grpc_cronet_transport* t = (grpc_cronet_transport*)s->curr_ct; gpr_mu_lock(&s->mu); @@ -498,7 +498,7 @@ static void on_response_headers_received( bidirectional_stream* stream, const bidirectional_stream_header_array* headers, const char* negotiated_protocol) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_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; @@ -550,7 +550,7 @@ static void on_response_headers_received( Cronet callback */ static void on_write_completed(bidirectional_stream* stream, const char* data) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_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); @@ -568,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) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; stream_obj* s = (stream_obj*)stream->annotation; CRONET_LOG(GPR_DEBUG, "R: on_read_completed(%p, %p, %d)", stream, data, count); @@ -610,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) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; CRONET_LOG(GPR_DEBUG, "R: on_response_trailers_received(%p,%p)", stream, trailers); stream_obj* s = (stream_obj*)stream->annotation; diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index a79b2b26b0..e303f5ac0d 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -1091,7 +1091,7 @@ static grpc_endpoint* get_endpoint(grpc_transport* t) { return NULL; } static void do_nothing(void* arg, grpc_error* error) {} void grpc_inproc_transport_init(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, NULL, grpc_schedule_on_exec_ctx); g_empty_slice = grpc_slice_from_static_buffer(NULL, 0); @@ -1155,7 +1155,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server, GRPC_API_TRACE("grpc_inproc_channel_create(server=%p, args=%p)", 2, (server, args)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; const grpc_channel_args* server_args = grpc_server_get_channel_args(server); @@ -1186,7 +1186,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server, } void grpc_inproc_transport_shutdown(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_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); diff --git a/src/core/lib/backoff/backoff.cc b/src/core/lib/backoff/backoff.cc index b75ce79d46..da3b9b1b2d 100644 --- a/src/core/lib/backoff/backoff.cc +++ b/src/core/lib/backoff/backoff.cc @@ -36,7 +36,7 @@ grpc_backoff_result grpc_backoff_begin(grpc_backoff* backoff) { backoff->current_backoff = backoff->initial_backoff; const grpc_millis initial_timeout = GPR_MAX(backoff->initial_backoff, backoff->min_connect_timeout); - const grpc_millis now = ExecCtx::Get()->Now(); + const grpc_millis now = grpc_core::ExecCtx::Get()->Now(); const grpc_backoff_result result = {now + initial_timeout, now + backoff->current_backoff}; return result; @@ -67,7 +67,7 @@ grpc_backoff_result grpc_backoff_step(grpc_backoff* backoff) { backoff->min_connect_timeout); const grpc_millis next_timeout = GPR_MIN( (grpc_millis)(backoff->current_backoff + jitter), backoff->max_backoff); - const grpc_millis now = ExecCtx::Get()->Now(); + const grpc_millis now = grpc_core::ExecCtx::Get()->Now(); const grpc_backoff_result result = {now + current_timeout, now + next_timeout}; return result; diff --git a/src/core/lib/compression/stream_compression_gzip.cc b/src/core/lib/compression/stream_compression_gzip.cc index 3fae3490ce..4aaef4e128 100644 --- a/src/core/lib/compression/stream_compression_gzip.cc +++ b/src/core/lib/compression/stream_compression_gzip.cc @@ -40,7 +40,7 @@ static bool gzip_flate(grpc_stream_compression_context_gzip* ctx, /* Full flush is not allowed when inflating. */ GPR_ASSERT(!(ctx->flate == inflate && (flush == Z_FINISH))); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; int r; bool eoc = false; size_t original_max_output_size = max_output_size; diff --git a/src/core/lib/debug/stats.h b/src/core/lib/debug/stats.h index 24b0084130..6b36f67172 100644 --- a/src/core/lib/debug/stats.h +++ b/src/core/lib/debug/stats.h @@ -35,7 +35,7 @@ typedef struct grpc_stats_data { extern grpc_stats_data* grpc_stats_per_cpu_storage; #define GRPC_THREAD_STATS_DATA() \ - (&grpc_stats_per_cpu_storage[ExecCtx::Get()->starting_cpu()]) + (&grpc_stats_per_cpu_storage[grpc_core::ExecCtx::Get()->starting_cpu()]) #define GRPC_STATS_INC_COUNTER(ctr) \ (gpr_atm_no_barrier_fetch_add(&GRPC_THREAD_STATS_DATA()->counters[(ctr)], 1)) diff --git a/src/core/lib/iomgr/block_annotate.h b/src/core/lib/iomgr/block_annotate.h index 7783da0c14..55bde3eaac 100644 --- a/src/core/lib/iomgr/block_annotate.h +++ b/src/core/lib/iomgr/block_annotate.h @@ -41,18 +41,18 @@ void gpr_thd_end_blocking_region(); do { \ gpr_thd_start_blocking_region(); \ } while (0) -#define GRPC_SCHEDULING_END_BLOCKING_REGION \ - do { \ - gpr_thd_end_blocking_region(); \ - ExecCtx::Get()->InvalidateNow(); \ +#define GRPC_SCHEDULING_END_BLOCKING_REGION \ + do { \ + gpr_thd_end_blocking_region(); \ + grpc_core::ExecCtx::Get()->InvalidateNow(); \ } while (0) #else #define GRPC_SCHEDULING_START_BLOCKING_REGION \ do { \ } while (0) -#define GRPC_SCHEDULING_END_BLOCKING_REGION \ - do { \ - ExecCtx::Get()->InvalidateNow(); \ +#define GRPC_SCHEDULING_END_BLOCKING_REGION \ + do { \ + grpc_core::ExecCtx::Get()->InvalidateNow(); \ } while (0) #endif diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc index c9f5448630..6cc4eef1d8 100644 --- a/src/core/lib/iomgr/combiner.cc +++ b/src/core/lib/iomgr/combiner.cc @@ -129,23 +129,23 @@ grpc_combiner* grpc_combiner_ref(grpc_combiner* lock GRPC_COMBINER_DEBUG_ARGS) { static void push_last_on_exec_ctx(grpc_combiner* lock) { lock->next_combiner_on_this_exec_ctx = nullptr; - if (ExecCtx::Get()->combiner_data()->active_combiner == nullptr) { - ExecCtx::Get()->combiner_data()->active_combiner = - ExecCtx::Get()->combiner_data()->last_combiner = lock; + if (grpc_core::ExecCtx::Get()->combiner_data()->active_combiner == nullptr) { + grpc_core::ExecCtx::Get()->combiner_data()->active_combiner = + grpc_core::ExecCtx::Get()->combiner_data()->last_combiner = lock; } else { - ExecCtx::Get() + grpc_core::ExecCtx::Get() ->combiner_data() ->last_combiner->next_combiner_on_this_exec_ctx = lock; - ExecCtx::Get()->combiner_data()->last_combiner = lock; + grpc_core::ExecCtx::Get()->combiner_data()->last_combiner = lock; } } static void push_first_on_exec_ctx(grpc_combiner* lock) { lock->next_combiner_on_this_exec_ctx = - ExecCtx::Get()->combiner_data()->active_combiner; - ExecCtx::Get()->combiner_data()->active_combiner = lock; + grpc_core::ExecCtx::Get()->combiner_data()->active_combiner; + grpc_core::ExecCtx::Get()->combiner_data()->active_combiner = lock; if (lock->next_combiner_on_this_exec_ctx == NULL) { - ExecCtx::Get()->combiner_data()->last_combiner = lock; + grpc_core::ExecCtx::Get()->combiner_data()->last_combiner = lock; } } @@ -165,7 +165,7 @@ static void combiner_exec(grpc_closure* cl, grpc_error* error) { GRPC_STATS_INC_COMBINER_LOCKS_INITIATED(); GPR_TIMER_MARK("combiner.initiated", 0); gpr_atm_no_barrier_store(&lock->initiating_exec_ctx_or_null, - (gpr_atm)ExecCtx::Get()); + (gpr_atm)grpc_core::ExecCtx::Get()); // first element on this list: add it to the list of combiner locks // executing within this exec_ctx push_last_on_exec_ctx(lock); @@ -174,7 +174,7 @@ static void combiner_exec(grpc_closure* cl, grpc_error* error) { // offload for one or two actions, and that's fine gpr_atm initiator = gpr_atm_no_barrier_load(&lock->initiating_exec_ctx_or_null); - if (initiator != 0 && initiator != (gpr_atm)ExecCtx::Get()) { + if (initiator != 0 && initiator != (gpr_atm)grpc_core::ExecCtx::Get()) { gpr_atm_no_barrier_store(&lock->initiating_exec_ctx_or_null, 0); } } @@ -186,12 +186,12 @@ static void combiner_exec(grpc_closure* cl, grpc_error* error) { } static void move_next() { - ExecCtx::Get()->combiner_data()->active_combiner = - ExecCtx::Get() + grpc_core::ExecCtx::Get()->combiner_data()->active_combiner = + grpc_core::ExecCtx::Get() ->combiner_data() ->active_combiner->next_combiner_on_this_exec_ctx; - if (ExecCtx::Get()->combiner_data()->active_combiner == NULL) { - ExecCtx::Get()->combiner_data()->last_combiner = NULL; + if (grpc_core::ExecCtx::Get()->combiner_data()->active_combiner == NULL) { + grpc_core::ExecCtx::Get()->combiner_data()->last_combiner = NULL; } } @@ -209,7 +209,8 @@ static void queue_offload(grpc_combiner* lock) { bool grpc_combiner_continue_exec_ctx() { GPR_TIMER_BEGIN("combiner.continue_exec_ctx", 0); - grpc_combiner* lock = ExecCtx::Get()->combiner_data()->active_combiner; + grpc_combiner* lock = + grpc_core::ExecCtx::Get()->combiner_data()->active_combiner; if (lock == NULL) { GPR_TIMER_END("combiner.continue_exec_ctx", 0); return false; @@ -224,10 +225,10 @@ bool grpc_combiner_continue_exec_ctx() { "exec_ctx_ready_to_finish=%d " "time_to_execute_final_list=%d", lock, contended, - ExecCtx::Get()->IsReadyToFinish(), + grpc_core::ExecCtx::Get()->IsReadyToFinish(), lock->time_to_execute_final_list)); - if (contended && ExecCtx::Get()->IsReadyToFinish() && + if (contended && grpc_core::ExecCtx::Get()->IsReadyToFinish() && grpc_executor_is_threaded()) { GPR_TIMER_MARK("offload_from_finished_exec_ctx", 0); // this execution context wants to move on: schedule remaining work to be @@ -333,11 +334,11 @@ static void combiner_finally_exec(grpc_closure* closure, grpc_error* error) { GRPC_STATS_INC_COMBINER_LOCKS_SCHEDULED_FINAL_ITEMS(); grpc_combiner* lock = COMBINER_FROM_CLOSURE_SCHEDULER(closure, finally_scheduler); - GRPC_COMBINER_TRACE( - gpr_log(GPR_DEBUG, "C:%p grpc_combiner_execute_finally c=%p; ac=%p", lock, - closure, ExecCtx::Get()->combiner_data()->active_combiner)); + GRPC_COMBINER_TRACE(gpr_log( + GPR_DEBUG, "C:%p grpc_combiner_execute_finally c=%p; ac=%p", lock, + closure, grpc_core::ExecCtx::Get()->combiner_data()->active_combiner)); GPR_TIMER_BEGIN("combiner.execute_finally", 0); - if (ExecCtx::Get()->combiner_data()->active_combiner != lock) { + if (grpc_core::ExecCtx::Get()->combiner_data()->active_combiner != lock) { GPR_TIMER_MARK("slowpath", 0); GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(enqueue_finally, closure, grpc_combiner_scheduler(lock)), diff --git a/src/core/lib/iomgr/endpoint_pair_posix.cc b/src/core/lib/iomgr/endpoint_pair_posix.cc index 1a281322a8..65db4a9675 100644 --- a/src/core/lib/iomgr/endpoint_pair_posix.cc +++ b/src/core/lib/iomgr/endpoint_pair_posix.cc @@ -54,7 +54,7 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char* name, char* final_name; create_sockets(sv); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_asprintf(&final_name, "%s:client", name); p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name), args, diff --git a/src/core/lib/iomgr/endpoint_pair_windows.cc b/src/core/lib/iomgr/endpoint_pair_windows.cc index e0f211cdf9..afd91c9932 100644 --- a/src/core/lib/iomgr/endpoint_pair_windows.cc +++ b/src/core/lib/iomgr/endpoint_pair_windows.cc @@ -72,7 +72,7 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( SOCKET sv[2]; grpc_endpoint_pair p; create_sockets(sv); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; p.client = grpc_tcp_create(grpc_winsocket_create(sv[1], "endpoint:client"), channel_args, "endpoint:server"); p.server = grpc_tcp_create(grpc_winsocket_create(sv[0], "endpoint:server"), diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 2b486887b8..f22fb82797 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -554,7 +554,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { static int poll_deadline_to_millis_timeout(grpc_millis millis) { if (millis == GRPC_MILLIS_INF_FUTURE) return -1; - grpc_millis delta = millis - ExecCtx::Get()->Now(); + grpc_millis delta = millis - grpc_core::ExecCtx::Get()->Now(); if (delta > INT_MAX) { return INT_MAX; } else if (delta < 0) { @@ -743,7 +743,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, SET_KICK_STATE(worker, KICKED); } } - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); } if (GRPC_TRACER_ON(grpc_polling_trace)) { @@ -848,7 +848,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, /* Make sure we appear kicked */ SET_KICK_STATE(worker, KICKED); grpc_closure_list_move(&worker->schedule_on_end_work, - ExecCtx::Get()->closure_list()); + grpc_core::ExecCtx::Get()->closure_list()); if (gpr_atm_no_barrier_load(&g_active_poller) == (gpr_atm)worker) { if (worker->next != worker && worker->next->state == UNKICKED) { if (GRPC_TRACER_ON(grpc_polling_trace)) { @@ -859,9 +859,9 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, SET_KICK_STATE(worker->next, DESIGNATED_POLLER); GRPC_STATS_INC_POLLSET_KICK_WAKEUP_CV(); gpr_cv_signal(&worker->next->cv); - if (ExecCtx::Get()->HasWork()) { + if (grpc_core::ExecCtx::Get()->HasWork()) { gpr_mu_unlock(&pollset->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->mu); } } else { @@ -892,12 +892,12 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, found_worker = check_neighborhood_for_available_poller(neighborhood); gpr_mu_unlock(&neighborhood->mu); } - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->mu); } - } else if (ExecCtx::Get()->HasWork()) { + } else if (grpc_core::ExecCtx::Get()->HasWork()) { gpr_mu_unlock(&pollset->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->mu); } if (worker->initialized_cv) { @@ -948,8 +948,8 @@ static grpc_error* pollset_work(grpc_pollset* ps, process_epoll_events() returns very quickly: It just queues the work on exec_ctx but does not execute it (the actual exectution or more - accurately ExecCtx::Get()->Flush() happens in end_worker() AFTER - selecting a designated poller). So we are not waiting long periods + accurately grpc_core::ExecCtx::Get()->Flush() happens in end_worker() + AFTER selecting a designated poller). So we are not waiting long periods without a designated poller */ if (gpr_atm_acq_load(&g_epoll_set.cursor) == gpr_atm_acq_load(&g_epoll_set.num_events)) { diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index 385b5f68d0..5b4edd1e74 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -682,7 +682,7 @@ static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) { static int poll_deadline_to_millis_timeout(grpc_millis millis) { if (millis == GRPC_MILLIS_INF_FUTURE) return -1; - grpc_millis delta = millis - ExecCtx::Get()->Now(); + grpc_millis delta = millis - grpc_core::ExecCtx::Get()->Now(); if (delta > INT_MAX) return INT_MAX; else if (delta < 0) @@ -902,7 +902,7 @@ static bool begin_worker(grpc_pollset* pollset, grpc_pollset_worker* worker, worker->pollable_obj, worker); } } - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); } else { gpr_mu_unlock(&pollset->mu); } @@ -970,8 +970,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset, gpr_log(GPR_DEBUG, "PS:%p work hdl=%p worker=%p now=%" PRIdPTR " deadline=%" PRIdPTR " kwp=%d pollable=%p", - pollset, worker_hdl, WORKER_PTR, ExecCtx::Get()->Now(), deadline, - pollset->kicked_without_poller, pollset->active_pollable); + pollset, worker_hdl, WORKER_PTR, grpc_core::ExecCtx::Get()->Now(), + deadline, pollset->kicked_without_poller, pollset->active_pollable); } static const char* err_desc = "pollset_work"; grpc_error* error = GRPC_ERROR_NONE; @@ -990,7 +990,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, &error, pollable_process_events(pollset, WORKER_PTR->pollable_obj, false), err_desc); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_tls_set(&g_current_thread_pollset, 0); gpr_tls_set(&g_current_thread_worker, 0); } diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc index a9b094a2fa..4ded7c0211 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.cc +++ b/src/core/lib/iomgr/ev_epollsig_linux.cc @@ -1090,7 +1090,7 @@ static void pollset_init(grpc_pollset* pollset, gpr_mu** mu) { static int poll_deadline_to_millis_timeout(grpc_millis millis) { if (millis == GRPC_MILLIS_INF_FUTURE) return -1; - grpc_millis delta = millis - ExecCtx::Get()->Now(); + grpc_millis delta = millis - grpc_core::ExecCtx::Get()->Now(); if (delta > INT_MAX) return INT_MAX; else if (delta < 0) @@ -1350,7 +1350,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, pollset_work_and_unlock(pollset, &worker, timeout_ms, &g_orig_sigmask, &error); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->po.mu); @@ -1373,7 +1373,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, finish_shutdown_locked(pollset); gpr_mu_unlock(&pollset->po.mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->po.mu); } diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index cab4f7547c..b6546aa4b4 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -1040,7 +1040,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, worker list, which means nobody could ask us to re-evaluate polling). */ done: if (!locked) { - queued_work |= ExecCtx::Get()->Flush(); + queued_work |= grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->mu); locked = 1; } @@ -1074,7 +1074,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, pollset->called_shutdown = 1; gpr_mu_unlock(&pollset->mu); finish_shutdown(pollset); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Continuing to access pollset here is safe -- it is the caller's * responsibility to not destroy when it has outstanding calls to * pollset_work. @@ -1083,7 +1083,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset, } else if (!grpc_closure_list_empty(pollset->idle_jobs)) { GRPC_CLOSURE_LIST_SCHED(&pollset->idle_jobs); gpr_mu_unlock(&pollset->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&pollset->mu); } } @@ -1110,7 +1110,7 @@ static void pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) { static int poll_deadline_to_millis_timeout(grpc_millis deadline) { if (deadline == GRPC_MILLIS_INF_FUTURE) return -1; if (deadline == 0) return 0; - grpc_millis n = deadline - ExecCtx::Get()->Now(); + grpc_millis n = deadline - grpc_core::ExecCtx::Get()->Now(); if (n < 0) return 0; if (n > INT_MAX) return -1; return (int)n; diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc index fe5a0e7e2d..de71c1cf9c 100644 --- a/src/core/lib/iomgr/exec_ctx.cc +++ b/src/core/lib/iomgr/exec_ctx.cc @@ -25,29 +25,6 @@ #include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/profiling/timers.h" -thread_local ExecCtx* exec_ctx = nullptr; - -ExecCtx::ExecCtx() : flags_(GRPC_EXEC_CTX_FLAG_IS_FINISHED) { exec_ctx = this; } -ExecCtx::ExecCtx(uintptr_t fl) : flags_(fl) { exec_ctx = this; } -ExecCtx::~ExecCtx() { - GPR_ASSERT(exec_ctx == this); - flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED; - Flush(); - exec_ctx = last_exec_ctx_; -} - -bool ExecCtx::IsReadyToFinish() { - if ((flags_ & GRPC_EXEC_CTX_FLAG_IS_FINISHED) == 0) { - if (CheckReadyToFinish()) { - flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED; - return true; - } - return false; - } else { - return true; - } -} - void exec_ctx_run(grpc_closure* closure, grpc_error* error) { #ifndef NDEBUG closure->scheduled = false; @@ -67,48 +44,16 @@ void exec_ctx_run(grpc_closure* closure, grpc_error* error) { GRPC_ERROR_UNREF(error); } -bool ExecCtx::Flush() { - bool did_something = 0; - GPR_TIMER_BEGIN("grpc_exec_ctx_flush", 0); - for (;;) { - if (!grpc_closure_list_empty(closure_list_)) { - grpc_closure* c = closure_list_.head; - closure_list_.head = closure_list_.tail = NULL; - while (c != NULL) { - grpc_closure* next = c->next_data.next; - grpc_error* error = c->error_data.error; - did_something = true; - exec_ctx_run(c, error); - c = next; - } - } else if (!grpc_combiner_continue_exec_ctx()) { - break; - } - } - GPR_ASSERT(combiner_data_.active_combiner == nullptr); - GPR_TIMER_END("grpc_exec_ctx_flush", 0); - return did_something; -} - -void exec_ctx_sched(grpc_closure* closure, grpc_error* error) { - grpc_closure_list_append(exec_ctx->closure_list(), closure, error); -} - static gpr_timespec g_start_time[GPR_TIMESPAN + 1]; // assumes GPR_TIMESPAN is the // last enum value in // gpr_clock_type -void ExecCtx::GlobalInit(void) { - for (int i = 0; i < GPR_TIMESPAN; i++) { - g_start_time[i] = gpr_now((gpr_clock_type)i); - } - // allows uniform treatment in conversion functions - g_start_time[GPR_TIMESPAN] = gpr_time_0(GPR_TIMESPAN); +void exec_ctx_sched(grpc_closure* closure, grpc_error* error) { + grpc_closure_list_append(grpc_core::ExecCtx::Get()->closure_list(), closure, + error); } -void ExecCtx::GlobalShutdown(void) {} - static gpr_atm timespec_to_atm_round_down(gpr_timespec ts) { ts = gpr_time_sub(ts, g_start_time[ts.clock_type]); double x = @@ -154,6 +99,47 @@ grpc_millis grpc_timespec_to_millis_round_up(gpr_timespec ts) { return timespec_to_atm_round_up(ts); } +static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = { + exec_ctx_run, exec_ctx_sched, "exec_ctx"}; +static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable}; +grpc_closure_scheduler* grpc_schedule_on_exec_ctx = &exec_ctx_scheduler; + +namespace grpc_core { +thread_local ExecCtx* ExecCtx::exec_ctx_ = nullptr; + +bool ExecCtx::Flush() { + bool did_something = 0; + GPR_TIMER_BEGIN("grpc_exec_ctx_flush", 0); + for (;;) { + if (!grpc_closure_list_empty(closure_list_)) { + grpc_closure* c = closure_list_.head; + closure_list_.head = closure_list_.tail = NULL; + while (c != NULL) { + grpc_closure* next = c->next_data.next; + grpc_error* error = c->error_data.error; + did_something = true; + exec_ctx_run(c, error); + c = next; + } + } else if (!grpc_combiner_continue_exec_ctx()) { + break; + } + } + GPR_ASSERT(combiner_data_.active_combiner == nullptr); + GPR_TIMER_END("grpc_exec_ctx_flush", 0); + return did_something; +} + +void ExecCtx::GlobalInit(void) { + for (int i = 0; i < GPR_TIMESPAN; i++) { + g_start_time[i] = gpr_now((gpr_clock_type)i); + } + // allows uniform treatment in conversion functions + g_start_time[GPR_TIMESPAN] = gpr_time_0(GPR_TIMESPAN); +} + +void ExecCtx::GlobalShutdown(void) {} + grpc_millis ExecCtx::Now() { if (!now_is_valid_) { now_ = timespec_to_atm_round_down(gpr_now(GPR_CLOCK_MONOTONIC)); @@ -162,9 +148,4 @@ grpc_millis ExecCtx::Now() { return now_; } -ExecCtx* ExecCtx::Get() { return exec_ctx; } - -static const grpc_closure_scheduler_vtable exec_ctx_scheduler_vtable = { - exec_ctx_run, exec_ctx_sched, "exec_ctx"}; -static grpc_closure_scheduler exec_ctx_scheduler = {&exec_ctx_scheduler_vtable}; -grpc_closure_scheduler* grpc_schedule_on_exec_ctx = &exec_ctx_scheduler; +} // namespace grpc_core diff --git a/src/core/lib/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h index a71e43e178..7b8da2f0af 100644 --- a/src/core/lib/iomgr/exec_ctx.h +++ b/src/core/lib/iomgr/exec_ctx.h @@ -46,6 +46,7 @@ typedef struct grpc_combiner grpc_combiner; should be given to not delete said call/channel from this exec_ctx */ #define GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP 2 +namespace grpc_core { /** Execution context. * A bag of data that collects information along a callstack. * Generally created at public API entry points, and passed down as @@ -68,10 +69,25 @@ typedef struct grpc_combiner grpc_combiner; */ class ExecCtx { public: - ExecCtx(); - ExecCtx(uintptr_t fl); - ~ExecCtx(); + /** Default Constructor */ + ExecCtx() : flags_(GRPC_EXEC_CTX_FLAG_IS_FINISHED) { exec_ctx_ = this; } + + /** Parameterised Constructor */ + ExecCtx(uintptr_t fl) : flags_(fl) { exec_ctx_ = this; } + + /** Destructor */ + ~ExecCtx() { + GPR_ASSERT(exec_ctx_ == this); + flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED; + Flush(); + exec_ctx_ = last_exec_ctx_; + } + + /** Disallow copy and assignment operators */ + ExecCtx(const ExecCtx&) = delete; + ExecCtx& operator=(const ExecCtx&) = delete; + /** Return starting_cpu */ unsigned starting_cpu() const { return starting_cpu_; } struct CombinerData { @@ -84,8 +100,13 @@ class ExecCtx { /** Only to be used by grpc-combiner code */ CombinerData* combiner_data() { return &combiner_data_; } + /** Return pointer to grpc_closure_list */ grpc_closure_list* closure_list() { return &closure_list_; } + /** Return flags */ + uintptr_t flags() { return flags_; } + + /** Checks if there is work to be done */ bool HasWork() { return combiner_data_.active_combiner != NULL || !grpc_closure_list_empty(closure_list_); @@ -99,32 +120,59 @@ class ExecCtx { /** Returns true if we'd like to leave this execution context as soon as possible: useful for deciding whether to do something more or not depending on outside context */ - bool IsReadyToFinish(); + bool IsReadyToFinish() { + if ((flags_ & GRPC_EXEC_CTX_FLAG_IS_FINISHED) == 0) { + if (CheckReadyToFinish()) { + flags_ |= GRPC_EXEC_CTX_FLAG_IS_FINISHED; + return true; + } + return false; + } else { + return true; + } + } + /** Returns the stored current time relative to start if valid, + * otherwise refreshes the stored time, sets it valid and returns the new + * value */ grpc_millis Now(); + /** Invalidates the stored time value. A new time value will be set on calling + * Now() */ void InvalidateNow() { now_is_valid_ = false; } - void SetNow(grpc_millis new_val) { - now_ = new_val; + /** To be used only by shutdown code in iomgr */ + void SetNowIomgrShutdown() { + now_ = GRPC_MILLIS_INF_FUTURE; now_is_valid_ = true; } - uintptr_t flags() { return flags_; } + /** To be used only for testing. + * Sets the now value + */ + void TestOnlySetNow(grpc_millis new_val) { + now_ = new_val; + now_is_valid_ = true; + } /** Finish any pending work for a grpc_exec_ctx. Must be called before * the instance is destroyed, or work may be lost. */ void Finish(); + /** Global initialization for ExecCtx. Called by iomgr */ static void GlobalInit(void); + /** Global shutdown for ExecCtx. Called by iomgr */ static void GlobalShutdown(void); - static ExecCtx* Get(); + /** Gets pointer to current exec_ctx */ + static ExecCtx* Get() { return exec_ctx_; } protected: + /** Check if ready to finish */ virtual bool CheckReadyToFinish() { return false; } + private: grpc_closure_list closure_list_ = GRPC_CLOSURE_LIST_INIT; CombinerData combiner_data_ = {nullptr, nullptr}; uintptr_t flags_; @@ -133,8 +181,10 @@ on outside context */ bool now_is_valid_ = false; grpc_millis now_ = 0; - ExecCtx* last_exec_ctx_ = Get(); + static thread_local ExecCtx* exec_ctx_; + ExecCtx* last_exec_ctx_ = exec_ctx_; }; +} // namespace grpc_core extern grpc_closure_scheduler* grpc_schedule_on_exec_ctx; diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc index bf8805a2cd..4db298c1c5 100644 --- a/src/core/lib/iomgr/executor.cc +++ b/src/core/lib/iomgr/executor.cc @@ -78,7 +78,7 @@ static size_t run_closures(grpc_closure_list list) { GRPC_ERROR_UNREF(error); c = next; n++; - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } return n; @@ -145,7 +145,7 @@ static void executor_thread(void* arg) { thread_state* ts = (thread_state*)arg; gpr_tls_set(&g_this_thread_state, (intptr_t)ts); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; size_t subtract_depth = 0; for (;;) { @@ -175,7 +175,7 @@ static void executor_thread(void* arg) { gpr_log(GPR_DEBUG, "EXECUTOR[%d]: execute", (int)(ts - g_thread_state)); } - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); subtract_depth = run_closures(exec); } } @@ -200,12 +200,14 @@ static void executor_push(grpc_closure* closure, grpc_error* error, gpr_log(GPR_DEBUG, "EXECUTOR: schedule %p inline", closure); #endif } - grpc_closure_list_append(ExecCtx::Get()->closure_list(), closure, error); + grpc_closure_list_append(grpc_core::ExecCtx::Get()->closure_list(), + closure, error); return; } thread_state* ts = (thread_state*)gpr_tls_get(&g_this_thread_state); if (ts == NULL) { - ts = &g_thread_state[GPR_HASH_POINTER(ExecCtx::Get(), cur_thread_count)]; + ts = &g_thread_state[GPR_HASH_POINTER(grpc_core::ExecCtx::Get(), + cur_thread_count)]; } else { GRPC_STATS_INC_EXECUTOR_SCHEDULED_TO_SELF(); } diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index 1686bf2872..f5c6297438 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -46,7 +46,7 @@ static DWORD deadline_to_millis_timeout(grpc_millis deadline) { if (deadline == GRPC_MILLIS_INF_FUTURE) { return INFINITE; } - grpc_millis now = ExecCtx::Get()->Now(); + grpc_millis now = grpc_core::ExecCtx::Get()->Now(); if (deadline < now) return 0; grpc_millis timeout = deadline - now; if (timeout > std::numeric_limits<DWORD>::max()) return INFINITE; @@ -65,7 +65,7 @@ grpc_iocp_work_status grpc_iocp_work(grpc_millis deadline) { success = GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key, &overlapped, deadline_to_millis_timeout(deadline)); - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); if (success == 0 && overlapped == NULL) { return GRPC_IOCP_WORK_TIMEOUT; } @@ -113,19 +113,20 @@ void grpc_iocp_kick(void) { } void grpc_iocp_flush(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_iocp_work_status work_status; do { work_status = grpc_iocp_work(GRPC_MILLIS_INF_PAST); - } while (work_status == GRPC_IOCP_WORK_KICK || ExecCtx::Get()->Flush()); + } while (work_status == GRPC_IOCP_WORK_KICK || + grpc_core::ExecCtx::Get()->Flush()); } void grpc_iocp_shutdown(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (gpr_atm_acq_load(&g_custom_events)) { grpc_iocp_work(GRPC_MILLIS_INF_FUTURE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GPR_ASSERT(CloseHandle(g_iocp)); diff --git a/src/core/lib/iomgr/iomgr.cc b/src/core/lib/iomgr/iomgr.cc index a1add4a303..9c74b5d1c3 100644 --- a/src/core/lib/iomgr/iomgr.cc +++ b/src/core/lib/iomgr/iomgr.cc @@ -49,7 +49,7 @@ void grpc_iomgr_init() { g_shutdown = 0; gpr_mu_init(&g_mu); gpr_cv_init(&g_rcv); - ExecCtx::GlobalInit(); + grpc_core::ExecCtx::GlobalInit(); grpc_executor_init(); grpc_timer_list_init(); g_root_object.next = g_root_object.prev = &g_root_object; @@ -98,10 +98,10 @@ void grpc_iomgr_shutdown() { } last_warning_time = gpr_now(GPR_CLOCK_REALTIME); } - ExecCtx::Get()->SetNow(GRPC_MILLIS_INF_FUTURE); + grpc_core::ExecCtx::Get()->SetNowIomgrShutdown(); if (grpc_timer_check(NULL) == GRPC_TIMERS_FIRED) { gpr_mu_unlock(&g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_iomgr_platform_flush(); gpr_mu_lock(&g_mu); continue; @@ -136,14 +136,14 @@ void grpc_iomgr_shutdown() { gpr_mu_unlock(&g_mu); grpc_timer_list_shutdown(); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* ensure all threads have left g_mu */ gpr_mu_lock(&g_mu); gpr_mu_unlock(&g_mu); grpc_iomgr_platform_shutdown(); - ExecCtx::GlobalShutdown(); + grpc_core::ExecCtx::GlobalShutdown(); grpc_network_status_shutdown(); gpr_mu_destroy(&g_mu); gpr_cv_destroy(&g_rcv); diff --git a/src/core/lib/iomgr/iomgr_uv.cc b/src/core/lib/iomgr/iomgr_uv.cc index 2ab414252a..5823bb7ec2 100644 --- a/src/core/lib/iomgr/iomgr_uv.cc +++ b/src/core/lib/iomgr/iomgr_uv.cc @@ -29,7 +29,7 @@ gpr_thd_id g_init_thread; void grpc_iomgr_platform_init(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_global_init(); grpc_register_tracer(&grpc_tcp_trace); grpc_executor_set_threading(false); diff --git a/src/core/lib/iomgr/pollset_uv.cc b/src/core/lib/iomgr/pollset_uv.cc index a68ad4a6e3..89d28a0f9d 100644 --- a/src/core/lib/iomgr/pollset_uv.cc +++ b/src/core/lib/iomgr/pollset_uv.cc @@ -124,7 +124,7 @@ grpc_error* grpc_pollset_work(grpc_pollset* pollset, GRPC_UV_ASSERT_SAME_THREAD(); gpr_mu_unlock(&grpc_polling_mu); if (grpc_pollset_work_run_loop) { - grpc_millis now = ExecCtx::Get()->Now(); + grpc_millis now = grpc_core::ExecCtx::Get()->Now(); if (deadline >= now) { timeout = deadline - now; } else { @@ -143,7 +143,7 @@ grpc_error* grpc_pollset_work(grpc_pollset* pollset, } } if (!grpc_closure_list_empty(exec_ctx->closure_list)) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } gpr_mu_lock(&grpc_polling_mu); return GRPC_ERROR_NONE; diff --git a/src/core/lib/iomgr/pollset_windows.cc b/src/core/lib/iomgr/pollset_windows.cc index 5ff3e7cb3a..81e1d009ca 100644 --- a/src/core/lib/iomgr/pollset_windows.cc +++ b/src/core/lib/iomgr/pollset_windows.cc @@ -129,7 +129,7 @@ grpc_error* grpc_pollset_work(grpc_pollset* pollset, g_active_poller = &worker; gpr_mu_unlock(&grpc_polling_mu); grpc_iocp_work(deadline); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&grpc_polling_mu); pollset->is_iocp_worker = 0; g_active_poller = NULL; @@ -160,10 +160,10 @@ grpc_error* grpc_pollset_work(grpc_pollset* pollset, while (!worker.kicked) { if (gpr_cv_wait(&worker.cv, &grpc_polling_mu, grpc_millis_to_timespec(deadline, GPR_CLOCK_REALTIME))) { - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); break; } - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); } } else { pollset->kicked_without_pollers = 0; @@ -171,7 +171,7 @@ grpc_error* grpc_pollset_work(grpc_pollset* pollset, done: if (!grpc_closure_list_empty(exec_ctx->closure_list)) { gpr_mu_unlock(&grpc_polling_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&grpc_polling_mu); } if (added_worker) { diff --git a/src/core/lib/iomgr/resolve_address_uv.cc b/src/core/lib/iomgr/resolve_address_uv.cc index ffd70c4f35..54adf9b9f6 100644 --- a/src/core/lib/iomgr/resolve_address_uv.cc +++ b/src/core/lib/iomgr/resolve_address_uv.cc @@ -114,7 +114,7 @@ static grpc_error* handle_addrinfo_result(int status, struct addrinfo* result, static void getaddrinfo_callback(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { request* r = (request*)req->data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_error* error; int retry_status; char* port = r->port; diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc index 8fee585f4b..11cb5ddbee 100644 --- a/src/core/lib/iomgr/resource_quota.cc +++ b/src/core/lib/iomgr/resource_quota.cc @@ -622,7 +622,7 @@ void grpc_resource_quota_unref_internal(grpc_resource_quota* resource_quota) { /* Public API */ void grpc_resource_quota_unref(grpc_resource_quota* resource_quota) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_quota_unref_internal(resource_quota); } @@ -647,7 +647,7 @@ double grpc_resource_quota_get_memory_pressure( /* Public API */ void grpc_resource_quota_resize(grpc_resource_quota* resource_quota, size_t size) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; rq_resize_args* a = (rq_resize_args*)gpr_malloc(sizeof(*a)); a->resource_quota = grpc_resource_quota_ref_internal(resource_quota); a->size = (int64_t)size; diff --git a/src/core/lib/iomgr/tcp_client_uv.cc b/src/core/lib/iomgr/tcp_client_uv.cc index 7454b01445..0bf3a043df 100644 --- a/src/core/lib/iomgr/tcp_client_uv.cc +++ b/src/core/lib/iomgr/tcp_client_uv.cc @@ -76,7 +76,7 @@ static void uv_tc_on_alarm(void* acp, grpc_error* error) { static void uv_tc_on_connect(uv_connect_t* req, int status) { grpc_uv_tcp_connect* connect = (grpc_uv_tcp_connect*)req->data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_error* error = GRPC_ERROR_NONE; int done; grpc_closure* closure = connect->closure; @@ -105,7 +105,7 @@ static void uv_tc_on_connect(uv_connect_t* req, int status) { } done = (--connect->refs == 0); if (done) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); uv_tcp_connect_cleanup(connect); } GRPC_CLOSURE_SCHED(closure, error); diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index de3dabd7fc..04d4440f9e 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -130,7 +130,7 @@ static void run_poller(void* bp, grpc_error* error_ignored) { gpr_log(GPR_DEBUG, "BACKUP_POLLER:%p run", p); } gpr_mu_lock(p->pollset_mu); - grpc_millis deadline = ExecCtx::Get()->Now() + 13 * GPR_MS_PER_SEC; + grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 13 * GPR_MS_PER_SEC; GRPC_STATS_INC_TCP_BACKUP_POLLER_POLLS(); GRPC_LOG_IF_ERROR( "backup_poller:pollset_work", diff --git a/src/core/lib/iomgr/tcp_server_uv.cc b/src/core/lib/iomgr/tcp_server_uv.cc index 9db2cbe58d..daa7afe95f 100644 --- a/src/core/lib/iomgr/tcp_server_uv.cc +++ b/src/core/lib/iomgr/tcp_server_uv.cc @@ -137,7 +137,7 @@ static void finish_shutdown(grpc_tcp_server* s) { static void handle_close_callback(uv_handle_t* handle) { grpc_tcp_listener* sp = (grpc_tcp_listener*)handle->data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; sp->server->open_ports--; if (sp->server->open_ports == 0 && sp->server->shutdown) { finish_shutdown(sp->server); @@ -174,9 +174,9 @@ void grpc_tcp_server_unref(grpc_tcp_server* s) { GRPC_UV_ASSERT_SAME_THREAD(); if (gpr_unref(&s->refs)) { /* Complete shutdown_starting work before destroying. */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CLOSURE_LIST_SCHED(&s->shutdown_starting); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); tcp_server_destroy(s); } } @@ -223,7 +223,7 @@ static void finish_accept(grpc_tcp_listener* sp) { static void on_connect(uv_stream_t* server, int status) { grpc_tcp_listener* sp = (grpc_tcp_listener*)server->data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (status < 0) { switch (status) { diff --git a/src/core/lib/iomgr/tcp_uv.cc b/src/core/lib/iomgr/tcp_uv.cc index 3ea9674840..742ab9a754 100644 --- a/src/core/lib/iomgr/tcp_uv.cc +++ b/src/core/lib/iomgr/tcp_uv.cc @@ -112,7 +112,7 @@ static void tcp_ref(grpc_tcp* tcp) { gpr_ref(&tcp->refcount); } #endif static void uv_close_callback(uv_handle_t* handle) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp* tcp = (grpc_tcp*)handle->data; TCP_UNREF(tcp, "destroy"); } @@ -124,7 +124,7 @@ static grpc_slice alloc_read_slice(grpc_resource_user* resource_user) { static void alloc_uv_buf(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp* tcp = (grpc_tcp*)handle->data; (void)suggested_size; buf->base = (char*)GRPC_SLICE_START_PTR(tcp->read_slice); @@ -135,7 +135,7 @@ static void read_callback(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { grpc_slice sub; grpc_error* error; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp* tcp = (grpc_tcp*)stream->data; grpc_closure* cb = tcp->read_cb; if (nread == 0) { @@ -204,7 +204,7 @@ static void uv_endpoint_read(grpc_endpoint* ep, grpc_slice_buffer* read_slices, static void write_callback(uv_write_t* req, int status) { grpc_tcp* tcp = (grpc_tcp*)req->data; grpc_error* error; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure* cb = tcp->write_cb; tcp->write_cb = NULL; TCP_UNREF(tcp, "write"); @@ -355,7 +355,7 @@ grpc_endpoint* grpc_tcp_create(uv_tcp_t* handle, grpc_resource_quota* resource_quota, char* peer_string) { grpc_tcp* tcp = (grpc_tcp*)gpr_malloc(sizeof(grpc_tcp)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (GRPC_TRACER_ON(grpc_tcp_trace)) { gpr_log(GPR_DEBUG, "Creating TCP endpoint %p", tcp); diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index d5e6066f35..ae82701676 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -249,7 +249,7 @@ void grpc_timer_list_init() { g_shared_mutables.initialized = true; g_shared_mutables.checker_mu = GPR_SPINLOCK_INITIALIZER; gpr_mu_init(&g_shared_mutables.mu); - g_shared_mutables.min_timer = ExecCtx::Get()->Now(); + g_shared_mutables.min_timer = grpc_core::ExecCtx::Get()->Now(); gpr_tls_init(&g_last_seen_min_timer); gpr_tls_set(&g_last_seen_min_timer, 0); grpc_register_tracer(&grpc_timer_trace); @@ -341,7 +341,7 @@ void grpc_timer_init(grpc_timer* timer, grpc_millis deadline, if (GRPC_TRACER_ON(grpc_timer_trace)) { gpr_log(GPR_DEBUG, "TIMER %p: SET %" PRIdPTR " now %" PRIdPTR " call %p[%p]", timer, - deadline, ExecCtx::Get()->Now(), closure, closure->cb); + deadline, grpc_core::ExecCtx::Get()->Now(), closure, closure->cb); } if (!g_shared_mutables.initialized) { @@ -354,7 +354,7 @@ void grpc_timer_init(grpc_timer* timer, grpc_millis deadline, gpr_mu_lock(&shard->mu); timer->pending = true; - grpc_millis now = ExecCtx::Get()->Now(); + grpc_millis now = grpc_core::ExecCtx::Get()->Now(); if (deadline <= now) { timer->pending = false; GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE); @@ -607,7 +607,7 @@ static grpc_timer_check_result run_some_expired_timers(gpr_atm now, grpc_timer_check_result grpc_timer_check(grpc_millis* next) { // prelude - grpc_millis now = ExecCtx::Get()->Now(); + grpc_millis now = grpc_core::ExecCtx::Get()->Now(); /* fetch from a thread-local first: this avoids contention on a globally mutable cacheline in the common case */ diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc index 69adb673d8..6a43f4fadb 100644 --- a/src/core/lib/iomgr/timer_manager.cc +++ b/src/core/lib/iomgr/timer_manager.cc @@ -98,7 +98,7 @@ static void start_timer_thread_and_unlock(void) { } void grpc_timer_manager_tick() { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis next = GRPC_MILLIS_INF_FUTURE; grpc_timer_check(&next); } @@ -125,7 +125,7 @@ static void run_some_timers() { if (GRPC_TRACER_ON(grpc_timer_check_trace)) { gpr_log(GPR_DEBUG, "flush exec_ctx"); } - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&g_mu); // garbage collect any threads hanging out that are dead gc_completed_threads(); @@ -178,7 +178,7 @@ static bool wait_until(grpc_millis next) { g_timed_waiter_deadline = next; if (GRPC_TRACER_ON(grpc_timer_check_trace)) { - grpc_millis wait_time = next - ExecCtx::Get()->Now(); + grpc_millis wait_time = next - grpc_core::ExecCtx::Get()->Now(); gpr_log(GPR_DEBUG, "sleep for a %" PRIdPTR " milliseconds", wait_time); } @@ -223,7 +223,7 @@ static bool wait_until(grpc_millis next) { static void timer_main_loop() { for (;;) { grpc_millis next = GRPC_MILLIS_INF_FUTURE; - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); // check timer state, updates next to the next time to run a check switch (grpc_timer_check(&next)) { case GRPC_TIMERS_FIRED: @@ -273,7 +273,7 @@ static void timer_thread_cleanup(completed_thread* ct) { static void timer_thread(void* completed_thread_ptr) { // this threads exec_ctx: we try to run things through to completion here // since it's easy to spin up new threads - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; timer_main_loop(); timer_thread_cleanup((completed_thread*)completed_thread_ptr); diff --git a/src/core/lib/iomgr/timer_uv.cc b/src/core/lib/iomgr/timer_uv.cc index 6edd4169f1..1432eba51e 100644 --- a/src/core/lib/iomgr/timer_uv.cc +++ b/src/core/lib/iomgr/timer_uv.cc @@ -45,7 +45,7 @@ static void stop_uv_timer(uv_timer_t* handle) { void run_expired_timer(uv_timer_t* handle) { grpc_timer* timer = (grpc_timer*)handle->data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_UV_ASSERT_SAME_THREAD(); GPR_ASSERT(timer->pending); timer->pending = 0; @@ -59,13 +59,13 @@ void grpc_timer_init(grpc_timer* timer, grpc_millis deadline, uv_timer_t* uv_timer; GRPC_UV_ASSERT_SAME_THREAD(); timer->closure = closure; - if (deadline <= ExecCtx::Get()->Now()) { + if (deadline <= grpc_core::ExecCtx::Get()->Now()) { timer->pending = 0; GRPC_CLOSURE_SCHED(timer->closure, GRPC_ERROR_NONE); return; } timer->pending = 1; - timeout = (uint64_t)(deadline - ExecCtx::Get()->Now()); + timeout = (uint64_t)(deadline - grpc_core::ExecCtx::Get()->Now()); uv_timer = (uv_timer_t*)gpr_malloc(sizeof(uv_timer_t)); uv_timer_init(uv_default_loop(), uv_timer); uv_timer->data = timer; diff --git a/src/core/lib/security/context/security_context.cc b/src/core/lib/security/context/security_context.cc index 9b58b3657f..570db78882 100644 --- a/src/core/lib/security/context/security_context.cc +++ b/src/core/lib/security/context/security_context.cc @@ -38,7 +38,7 @@ grpc_tracer_flag grpc_trace_auth_context_refcount = grpc_call_error grpc_call_set_credentials(grpc_call* call, grpc_call_credentials* creds) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_client_security_context* ctx = NULL; GRPC_API_TRACE("grpc_call_set_credentials(call=%p, creds=%p)", 2, (call, creds)); @@ -87,7 +87,7 @@ grpc_client_security_context* grpc_client_security_context_create(void) { } void grpc_client_security_context_destroy(void* ctx) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_client_security_context* c = (grpc_client_security_context*)ctx; grpc_call_credentials_unref(c->creds); GRPC_AUTH_CONTEXT_UNREF(c->auth_context, "client_security_context"); diff --git a/src/core/lib/security/credentials/credentials.cc b/src/core/lib/security/credentials/credentials.cc index 6a272653f8..5181f7f260 100644 --- a/src/core/lib/security/credentials/credentials.cc +++ b/src/core/lib/security/credentials/credentials.cc @@ -72,7 +72,7 @@ void grpc_channel_credentials_unref(grpc_channel_credentials* creds) { void grpc_channel_credentials_release(grpc_channel_credentials* creds) { GRPC_API_TRACE("grpc_channel_credentials_release(creds=%p)", 1, (creds)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_credentials_unref(creds); } @@ -94,7 +94,7 @@ void grpc_call_credentials_unref(grpc_call_credentials* creds) { void grpc_call_credentials_release(grpc_call_credentials* creds) { GRPC_API_TRACE("grpc_call_credentials_release(creds=%p)", 1, (creds)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_call_credentials_unref(creds); } @@ -209,7 +209,7 @@ void grpc_server_credentials_unref(grpc_server_credentials* creds) { void grpc_server_credentials_release(grpc_server_credentials* creds) { GRPC_API_TRACE("grpc_server_credentials_release(creds=%p)", 1, (creds)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_server_credentials_unref(creds); } diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.cc b/src/core/lib/security/credentials/google_default/google_default_credentials.cc index 03ec4bc3b3..a8991943b0 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.cc +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.cc @@ -114,13 +114,13 @@ static int is_stack_running_on_compute_engine() { grpc_resource_quota_create("google_default_credentials"); grpc_httpcli_get( &context, &detector.pollent, resource_quota, &request, - ExecCtx::Get()->Now() + max_detection_delay, + grpc_core::ExecCtx::Get()->Now() + max_detection_delay, GRPC_CLOSURE_CREATE(on_compute_engine_detection_http_response, &detector, grpc_schedule_on_exec_ctx), &detector.response); grpc_resource_quota_unref_internal(resource_quota); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Block until we get the response. This is not ideal but this should only be called once for the lifetime of the process by the default credentials. */ @@ -144,7 +144,7 @@ static int is_stack_running_on_compute_engine() { grpc_pollset_shutdown(grpc_polling_entity_pollset(&detector.pollent), &destroy_closure); g_polling_mu = NULL; - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_free(grpc_polling_entity_pollset(&detector.pollent)); grpc_http_response_destroy(&detector.response); @@ -220,7 +220,7 @@ grpc_channel_credentials* grpc_google_default_credentials_create(void) { grpc_error* error = GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Failed to create Google credentials"); grpc_error* err; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_google_default_credentials_create(void)", 0, ()); @@ -290,7 +290,7 @@ end: } void grpc_flush_cached_google_default_credentials(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_once_init(&g_once, init_default_credentials); gpr_mu_lock(&g_state_mu); if (default_credentials != NULL) { diff --git a/src/core/lib/security/credentials/iam/iam_credentials.cc b/src/core/lib/security/credentials/iam/iam_credentials.cc index 4d9da0cbe3..9f3a86877b 100644 --- a/src/core/lib/security/credentials/iam/iam_credentials.cc +++ b/src/core/lib/security/credentials/iam/iam_credentials.cc @@ -54,7 +54,7 @@ static grpc_call_credentials_vtable iam_vtable = { grpc_call_credentials* grpc_google_iam_credentials_create( const char* token, const char* authority_selector, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE( "grpc_iam_credentials_create(token=%s, authority_selector=%s, " "reserved=%p)", diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.cc b/src/core/lib/security/credentials/jwt/jwt_credentials.cc index ccc3f4aeed..3facce1798 100644 --- a/src/core/lib/security/credentials/jwt/jwt_credentials.cc +++ b/src/core/lib/security/credentials/jwt/jwt_credentials.cc @@ -181,7 +181,7 @@ grpc_call_credentials* grpc_service_account_jwt_access_credentials_create( gpr_free(clean_json); } GPR_ASSERT(reserved == NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_call_credentials* creds = grpc_service_account_jwt_access_credentials_create_from_auth_json_key( grpc_auth_json_key_create_from_string(json_key), token_lifetime); diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index 5246e1f985..dd0d206b01 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -347,7 +347,7 @@ static verifier_cb_ctx* verifier_cb_ctx_create( grpc_jwt_claims* claims, const char* audience, grpc_slice signature, const char* signed_jwt, size_t signed_jwt_len, void* user_data, grpc_jwt_verification_done_cb cb) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; verifier_cb_ctx* ctx = (verifier_cb_ctx*)gpr_zalloc(sizeof(verifier_cb_ctx)); ctx->verifier = verifier; ctx->pollent = grpc_polling_entity_create_from_pollset(pollset); @@ -702,7 +702,7 @@ static void on_openid_config_retrieved(void* user_data, grpc_error* error) { resource_quota = grpc_resource_quota_create("jwt_verifier"); grpc_httpcli_get( &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req, - ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay, + grpc_core::ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay, GRPC_CLOSURE_CREATE(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx), &ctx->responses[HTTP_RESPONSE_KEYS]); grpc_resource_quota_unref_internal(resource_quota); @@ -827,9 +827,10 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) { channel. This would allow us to cancel an authentication query when under extreme memory pressure. */ resource_quota = grpc_resource_quota_create("jwt_verifier"); - grpc_httpcli_get(&ctx->verifier->http_ctx, &ctx->pollent, resource_quota, - &req, ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay, - http_cb, &ctx->responses[rsp_idx]); + grpc_httpcli_get( + &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req, + grpc_core::ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay, http_cb, + &ctx->responses[rsp_idx]); grpc_resource_quota_unref_internal(resource_quota); gpr_free(req.host); gpr_free(req.http.path); diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index b653705609..71be15a46e 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -217,7 +217,7 @@ static void on_oauth2_token_fetcher_http_response(void* user_data, c->token_fetch_pending = false; c->access_token_md = GRPC_MDELEM_REF(access_token_md); c->token_expiration = status == GRPC_CREDENTIALS_OK - ? ExecCtx::Get()->Now() + token_lifetime + ? grpc_core::ExecCtx::Get()->Now() + token_lifetime : 0; grpc_oauth2_pending_get_request_metadata* pending_request = c->pending_requests; @@ -256,7 +256,8 @@ static bool oauth2_token_fetcher_get_request_metadata( grpc_mdelem cached_access_token_md = GRPC_MDNULL; gpr_mu_lock(&c->mu); if (!GRPC_MDISNULL(c->access_token_md) && - (c->token_expiration - ExecCtx::Get()->Now() > refresh_threshold)) { + (c->token_expiration - grpc_core::ExecCtx::Get()->Now() > + refresh_threshold)) { cached_access_token_md = GRPC_MDELEM_REF(c->access_token_md); } if (!GRPC_MDISNULL(cached_access_token_md)) { @@ -288,7 +289,7 @@ static bool oauth2_token_fetcher_get_request_metadata( c->fetch_func(grpc_credentials_metadata_request_create(creds), &c->httpcli_context, &c->pollent, on_oauth2_token_fetcher_http_response, - ExecCtx::Get()->Now() + refresh_threshold); + grpc_core::ExecCtx::Get()->Now() + refresh_threshold); } return false; } @@ -514,7 +515,7 @@ grpc_call_credentials* grpc_access_token_credentials_create( gpr_ref_init(&c->base.refcount, 1); char* token_md_value; gpr_asprintf(&token_md_value, "Bearer %s", access_token); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; c->access_token_md = grpc_mdelem_from_slices( grpc_slice_from_static_string(GRPC_AUTHORIZATION_METADATA_KEY), grpc_slice_from_copied_string(token_md_value)); diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc index 025d024617..7634cadc3a 100644 --- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc +++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc @@ -116,8 +116,8 @@ static void plugin_md_request_metadata_ready(void* request, grpc_status_code status, const char* error_details) { /* called from application code */ - ExecCtx _local_exec_ctx(GRPC_EXEC_CTX_FLAG_IS_FINISHED | - GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP); + grpc_core::ExecCtx _local_exec_ctx(GRPC_EXEC_CTX_FLAG_IS_FINISHED | + GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP); grpc_plugin_credentials_pending_request* r = (grpc_plugin_credentials_pending_request*)request; if (GRPC_TRACER_ON(grpc_plugin_credentials_trace)) { diff --git a/src/core/lib/security/transport/security_handshaker.cc b/src/core/lib/security/transport/security_handshaker.cc index 4ed2ec55bd..0df3375d34 100644 --- a/src/core/lib/security/transport/security_handshaker.cc +++ b/src/core/lib/security/transport/security_handshaker.cc @@ -255,7 +255,7 @@ static void on_handshake_next_done_grpc_wrapper( security_handshaker* h = (security_handshaker*)user_data; // This callback will be invoked by TSI in a non-grpc thread, so it's // safe to create our own exec_ctx here. - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(&h->mu); grpc_error* error = on_handshake_next_done_locked( h, result, bytes_to_send, bytes_to_send_size, handshaker_result); diff --git a/src/core/lib/security/transport/server_auth_filter.cc b/src/core/lib/security/transport/server_auth_filter.cc index 86817076f8..5f5ff7c09c 100644 --- a/src/core/lib/security/transport/server_auth_filter.cc +++ b/src/core/lib/security/transport/server_auth_filter.cc @@ -118,7 +118,7 @@ static void on_md_processing_done( grpc_status_code status, const char* error_details) { grpc_call_element* elem = (grpc_call_element*)user_data; call_data* calld = (call_data*)elem->call_data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // If the call was not cancelled while we were in flight, process the result. if (gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT, (gpr_atm)STATE_DONE)) { diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc index 6e1554d471..3604bb77a8 100644 --- a/src/core/lib/slice/slice.cc +++ b/src/core/lib/slice/slice.cc @@ -67,7 +67,7 @@ grpc_slice grpc_slice_ref(grpc_slice slice) { /* Public API */ void grpc_slice_unref(grpc_slice slice) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_unref_internal(slice); } diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc index 4bc54c303f..0a4d48f114 100644 --- a/src/core/lib/slice/slice_buffer.cc +++ b/src/core/lib/slice/slice_buffer.cc @@ -73,7 +73,7 @@ void grpc_slice_buffer_destroy_internal(grpc_slice_buffer* sb) { } void grpc_slice_buffer_destroy(grpc_slice_buffer* sb) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer_destroy_internal(sb); } @@ -172,7 +172,7 @@ void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer* sb) { } void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer* sb) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer_reset_and_unref_internal(sb); } diff --git a/src/core/lib/surface/alarm.cc b/src/core/lib/surface/alarm.cc index 7aee100f3f..8dcfb1ddb5 100644 --- a/src/core/lib/surface/alarm.cc +++ b/src/core/lib/surface/alarm.cc @@ -47,7 +47,7 @@ static void alarm_ref(grpc_alarm* alarm) { gpr_ref(&alarm->refs); } static void alarm_unref(grpc_alarm* alarm) { if (gpr_unref(&alarm->refs)) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (alarm->cq != NULL) { GRPC_CQ_INTERNAL_UNREF(alarm->cq, "alarm"); } @@ -117,7 +117,7 @@ grpc_alarm* grpc_alarm_create(void* reserved) { void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq, gpr_timespec deadline, void* tag, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CQ_INTERNAL_REF(cq, "alarm"); alarm->cq = cq; @@ -129,7 +129,7 @@ void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq, } void grpc_alarm_cancel(grpc_alarm* alarm, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_timer_cancel(&alarm->alarm); } diff --git a/src/core/lib/surface/byte_buffer.cc b/src/core/lib/surface/byte_buffer.cc index 6a9b13bb41..03097c6896 100644 --- a/src/core/lib/surface/byte_buffer.cc +++ b/src/core/lib/surface/byte_buffer.cc @@ -71,7 +71,7 @@ grpc_byte_buffer* grpc_byte_buffer_copy(grpc_byte_buffer* bb) { void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) { if (!bb) return; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; switch (bb->type) { case GRPC_BB_RAW: grpc_slice_buffer_destroy_internal(&bb->data.raw.slice_buffer); diff --git a/src/core/lib/surface/byte_buffer_reader.cc b/src/core/lib/surface/byte_buffer_reader.cc index 9a9e26ecdc..c5f8df3dda 100644 --- a/src/core/lib/surface/byte_buffer_reader.cc +++ b/src/core/lib/surface/byte_buffer_reader.cc @@ -42,7 +42,7 @@ static int is_compressed(grpc_byte_buffer* buffer) { int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, grpc_byte_buffer* buffer) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer decompressed_slices_buffer; reader->buffer_in = buffer; switch (reader->buffer_in->type) { @@ -110,7 +110,7 @@ grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader* reader) { grpc_slice out_slice = GRPC_SLICE_MALLOC(input_size); uint8_t* const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (grpc_byte_buffer_reader_next(reader, &in_slice) != 0) { const size_t slice_length = GRPC_SLICE_LENGTH(in_slice); memcpy(&(outbuf[bytes_read]), GRPC_SLICE_START_PTR(in_slice), slice_length); diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index bbb7a39e29..cb858785f2 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -561,7 +561,7 @@ void grpc_call_unref(grpc_call* c) { if (!gpr_unref(&c->ext_ref)) return; child_call* cc = c->child; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_TIMER_BEGIN("grpc_call_unref", 0); GRPC_API_TRACE("grpc_call_unref(c=%p)", 1, (c)); @@ -602,7 +602,7 @@ void grpc_call_unref(grpc_call* c) { grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) { GRPC_API_TRACE("grpc_call_cancel(call=%p, reserved=%p)", 2, (call, reserved)); GPR_ASSERT(!reserved); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; cancel_with_error(call, STATUS_FROM_API_OVERRIDE, GRPC_ERROR_CANCELLED); return GRPC_CALL_OK; @@ -652,7 +652,7 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call* c, grpc_status_code status, const char* description, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE( "grpc_call_cancel_with_status(" "c=%p, status=%d, description=%s, reserved=%p)", @@ -2034,7 +2034,7 @@ done_with_error: grpc_call_error grpc_call_start_batch(grpc_call* call, const grpc_op* ops, size_t nops, void* tag, void* reserved) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_call_error err; GRPC_API_TRACE( diff --git a/src/core/lib/surface/call_details.cc b/src/core/lib/surface/call_details.cc index 03ce7f88fb..7d81ba9e22 100644 --- a/src/core/lib/surface/call_details.cc +++ b/src/core/lib/surface/call_details.cc @@ -34,7 +34,7 @@ void grpc_call_details_init(grpc_call_details* cd) { void grpc_call_details_destroy(grpc_call_details* cd) { GRPC_API_TRACE("grpc_call_details_destroy(cd=%p)", 1, (cd)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_unref_internal(cd->method); grpc_slice_unref_internal(cd->host); } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 7725351f74..80ba47676e 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -248,7 +248,7 @@ char* grpc_channel_get_target(grpc_channel* channel) { void grpc_channel_get_info(grpc_channel* channel, const grpc_channel_info* channel_info) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_element* elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CHANNEL(channel), 0); elem->filter->get_channel_info(elem, channel_info); @@ -296,7 +296,7 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel, grpc_slice method, const grpc_slice* host, gpr_timespec deadline, void* reserved) { GPR_ASSERT(!reserved); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_call* call = grpc_channel_create_call_internal( channel, parent_call, propagation_mask, cq, NULL, grpc_mdelem_from_slices(GRPC_MDSTR_PATH, grpc_slice_ref_internal(method)), @@ -329,7 +329,7 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method, "grpc_channel_register_call(channel=%p, method=%s, host=%s, reserved=%p)", 4, (channel, method, host, reserved)); GPR_ASSERT(!reserved); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; rc->path = grpc_mdelem_from_slices( GRPC_MDSTR_PATH, @@ -364,7 +364,7 @@ grpc_call* grpc_channel_create_registered_call( registered_call_handle, deadline.tv_sec, deadline.tv_nsec, (int)deadline.clock_type, reserved)); GPR_ASSERT(!reserved); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_call* call = grpc_channel_create_call_internal( channel, parent_call, propagation_mask, completion_queue, NULL, GRPC_MDELEM_REF(rc->path), GRPC_MDELEM_REF(rc->authority), @@ -407,7 +407,7 @@ static void destroy_channel(void* arg, grpc_error* error) { void grpc_channel_destroy(grpc_channel* channel) { grpc_transport_op* op = grpc_make_transport_op(NULL); grpc_channel_element* elem; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_channel_destroy(channel=%p)", 1, (channel)); op->disconnect_with_error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Destroyed"); diff --git a/src/core/lib/surface/channel_ping.cc b/src/core/lib/surface/channel_ping.cc index 06cdbf6c73..545b8fe6ee 100644 --- a/src/core/lib/surface/channel_ping.cc +++ b/src/core/lib/surface/channel_ping.cc @@ -51,7 +51,7 @@ void grpc_channel_ping(grpc_channel* channel, grpc_completion_queue* cq, ping_result* pr = (ping_result*)gpr_malloc(sizeof(*pr)); grpc_channel_element* top_elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(reserved == NULL); pr->tag = tag; pr->cq = cq; diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index 0b0a8d070d..24c502881a 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -124,7 +124,7 @@ static grpc_error* non_polling_poller_work(grpc_pollset* pollset, while (!npp->shutdown && !w.kicked && !gpr_cv_wait(&w.cv, &npp->mu, deadline_ts)) ; - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); if (&w == npp->root) { npp->root = w.next; if (&w == npp->root) { @@ -359,7 +359,7 @@ int grpc_completion_queue_thread_local_cache_flush(grpc_completion_queue* cq, if (storage != NULL && (grpc_completion_queue*)gpr_tls_get(&g_cached_cq) == cq) { *tag = storage->tag; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; *ok = (storage->next & (uintptr_t)(1)) == 1; storage->done(storage->done_arg, storage); ret = 1; @@ -395,7 +395,7 @@ static bool cq_event_queue_push(grpc_cq_event_queue* q, grpc_cq_completion* c) { static grpc_cq_completion* cq_event_queue_pop(grpc_cq_event_queue* q) { grpc_cq_completion* c = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (gpr_spinlock_trylock(&q->queue_lock)) { GRPC_STATS_INC_CQ_EV_QUEUE_TRYLOCK_SUCCESSES(); @@ -440,7 +440,7 @@ grpc_completion_queue* grpc_completion_queue_create_internal( const cq_poller_vtable* poller_vtable = &g_poller_vtable_by_poller_type[polling_type]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_STATS_INC_CQS_CREATED(); cq = (grpc_completion_queue*)gpr_zalloc(sizeof(grpc_completion_queue) + @@ -790,7 +790,7 @@ typedef struct { bool first_loop; } cq_is_finished_arg; -class ExecCtxNext : public ExecCtx { +class ExecCtxNext : public grpc_core::ExecCtx { public: ExecCtxNext(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {} @@ -818,7 +818,7 @@ class ExecCtxNext : public ExecCtx { return true; } } - return !a->first_loop && a->deadline < ExecCtx::Get()->Now(); + return !a->first_loop && a->deadline < grpc_core::ExecCtx::Get()->Now(); } private: @@ -929,7 +929,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline, } if (!is_finished_arg.first_loop && - ExecCtx::Get()->Now() >= deadline_millis) { + grpc_core::ExecCtx::Get()->Now() >= deadline_millis) { memset(&ret, 0, sizeof(ret)); ret.type = GRPC_QUEUE_TIMEOUT; dump_pending_tags(cq); @@ -1045,7 +1045,7 @@ static void del_plucker(grpc_completion_queue* cq, void* tag, GPR_UNREACHABLE_CODE(return ); } -class ExecCtxPluck : public ExecCtx { +class ExecCtxPluck : public grpc_core::ExecCtx { public: ExecCtxPluck(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {} @@ -1079,7 +1079,7 @@ class ExecCtxPluck : public ExecCtx { } gpr_mu_unlock(cq->mu); } - return !a->first_loop && a->deadline < ExecCtx::Get()->Now(); + return !a->first_loop && a->deadline < grpc_core::ExecCtx::Get()->Now(); } private: @@ -1169,7 +1169,7 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag, break; } if (!is_finished_arg.first_loop && - ExecCtx::Get()->Now() >= deadline_millis) { + grpc_core::ExecCtx::Get()->Now() >= deadline_millis) { del_plucker(cq, tag, &worker); gpr_mu_unlock(cq->mu); memset(&ret, 0, sizeof(ret)); @@ -1250,7 +1250,7 @@ static void cq_shutdown_pluck(grpc_completion_queue* cq) { /* Shutdown simply drops a ref that we reserved at creation time; if we drop to zero here, then enter shutdown mode and wake up any waiters */ void grpc_completion_queue_shutdown(grpc_completion_queue* cq) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_TIMER_BEGIN("grpc_completion_queue_shutdown", 0); GRPC_API_TRACE("grpc_completion_queue_shutdown(cq=%p)", 1, (cq)); cq->vtable->shutdown(cq); @@ -1263,7 +1263,7 @@ void grpc_completion_queue_destroy(grpc_completion_queue* cq) { GPR_TIMER_BEGIN("grpc_completion_queue_destroy", 0); grpc_completion_queue_shutdown(cq); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CQ_INTERNAL_UNREF(cq, "destroy"); GPR_TIMER_END("grpc_completion_queue_destroy", 0); diff --git a/src/core/lib/surface/init.cc b/src/core/lib/surface/init.cc index 20e17a7f60..fdbf926f77 100644 --- a/src/core/lib/surface/init.cc +++ b/src/core/lib/surface/init.cc @@ -116,7 +116,7 @@ void grpc_init(void) { int i; gpr_once_init(&g_basic_init, do_basic_init); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(&g_init_mu); if (++g_initializations == 1) { gpr_time_init(); @@ -175,7 +175,7 @@ void grpc_init(void) { void grpc_shutdown(void) { int i; GRPC_API_TRACE("grpc_shutdown(void)", 0, ()); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(&g_init_mu); if (--g_initializations == 0) { grpc_executor_shutdown(); diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index da081e68cb..3bbdd21285 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -156,7 +156,7 @@ extern "C" const grpc_channel_filter grpc_lame_filter = { grpc_channel* grpc_lame_client_channel_create(const char* target, grpc_status_code error_code, const char* error_message) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_element* elem; grpc_channel* channel = grpc_channel_create(target, NULL, GRPC_CLIENT_LAME_CHANNEL, NULL); diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 0d4435d556..835e495495 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1022,7 +1022,7 @@ static void start_listeners(void* s, grpc_error* error) { void grpc_server_start(grpc_server* server) { size_t i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_server_start(server=%p)", 1, (server)); @@ -1168,7 +1168,7 @@ void grpc_server_shutdown_and_notify(grpc_server* server, listener* l; shutdown_tag* sdt; channel_broadcaster broadcaster; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_server_shutdown_and_notify(server=%p, cq=%p, tag=%p)", 3, (server, cq, tag)); @@ -1227,7 +1227,7 @@ void grpc_server_shutdown_and_notify(grpc_server* server, void grpc_server_cancel_all_calls(grpc_server* server) { channel_broadcaster broadcaster; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_server_cancel_all_calls(server=%p)", 1, (server)); @@ -1242,7 +1242,7 @@ void grpc_server_cancel_all_calls(grpc_server* server) { void grpc_server_destroy(grpc_server* server) { listener* l; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_API_TRACE("grpc_server_destroy(server=%p)", 1, (server)); @@ -1324,7 +1324,7 @@ grpc_call_error grpc_server_request_call( grpc_completion_queue* cq_bound_to_call, grpc_completion_queue* cq_for_notification, void* tag) { grpc_call_error error; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; requested_call* rc = (requested_call*)gpr_malloc(sizeof(*rc)); GRPC_STATS_INC_SERVER_REQUESTED_CALLS(); GRPC_API_TRACE( @@ -1371,7 +1371,7 @@ grpc_call_error grpc_server_request_registered_call( grpc_completion_queue* cq_bound_to_call, grpc_completion_queue* cq_for_notification, void* tag) { grpc_call_error error; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; requested_call* rc = (requested_call*)gpr_malloc(sizeof(*rc)); registered_method* rm = (registered_method*)rmp; GRPC_STATS_INC_SERVER_REQUESTED_CALLS(); diff --git a/src/core/lib/transport/bdp_estimator.cc b/src/core/lib/transport/bdp_estimator.cc index 4e279b4d94..d2b6e5db25 100644 --- a/src/core/lib/transport/bdp_estimator.cc +++ b/src/core/lib/transport/bdp_estimator.cc @@ -79,7 +79,7 @@ grpc_millis BdpEstimator::CompletePing() { } ping_state_ = PingState::UNSCHEDULED; accumulator_ = 0; - return ExecCtx::Get()->Now() + inter_ping_delay_; + return grpc_core::ExecCtx::Get()->Now() + inter_ping_delay_; } } // namespace grpc_core diff --git a/src/core/lib/transport/status_conversion.cc b/src/core/lib/transport/status_conversion.cc index 61470b8c78..46cba4292b 100644 --- a/src/core/lib/transport/status_conversion.cc +++ b/src/core/lib/transport/status_conversion.cc @@ -46,8 +46,9 @@ grpc_status_code grpc_http2_error_to_grpc_status(grpc_http2_error_code error, case GRPC_HTTP2_CANCEL: /* http2 cancel translates to STATUS_CANCELLED iff deadline hasn't been * exceeded */ - return ExecCtx::Get()->Now() > deadline ? GRPC_STATUS_DEADLINE_EXCEEDED - : GRPC_STATUS_CANCELLED; + return grpc_core::ExecCtx::Get()->Now() > deadline + ? GRPC_STATUS_DEADLINE_EXCEEDED + : GRPC_STATUS_CANCELLED; case GRPC_HTTP2_ENHANCE_YOUR_CALM: return GRPC_STATUS_RESOURCE_EXHAUSTED; case GRPC_HTTP2_INADEQUATE_SECURITY: diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index ca80a7404d..ed2f02de55 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -62,7 +62,8 @@ void grpc_stream_unref(grpc_stream_refcount* refcount, const char* reason) { void grpc_stream_unref(grpc_stream_refcount* refcount) { #endif if (gpr_unref(&refcount->refs)) { - if (ExecCtx::Get()->flags() & GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP) { + if (grpc_core::ExecCtx::Get()->flags() & + GRPC_EXEC_CTX_FLAG_THREAD_RESOURCE_LOOP) { /* Ick. The thread we're running on MAY be owned (indirectly) by a call-stack. If that's the case, destroying the call-stack MAY try to destroy the diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc index 0bcfac2845..82d687c530 100644 --- a/src/cpp/common/channel_arguments.cc +++ b/src/cpp/common/channel_arguments.cc @@ -67,7 +67,7 @@ ChannelArguments::ChannelArguments(const ChannelArguments& other) } ChannelArguments::~ChannelArguments() { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; for (auto it = args_.begin(); it != args_.end(); ++it) { if (it->type == GRPC_ARG_POINTER) { it->value.pointer.vtable->destroy(it->value.pointer.p); @@ -95,7 +95,7 @@ void ChannelArguments::SetSocketMutator(grpc_socket_mutator* mutator) { } grpc_arg mutator_arg = grpc_socket_mutator_to_arg(mutator); bool replaced = false; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; for (auto it = args_.begin(); it != args_.end(); ++it) { if (it->type == mutator_arg.type && grpc::string(it->key) == grpc::string(mutator_arg.key)) { diff --git a/test/core/backoff/backoff_test.cc b/test/core/backoff/backoff_test.cc index 739ab86bb2..76a9f39c35 100644 --- a/test/core/backoff/backoff_test.cc +++ b/test/core/backoff/backoff_test.cc @@ -32,19 +32,23 @@ static void test_constant_backoff(void) { const grpc_millis max_backoff = 1000; grpc_backoff_init(&backoff, initial_backoff, multiplier, jitter, min_connect_timeout, max_backoff); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff); - GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.current_deadline - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); - GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.next_attempt_start_time - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); for (int i = 0; i < 10000; i++) { next_deadlines = grpc_backoff_step(&backoff); - GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.current_deadline - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); - GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.next_attempt_start_time - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); } } @@ -57,15 +61,15 @@ static void test_min_connect(void) { const grpc_millis max_backoff = 1000; grpc_backoff_init(&backoff, initial_backoff, multiplier, jitter, min_connect_timeout, max_backoff); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_backoff_result next = grpc_backoff_begin(&backoff); // Because the min_connect_timeout > initial_backoff, current_deadline is used // as the deadline for the current attempt. - GPR_ASSERT(next.current_deadline - ExecCtx::Get()->Now() == + GPR_ASSERT(next.current_deadline - grpc_core::ExecCtx::Get()->Now() == min_connect_timeout); // ... while, if the current attempt fails, the next one will happen after // initial_backoff. - GPR_ASSERT(next.next_attempt_start_time - ExecCtx::Get()->Now() == + GPR_ASSERT(next.next_attempt_start_time - grpc_core::ExecCtx::Get()->Now() == initial_backoff); } @@ -80,45 +84,45 @@ static void test_no_jitter_backoff(void) { min_connect_timeout, max_backoff); // x_1 = 2 // x_n = 2**i + x_{i-1} ( = 2**(n+1) - 2 ) - ExecCtx _local_exec_ctx; - ExecCtx::Get()->SetNow(0); + grpc_core::ExecCtx _local_exec_ctx; + grpc_core::ExecCtx::Get()->TestOnlySetNow(0); grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff); GPR_ASSERT(next_deadlines.current_deadline == next_deadlines.next_attempt_start_time); GPR_ASSERT(next_deadlines.current_deadline == 2); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 6); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 14); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 30); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 62); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 126); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 254); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 510); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 1022); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); // Hit the maximum timeout. From this point onwards, retries will increase // only by max timeout. GPR_ASSERT(next_deadlines.current_deadline == 1535); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 2048); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); next_deadlines = grpc_backoff_step(&backoff); GPR_ASSERT(next_deadlines.current_deadline == 2561); } @@ -136,11 +140,13 @@ static void test_jitter_backoff(void) { backoff.rng_state = 0; // force consistent PRNG - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_backoff_result next_deadlines = grpc_backoff_begin(&backoff); - GPR_ASSERT(next_deadlines.current_deadline - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.current_deadline - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); - GPR_ASSERT(next_deadlines.next_attempt_start_time - ExecCtx::Get()->Now() == + GPR_ASSERT(next_deadlines.next_attempt_start_time - + grpc_core::ExecCtx::Get()->Now() == initial_backoff); grpc_millis expected_next_lower_bound = @@ -153,7 +159,7 @@ static void test_jitter_backoff(void) { // next-now must be within (jitter*100)% of the current backoff (which // increases by * multiplier up to max_backoff). const grpc_millis timeout_millis = - next_deadlines.current_deadline - ExecCtx::Get()->Now(); + next_deadlines.current_deadline - grpc_core::ExecCtx::Get()->Now(); GPR_ASSERT(timeout_millis >= expected_next_lower_bound); GPR_ASSERT(timeout_millis <= expected_next_upper_bound); current_backoff = GPR_MIN( @@ -162,7 +168,7 @@ static void test_jitter_backoff(void) { (grpc_millis)((double)current_backoff * (1 - jitter)); expected_next_upper_bound = (grpc_millis)((double)current_backoff * (1 + jitter)); - ExecCtx::Get()->SetNow(next_deadlines.current_deadline); + grpc_core::ExecCtx::Get()->TestOnlySetNow(next_deadlines.current_deadline); } } diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc index bc9e65089c..b7c9404638 100644 --- a/test/core/bad_client/bad_client.cc +++ b/test/core/bad_client/bad_client.cc @@ -57,7 +57,7 @@ static void done_write(void* arg, grpc_error* error) { static void server_setup_transport(void* ts, grpc_transport* transport) { thd_args* a = (thd_args*)ts; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_server_setup_transport(a->server, transport, NULL, grpc_server_get_channel_args(a->server)); } @@ -80,7 +80,7 @@ void grpc_run_bad_client_test( grpc_slice_from_copied_buffer(client_payload, client_payload_length); grpc_slice_buffer outgoing; grpc_closure done_write_closure; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_completion_queue* shutdown_cq; if (client_payload_length < 4 * 1024) { diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc index f0393b0f40..eb2654e6a9 100644 --- a/test/core/channel/channel_args_test.cc +++ b/test/core/channel/channel_args_test.cc @@ -26,7 +26,7 @@ #include "test/core/util/test_config.h" static void test_create(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_arg arg_int; grpc_arg arg_string; @@ -59,7 +59,7 @@ static void test_create(void) { } static void test_set_compression_algorithm(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args* ch_args; ch_args = @@ -73,7 +73,7 @@ static void test_set_compression_algorithm(void) { } static void test_compression_algorithm_states(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate; unsigned states_bitset; size_t i; @@ -134,7 +134,7 @@ static void test_set_socket_mutator(void) { GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_POINTER); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(ch_args); } } diff --git a/test/core/channel/channel_stack_test.cc b/test/core/channel/channel_stack_test.cc index 66ee2948b1..21d7e89cb0 100644 --- a/test/core/channel/channel_stack_test.cc +++ b/test/core/channel/channel_stack_test.cc @@ -95,7 +95,7 @@ static void test_create_channel_stack(void) { grpc_channel_args chan_args; int* channel_data; int* call_data; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice path = grpc_slice_from_static_string("/service/method"); arg.type = GRPC_ARG_INTEGER; @@ -138,7 +138,7 @@ static void test_create_channel_stack(void) { GPR_ASSERT(*channel_data == 1); GRPC_CALL_STACK_UNREF(call_stack, "done"); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(*channel_data == 2); GRPC_CHANNEL_STACK_UNREF(channel_stack, "done"); diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index dd3c70a261..5aab969276 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -124,7 +124,7 @@ static int check_stack(const char* file, int line, const char* transport_name, grpc_channel_stack_builder_set_transport(builder, &fake_transport); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_stack_builder_set_channel_arguments(builder, channel_args); GPR_ASSERT(grpc_channel_init_create_stack( builder, (grpc_channel_stack_type)channel_stack_type)); @@ -209,7 +209,7 @@ static int check_stack(const char* file, int line, const char* transport_name, gpr_free(expect); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_stack_builder_destroy(builder); grpc_channel_args_destroy(channel_args); } diff --git a/test/core/client_channel/lb_policies_test.cc b/test/core/client_channel/lb_policies_test.cc index 5b412cc622..88e12ed8e1 100644 --- a/test/core/client_channel/lb_policies_test.cc +++ b/test/core/client_channel/lb_policies_test.cc @@ -651,7 +651,7 @@ static void test_get_channel_info() { grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1); channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } // Ensures that resolver returns. @@ -958,7 +958,7 @@ static void verify_rebirth_round_robin(const servers_fixture* f, } int main(int argc, char** argv) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; test_spec* spec; size_t i; const size_t NUM_ITERS = 10; diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc index 597a1212c1..8f88083045 100644 --- a/test/core/client_channel/parse_address_test.cc +++ b/test/core/client_channel/parse_address_test.cc @@ -33,7 +33,7 @@ #ifdef GRPC_HAVE_UNIX_SOCKET static void test_grpc_parse_unix(const char* uri_text, const char* pathname) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(uri_text, 0); grpc_resolved_address addr; @@ -53,7 +53,7 @@ static void test_grpc_parse_unix(const char* uri_text, const char* pathname) {} static void test_grpc_parse_ipv4(const char* uri_text, const char* host, unsigned short port) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(uri_text, 0); grpc_resolved_address addr; char ntop_buf[INET_ADDRSTRLEN]; @@ -71,7 +71,7 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host, static void test_grpc_parse_ipv6(const char* uri_text, const char* host, unsigned short port, uint32_t scope_id) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(uri_text, 0); grpc_resolved_address addr; char ntop_buf[INET6_ADDRSTRLEN]; diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index c7a0e029f2..1f00d9ab43 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -104,7 +104,7 @@ static bool wait_loop(int deadline_seconds, gpr_event* ev) { if (gpr_event_wait(ev, grpc_timeout_seconds_to_deadline(1))) return true; deadline_seconds--; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_timer_check(NULL); } return false; @@ -146,14 +146,14 @@ int main(int argc, char** argv) { grpc_dns_lookup_ares = my_dns_lookup_ares; grpc_channel_args* result = (grpc_channel_args*)1; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolver* resolver = create_resolver("dns:test"); gpr_event ev1; gpr_event_init(&ev1); call_resolver_next_after_locking( resolver, &result, GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(wait_loop(5, &ev1)); GPR_ASSERT(result == NULL); @@ -162,7 +162,7 @@ int main(int argc, char** argv) { call_resolver_next_after_locking( resolver, &result, GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(wait_loop(30, &ev2)); GPR_ASSERT(result != NULL); diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc index 33916b59ec..e8900ab1bb 100644 --- a/test/core/client_channel/resolvers/dns_resolver_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_test.cc @@ -28,7 +28,7 @@ static grpc_combiner* g_combiner; static void test_succeeds(grpc_resolver_factory* factory, const char* string) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(string, 0); grpc_resolver_args args; grpc_resolver* resolver; @@ -45,7 +45,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) { } static void test_fails(grpc_resolver_factory* factory, const char* string) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(string, 0); grpc_resolver_args args; grpc_resolver* resolver; @@ -80,7 +80,7 @@ int main(int argc, char** argv) { grpc_resolver_factory_unref(dns); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_COMBINER_UNREF(g_combiner, "test"); } grpc_shutdown(); diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 9a1971561c..1595313f36 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -72,7 +72,7 @@ void on_resolution_cb(void* arg, grpc_error* error) { } static void test_fake_resolver() { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_combiner* combiner = grpc_combiner_create(); // Create resolver. grpc_fake_resolver_response_generator* response_generator = @@ -109,7 +109,7 @@ static void test_fake_resolver() { results); grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result, on_resolution); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, grpc_timeout_seconds_to_deadline(5)) != NULL); @@ -144,7 +144,7 @@ static void test_fake_resolver() { results_update); grpc_resolver_next_locked(resolver, &on_res_arg_update.resolver_result, on_resolution); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev, grpc_timeout_seconds_to_deadline(5)) != NULL); @@ -153,7 +153,7 @@ static void test_fake_resolver() { memset(&on_res_arg, 0, sizeof(on_res_arg)); grpc_resolver_next_locked(resolver, &on_res_arg.resolver_result, on_resolution); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL); diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc index 70b3cbf5b7..7584901813 100644 --- a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc +++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc @@ -41,7 +41,7 @@ void on_resolution_cb(void* arg, grpc_error* error) { } static void test_succeeds(grpc_resolver_factory* factory, const char* string) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(string, 0); grpc_resolver_args args; grpc_resolver* resolver; @@ -68,7 +68,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) { } static void test_fails(grpc_resolver_factory* factory, const char* string) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(string, 0); grpc_resolver_args args; grpc_resolver* resolver; @@ -111,7 +111,7 @@ int main(int argc, char** argv) { grpc_resolver_factory_unref(ipv6); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_COMBINER_UNREF(g_combiner, "test"); } grpc_shutdown(); diff --git a/test/core/client_channel/uri_fuzzer_test.cc b/test/core/client_channel/uri_fuzzer_test.cc index 6c1e8cb137..484676e472 100644 --- a/test/core/client_channel/uri_fuzzer_test.cc +++ b/test/core/client_channel/uri_fuzzer_test.cc @@ -33,7 +33,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { memcpy(s, data, size); s[size] = 0; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* x; if ((x = grpc_uri_parse(s, 1))) { grpc_uri_destroy(x); diff --git a/test/core/client_channel/uri_parser_test.cc b/test/core/client_channel/uri_parser_test.cc index 024c30faee..61418ae7d8 100644 --- a/test/core/client_channel/uri_parser_test.cc +++ b/test/core/client_channel/uri_parser_test.cc @@ -28,7 +28,7 @@ static void test_succeeds(const char* uri_text, const char* scheme, const char* authority, const char* path, const char* query, const char* fragment) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_uri* uri = grpc_uri_parse(uri_text, 0); GPR_ASSERT(uri); GPR_ASSERT(0 == strcmp(scheme, uri->scheme)); @@ -41,13 +41,13 @@ static void test_succeeds(const char* uri_text, const char* scheme, } static void test_fails(const char* uri_text) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(NULL == grpc_uri_parse(uri_text, 0)); } static void test_query_parts() { { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; const char* uri_text = "http://foo/path?a&b=B&c=&#frag"; grpc_uri* uri = grpc_uri_parse(uri_text, 0); GPR_ASSERT(uri); @@ -81,7 +81,7 @@ static void test_query_parts() { } { /* test the current behavior of multiple query part values */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; const char* uri_text = "http://auth/path?foo=bar=baz&foobar=="; grpc_uri* uri = grpc_uri_parse(uri_text, 0); GPR_ASSERT(uri); @@ -99,7 +99,7 @@ static void test_query_parts() { } { /* empty query */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; const char* uri_text = "http://foo/path"; grpc_uri* uri = grpc_uri_parse(uri_text, 0); GPR_ASSERT(uri); diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc index 9ae6363d97..a6fc55e682 100644 --- a/test/core/compression/algorithm_test.cc +++ b/test/core/compression/algorithm_test.cc @@ -39,7 +39,7 @@ static void test_algorithm_mesh(void) { grpc_compression_algorithm parsed; grpc_slice mdstr; grpc_mdelem mdelem; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT( grpc_compression_algorithm_name((grpc_compression_algorithm)i, &name)); GPR_ASSERT(grpc_compression_algorithm_parse( @@ -61,7 +61,7 @@ static void test_algorithm_mesh(void) { } static void test_algorithm_failure(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice mdstr; gpr_log(GPR_DEBUG, "test_algorithm_failure"); diff --git a/test/core/compression/message_compress_test.cc b/test/core/compression/message_compress_test.cc index a5dfdc884f..0145b4f402 100644 --- a/test/core/compression/message_compress_test.cc +++ b/test/core/compression/message_compress_test.cc @@ -70,7 +70,7 @@ static void assert_passthrough(grpc_slice value, grpc_split_slices_to_buffer(uncompressed_split_mode, &value, 1, &input); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; was_compressed = grpc_msg_compress(algorithm, &input, &compressed_raw); } GPR_ASSERT(input.count > 0); @@ -90,7 +90,7 @@ static void assert_passthrough(grpc_slice value, grpc_split_slice_buffer(compressed_split_mode, &compressed_raw, &compressed); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_msg_decompress( was_compressed ? algorithm : GRPC_COMPRESS_NONE, &compressed, &output)); } @@ -152,7 +152,7 @@ static void test_tiny_data_compress(void) { for (int i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { if (i == GRPC_COMPRESS_NONE) continue; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(0 == grpc_msg_compress(static_cast<grpc_compression_algorithm>(i), &input, &output)); @@ -176,7 +176,7 @@ static void test_bad_decompression_data_crc(void) { grpc_slice_buffer_init(&output); grpc_slice_buffer_add(&input, create_test_value(ONE_MB_A)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* compress it */ grpc_msg_compress(GRPC_COMPRESS_GZIP, &input, &corrupted); /* corrupt the output by smashing the CRC */ @@ -205,7 +205,7 @@ static void test_bad_decompression_data_trailing_garbage(void) { "\x78\xda\x63\x60\x60\x60\x00\x00\x00\x04\x00\x01\x99", 13)); /* try (and fail) to decompress the invalid compresed buffer */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output)); grpc_slice_buffer_destroy(&input); @@ -222,7 +222,7 @@ static void test_bad_decompression_data_stream(void) { grpc_slice_from_copied_buffer("\x78\xda\xff\xff", 4)); /* try (and fail) to decompress the invalid compresed buffer */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output)); grpc_slice_buffer_destroy(&input); @@ -239,7 +239,7 @@ static void test_bad_compression_algorithm(void) { grpc_slice_buffer_add( &input, grpc_slice_from_copied_string("Never gonna give you up")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; was_compressed = grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output); GPR_ASSERT(0 == was_compressed); @@ -263,7 +263,7 @@ static void test_bad_decompression_algorithm(void) { grpc_slice_buffer_add(&input, grpc_slice_from_copied_string( "I'm not really compressed but it doesn't matter")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; was_decompressed = grpc_msg_decompress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output); GPR_ASSERT(0 == was_decompressed); diff --git a/test/core/debug/stats_test.cc b/test/core/debug/stats_test.cc index c7aaf68dd3..a3bb44f496 100644 --- a/test/core/debug/stats_test.cc +++ b/test/core/debug/stats_test.cc @@ -49,7 +49,7 @@ TEST(StatsTest, IncCounters) { for (int i = 0; i < GRPC_STATS_COUNTER_COUNT; i++) { Snapshot snapshot; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_STATS_INC_COUNTER((grpc_stats_counters)i); EXPECT_EQ(snapshot.delta().counters[i], 1); @@ -59,7 +59,7 @@ TEST(StatsTest, IncCounters) { TEST(StatsTest, IncSpecificCounter) { Snapshot snapshot; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_STATS_INC_SYSCALL_POLL(); EXPECT_EQ(snapshot.delta().counters[GRPC_STATS_COUNTER_SYSCALL_POLL], 1); @@ -92,7 +92,7 @@ TEST_P(HistogramTest, IncHistogram) { for (auto j : test_values) { Snapshot snapshot; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_stats_inc_histogram[kHistogram](j); auto delta = snapshot.delta(); diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc index 5e7e12643e..bb192267c7 100644 --- a/test/core/end2end/bad_server_response_test.cc +++ b/test/core/end2end/bad_server_response_test.cc @@ -269,7 +269,7 @@ static void run_test(const char* response_payload, grpc_status_code expected_status, const char* expected_detail) { test_tcp_server test_server; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_event ev; grpc_init(); diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc index 1372c5a746..2c4163ea02 100644 --- a/test/core/end2end/connection_refused_test.cc +++ b/test/core/end2end/connection_refused_test.cc @@ -131,7 +131,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_metadata_array_destroy(&trailing_metadata_recv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (args != NULL) grpc_channel_args_destroy(args); } diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc index a43d963c54..885b2b22b9 100644 --- a/test/core/end2end/fixtures/h2_census.cc +++ b/test/core/end2end/fixtures/h2_census.cc @@ -74,7 +74,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); } } @@ -90,7 +90,7 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1); f->server = grpc_server_create(server_args, NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(server_args); } grpc_server_register_completion_queue(f->server, f->cq, NULL); diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc index 3f9a87d0fc..6fea4d40e0 100644 --- a/test/core/end2end/fixtures/h2_compress.cc +++ b/test/core/end2end/fixtures/h2_compress.cc @@ -66,7 +66,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f, fullstack_compression_fixture_data* ffd = static_cast<fullstack_compression_fixture_data*>(f->fixture_data); if (ffd->client_args_compression != NULL) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(ffd->client_args_compression); } ffd->client_args_compression = grpc_channel_args_set_compression_algorithm( @@ -80,7 +80,7 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f, fullstack_compression_fixture_data* ffd = static_cast<fullstack_compression_fixture_data*>(f->fixture_data); if (ffd->server_args_compression != NULL) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(ffd->server_args_compression); } ffd->server_args_compression = grpc_channel_args_set_compression_algorithm( @@ -95,7 +95,7 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f, } void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture* f) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; fullstack_compression_fixture_data* ffd = static_cast<fullstack_compression_fixture_data*>(f->fixture_data); grpc_channel_args_destroy(ffd->client_args_compression); diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc index 99bced8651..62cc0f6f8f 100644 --- a/test/core/end2end/fixtures/h2_fd.cc +++ b/test/core/end2end/fixtures/h2_fd.cc @@ -68,7 +68,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data); GPR_ASSERT(!f->client); @@ -79,7 +79,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data); GPR_ASSERT(!f->server); f->server = grpc_server_create(server_args, NULL); diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc index e98df083f2..074ba289c9 100644 --- a/test/core/end2end/fixtures/h2_full+workarounds.cc +++ b/test/core/end2end/fixtures/h2_full+workarounds.cc @@ -71,7 +71,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { int i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; fullstack_fixture_data* ffd = static_cast<fullstack_fixture_data*>(f->fixture_data); grpc_arg args[GRPC_MAX_WORKAROUND_ID]; diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc index 84eb9e4513..846319285e 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.cc +++ b/test/core/end2end/fixtures/h2_load_reporting.cc @@ -77,7 +77,7 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture* f, server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1); f->server = grpc_server_create(server_args, NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(server_args); } grpc_server_register_completion_queue(f->server, f->cq, NULL); diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc index 9ffc5b7b7e..b648a1be4d 100644 --- a/test/core/end2end/fixtures/h2_oauth2.cc +++ b/test/core/end2end/fixtures/h2_oauth2.cc @@ -143,7 +143,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) { static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_credentials* ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); grpc_call_credentials* oauth2_creds = grpc_md_only_test_credentials_create( diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc index 9e87a22962..c18f815f9f 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.cc +++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc @@ -50,7 +50,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq)); grpc_server_setup_transport(f->server, transport, NULL, @@ -87,7 +87,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; sp_client_setup cs; @@ -101,7 +101,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); @@ -126,7 +126,7 @@ static grpc_end2end_test_config configs[] = { int main(int argc, char** argv) { size_t i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* force tracing on, with a value to force many code paths in trace.c to be taken */ diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc index fa69ad84cf..6c34dbba6f 100644 --- a/test/core/end2end/fixtures/h2_sockpair.cc +++ b/test/core/end2end/fixtures/h2_sockpair.cc @@ -44,7 +44,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq)); grpc_server_setup_transport(f->server, transport, NULL, @@ -81,7 +81,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; sp_client_setup cs; @@ -95,7 +95,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc index a12d60575b..909a2db8aa 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc @@ -44,7 +44,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_end2end_test_fixture* f = static_cast<grpc_end2end_test_fixture*>(ts); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_endpoint_add_to_pollset(sfd->server, grpc_cq_pollset(f->cq)); grpc_server_setup_transport(f->server, transport, NULL, @@ -92,7 +92,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; sp_client_setup cs; @@ -106,7 +106,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc index c137cec8b9..ea8286c9e7 100644 --- a/test/core/end2end/fixtures/h2_ssl.cc +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -110,7 +110,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack( grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(new_client_args); } } diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc index 0c130d6ae1..d50cd5c9e3 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.cc +++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc @@ -66,7 +66,7 @@ static grpc_channel* create_proxy_client(const char* target, grpc_secure_channel_create(ssl_creds, target, new_client_args, NULL); grpc_channel_credentials_release(ssl_creds); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(new_client_args); } return channel; @@ -147,7 +147,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack( grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(new_client_args); } } diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc index 73a3e2c444..698282d990 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.cc +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc @@ -391,7 +391,8 @@ static void on_read_request_done(void* arg, grpc_error* error) { GPR_ASSERT(resolved_addresses->naddrs >= 1); // Connect to requested address. // The connection callback inherits our reference to conn. - const grpc_millis deadline = ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC; + const grpc_millis deadline = + grpc_core::ExecCtx::Get()->Now() + 10 * GPR_MS_PER_SEC; grpc_tcp_client_connect(&conn->on_server_connect_done, &conn->server_endpoint, conn->pollset_set, NULL, &resolved_addresses->addrs[0], deadline); @@ -444,7 +445,7 @@ static void on_accept(void* arg, grpc_endpoint* endpoint, static void thread_main(void* arg) { grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)arg; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; do { gpr_ref(&proxy->users); grpc_pollset_worker* worker = NULL; @@ -452,15 +453,15 @@ static void thread_main(void* arg) { GRPC_LOG_IF_ERROR( "grpc_pollset_work", grpc_pollset_work(proxy->pollset, &worker, - ExecCtx::Get()->Now() + GPR_MS_PER_SEC)); + grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC)); gpr_mu_unlock(proxy->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } while (!gpr_unref(&proxy->users)); } grpc_end2end_http_proxy* grpc_end2end_http_proxy_create( grpc_channel_args* args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_end2end_http_proxy* proxy = (grpc_end2end_http_proxy*)gpr_malloc(sizeof(*proxy)); memset(proxy, 0, sizeof(*proxy)); @@ -505,7 +506,7 @@ static void destroy_pollset(void* arg, grpc_error* error) { void grpc_end2end_http_proxy_destroy(grpc_end2end_http_proxy* proxy) { gpr_unref(&proxy->users); // Signal proxy thread to shutdown. - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_thd_join(proxy->thd); grpc_tcp_server_shutdown_listeners(proxy->server); grpc_tcp_server_unref(proxy->server); diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 1d22ba3a42..3fb6d0fdb6 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -411,7 +411,7 @@ void my_resolve_address(const char* addr, const char* default_port, r->addrs = addresses; r->lb_addrs = NULL; grpc_timer_init( - &r->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(), + &r->timer, GPR_MS_PER_SEC + grpc_core::ExecCtx::Get()->Now(), GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); } @@ -428,7 +428,7 @@ grpc_ares_request* my_dns_lookup_ares(const char* dns_server, const char* addr, r->addrs = NULL; r->lb_addrs = lb_addrs; grpc_timer_init( - &r->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(), + &r->timer, GPR_MS_PER_SEC + grpc_core::ExecCtx::Get()->Now(), GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); return NULL; } @@ -488,7 +488,7 @@ static void sched_connect(grpc_closure* closure, grpc_endpoint** ep, fc->ep = ep; fc->deadline = deadline; grpc_timer_init( - &fc->timer, GPR_MS_PER_SEC + ExecCtx::Get()->Now(), + &fc->timer, GPR_MS_PER_SEC + grpc_core::ExecCtx::Get()->Now(), GRPC_CLOSURE_CREATE(do_connect, fc, grpc_schedule_on_exec_ctx)); } @@ -743,7 +743,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_init(); grpc_timer_manager_set_threading(false); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_executor_set_threading(false); } grpc_resolve_address = my_resolve_address; @@ -837,7 +837,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { g_channel = grpc_insecure_channel_create(target_uri, args, NULL); GPR_ASSERT(g_channel != NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } gpr_free(target_uri); @@ -864,7 +864,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { g_server = grpc_server_create(args, NULL); GPR_ASSERT(g_server != NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } grpc_server_register_completion_queue(g_server, cq, NULL); @@ -1192,7 +1192,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { g_channel = grpc_secure_channel_create(creds, target_uri, args, NULL); GPR_ASSERT(g_channel != NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } gpr_free(target_uri); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 95ed2fcdac..318e8129d0 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -43,7 +43,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_executor_set_threading(false); grpc_resource_quota* resource_quota = @@ -111,7 +111,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_event ev; while (1) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index 21778c0a67..dca3ff498e 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -41,7 +41,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_executor_set_threading(false); grpc_resource_quota* resource_quota = @@ -78,7 +78,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_event ev; while (1) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index e0da548a75..97c0692711 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -181,7 +181,7 @@ typedef enum { NONE, SELF_SIGNED, SIGNED, BAD_CERT_PAIR } certtype; grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); \ chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); \ { \ - ExecCtx _local_exec_ctx; \ + grpc_core::ExecCtx _local_exec_ctx; \ grpc_channel_args_destroy(new_client_args); \ } \ } diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc index ffafb1f1e9..45ea2b9906 100644 --- a/test/core/end2end/tests/cancel_after_accept.cc +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -245,7 +245,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_call_unref(s); if (args != NULL) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc index 7e20487f8b..231aa7abbc 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.cc +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -277,7 +277,7 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_call_unref(s); if (args != NULL) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(args); } diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc index f04addbe9e..aa3523a987 100644 --- a/test/core/end2end/tests/compressed_payload.cc +++ b/test/core/end2end/tests/compressed_payload.cc @@ -129,7 +129,7 @@ static void request_for_disabled_algorithm( server_args = grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_NONE); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; server_args = grpc_channel_args_compression_algorithm_set_state( &server_args, algorithm_to_disable, false); } @@ -256,7 +256,7 @@ static void request_for_disabled_algorithm( grpc_byte_buffer_destroy(request_payload_recv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } @@ -534,7 +534,7 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc index 6ce22d77c6..34c046d364 100644 --- a/test/core/end2end/tests/load_reporting_hook.cc +++ b/test/core/end2end/tests/load_reporting_hook.cc @@ -300,7 +300,7 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { &trailing_lr_metadata); end_test(&f); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(lr_server_args); } config.tear_down_data(&f); diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc index f884d8b11f..808cf470e1 100644 --- a/test/core/end2end/tests/max_message_length.cc +++ b/test/core/end2end/tests/max_message_length.cc @@ -173,7 +173,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, f = begin_test(config, "test_max_request_message_length", client_args, server_args); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (client_args != NULL) grpc_channel_args_destroy(client_args); if (server_args != NULL) grpc_channel_args_destroy(server_args); } @@ -363,7 +363,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, f = begin_test(config, "test_max_response_message_length", client_args, server_args); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; if (client_args != NULL) grpc_channel_args_destroy(client_args); if (server_args != NULL) grpc_channel_args_destroy(server_args); } diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc index cec46305bd..d118aceeb1 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.cc +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc @@ -129,7 +129,7 @@ static void request_for_disabled_algorithm( server_args = grpc_channel_args_set_stream_compression_algorithm( NULL, GRPC_STREAM_COMPRESS_NONE); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; server_args = grpc_channel_args_stream_compression_algorithm_set_state( &server_args, algorithm_to_disable, false); } @@ -257,7 +257,7 @@ static void request_for_disabled_algorithm( grpc_byte_buffer_destroy(request_payload_recv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } @@ -542,7 +542,7 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc index c304c990d7..6bd1e99ca1 100644 --- a/test/core/end2end/tests/stream_compression_payload.cc +++ b/test/core/end2end/tests/stream_compression_payload.cc @@ -277,7 +277,7 @@ static void test_invoke_request_response_with_payload( end_test(&f); config.tear_down_data(&f); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index f4b737d7a3..2504c791e6 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc @@ -273,7 +273,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, end_test(&f); config.tear_down_data(&f); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc index 100f393b8e..723d3274e2 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.cc +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -142,7 +142,7 @@ static void request_with_payload_template( NULL, default_server_channel_compression_algorithm); if (user_agent_override) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args* client_args_old = client_args; grpc_arg arg; arg.key = const_cast<char*>(GRPC_ARG_PRIMARY_USER_AGENT_STRING); @@ -348,7 +348,7 @@ static void request_with_payload_template( cq_verifier_destroy(cqv); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(client_args); grpc_channel_args_destroy(server_args); } diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc index dfa328360d..4f9421e6d4 100644 --- a/test/core/http/httpcli_test.cc +++ b/test/core/http/httpcli_test.cc @@ -60,7 +60,7 @@ static void on_finish(void* arg, grpc_error* error) { static void test_get(int port) { grpc_httpcli_request req; char* host; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; g_done = 0; gpr_log(GPR_INFO, "test_get"); @@ -99,7 +99,7 @@ static void test_get(int port) { static void test_post(int port) { grpc_httpcli_request req; char* host; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; g_done = 0; gpr_log(GPR_INFO, "test_post"); @@ -142,7 +142,7 @@ static void destroy_pops(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_subprocess* server; char* me = argv[0]; char* lslash = strrchr(me, '/'); diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index ff082e8367..fb69fc97d1 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -60,7 +60,7 @@ static void on_finish(void* arg, grpc_error* error) { static void test_get(int port) { grpc_httpcli_request req; char* host; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; g_done = 0; gpr_log(GPR_INFO, "test_get"); @@ -100,7 +100,7 @@ static void test_get(int port) { static void test_post(int port) { grpc_httpcli_request req; char* host; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; g_done = 0; gpr_log(GPR_INFO, "test_post"); @@ -144,7 +144,7 @@ static void destroy_pops(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_subprocess* server; char* me = argv[0]; char* lslash = strrchr(me, '/'); diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index df8d55f1f6..cf2bc0ce06 100644 --- a/test/core/iomgr/combiner_test.cc +++ b/test/core/iomgr/combiner_test.cc @@ -28,7 +28,7 @@ static void test_no_op(void) { gpr_log(GPR_DEBUG, "test_no_op"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_COMBINER_UNREF(grpc_combiner_create(), "test_no_op"); } @@ -42,11 +42,11 @@ static void test_execute_one(void) { grpc_combiner* lock = grpc_combiner_create(); gpr_event done; gpr_event_init(&done); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE(set_event_to_true, &done, grpc_combiner_scheduler(lock)), GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)) != NULL); GRPC_COMBINER_UNREF(lock, "test_execute_one"); @@ -72,7 +72,7 @@ static void check_one(void* a, grpc_error* error) { static void execute_many_loop(void* a) { thd_args* args = static_cast<thd_args*>(a); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; size_t n = 1; for (size_t i = 0; i < 10; i++) { for (size_t j = 0; j < 10000; j++) { @@ -82,7 +82,7 @@ static void execute_many_loop(void* a) { GRPC_CLOSURE_SCHED(GRPC_CLOSURE_CREATE( check_one, c, grpc_combiner_scheduler(args->lock)), GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } // sleep for a little bit, to test a combiner draining and another thread // picking it up @@ -112,7 +112,7 @@ static void test_execute_many(void) { gpr_inf_future(GPR_CLOCK_REALTIME)) != NULL); gpr_thd_join(thds[i]); } - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_COMBINER_UNREF(lock, "test_execute_many"); } @@ -133,12 +133,12 @@ static void test_execute_finally(void) { gpr_log(GPR_DEBUG, "test_execute_finally"); grpc_combiner* lock = grpc_combiner_create(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_event_init(&got_in_finally); GRPC_CLOSURE_SCHED( GRPC_CLOSURE_CREATE(add_finally, lock, grpc_combiner_scheduler(lock)), GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(gpr_event_wait(&got_in_finally, grpc_timeout_seconds_to_deadline(5)) != NULL); GRPC_COMBINER_UNREF(lock, "test_execute_finally"); diff --git a/test/core/iomgr/endpoint_pair_test.cc b/test/core/iomgr/endpoint_pair_test.cc index 72833a8dbe..658971b9fb 100644 --- a/test/core/iomgr/endpoint_pair_test.cc +++ b/test/core/iomgr/endpoint_pair_test.cc @@ -32,7 +32,7 @@ static void clean_up(void) {} static grpc_endpoint_test_fixture create_fixture_endpoint_pair( size_t slice_size) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_test_fixture f; grpc_arg a[1]; a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE); @@ -59,7 +59,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size())); diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc index 5c156ef524..e000eb289b 100644 --- a/test/core/iomgr/endpoint_tests.cc +++ b/test/core/iomgr/endpoint_tests.cc @@ -173,7 +173,7 @@ static void read_and_write_test(grpc_endpoint_test_config config, struct read_and_write_test_state state; grpc_endpoint_test_fixture f = begin_test(config, "read_and_write_test", slice_size); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20)); gpr_log(GPR_DEBUG, @@ -213,7 +213,7 @@ static void read_and_write_test(grpc_endpoint_test_config config, even when bytes_written is unsigned. */ state.bytes_written -= state.current_write_size; read_and_write_test_write_handler(&state, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_endpoint_read(state.read_ep, &state.incoming, &state.done_read); @@ -225,17 +225,17 @@ static void read_and_write_test(grpc_endpoint_test_config config, grpc_endpoint_shutdown( state.write_ep, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Test Shutdown")); } - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); while (!state.read_done || !state.write_done) { grpc_pollset_worker* worker = NULL; - GPR_ASSERT(ExecCtx::Get()->Now() < deadline); + GPR_ASSERT(grpc_core::ExecCtx::Get()->Now() < deadline); GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); } gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); end_test(config); grpc_slice_buffer_destroy_internal(&state.outgoing); @@ -252,16 +252,17 @@ static void inc_on_failure(void* arg, grpc_error* error) { } static void wait_for_fail_count(int* fail_count, int want_fail_count) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10)); - while (ExecCtx::Get()->Now() < deadline && *fail_count < want_fail_count) { + while (grpc_core::ExecCtx::Get()->Now() < deadline && + *fail_count < want_fail_count) { grpc_pollset_worker* worker = NULL; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } GPR_ASSERT(*fail_count == want_fail_count); @@ -276,7 +277,7 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) { grpc_slice_buffer slice_buffer; grpc_slice_buffer_init(&slice_buffer); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_endpoint_add_to_pollset(f.client_ep, g_pollset); grpc_endpoint_read(f.client_ep, &slice_buffer, GRPC_CLOSURE_CREATE(inc_on_failure, &fail_count, diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc index 5c71bc6152..8aa68c6f6f 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.cc +++ b/test/core/iomgr/ev_epollsig_linux_test.cc @@ -77,11 +77,11 @@ static void test_fd_cleanup(test_fd* tfds, int num_fds) { for (i = 0; i < num_fds; i++) { grpc_fd_shutdown(tfds[i].fd, GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup")); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */, "test_fd_cleanup"); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(release_fd == tfds[i].inner_fd); close(tfds[i].inner_fd); @@ -110,7 +110,7 @@ static void test_pollset_cleanup(test_pollset* pollsets, int num_pollsets) { grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(pollsets[i].pollset, &destroyed); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_free(pollsets[i].pollset); } } @@ -130,7 +130,7 @@ static void test_pollset_cleanup(test_pollset* pollsets, int num_pollsets) { #define NUM_POLLSETS 4 static void test_add_fd_to_pollset() { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; test_fd tfds[NUM_FDS]; int fds[NUM_FDS]; test_pollset pollsets[NUM_POLLSETS]; @@ -168,32 +168,32 @@ static void test_add_fd_to_pollset() { /* == Step 1 == */ for (i = 0; i <= 2; i++) { grpc_pollset_add_fd(pollsets[0].pollset, tfds[i].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } for (i = 3; i <= 4; i++) { grpc_pollset_add_fd(pollsets[1].pollset, tfds[i].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } for (i = 5; i <= 7; i++) { grpc_pollset_add_fd(pollsets[2].pollset, tfds[i].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } /* == Step 2 == */ for (i = 0; i <= 1; i++) { grpc_pollset_add_fd(pollsets[3].pollset, tfds[i].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } /* == Step 3 == */ grpc_pollset_add_fd(pollsets[1].pollset, tfds[0].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* == Step 4 == */ grpc_pollset_add_fd(pollsets[2].pollset, tfds[3].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* All polling islands are merged at this point */ @@ -231,7 +231,7 @@ static __thread int thread_wakeups = 0; static void test_threading_loop(void* arg) { threading_shared* shared = static_cast<threading_shared*>(arg); while (thread_wakeups < 1000000) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_worker* worker; gpr_mu_lock(shared->mu); GPR_ASSERT(GRPC_LOG_IF_ERROR( @@ -271,7 +271,7 @@ static void test_threading(void) { shared.wakeup_desc = grpc_fd_create(fd.read_fd, "wakeup"); shared.wakeups = 0; { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_add_fd(shared.pollset, shared.wakeup_desc); grpc_fd_notify_on_read( shared.wakeup_desc, @@ -286,7 +286,7 @@ static void test_threading(void) { fd.read_fd = 0; grpc_wakeup_fd_destroy(&fd); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_fd_shutdown(shared.wakeup_desc, GRPC_ERROR_CANCELLED); grpc_fd_orphan(shared.wakeup_desc, NULL, NULL, false /* already_closed */, "done"); @@ -301,7 +301,7 @@ int main(int argc, char** argv) { const char* poll_strategy = NULL; grpc_test_init(argc, argv); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; poll_strategy = grpc_get_poll_strategy_name(); if (poll_strategy != NULL && strcmp(poll_strategy, "epollsig") == 0) { diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index 7f3420269e..11e664d8ff 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -31,7 +31,7 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* set max # of file descriptors to a low value, and verify we can create and destroy many more than this number @@ -45,7 +45,7 @@ int main(int argc, char** argv) { p = grpc_iomgr_create_endpoint_pair("test", NULL); grpc_endpoint_destroy(p.client); grpc_endpoint_destroy(p.server); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } grpc_resource_quota_unref(resource_quota); diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index d22cb5f4f6..160cfd4e99 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -246,7 +246,7 @@ static int server_start(server* sv) { static void server_wait_and_shutdown(server* sv) { gpr_mu_lock(g_mu); while (!sv->done) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_worker* worker = NULL; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", @@ -362,7 +362,7 @@ static void client_wait_and_shutdown(client* cl) { gpr_mu_lock(g_mu); while (!cl->done) { grpc_pollset_worker* worker = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(g_pollset, &worker, GRPC_MILLIS_INF_FUTURE))); @@ -380,7 +380,7 @@ static void test_grpc_fd(void) { server sv; client cl; int port; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; server_init(&sv); port = server_start(&sv); @@ -436,7 +436,7 @@ static void test_grpc_fd_change(void) { ssize_t result; grpc_closure first_closure; grpc_closure second_closure; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CLOSURE_INIT(&first_closure, first_read_callback, &a, grpc_schedule_on_exec_ctx); @@ -513,7 +513,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size())); @@ -523,7 +523,7 @@ int main(int argc, char** argv) { GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(g_pollset, &destroyed); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_free(g_pollset); grpc_shutdown(); diff --git a/test/core/iomgr/pollset_set_test.cc b/test/core/iomgr/pollset_set_test.cc index e9b46f59e3..bc9aafd5bd 100644 --- a/test/core/iomgr/pollset_set_test.cc +++ b/test/core/iomgr/pollset_set_test.cc @@ -84,7 +84,7 @@ static void cleanup_test_pollsets(test_pollset* pollsets, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(pollsets[i].ps, &destroyed); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_free(pollsets[i].ps); pollsets[i].ps = NULL; } @@ -129,7 +129,7 @@ static void cleanup_test_fds(test_fd* tfds, const int num_fds) { for (int i = 0; i < num_fds; i++) { grpc_fd_shutdown(tfds[i].fd, GRPC_ERROR_CREATE_FROM_STATIC_STRING("fd cleanup")); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* grpc_fd_orphan frees the memory allocated for grpc_fd. Normally it also * calls close() on the underlying fd. In our case, we are using @@ -138,7 +138,7 @@ static void cleanup_test_fds(test_fd* tfds, const int num_fds) { * underlying fd, call it with a non-NULL 'release_fd' parameter */ grpc_fd_orphan(tfds[i].fd, NULL, &release_fd, false /* already_closed */, "test_fd_cleanup"); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_wakeup_fd_destroy(&tfds[i].wakeup_fd); } @@ -199,7 +199,7 @@ static void pollset_set_test_basic() { * | * +---> FD9 (Added after PS2 is added to PSS0) */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_worker* worker; grpc_millis deadline; @@ -236,7 +236,7 @@ static void pollset_set_test_basic() { grpc_pollset_add_fd(pollsets[1].ps, tfds[8].fd); grpc_pollset_add_fd(pollsets[2].ps, tfds[9].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Test that if any FD in the above structure is readable, it is observable by * doing grpc_pollset_work on any pollset @@ -259,10 +259,10 @@ static void pollset_set_test_basic() { grpc_pollset_work(pollsets[i].ps, &worker, deadline)); gpr_mu_unlock(pollsets[i].mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); verify_readable_and_reset(tfds, num_fds); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } /* Test tear down */ @@ -270,14 +270,14 @@ static void pollset_set_test_basic() { grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[5].fd); grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[1].fd); grpc_pollset_set_del_fd(pollset_sets[1].pss, tfds[6].fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollsets[0].ps); grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[1].ps); grpc_pollset_set_del_pollset(pollset_sets[0].pss, pollsets[2].ps); grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); cleanup_test_fds(tfds, num_fds); cleanup_test_pollsets(pollsets, num_ps); @@ -301,7 +301,7 @@ void pollset_set_test_dup_fds() { * | +--> FD2 * +---> FD1 */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_worker* worker; grpc_millis deadline; @@ -337,10 +337,10 @@ void pollset_set_test_dup_fds() { GPR_ASSERT(GRPC_ERROR_NONE == grpc_pollset_work(pollset.ps, &worker, deadline)); gpr_mu_unlock(pollset.mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); verify_readable_and_reset(tfds, num_fds); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Tear down */ grpc_pollset_set_del_fd(pollset_sets[0].pss, tfds[0].fd); @@ -349,7 +349,7 @@ void pollset_set_test_dup_fds() { grpc_pollset_set_del_pollset(pollset_sets[1].pss, pollset.ps); grpc_pollset_set_del_pollset_set(pollset_sets[0].pss, pollset_sets[1].pss); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); cleanup_test_fds(tfds, num_fds); cleanup_test_pollsets(&pollset, num_ps); @@ -371,7 +371,7 @@ void pollset_set_test_empty_pollset() { * | * +---> FD2 */ - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_worker* worker; grpc_millis deadline; @@ -404,16 +404,16 @@ void pollset_set_test_empty_pollset() { GPR_ASSERT(GRPC_ERROR_NONE == grpc_pollset_work(pollsets[0].ps, &worker, deadline)); gpr_mu_unlock(pollsets[0].mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); verify_readable_and_reset(tfds, num_fds); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Tear down */ grpc_pollset_set_del_fd(pollset_set.pss, tfds[0].fd); grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[0].ps); grpc_pollset_set_del_pollset(pollset_set.pss, pollsets[1].ps); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); cleanup_test_fds(tfds, num_fds); cleanup_test_pollsets(pollsets, num_ps); @@ -421,7 +421,7 @@ void pollset_set_test_empty_pollset() { } int main(int argc, char** argv) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); const char* poll_strategy = grpc_get_poll_strategy_name(); diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index 9870d7aa73..4da5cd7a1f 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -67,7 +67,7 @@ void args_finish(args_struct* args) { grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(args->pollset, &do_nothing_cb); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_pollset_destroy(args->pollset); gpr_free(args->pollset); } @@ -79,14 +79,14 @@ static grpc_millis n_sec_deadline(int seconds) { static void actually_poll(void* argsp) { args_struct* args = static_cast<args_struct*>(argsp); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = n_sec_deadline(10); while (true) { bool done = gpr_atm_acq_load(&args->done_atm) != 0; if (done) { break; } - grpc_millis time_left = deadline - ExecCtx::Get()->Now(); + grpc_millis time_left = deadline - grpc_core::ExecCtx::Get()->Now(); gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left); GPR_ASSERT(time_left >= 0); grpc_pollset_worker* worker = NULL; @@ -94,7 +94,7 @@ static void actually_poll(void* argsp) { GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(args->pollset, &worker, n_sec_deadline(1))); gpr_mu_unlock(args->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } gpr_event_set(&args->ev, (void*)1); } @@ -120,7 +120,7 @@ static void must_fail(void* argsp, grpc_error* err) { } static void test_unix_socket(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); poll_pollset_until_request_done(&args); @@ -132,7 +132,7 @@ static void test_unix_socket(void) { } static void test_unix_socket_path_name_too_long(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); const char prefix[] = "unix:/path/name"; @@ -156,7 +156,7 @@ static void test_unix_socket_path_name_too_long(void) { int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; test_unix_socket(); test_unix_socket_path_name_too_long(); grpc_executor_shutdown(); diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index dbc825884d..035d99cf5e 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -63,7 +63,7 @@ void args_finish(args_struct* args) { grpc_pollset_shutdown(args->pollset, &do_nothing_cb); gpr_mu_unlock(args->mu); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_pollset_destroy(args->pollset); gpr_free(args->pollset); } @@ -74,14 +74,14 @@ static grpc_millis n_sec_deadline(int seconds) { } static void poll_pollset_until_request_done(args_struct* args) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = n_sec_deadline(10); while (true) { bool done = gpr_atm_acq_load(&args->done_atm) != 0; if (done) { break; } - grpc_millis time_left = deadline - ExecCtx::Get()->Now(); + grpc_millis time_left = deadline - grpc_core::ExecCtx::Get()->Now(); gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left); GPR_ASSERT(time_left >= 0); grpc_pollset_worker* worker = NULL; @@ -89,7 +89,7 @@ static void poll_pollset_until_request_done(args_struct* args) { GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(args->pollset, &worker, n_sec_deadline(1))); gpr_mu_unlock(args->mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } gpr_event_set(&args->ev, (void*)1); } @@ -115,66 +115,66 @@ static void must_fail(void* argsp, grpc_error* err) { } static void test_localhost(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( "localhost:1", NULL, args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } static void test_default_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( "localhost", "1", args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } static void test_non_numeric_default_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( "localhost", "https", args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } static void test_missing_default_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( "localhost", NULL, args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } static void test_ipv6_with_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( "[2001:db8::1]:1", NULL, args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } @@ -187,14 +187,14 @@ static void test_ipv6_without_port(void) { }; unsigned i; for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( kCases[i], "80", args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } @@ -207,14 +207,14 @@ static void test_invalid_ip_addresses(void) { }; unsigned i; for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( kCases[i], NULL, args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } @@ -226,14 +226,14 @@ static void test_unparseable_hostports(void) { }; unsigned i; for (i = 0; i < sizeof(kCases) / sizeof(*kCases); i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; args_struct args; args_init(&args); grpc_resolve_address( kCases[i], "1", args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&args); args_finish(&args); } @@ -242,7 +242,7 @@ static void test_unparseable_hostports(void) { int main(int argc, char** argv) { grpc_test_init(argc, argv); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; test_localhost(); test_default_port(); test_non_numeric_default_port(); diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc index 40beadc5d6..c4f6886836 100644 --- a/test/core/iomgr/resource_quota_test.cc +++ b/test/core/iomgr/resource_quota_test.cc @@ -84,7 +84,7 @@ grpc_closure* make_unused_reclaimer(grpc_closure* then) { } static void destroy_user(grpc_resource_user* usr) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_unref(usr); } @@ -117,11 +117,11 @@ static void test_instant_alloc_then_free(void) { grpc_resource_quota_resize(q, 1024 * 1024); grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -135,7 +135,7 @@ static void test_instant_alloc_free_pair(void) { grpc_resource_quota_resize(q, 1024 * 1024); grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, NULL); grpc_resource_user_free(usr, 1024); } @@ -152,14 +152,14 @@ static void test_simple_async_alloc(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -175,7 +175,7 @@ static void test_async_alloc_blocked_by_size(void) { gpr_event ev; gpr_event_init(&ev); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait( @@ -185,7 +185,7 @@ static void test_async_alloc_blocked_by_size(void) { GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != NULL); ; { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -201,7 +201,7 @@ static void test_scavenge(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -209,13 +209,13 @@ static void test_scavenge(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr1, 1024); } { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -223,7 +223,7 @@ static void test_scavenge(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr2, 1024); } grpc_resource_quota_unref(q); @@ -240,7 +240,7 @@ static void test_scavenge_blocked(void) { gpr_event ev; { gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -249,14 +249,14 @@ static void test_scavenge_blocked(void) { } { gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait( &ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr1, 1024); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -264,7 +264,7 @@ static void test_scavenge_blocked(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr2, 1024); } grpc_resource_quota_unref(q); @@ -281,7 +281,7 @@ static void test_blocked_until_scheduled_reclaim(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -291,14 +291,14 @@ static void test_blocked_until_scheduled_reclaim(void) { gpr_event reclaim_done; gpr_event_init(&reclaim_done); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_reclaimer(usr, 1024, set_event(&reclaim_done))); } { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&reclaim_done, @@ -308,7 +308,7 @@ static void test_blocked_until_scheduled_reclaim(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -325,7 +325,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr1, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -335,14 +335,14 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { gpr_event reclaim_done; gpr_event_init(&reclaim_done); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr1, false, make_reclaimer(usr1, 1024, set_event(&reclaim_done))); } { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr2, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&reclaim_done, @@ -352,7 +352,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr2, 1024); } grpc_resource_quota_unref(q); @@ -369,7 +369,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -379,14 +379,14 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { gpr_event reclaim_done; gpr_event_init(&reclaim_done); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, true, make_reclaimer(usr, 1024, set_event(&reclaim_done))); } { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&reclaim_done, @@ -396,7 +396,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -414,7 +414,7 @@ static void test_unused_reclaim_is_cancelled(void) { gpr_event destructive_done; gpr_event_init(&destructive_done); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_unused_reclaimer(set_event(&benign_done))); grpc_resource_user_post_reclaimer( @@ -448,7 +448,7 @@ static void test_benign_reclaim_is_preferred(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -456,7 +456,7 @@ static void test_benign_reclaim_is_preferred(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_reclaimer(usr, 1024, set_event(&benign_done))); grpc_resource_user_post_reclaimer( @@ -472,7 +472,7 @@ static void test_benign_reclaim_is_preferred(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&benign_done, @@ -484,7 +484,7 @@ static void test_benign_reclaim_is_preferred(void) { NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -508,7 +508,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != @@ -516,7 +516,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_reclaimer(usr, 512, set_event(&benign_done))); grpc_resource_user_post_reclaimer( @@ -532,7 +532,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { { gpr_event ev; gpr_event_init(&ev); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&ev)); GPR_ASSERT(gpr_event_wait(&benign_done, @@ -544,7 +544,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { ; } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } grpc_resource_quota_unref(q); @@ -563,16 +563,16 @@ static void test_resource_user_stays_allocated_until_memory_released(void) { grpc_resource_quota_resize(q, 1024 * 1024); grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_quota_unref(q); grpc_resource_user_unref(usr); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } } @@ -593,7 +593,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( gpr_event reclaimer_cancelled; gpr_event_init(&reclaimer_cancelled); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_unused_reclaimer(set_event(&reclaimer_cancelled))); @@ -604,7 +604,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( { gpr_event allocated; gpr_event_init(&allocated); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); GPR_ASSERT(gpr_event_wait(&allocated, @@ -614,7 +614,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_unref(usr); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, @@ -622,7 +622,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( NULL); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, @@ -641,7 +641,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { { gpr_event allocated; gpr_event_init(&allocated); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); GPR_ASSERT(gpr_event_wait(&allocated, @@ -651,7 +651,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { gpr_event reclaimer_done; gpr_event_init(&reclaimer_done); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_post_reclaimer( usr, false, make_reclaimer(usr, 1024, set_event(&reclaimer_done))); @@ -662,7 +662,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { { gpr_event allocated; gpr_event_init(&allocated); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc(usr, 1024, set_event(&allocated)); GPR_ASSERT(gpr_event_wait(&allocated, @@ -672,7 +672,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { } } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_free(usr, 1024); } destroy_user(usr); @@ -696,14 +696,14 @@ static void test_one_slice(void) { { const int start_allocs = num_allocs; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); assert_counter_becomes(&num_allocs, start_allocs + 1); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer_destroy_internal(&buffer); } destroy_user(usr); @@ -728,20 +728,20 @@ static void test_one_slice_deleted_late(void) { { const int start_allocs = num_allocs; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); assert_counter_becomes(&num_allocs, start_allocs + 1); } { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_unref(usr); } grpc_resource_quota_unref(q); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer_destroy_internal(&buffer); } } @@ -770,7 +770,7 @@ static void test_negative_rq_free_pool(void) { { const int start_allocs = num_allocs; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_alloc_slices(&alloc, 1024, 1, &buffer); assert_counter_becomes(&num_allocs, start_allocs + 1); @@ -783,13 +783,13 @@ static void test_negative_rq_free_pool(void) { GPR_ASSERT(grpc_resource_quota_get_memory_pressure(q) > 1 - eps); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_user_unref(usr); } grpc_resource_quota_unref(q); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_buffer_destroy_internal(&buffer); } } diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc index abefecba33..d736d08a45 100644 --- a/test/core/iomgr/tcp_client_posix_test.cc +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -53,7 +53,7 @@ static grpc_millis test_deadline(void) { static void finish_connection() { gpr_mu_lock(g_mu); g_connections_complete++; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT( GRPC_LOG_IF_ERROR("pollset_kick", grpc_pollset_kick(g_pollset, NULL))); @@ -83,7 +83,7 @@ void test_succeeds(void) { int r; int connections_complete_before; grpc_closure done; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_succeeds"); @@ -127,7 +127,7 @@ void test_succeeds(void) { grpc_timespec_to_millis_round_up( grpc_timeout_seconds_to_deadline(5))))); gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } @@ -139,7 +139,7 @@ void test_fails(void) { struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; int connections_complete_before; grpc_closure done; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_fails"); @@ -175,7 +175,7 @@ void test_fails(void) { break; } gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } @@ -188,7 +188,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset_set = grpc_pollset_set_create(); diff --git a/test/core/iomgr/tcp_client_uv_test.cc b/test/core/iomgr/tcp_client_uv_test.cc index 0355896b85..344478ea97 100644 --- a/test/core/iomgr/tcp_client_uv_test.cc +++ b/test/core/iomgr/tcp_client_uv_test.cc @@ -87,7 +87,7 @@ void test_succeeds(void) { uv_tcp_t* svr_handle = static_cast<uv_tcp_t*>(gpr_malloc(sizeof(uv_tcp_t))); int connections_complete_before; grpc_closure done; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_succeeds"); @@ -121,7 +121,7 @@ void test_succeeds(void) { grpc_timespec_to_millis_round_up( grpc_timeout_seconds_to_deadline(5))))); gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } @@ -136,7 +136,7 @@ void test_fails(void) { struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; int connections_complete_before; grpc_closure done; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_fails"); @@ -173,7 +173,7 @@ void test_fails(void) { break; } gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } @@ -186,7 +186,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = static_cast<grpc_pollset*>(gpr_malloc(grpc_pollset_size())); diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index 678e1c3638..c12e695fb6 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -162,7 +162,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { size_t written_bytes; grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "Read test of size %" PRIuPTR ", slice size %" PRIuPTR, num_bytes, slice_size); @@ -212,7 +212,7 @@ static void large_read_test(size_t slice_size) { ssize_t written_bytes; grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "Start large read test, slice size %" PRIuPTR, slice_size); @@ -300,7 +300,7 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) { int flags; int current = 0; int i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; flags = fcntl(fd, F_GETFL, 0); GPR_ASSERT(fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == 0); @@ -347,7 +347,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { grpc_closure write_done_closure; grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "Start write test with %" PRIuPTR " bytes, slice size %" PRIuPTR, @@ -410,7 +410,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { int fd; grpc_millis deadline = grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(20)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure fd_released_cb; int fd_released_done = 0; GRPC_CLOSURE_INIT(&fd_released_cb, &on_fd_released, &fd_released_done, @@ -450,7 +450,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { gpr_log(GPR_DEBUG, "wakeup: read=%" PRIdPTR " target=%" PRIdPTR, state.read_bytes, state.target_read_bytes); gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } GPR_ASSERT(state.read_bytes == state.target_read_bytes); @@ -458,7 +458,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_slice_buffer_destroy_internal(&state.incoming); grpc_tcp_destroy_and_release_fd(ep, &fd, &fd_released_cb); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); while (!fd_released_done) { grpc_pollset_worker* worker = NULL; @@ -506,7 +506,7 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( size_t slice_size) { int sv[2]; grpc_endpoint_test_fixture f; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; create_sockets(sv); grpc_resource_quota* resource_quota = @@ -537,7 +537,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size()); diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index 1c3f4490d5..7b3219320e 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -163,14 +163,14 @@ static void on_connect(void* arg, grpc_endpoint* tcp, grpc_pollset* pollset, } static void test_no_op(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s)); grpc_tcp_server_unref(s); } static void test_no_op_with_start(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s)); LOG_TEST("test_no_op_with_start"); @@ -179,7 +179,7 @@ static void test_no_op_with_start(void) { } static void test_no_op_with_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; @@ -198,7 +198,7 @@ static void test_no_op_with_port(void) { } static void test_no_op_with_port_and_start(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; @@ -243,7 +243,8 @@ static grpc_error* tcp_connect(const test_addr* remote, return GRPC_OS_ERROR(errno, "connect"); } gpr_log(GPR_DEBUG, "wait"); - while (g_nconnects == nconnects_before && deadline > ExecCtx::Get()->Now()) { + while (g_nconnects == nconnects_before && + deadline > grpc_core::ExecCtx::Get()->Now()) { grpc_pollset_worker* worker = NULL; grpc_error* err; if ((err = grpc_pollset_work(g_pollset, &worker, deadline)) != @@ -281,7 +282,7 @@ static grpc_error* tcp_connect(const test_addr* remote, static void test_connect(size_t num_connects, const grpc_channel_args* channel_args, test_addrs* dst_addrs, bool test_dst_addrs) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; grpc_resolved_address resolved_addr1; struct sockaddr_storage* const addr = @@ -420,7 +421,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_arg chan_args[1]; chan_args[0].type = GRPC_ARG_INTEGER; chan_args[0].key = const_cast<char*>(GRPC_ARG_EXPAND_WILDCARD_ADDRS); diff --git a/test/core/iomgr/tcp_server_uv_test.cc b/test/core/iomgr/tcp_server_uv_test.cc index 50042af37f..07b1fb1579 100644 --- a/test/core/iomgr/tcp_server_uv_test.cc +++ b/test/core/iomgr/tcp_server_uv_test.cc @@ -115,14 +115,14 @@ static void on_connect(void* arg, grpc_endpoint* tcp, grpc_pollset* pollset, } static void test_no_op(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s)); grpc_tcp_server_unref(s); } static void test_no_op_with_start(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == grpc_tcp_server_create(NULL, NULL, &s)); LOG_TEST("test_no_op_with_start"); @@ -131,7 +131,7 @@ static void test_no_op_with_start(void) { } static void test_no_op_with_port(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; @@ -150,7 +150,7 @@ static void test_no_op_with_port(void) { } static void test_no_op_with_port_and_start(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; @@ -214,7 +214,7 @@ static void tcp_connect(const struct sockaddr* remote, socklen_t remote_len, /* Tests a tcp server with multiple ports. */ static void test_connect(unsigned n) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; grpc_resolved_address resolved_addr1; struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; @@ -284,7 +284,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = static_cast<grpc_pollset*>(gpr_malloc(grpc_pollset_size())); diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc index 7281f55b85..537733150f 100644 --- a/test/core/iomgr/timer_list_test.cc +++ b/test/core/iomgr/timer_list_test.cc @@ -43,7 +43,7 @@ static void cb(void* arg, grpc_error* error) { static void add_test(void) { int i; grpc_timer timers[20]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "add_test"); @@ -52,7 +52,7 @@ static void add_test(void) { grpc_timer_check_trace.value = 1; memset(cb_called, 0, sizeof(cb_called)); - grpc_millis start = ExecCtx::Get()->Now(); + grpc_millis start = grpc_core::ExecCtx::Get()->Now(); /* 10 ms timers. will expire in the current epoch */ for (i = 0; i < 10; i++) { @@ -69,7 +69,7 @@ static void add_test(void) { } /* collect timers. Only the first batch should be ready. */ - ExecCtx::Get()->SetNow(start + 500); + grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 500); GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED); for (i = 0; i < 20; i++) { @@ -77,7 +77,7 @@ static void add_test(void) { GPR_ASSERT(cb_called[i][0] == 0); } - ExecCtx::Get()->SetNow(start + 600); + grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 600); GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_CHECKED_AND_EMPTY); for (i = 0; i < 30; i++) { @@ -86,7 +86,7 @@ static void add_test(void) { } /* collect the rest of the timers */ - ExecCtx::Get()->SetNow(start + 1500); + grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 1500); GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED); for (i = 0; i < 30; i++) { @@ -94,7 +94,7 @@ static void add_test(void) { GPR_ASSERT(cb_called[i][0] == 0); } - ExecCtx::Get()->SetNow(start + 1600); + grpc_core::ExecCtx::Get()->TestOnlySetNow(start + 1600); GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_CHECKED_AND_EMPTY); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); @@ -107,11 +107,11 @@ static void add_test(void) { /* Cleaning up a list with pending timers. */ void destruction_test(void) { grpc_timer timers[5]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "destruction_test"); - ExecCtx::Get()->SetNow(0); + grpc_core::ExecCtx::Get()->TestOnlySetNow(0); grpc_timer_list_init(); grpc_timer_trace.value = 1; grpc_timer_check_trace.value = 1; @@ -132,7 +132,7 @@ void destruction_test(void) { grpc_timer_init( &timers[4], 1, GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx)); - ExecCtx::Get()->SetNow(2); + grpc_core::ExecCtx::Get()->TestOnlySetNow(2); GPR_ASSERT(grpc_timer_check(NULL) == GRPC_TIMERS_FIRED); GPR_ASSERT(1 == cb_called[4][1]); diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc index 47e5cf0254..0afd836744 100644 --- a/test/core/iomgr/udp_server_test.cc +++ b/test/core/iomgr/udp_server_test.cc @@ -127,13 +127,13 @@ static test_socket_factory* test_socket_factory_create(void) { } static void test_no_op(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_udp_server* s = grpc_udp_server_create(NULL); grpc_udp_server_destroy(s, NULL); } static void test_no_op_with_start(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_udp_server* s = grpc_udp_server_create(NULL); LOG_TEST("test_no_op_with_start"); grpc_udp_server_start(s, NULL, 0, NULL); @@ -142,7 +142,7 @@ static void test_no_op_with_start(void) { static void test_no_op_with_port(void) { g_number_of_orphan_calls = 0; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_udp_server* s = grpc_udp_server_create(NULL); @@ -162,7 +162,7 @@ static void test_no_op_with_port(void) { static void test_no_op_with_port_and_socket_factory(void) { g_number_of_orphan_calls = 0; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; @@ -194,7 +194,7 @@ static void test_no_op_with_port_and_socket_factory(void) { static void test_no_op_with_port_and_start(void) { g_number_of_orphan_calls = 0; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_udp_server* s = grpc_udp_server_create(NULL); @@ -216,7 +216,7 @@ static void test_no_op_with_port_and_start(void) { } static void test_receive(int number_of_clients) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; int clifd, svrfd; @@ -260,12 +260,12 @@ static void test_receive(int number_of_clients) { (socklen_t)resolved_addr.len) == 0); GPR_ASSERT(5 == write(clifd, "hello", 5)); while (g_number_of_reads == number_of_reads_before && - deadline > ExecCtx::Get()->Now()) { + deadline > grpc_core::ExecCtx::Get()->Now()) { grpc_pollset_worker* worker = NULL; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(g_pollset, &worker, deadline))); gpr_mu_unlock(g_mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(g_mu); } GPR_ASSERT(g_number_of_reads == number_of_reads_before + 1); @@ -291,7 +291,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); g_pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size())); diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 029171c931..639f4e5056 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -148,7 +148,7 @@ static grpc_httpcli_response http_response(int status, const char* body) { /* -- Tests. -- */ static void test_empty_md_array(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_credentials_mdelem_array md_array; memset(&md_array, 0, sizeof(md_array)); GPR_ASSERT(md_array.md == NULL); @@ -157,7 +157,7 @@ static void test_empty_md_array(void) { } static void test_add_to_empty_md_array(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_credentials_mdelem_array md_array; memset(&md_array, 0, sizeof(md_array)); const char* key = "hello"; @@ -172,7 +172,7 @@ static void test_add_to_empty_md_array(void) { } static void test_add_abunch_to_md_array(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_credentials_mdelem_array md_array; memset(&md_array, 0, sizeof(md_array)); const char* key = "hello"; @@ -191,7 +191,7 @@ static void test_add_abunch_to_md_array(void) { } static void test_oauth2_token_fetcher_creds_parsing_ok(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = @@ -208,7 +208,7 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) { } static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = @@ -220,7 +220,7 @@ static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { } static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = http_response(200, ""); @@ -231,7 +231,7 @@ static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { } static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = @@ -246,7 +246,7 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { } static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = http_response(200, @@ -260,7 +260,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { } static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = @@ -276,7 +276,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem token_md = GRPC_MDNULL; grpc_millis token_lifetime; grpc_httpcli_response response = @@ -378,7 +378,7 @@ static void run_request_metadata_test(grpc_call_credentials* creds, } static void test_google_iam_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = {{GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, test_google_iam_authorization_token}, {GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, @@ -395,7 +395,7 @@ static void test_google_iam_creds(void) { } static void test_access_token_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = {{GRPC_AUTHORIZATION_METADATA_KEY, "Bearer blah"}}; request_metadata_state* state = make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); @@ -419,7 +419,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector( } static void test_channel_oauth2_composite_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args* new_args; grpc_channel_credentials_vtable vtable = { NULL, check_channel_oauth2_create_security_connector, NULL}; @@ -439,7 +439,7 @@ static void test_channel_oauth2_composite_creds(void) { } static void test_oauth2_google_iam_composite_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = { {GRPC_AUTHORIZATION_METADATA_KEY, test_oauth2_bearer_token}, {GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, @@ -492,7 +492,7 @@ check_channel_oauth2_google_iam_create_security_connector( } static void test_channel_oauth2_google_iam_composite_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args* new_args; grpc_channel_credentials_vtable vtable = { NULL, check_channel_oauth2_google_iam_create_security_connector, NULL}; @@ -569,7 +569,7 @@ static int httpcli_get_should_not_be_called(const grpc_httpcli_request* request, } static void test_compute_engine_creds_success(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; grpc_call_credentials* creds = @@ -583,7 +583,7 @@ static void test_compute_engine_creds_success(void) { grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Second request: the cached token should be served directly. */ state = @@ -591,14 +591,14 @@ static void test_compute_engine_creds_success(void) { grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_call_credentials_unref(creds); grpc_httpcli_set_override(NULL, NULL); } static void test_compute_engine_creds_failure(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; request_metadata_state* state = make_request_metadata_state( GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Error occured when fetching oauth2 token."), @@ -658,7 +658,7 @@ static int refresh_token_httpcli_post_failure( } static void test_refresh_token_creds_success(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, @@ -672,7 +672,7 @@ static void test_refresh_token_creds_success(void) { grpc_httpcli_set_override(httpcli_get_should_not_be_called, refresh_token_httpcli_post_success); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Second request: the cached token should be served directly. */ state = @@ -680,14 +680,14 @@ static void test_refresh_token_creds_success(void) { grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_call_credentials_unref(creds); grpc_httpcli_set_override(NULL, NULL); } static void test_refresh_token_creds_failure(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; request_metadata_state* state = make_request_metadata_state( GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Error occured when fetching oauth2 token."), @@ -790,7 +790,7 @@ static void test_jwt_creds_lifetime(void) { static void test_jwt_creds_success(void) { char* json_key_string = test_json_key_str(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; char* expected_md_value; @@ -805,7 +805,7 @@ static void test_jwt_creds_success(void) { make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Second request: the cached token should be served directly. */ state = @@ -813,7 +813,7 @@ static void test_jwt_creds_success(void) { grpc_jwt_encode_and_sign_set_override( encode_and_sign_jwt_should_not_be_called); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Third request: Different service url so jwt_encode_and_sign should be called again (no caching). */ @@ -822,7 +822,7 @@ static void test_jwt_creds_success(void) { auth_md_ctx.service_url = other_test_service_url; grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_success); run_request_metadata_test(creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_call_credentials_unref(creds); gpr_free(json_key_string); @@ -832,7 +832,7 @@ static void test_jwt_creds_success(void) { static void test_jwt_creds_signing_failure(void) { char* json_key_string = test_json_key_str(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; request_metadata_state* state = make_request_metadata_state( @@ -863,7 +863,7 @@ static void set_google_default_creds_env_var_with_file_contents( } static void test_google_default_creds_auth_key(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_service_account_jwt_access_credentials* jwt; grpc_composite_channel_credentials* creds; char* json_key = test_json_key_str(); @@ -884,7 +884,7 @@ static void test_google_default_creds_auth_key(void) { } static void test_google_default_creds_refresh_token(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_google_refresh_token_credentials* refresh; grpc_composite_channel_credentials* creds; grpc_flush_cached_google_default_credentials(); @@ -919,7 +919,7 @@ static int default_creds_gce_detection_httpcli_get_success_override( static char* null_well_known_creds_path_getter(void) { return NULL; } static void test_google_default_creds_gce(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; expected_md emd[] = { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; request_metadata_state* state = @@ -945,7 +945,7 @@ static void test_google_default_creds_gce(void) { grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); run_request_metadata_test(creds->call_creds, auth_md_ctx, state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); /* Check that we get a cached creds if we call grpc_google_default_credentials_create again. @@ -1054,7 +1054,7 @@ static void plugin_destroy(void* state) { static void test_metadata_plugin_success(void) { plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; request_metadata_state* md_state = make_request_metadata_state( @@ -1077,7 +1077,7 @@ static void test_metadata_plugin_success(void) { static void test_metadata_plugin_failure(void) { plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, NULL}; char* expected_error; @@ -1119,7 +1119,7 @@ static void test_get_well_known_google_credentials_file_path(void) { } static void test_channel_creds_duplicate_without_call_creds(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_credentials* channel_creds = grpc_fake_transport_security_credentials_create(); diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc index 9eac2b9254..a139f3776f 100644 --- a/test/core/security/json_token_test.cc +++ b/test/core/security/json_token_test.cc @@ -206,7 +206,7 @@ static void test_parse_json_key_failure_no_private_key(void) { static grpc_json* parse_json_part_from_jwt(const char* str, size_t len, char** scratchpad) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; char* b64; char* decoded; grpc_json* json; @@ -326,7 +326,7 @@ static void check_jwt_claim(grpc_json* claim, const char* expected_audience, static void check_jwt_signature(const char* b64_signature, RSA* rsa_key, const char* signed_data, size_t signed_data_size) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; EVP_MD_CTX* md_ctx = EVP_MD_CTX_create(); EVP_PKEY* key = EVP_PKEY_new(); diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index 7485aa10b4..55e28e6eb2 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -209,7 +209,7 @@ static void test_claims_success(void) { grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); GPR_ASSERT(json != NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; claims = grpc_jwt_claims_from_json(json, s); GPR_ASSERT(claims != NULL); GPR_ASSERT(grpc_jwt_claims_json(claims) == json); @@ -231,7 +231,7 @@ static void test_expired_claims_failure(void) { gpr_timespec exp_exp = {120, 0, GPR_CLOCK_REALTIME}; gpr_timespec exp_nbf = {60, 0, GPR_CLOCK_REALTIME}; GPR_ASSERT(json != NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; claims = grpc_jwt_claims_from_json(json, s); GPR_ASSERT(claims != NULL); GPR_ASSERT(grpc_jwt_claims_json(claims) == json); @@ -252,7 +252,7 @@ static void test_invalid_claims_failure(void) { grpc_slice s = grpc_slice_from_copied_string(invalid_claims); grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_jwt_claims_from_json(json, s) == NULL); } @@ -262,7 +262,7 @@ static void test_bad_audience_claims_failure(void) { grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); GPR_ASSERT(json != NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; claims = grpc_jwt_claims_from_json(json, s); GPR_ASSERT(claims != NULL); GPR_ASSERT(grpc_jwt_claims_check(claims, "https://bar.com") == @@ -276,7 +276,7 @@ static void test_bad_subject_claims_failure(void) { grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); GPR_ASSERT(json != NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; claims = grpc_jwt_claims_from_json(json, s); GPR_ASSERT(claims != NULL); GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") == @@ -350,7 +350,7 @@ static void on_verification_success(void* user_data, } static void test_jwt_verifier_google_email_issuer_success(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_google_email_issuer); @@ -383,7 +383,7 @@ static int httpcli_get_custom_keys_for_email( } static void test_jwt_verifier_custom_email_issuer_success(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(&custom_mapping, 1); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_custom_email_issuer); @@ -430,7 +430,7 @@ static int httpcli_get_openid_config(const grpc_httpcli_request* request, } static void test_jwt_verifier_url_issuer_success(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -469,7 +469,7 @@ static int httpcli_get_bad_json(const grpc_httpcli_request* request, } static void test_jwt_verifier_url_issuer_bad_config(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -492,7 +492,7 @@ static void test_jwt_verifier_url_issuer_bad_config(void) { } static void test_jwt_verifier_bad_json_key(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_google_email_issuer); @@ -521,7 +521,7 @@ static void corrupt_jwt_sig(char* jwt) { char* last_dot = strrchr(jwt, '.'); GPR_ASSERT(last_dot != NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; sig = grpc_base64_decode(last_dot + 1, 1); } GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig)); @@ -543,7 +543,7 @@ static void on_verification_bad_signature(void* user_data, } static void test_jwt_verifier_bad_signature(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); char* jwt = NULL; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); @@ -583,7 +583,7 @@ static void on_verification_bad_format(void* user_data, } static void test_jwt_verifier_bad_format(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc index f4a52aaba0..e24ccbc107 100644 --- a/test/core/security/oauth2_utils.cc +++ b/test/core/security/oauth2_utils.cc @@ -69,7 +69,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials( grpc_call_credentials* creds) { oauth2_request request; memset(&request, 0, sizeof(request)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure do_nothing_closure; grpc_auth_metadata_context null_ctx = {"", "", NULL, NULL}; @@ -92,7 +92,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials( on_oauth2_response(&request, error); GRPC_ERROR_UNREF(error); } - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(request.mu); while (!request.is_done) { diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc index 6153e8a9cb..29201afe40 100644 --- a/test/core/security/print_google_default_creds_token.cc +++ b/test/core/security/print_google_default_creds_token.cc @@ -62,7 +62,7 @@ static void on_metadata_response(void* arg, grpc_error* error) { int main(int argc, char** argv) { int result = 0; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; synchronizer sync; grpc_channel_credentials* creds = NULL; const char* service_url = "https://test.foo.google.com/Foo"; @@ -111,7 +111,7 @@ int main(int argc, char** argv) { GRPC_MILLIS_INF_FUTURE))) sync.is_done = true; gpr_mu_unlock(sync.mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(sync.mu); } gpr_mu_unlock(sync.mu); diff --git a/test/core/security/secure_endpoint_test.cc b/test/core/security/secure_endpoint_test.cc index a49bf1a0b4..7cee0dd3fe 100644 --- a/test/core/security/secure_endpoint_test.cc +++ b/test/core/security/secure_endpoint_test.cc @@ -38,7 +38,7 @@ static grpc_pollset* g_pollset; static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( size_t slice_size, grpc_slice* leftover_slices, size_t leftover_nslices, bool use_zero_copy_protector) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; tsi_frame_protector* fake_read_protector = tsi_create_fake_frame_protector(NULL); tsi_frame_protector* fake_write_protector = @@ -170,7 +170,7 @@ static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) { grpc_slice_buffer incoming; grpc_slice s = grpc_slice_from_copied_string("hello world 12345678900987654321"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; int n = 0; grpc_closure done_closure; gpr_log(GPR_INFO, "Start test left over"); @@ -202,7 +202,7 @@ static void destroy_pollset(void* p, grpc_error* error) { int main(int argc, char** argv) { grpc_closure destroyed; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_test_init(argc, argv); grpc_init(); diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index 84a42546c6..b9198279e3 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -55,7 +55,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resource_quota* resource_quota = grpc_resource_quota_create("ssl_server_fuzzer"); @@ -83,7 +83,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_security_status status = grpc_server_credentials_create_security_connector(creds, &sc); GPR_ASSERT(status == GRPC_SECURITY_OK); - grpc_millis deadline = GPR_MS_PER_SEC + ExecCtx::Get()->Now(); + grpc_millis deadline = GPR_MS_PER_SEC + grpc_core::ExecCtx::Get()->Now(); struct handshake_state state; state.done_callback_called = false; @@ -92,7 +92,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_handshake_manager_do_handshake( handshake_mgr, mock_endpoint, NULL /* channel_args */, deadline, NULL /* acceptor */, on_handshake_done, &state); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); // If the given string happens to be part of the correct client hello, the // server will wait for more data. Explicitly fail the server by shutting down @@ -100,7 +100,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (!state.done_callback_called) { grpc_endpoint_shutdown( mock_endpoint, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close")); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GPR_ASSERT(state.done_callback_called); @@ -111,7 +111,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_slice_unref(cert_slice); grpc_slice_unref(key_slice); grpc_slice_unref(ca_slice); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_shutdown(); if (leak_check) { diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index f3e8966625..c4c3541d19 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -76,7 +76,7 @@ int main(int argc, char** argv) { gpr_cmdline* cl; const char* jwt = NULL; const char* aud = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_init(); cl = gpr_cmdline_create("JWT verifier tool"); @@ -106,7 +106,7 @@ int main(int argc, char** argv) { grpc_pollset_work(sync.pollset, &worker, GRPC_MILLIS_INF_FUTURE))) sync.is_done = true; gpr_mu_unlock(sync.mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(sync.mu); } gpr_mu_unlock(sync.mu); diff --git a/test/core/slice/b64_test.cc b/test/core/slice/b64_test.cc index 5ed9910740..08a5770b2a 100644 --- a/test/core/slice/b64_test.cc +++ b/test/core/slice/b64_test.cc @@ -44,7 +44,7 @@ static void test_simple_encode_decode_b64(int url_safe, int multiline) { const char* hello = "hello"; char* hello_b64 = grpc_base64_encode(hello, strlen(hello), url_safe, multiline); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice hello_slice = grpc_base64_decode(hello_b64, url_safe); GPR_ASSERT(GRPC_SLICE_LENGTH(hello_slice) == strlen(hello)); GPR_ASSERT(strncmp((const char*)GRPC_SLICE_START_PTR(hello_slice), hello, @@ -64,7 +64,7 @@ static void test_full_range_encode_decode_b64(int url_safe, int multiline) { /* Try all the different paddings. */ for (i = 0; i < 3; i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; b64 = grpc_base64_encode(orig, sizeof(orig) - i, url_safe, multiline); orig_decoded = grpc_base64_decode(b64, url_safe); GPR_ASSERT(GRPC_SLICE_LENGTH(orig_decoded) == (sizeof(orig) - i)); @@ -115,7 +115,7 @@ static void test_url_safe_unsafe_mismatch_failure(void) { int url_safe = 1; for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; b64 = grpc_base64_encode(orig, sizeof(orig), url_safe, 0); orig_decoded = grpc_base64_decode(b64, !url_safe); GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded)); @@ -164,7 +164,7 @@ static void test_rfc4648_test_vectors(void) { static void test_unpadded_decode(void) { grpc_slice decoded; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; decoded = grpc_base64_decode("Zm9vYmFy", 0); GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded)); GPR_ASSERT(grpc_slice_str_cmp(decoded, "foobar") == 0); diff --git a/test/core/slice/slice_hash_table_test.cc b/test/core/slice/slice_hash_table_test.cc index 89fc33a7bf..ea00688af0 100644 --- a/test/core/slice/slice_hash_table_test.cc +++ b/test/core/slice/slice_hash_table_test.cc @@ -119,7 +119,7 @@ static void test_slice_hash_table() { check_values(test_entries, num_entries, table); check_non_existent_value("XX", table); // Clean up. - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_hash_table_unref(table); } @@ -146,7 +146,7 @@ static void test_slice_hash_table_eq() { create_table_from_entries(test_entries_b, num_entries_b, value_cmp_fn); GPR_ASSERT(grpc_slice_hash_table_cmp(table_a, table_b) == 0); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_hash_table_unref(table_a); grpc_slice_hash_table_unref(table_b); } @@ -217,7 +217,7 @@ static void test_slice_hash_table_not_eq() { create_table_from_entries(test_entries_h, num_entries_h, pointer_cmp_fn); GPR_ASSERT(grpc_slice_hash_table_cmp(table_g, table_h) != 0); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_slice_hash_table_unref(table_a); grpc_slice_hash_table_unref(table_b_larger); grpc_slice_hash_table_unref(table_b_smaller); diff --git a/test/core/surface/byte_buffer_reader_test.cc b/test/core/surface/byte_buffer_reader_test.cc index 1f3a83efe6..f9ce98da21 100644 --- a/test/core/surface/byte_buffer_reader_test.cc +++ b/test/core/surface/byte_buffer_reader_test.cc @@ -132,7 +132,7 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm, memset(GRPC_SLICE_START_PTR(input_slice), 'a', input_size); grpc_slice_buffer_add(&sliceb_in, input_slice); /* takes ownership */ { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_msg_compress(algorithm, &sliceb_in, &sliceb_out)); } diff --git a/test/core/surface/channel_create_test.cc b/test/core/surface/channel_create_test.cc index ece06e4968..3e7dd311db 100644 --- a/test/core/surface/channel_create_test.cc +++ b/test/core/surface/channel_create_test.cc @@ -35,7 +35,7 @@ void test_unknown_scheme_target(void) { chan = grpc_insecure_channel_create("blah://blah", NULL, NULL); GPR_ASSERT(chan != NULL); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc index 39aedeba02..e38b087a4b 100644 --- a/test/core/surface/completion_queue_test.cc +++ b/test/core/surface/completion_queue_test.cc @@ -136,7 +136,7 @@ static void test_cq_end_op(void) { attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, NULL); @@ -170,7 +170,7 @@ static void test_cq_tls_cache_full(void) { attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - ExecCtx _local_exec_ctx; // Reset exec_ctx + grpc_core::ExecCtx _local_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, NULL); @@ -208,7 +208,7 @@ static void test_cq_tls_cache_empty(void) { attr.version = 1; attr.cq_completion_type = GRPC_CQ_NEXT; for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { - ExecCtx _local_exec_ctx; // Reset exec_ctx + grpc_core::ExecCtx _local_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, NULL); @@ -289,7 +289,7 @@ static void test_pluck(void) { attr.version = 1; attr.cq_completion_type = GRPC_CQ_PLUCK; for (size_t pidx = 0; pidx < GPR_ARRAY_SIZE(polling_types); pidx++) { - ExecCtx _local_exec_ctx; // reset exec_ctx + grpc_core::ExecCtx _local_exec_ctx; // reset exec_ctx attr.cq_polling_type = polling_types[pidx]; cc = grpc_completion_queue_create( grpc_completion_queue_factory_lookup(&attr), &attr, NULL); diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc index 6625e7e09f..0c818e0281 100644 --- a/test/core/surface/completion_queue_threading_test.cc +++ b/test/core/surface/completion_queue_threading_test.cc @@ -80,7 +80,7 @@ static void test_too_many_plucks(void) { gpr_thd_id thread_ids[GPR_ARRAY_SIZE(tags)]; struct thread_state thread_states[GPR_ARRAY_SIZE(tags)]; gpr_thd_options thread_options = gpr_thd_options_default(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; unsigned i, j; LOG_TEST("test_too_many_plucks"); @@ -142,7 +142,7 @@ static void free_completion(void* arg, grpc_cq_completion* completion) { static void producer_thread(void* arg) { test_thread_options* opt = static_cast<test_thread_options*>(arg); int i; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_INFO, "producer %d started", opt->id); gpr_event_set(&opt->on_started, (void*)(intptr_t)1); diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index b3999b481f..18d7f2f985 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -115,7 +115,7 @@ static void on_connect(void* vargs, grpc_endpoint* tcp, void bad_server_thread(void* vargs) { struct server_thread_args* args = (struct server_thread_args*)vargs; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_resolved_address resolved_addr; struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; int port; @@ -134,7 +134,7 @@ void bad_server_thread(void* vargs) { gpr_mu_lock(args->mu); while (gpr_atm_acq_load(&args->stop) == 0) { - grpc_millis deadline = ExecCtx::Get()->Now() + 100; + grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 100; grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( @@ -222,7 +222,7 @@ int run_concurrent_connectivity_test() { gpr_atm_rel_store(&args.stop, 1); gpr_thd_join(server); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_pollset_shutdown(args.pollset, GRPC_CLOSURE_CREATE(done_pollset_shutdown, args.pollset, grpc_schedule_on_exec_ctx)); diff --git a/test/core/surface/lame_client_test.cc b/test/core/surface/lame_client_test.cc index dd14a03577..54d55bf440 100644 --- a/test/core/surface/lame_client_test.cc +++ b/test/core/surface/lame_client_test.cc @@ -44,7 +44,7 @@ void test_transport_op(grpc_channel* channel) { grpc_transport_op* op; grpc_channel_element* elem; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CLOSURE_INIT(&transport_op_cb, verify_connectivity, &state, grpc_schedule_on_exec_ctx); diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc index bf51dac6dd..59fecf2d50 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.cc +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -178,7 +178,7 @@ static grpc_channel* secure_test_create_channel(const char* addr) { grpc_channel* channel = grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(new_client_args); } grpc_channel_credentials_release(ssl_creds); diff --git a/test/core/surface/secure_channel_create_test.cc b/test/core/surface/secure_channel_create_test.cc index dd9f907652..14afa6f18e 100644 --- a/test/core/surface/secure_channel_create_test.cc +++ b/test/core/surface/secure_channel_create_test.cc @@ -37,7 +37,7 @@ void test_unknown_scheme_target(void) { grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CHANNEL_INTERNAL_UNREF(chan, "test"); grpc_channel_credentials_unref(creds); } @@ -54,7 +54,7 @@ void test_security_connector_already_in_arg(void) { grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CHANNEL_INTERNAL_UNREF(chan, "test"); } @@ -63,7 +63,7 @@ void test_null_creds(void) { grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GRPC_CHANNEL_INTERNAL_UNREF(chan, "test"); } diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc index aae418cedb..5ad9ce65d1 100644 --- a/test/core/surface/sequential_connectivity_test.cc +++ b/test/core/surface/sequential_connectivity_test.cc @@ -156,7 +156,7 @@ static grpc_channel* secure_test_create_channel(const char* addr) { grpc_channel* channel = grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_channel_args_destroy(new_client_args); } grpc_channel_credentials_release(ssl_creds); diff --git a/test/core/transport/bdp_estimator_test.cc b/test/core/transport/bdp_estimator_test.cc index 4d41ece875..168807adde 100644 --- a/test/core/transport/bdp_estimator_test.cc +++ b/test/core/transport/bdp_estimator_test.cc @@ -58,7 +58,7 @@ namespace { void AddSamples(BdpEstimator* estimator, int64_t* samples, size_t n) { estimator->AddIncomingBytes(1234567); inc_time(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; estimator->SchedulePing(); estimator->StartPing(); for (size_t i = 0; i < n; i++) { @@ -66,7 +66,7 @@ void AddSamples(BdpEstimator* estimator, int64_t* samples, size_t n) { } gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_millis(1, GPR_TIMESPAN))); - ExecCtx::Get()->InvalidateNow(); + grpc_core::ExecCtx::Get()->InvalidateNow(); estimator->CompletePing(); } diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc index 12a933f332..08dd91e4ec 100644 --- a/test/core/transport/byte_stream_test.cc +++ b/test/core/transport/byte_stream_test.cc @@ -36,7 +36,7 @@ static void not_called_closure(void* arg, grpc_error* error) { static void test_slice_buffer_stream_basic(void) { gpr_log(GPR_DEBUG, "test_slice_buffer_stream_basic"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // Create and populate slice buffer. grpc_slice_buffer buffer; grpc_slice_buffer_init(&buffer); @@ -70,7 +70,7 @@ static void test_slice_buffer_stream_basic(void) { static void test_slice_buffer_stream_shutdown(void) { gpr_log(GPR_DEBUG, "test_slice_buffer_stream_shutdown"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // Create and populate slice buffer. grpc_slice_buffer buffer; grpc_slice_buffer_init(&buffer); @@ -116,7 +116,7 @@ static void test_slice_buffer_stream_shutdown(void) { static void test_caching_byte_stream_basic(void) { gpr_log(GPR_DEBUG, "test_caching_byte_stream_basic"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // Create and populate slice buffer byte stream. grpc_slice_buffer buffer; grpc_slice_buffer_init(&buffer); @@ -155,7 +155,7 @@ static void test_caching_byte_stream_basic(void) { static void test_caching_byte_stream_reset(void) { gpr_log(GPR_DEBUG, "test_caching_byte_stream_reset"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // Create and populate slice buffer byte stream. grpc_slice_buffer buffer; grpc_slice_buffer_init(&buffer); @@ -201,7 +201,7 @@ static void test_caching_byte_stream_reset(void) { static void test_caching_byte_stream_shared_cache(void) { gpr_log(GPR_DEBUG, "test_caching_byte_stream_shared_cache"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; // Create and populate slice buffer byte stream. grpc_slice_buffer buffer; grpc_slice_buffer_init(&buffer); diff --git a/test/core/transport/chttp2/bin_decoder_test.cc b/test/core/transport/chttp2/bin_decoder_test.cc index 3d463c40a5..897d3008b9 100644 --- a/test/core/transport/chttp2/bin_decoder_test.cc +++ b/test/core/transport/chttp2/bin_decoder_test.cc @@ -76,7 +76,7 @@ static grpc_slice base64_decode_with_length(const char* s, s, grpc_chttp2_base64_decode_with_length(base64_encode(s), strlen(s))); int main(int argc, char** argv) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* ENCODE_AND_DECODE tests grpc_chttp2_base64_decode_with_length(), which takes encoded base64 strings without pad chars, but output length is diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index fe4538339e..91e2ca376e 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -257,7 +257,7 @@ static void test_interned_key_indexed() { static void run_test(void (*test)(), const char* name) { gpr_log(GPR_INFO, "RUN TEST: %s", name); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hpack_compressor_init(&g_compressor); test(); grpc_chttp2_hpack_compressor_destroy(&g_compressor); diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index feb27fc0ff..0dfd5ecc2d 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -37,7 +37,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_init(); grpc_chttp2_hpack_parser parser; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hpack_parser_init(&parser); parser.on_header = onhdr; GRPC_ERROR_UNREF(grpc_chttp2_hpack_parser_parse( diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc index 69a13108f9..1bd3644fab 100644 --- a/test/core/transport/chttp2/hpack_parser_test.cc +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -62,7 +62,7 @@ static void test_vector(grpc_chttp2_hpack_parser* parser, grpc_slice_unref(input); for (i = 0; i < nslices; i++) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_chttp2_hpack_parser_parse(parser, slices[i]) == GRPC_ERROR_NONE); } @@ -79,7 +79,7 @@ static void test_vector(grpc_chttp2_hpack_parser* parser, static void test_vectors(grpc_slice_split_mode mode) { grpc_chttp2_hpack_parser parser; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hpack_parser_init(&parser); /* D.2.1 */ diff --git a/test/core/transport/chttp2/hpack_table_test.cc b/test/core/transport/chttp2/hpack_table_test.cc index fd5604d857..97e1a02621 100644 --- a/test/core/transport/chttp2/hpack_table_test.cc +++ b/test/core/transport/chttp2/hpack_table_test.cc @@ -44,7 +44,7 @@ static void assert_index(const grpc_chttp2_hptbl* tbl, uint32_t idx, } static void test_static_lookup(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hptbl tbl; grpc_chttp2_hptbl_init(&tbl); @@ -123,7 +123,7 @@ static void test_many_additions(void) { LOG_TEST("test_many_additions"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hptbl_init(&tbl); for (i = 0; i < 100000; i++) { @@ -152,7 +152,7 @@ static void test_many_additions(void) { static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl* tbl, const char* key, const char* value) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem md = grpc_mdelem_from_slices( grpc_slice_from_copied_string(key), grpc_slice_from_copied_string(value)); grpc_chttp2_hptbl_find_result r = grpc_chttp2_hptbl_find(tbl, md); @@ -162,7 +162,7 @@ static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl* tbl, } static void test_find(void) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hptbl tbl; uint32_t i; char buffer[32]; diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc index 8ddd8bb2df..0ccf7ba288 100644 --- a/test/core/transport/connectivity_state_test.cc +++ b/test/core/transport/connectivity_state_test.cc @@ -57,7 +57,7 @@ static void test_connectivity_state_name(void) { static void test_check(void) { grpc_connectivity_state_tracker tracker; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_error* error; gpr_log(GPR_DEBUG, "test_check"); grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx"); @@ -73,17 +73,17 @@ static void test_subscribe_then_unsubscribe(void) { grpc_closure* closure = GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_subscribe_then_unsubscribe"); g_counter = 0; grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx"); GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state, closure)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); GPR_ASSERT(g_counter == 0); grpc_connectivity_state_notify_on_state_change(&tracker, NULL, closure); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); GPR_ASSERT(g_counter == 1); @@ -95,13 +95,13 @@ static void test_subscribe_then_destroy(void) { grpc_closure* closure = GRPC_CLOSURE_CREATE(must_succeed, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_subscribe_then_destroy"); g_counter = 0; grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_IDLE, "xxx"); GPR_ASSERT(grpc_connectivity_state_notify_on_state_change(&tracker, &state, closure)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); GPR_ASSERT(g_counter == 0); grpc_connectivity_state_destroy(&tracker); @@ -115,13 +115,13 @@ static void test_subscribe_with_failure_then_destroy(void) { grpc_closure* closure = GRPC_CLOSURE_CREATE(must_fail, THE_ARG, grpc_schedule_on_exec_ctx); grpc_connectivity_state state = GRPC_CHANNEL_SHUTDOWN; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_log(GPR_DEBUG, "test_subscribe_with_failure_then_destroy"); g_counter = 0; grpc_connectivity_state_init(&tracker, GRPC_CHANNEL_SHUTDOWN, "xxx"); GPR_ASSERT(0 == grpc_connectivity_state_notify_on_state_change( &tracker, &state, closure)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GPR_ASSERT(state == GRPC_CHANNEL_SHUTDOWN); GPR_ASSERT(g_counter == 0); grpc_connectivity_state_destroy(&tracker); diff --git a/test/core/transport/metadata_test.cc b/test/core/transport/metadata_test.cc index 3d7034e4ce..e5bdc5901d 100644 --- a/test/core/transport/metadata_test.cc +++ b/test/core/transport/metadata_test.cc @@ -60,7 +60,7 @@ static void test_create_metadata(bool intern_keys, bool intern_values) { intern_keys, intern_values); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; m1 = grpc_mdelem_from_slices( maybe_intern(grpc_slice_from_static_string("a"), intern_keys), maybe_intern(grpc_slice_from_static_string("b"), intern_values)); @@ -95,7 +95,7 @@ static void test_create_many_ephemeral_metadata(bool intern_keys, intern_keys, intern_values); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* add, and immediately delete a bunch of different elements */ for (i = 0; i < MANY; i++) { gpr_ltoa(i, buffer); @@ -117,7 +117,7 @@ static void test_create_many_persistant_metadata(void) { gpr_log(GPR_INFO, "test_create_many_persistant_metadata"); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* add phase */ for (i = 0; i < MANY; i++) { gpr_ltoa(i, buffer); @@ -151,7 +151,7 @@ static void test_spin_creating_the_same_thing(bool intern_keys, intern_keys, intern_values); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem a, b, c; GRPC_MDELEM_UNREF( a = grpc_mdelem_from_slices( @@ -178,7 +178,7 @@ static void test_identity_laws(bool intern_keys, bool intern_values) { intern_keys, intern_values); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem a, b, c; a = grpc_mdelem_from_slices( maybe_intern(grpc_slice_from_static_string("a"), intern_keys), @@ -225,7 +225,7 @@ static void test_things_stick_around(void) { gpr_log(GPR_INFO, "test_things_stick_around"); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; for (i = 0; i < nstrs; i++) { gpr_asprintf(&buffer, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%" PRIuPTR "x", i); @@ -271,7 +271,7 @@ static void test_user_data_works(void) { gpr_log(GPR_INFO, "test_user_data_works"); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; ud1 = static_cast<int*>(gpr_malloc(sizeof(int))); *ud1 = 1; ud2 = static_cast<int*>(gpr_malloc(sizeof(int))); @@ -322,7 +322,7 @@ static void test_mdelem_sizes_in_hpack(bool intern_key, bool intern_value) { gpr_log(GPR_INFO, "test_mdelem_size: intern_key=%d intern_value=%d", intern_key, intern_value); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; uint8_t binary_value[BUFFER_SIZE] = {0}; for (uint8_t i = 0; i < BUFFER_SIZE; i++) { @@ -346,7 +346,7 @@ static void test_copied_static_metadata(bool dup_key, bool dup_value) { gpr_log(GPR_INFO, "test_static_metadata: dup_key=%d dup_value=%d", dup_key, dup_value); grpc_init(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) { grpc_mdelem p = GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[i], diff --git a/test/core/transport/status_conversion_test.cc b/test/core/transport/status_conversion_test.cc index 16ecd076a3..2a192e04ef 100644 --- a/test/core/transport/status_conversion_test.cc +++ b/test/core/transport/status_conversion_test.cc @@ -24,7 +24,7 @@ GPR_ASSERT(grpc_status_to_http2_error(a) == (b)) #define HTTP2_ERROR_TO_GRPC_STATUS(a, deadline, b) \ do { \ - ExecCtx _local_exec_ctx; \ + grpc_core::ExecCtx _local_exec_ctx; \ GPR_ASSERT(grpc_http2_error_to_grpc_status(a, deadline) == (b)); \ \ } while (0) diff --git a/test/core/util/port_server_client.cc b/test/core/util/port_server_client.cc index 4e68ee3744..8e61145a26 100644 --- a/test/core/util/port_server_client.cc +++ b/test/core/util/port_server_client.cc @@ -62,7 +62,7 @@ void grpc_free_port_using_server(int port) { grpc_httpcli_response rsp; freereq pr; char* path; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure* shutdown_closure; grpc_init(); @@ -85,19 +85,20 @@ void grpc_free_port_using_server(int port) { grpc_resource_quota* resource_quota = grpc_resource_quota_create("port_server_client/free"); grpc_httpcli_get(&context, &pr.pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(freed_port_from_server, &pr, grpc_schedule_on_exec_ctx), &rsp); grpc_resource_quota_unref_internal(resource_quota); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(pr.mu); while (!pr.done) { grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( "pollset_work", - grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker, - ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { + grpc_pollset_work( + grpc_polling_entity_pollset(&pr.pops), &worker, + grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { pr.done = 1; } } @@ -167,7 +168,7 @@ static void got_port_from_server(void* arg, grpc_error* error) { grpc_resource_quota* resource_quota = grpc_resource_quota_create("port_server_client/pick_retry"); grpc_httpcli_get(pr->ctx, &pr->pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(got_port_from_server, pr, grpc_schedule_on_exec_ctx), &pr->response); @@ -193,7 +194,7 @@ int grpc_pick_port_using_server(void) { grpc_httpcli_context context; grpc_httpcli_request req; portreq pr; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure* shutdown_closure; grpc_init(); @@ -217,18 +218,19 @@ int grpc_pick_port_using_server(void) { grpc_resource_quota_create("port_server_client/pick"); grpc_httpcli_get( &context, &pr.pops, resource_quota, &req, - ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, + grpc_core::ExecCtx::Get()->Now() + 30 * GPR_MS_PER_SEC, GRPC_CLOSURE_CREATE(got_port_from_server, &pr, grpc_schedule_on_exec_ctx), &pr.response); grpc_resource_quota_unref_internal(resource_quota); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(pr.mu); while (pr.port == -1) { grpc_pollset_worker* worker = NULL; if (!GRPC_LOG_IF_ERROR( "pollset_work", - grpc_pollset_work(grpc_polling_entity_pollset(&pr.pops), &worker, - ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { + grpc_pollset_work( + grpc_polling_entity_pollset(&pr.pops), &worker, + grpc_core::ExecCtx::Get()->Now() + GPR_MS_PER_SEC))) { pr.port = 0; } } diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc index 7e17ff1f53..6418a7dfaa 100644 --- a/test/core/util/test_tcp_server.cc +++ b/test/core/util/test_tcp_server.cc @@ -55,7 +55,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; int port_added; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; addr->sin_family = AF_INET; addr->sin_port = htons((uint16_t)port); @@ -76,7 +76,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { void test_tcp_server_poll(test_tcp_server* server, int seconds) { grpc_pollset_worker* worker = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_millis deadline = grpc_timespec_to_millis_round_up( grpc_timeout_seconds_to_deadline(seconds)); gpr_mu_lock(server->mu); @@ -91,7 +91,7 @@ static void finish_pollset(void* arg, grpc_error* error) { } void test_tcp_server_destroy(test_tcp_server* server) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_timespec shutdown_deadline; grpc_closure do_nothing_cb; grpc_tcp_server_unref(server->tcp_server); diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 4cf39eab48..d428985034 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -112,7 +112,7 @@ class ClientLbEnd2endTest : public ::testing::Test { } void SetNextResolution(const std::vector<int>& ports) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_lb_addresses* addresses = grpc_lb_addresses_create(ports.size(), NULL); for (size_t i = 0; i < ports.size(); ++i) { char* lb_uri_str; diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index 962d5a7e68..c5c53b8b8a 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -451,7 +451,7 @@ class GrpclbEnd2endTest : public ::testing::Test { }; void SetNextResolution(const std::vector<AddressData>& address_data) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_lb_addresses* addresses = grpc_lb_addresses_create(address_data.size(), nullptr); for (size_t i = 0; i < address_data.size(); ++i) { diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index 6f6dd3c4df..31103d9696 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -558,7 +558,7 @@ static void perform_request(client_fixture* cf) { #define BALANCERS_NAME "lb.name" static void setup_client(const server_fixture* lb_server, const server_fixture* backends, client_fixture* cf) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; char* expected_target_names = NULL; const char* backends_name = lb_server->servers_hostport; diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index 47b984bc28..bb76a2e762 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -521,7 +521,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { label << " #has_dummy_filter"; } - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; size_t channel_size = grpc_channel_stack_size( filters.size() == 0 ? NULL : &filters[0], filters.size()); grpc_channel_stack* channel_stack = @@ -534,7 +534,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { ? &dummy_transport::dummy_transport : nullptr, "CHANNEL", channel_stack))); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_call_stack* call_stack = static_cast<grpc_call_stack*>(gpr_zalloc(channel_stack->call_stack_size)); grpc_millis deadline = GRPC_MILLIS_INF_FUTURE; @@ -558,7 +558,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { typename TestOp::Op op(&test_op_data, call_stack); grpc_call_stack_destroy(call_stack, &final_info, NULL); op.Finish(); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); // recreate arena every 64k iterations to avoid oom if (0 == (state.iterations() & 0xffff)) { gpr_arena_destroy(call_args.arena); @@ -691,7 +691,7 @@ class IsolatedCallFixture : public TrackCounters { GPR_ASSERT(grpc_channel_stack_builder_append_filter( builder, &isolated_call_filter::isolated_call_filter, NULL, NULL)); { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; channel_ = grpc_channel_create_with_builder(builder, GRPC_CLIENT_CHANNEL); } cq_ = grpc_completion_queue_create_for_next(NULL); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index f822f095a7..d4f78e60b7 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -50,12 +50,12 @@ static grpc_slice MakeSlice(std::vector<uint8_t> bytes) { static void BM_HpackEncoderInitDestroy(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hpack_compressor c; while (state.KeepRunning()) { grpc_chttp2_hpack_compressor_init(&c); grpc_chttp2_hpack_compressor_destroy(&c); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -64,8 +64,8 @@ BENCHMARK(BM_HpackEncoderInitDestroy); static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; - grpc_millis saved_now = ExecCtx::Get()->Now(); + grpc_core::ExecCtx _local_exec_ctx; + grpc_millis saved_now = grpc_core::ExecCtx::Get()->Now(); grpc_metadata_batch b; grpc_metadata_batch_init(&b); @@ -87,7 +87,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { }; grpc_chttp2_encode_header(&c, NULL, 0, &b, &hopt, &outbuf); grpc_slice_buffer_reset_and_unref_internal(&outbuf); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } grpc_metadata_batch_destroy(&b); grpc_chttp2_hpack_compressor_destroy(&c); @@ -108,7 +108,7 @@ BENCHMARK(BM_HpackEncoderEncodeDeadline); template <class Fixture> static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; static bool logged_representative_output = false; grpc_metadata_batch b; @@ -144,7 +144,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { } } grpc_slice_buffer_reset_and_unref_internal(&outbuf); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } grpc_metadata_batch_destroy(&b); grpc_chttp2_hpack_compressor_destroy(&c); @@ -425,12 +425,12 @@ BENCHMARK_TEMPLATE(BM_HpackEncoderEncodeHeader, static void BM_HpackParserInitDestroy(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_chttp2_hpack_parser p; while (state.KeepRunning()) { grpc_chttp2_hpack_parser_init(&p); grpc_chttp2_hpack_parser_destroy(&p); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -444,7 +444,7 @@ static void UnrefHeader(void* user_data, grpc_mdelem md) { template <class Fixture, void (*OnHeader)(void*, grpc_mdelem)> static void BM_HpackParserParseHeader(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; std::vector<grpc_slice> init_slices = Fixture::GetInitSlices(); std::vector<grpc_slice> benchmark_slices = Fixture::GetBenchmarkSlices(); grpc_chttp2_hpack_parser p; @@ -458,7 +458,7 @@ static void BM_HpackParserParseHeader(benchmark::State& state) { for (auto slice : benchmark_slices) { GPR_ASSERT(GRPC_ERROR_NONE == grpc_chttp2_hpack_parser_parse(&p, slice)); } - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } for (auto slice : init_slices) grpc_slice_unref(slice); for (auto slice : benchmark_slices) grpc_slice_unref(slice); diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index f6e4c2bcc4..caccde0cd9 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -136,7 +136,7 @@ class Fixture { FlushExecCtx(); } - void FlushExecCtx() { ExecCtx::Get()->Flush(); } + void FlushExecCtx() { grpc_core::ExecCtx::Get()->Flush(); } ~Fixture() { grpc_transport_destroy(t_); } @@ -257,7 +257,7 @@ class Stream { static void BM_StreamCreateDestroy(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Fixture f(grpc::ChannelArguments(), true); Stream s(&f); grpc_transport_stream_op_batch op; @@ -303,7 +303,7 @@ class RepresentativeClientInitialMetadata { template <class Metadata> static void BM_StreamCreateSendInitialMetadataDestroy(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Fixture f(grpc::ChannelArguments(), true); Stream s(&f); grpc_transport_stream_op_batch op; @@ -354,7 +354,7 @@ BENCHMARK_TEMPLATE(BM_StreamCreateSendInitialMetadataDestroy, static void BM_TransportEmptyOp(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Fixture f(grpc::ChannelArguments(), true); Stream s(&f); s.Init(state); @@ -387,7 +387,7 @@ std::vector<std::unique_ptr<gpr_event>> done_events; static void BM_TransportStreamSend(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Fixture f(grpc::ChannelArguments(), true); auto s = std::unique_ptr<Stream>(new Stream(&f)); s->Init(state); @@ -517,7 +517,7 @@ static grpc_slice CreateIncomingDataSlice(size_t length, size_t frame_size) { static void BM_TransportStreamRecv(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Fixture f(grpc::ChannelArguments(), true); Stream s(&f); s.Init(state); diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index ce8a054515..64925fd3f9 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -34,7 +34,7 @@ auto& force_library_initialization = Library::get(); static void BM_NoOpExecCtx(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; } track_counters.Finish(state); } @@ -42,9 +42,9 @@ BENCHMARK(BM_NoOpExecCtx); static void BM_WellFlushed(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -68,7 +68,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { TrackCounters track_counters; grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { benchmark::DoNotOptimize(GRPC_CLOSURE_INIT( &c, DoNothing, NULL, grpc_combiner_scheduler(combiner))); @@ -83,10 +83,10 @@ static void BM_ClosureRunOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_RUN(&c, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -95,7 +95,7 @@ BENCHMARK(BM_ClosureRunOnExecCtx); static void BM_ClosureCreateAndRun(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_RUN( GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx), @@ -108,7 +108,7 @@ BENCHMARK(BM_ClosureCreateAndRun); static void BM_ClosureInitAndRun(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure c; while (state.KeepRunning()) { GRPC_CLOSURE_RUN( @@ -124,10 +124,10 @@ static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -140,11 +140,11 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { grpc_closure c2; GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -159,12 +159,12 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_schedule_on_exec_ctx); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } track_counters.Finish(state); @@ -176,7 +176,7 @@ static void BM_AcquireMutex(benchmark::State& state) { // for comparison with the combiner stuff below gpr_mu mu; gpr_mu_init(&mu); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { gpr_mu_lock(&mu); DoNothing(NULL, GRPC_ERROR_NONE); @@ -192,7 +192,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) { // for comparison with the combiner stuff below gpr_mu mu; gpr_mu_init(&mu); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { if (gpr_mu_trylock(&mu)) { DoNothing(NULL, GRPC_ERROR_NONE); @@ -210,7 +210,7 @@ static void BM_AcquireSpinlock(benchmark::State& state) { TrackCounters track_counters; // for comparison with the combiner stuff below gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { gpr_spinlock_lock(&mu); DoNothing(NULL, GRPC_ERROR_NONE); @@ -225,7 +225,7 @@ static void BM_TryAcquireSpinlock(benchmark::State& state) { TrackCounters track_counters; // for comparison with the combiner stuff below gpr_spinlock mu = GPR_SPINLOCK_INITIALIZER; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { if (gpr_spinlock_trylock(&mu)) { DoNothing(NULL, GRPC_ERROR_NONE); @@ -244,10 +244,10 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GRPC_COMBINER_UNREF(combiner, "finished"); @@ -262,11 +262,11 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) { grpc_closure c2; GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GRPC_COMBINER_UNREF(combiner, "finished"); @@ -283,12 +283,12 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) { GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GRPC_COMBINER_UNREF(combiner, "finished"); @@ -304,11 +304,11 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { grpc_closure c2; GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GRPC_COMBINER_UNREF(combiner1, "finished"); GRPC_COMBINER_UNREF(combiner2, "finished"); @@ -329,13 +329,13 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); GRPC_CLOSURE_INIT(&c4, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&c1, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c2, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c3, GRPC_ERROR_NONE); GRPC_CLOSURE_SCHED(&c4, GRPC_ERROR_NONE); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } GRPC_COMBINER_UNREF(combiner1, "finished"); GRPC_COMBINER_UNREF(combiner2, "finished"); @@ -375,7 +375,7 @@ class Rescheduler { static void BM_ClosureReschedOnExecCtx(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; Rescheduler r(state, grpc_schedule_on_exec_ctx); r.ScheduleFirst(); @@ -385,11 +385,11 @@ BENCHMARK(BM_ClosureReschedOnExecCtx); static void BM_ClosureReschedOnCombiner(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_combiner* combiner = grpc_combiner_create(); Rescheduler r(state, grpc_combiner_scheduler(combiner)); r.ScheduleFirst(); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GRPC_COMBINER_UNREF(combiner, "finished"); track_counters.Finish(state); @@ -398,11 +398,11 @@ BENCHMARK(BM_ClosureReschedOnCombiner); static void BM_ClosureReschedOnCombinerFinally(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_combiner* combiner = grpc_combiner_create(); Rescheduler r(state, grpc_combiner_finally_scheduler(combiner)); r.ScheduleFirstAgainstDifferentScheduler(grpc_combiner_scheduler(combiner)); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); GRPC_COMBINER_UNREF(combiner, "finished"); track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index 9fb603213a..85248ef91a 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -80,7 +80,7 @@ static void BM_Pass1Cpp(benchmark::State& state) { while (state.KeepRunning()) { grpc_cq_completion completion; DummyTag dummy_tag; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_cq_begin_op(c_cq, &dummy_tag)); grpc_cq_end_op(c_cq, &dummy_tag, GRPC_ERROR_NONE, DoneWithCompletionOnStack, NULL, &completion); @@ -100,7 +100,7 @@ static void BM_Pass1Core(benchmark::State& state) { gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); grpc_cq_end_op(cq, NULL, GRPC_ERROR_NONE, DoneWithCompletionOnStack, NULL, &completion); @@ -119,7 +119,7 @@ static void BM_Pluck1Core(benchmark::State& state) { gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); grpc_cq_end_op(cq, NULL, GRPC_ERROR_NONE, DoneWithCompletionOnStack, NULL, &completion); diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 0cd9a2c361..aeeba0963f 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -76,7 +76,7 @@ static grpc_error* pollset_work(grpc_pollset* ps, grpc_pollset_worker** worker, GPR_ASSERT(grpc_cq_begin_op(g_cq, g_tag)); grpc_cq_end_op(g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, NULL, (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion))); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); gpr_mu_lock(&ps->mu); return GRPC_ERROR_NONE; } diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index 8dc98ab923..d6dba1d82f 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -246,7 +246,7 @@ template <class Fixture> static void BM_ErrorGetStatus(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { grpc_status_code status; grpc_slice slice; @@ -261,7 +261,7 @@ template <class Fixture> static void BM_ErrorGetStatusCode(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { grpc_status_code status; grpc_error_get_status(fixture.error(), fixture.deadline(), &status, NULL, @@ -275,7 +275,7 @@ template <class Fixture> static void BM_ErrorHttpError(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { grpc_http2_error_code error; grpc_error_get_status(fixture.error(), fixture.deadline(), NULL, NULL, diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index 191c93c58d..7b04909ee1 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -177,7 +177,7 @@ class TrickledCHTTP2 : public EndpointPairFixture { } void Step(bool update_stats) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; inc_time(); size_t client_backlog = grpc_trickle_endpoint_trickle(endpoint_pair_.client); diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index 07fcf6af99..3a00db7a13 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -90,7 +90,7 @@ static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { TrackCounters track_counters; gpr_slice k = grpc_slice_from_static_string("key"); gpr_slice v = grpc_slice_from_static_string("value"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); } @@ -103,7 +103,7 @@ static void BM_MetadataFromInternedSlices(benchmark::State& state) { TrackCounters track_counters; gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); } @@ -119,7 +119,7 @@ static void BM_MetadataFromInternedSlicesAlreadyInIndex( TrackCounters track_counters; gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem seed = grpc_mdelem_create(k, v, NULL); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); @@ -136,7 +136,7 @@ static void BM_MetadataFromInternedKey(benchmark::State& state) { TrackCounters track_counters; gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_from_static_string("value"); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); } @@ -152,7 +152,7 @@ static void BM_MetadataFromNonInternedSlicesWithBackingStore( gpr_slice k = grpc_slice_from_static_string("key"); gpr_slice v = grpc_slice_from_static_string("value"); char backing_store[sizeof(grpc_mdelem_data)]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast<grpc_mdelem_data*>(backing_store))); @@ -168,7 +168,7 @@ static void BM_MetadataFromInternedSlicesWithBackingStore( gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); char backing_store[sizeof(grpc_mdelem_data)]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast<grpc_mdelem_data*>(backing_store))); @@ -186,7 +186,7 @@ static void BM_MetadataFromInternedKeyWithBackingStore( gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_from_static_string("value"); char backing_store[sizeof(grpc_mdelem_data)]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create( k, v, reinterpret_cast<grpc_mdelem_data*>(backing_store))); @@ -201,7 +201,7 @@ static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { TrackCounters track_counters; gpr_slice k = GRPC_MDSTR_STATUS; gpr_slice v = GRPC_MDSTR_200; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); } @@ -216,7 +216,7 @@ static void BM_MetadataFromStaticMetadataStringsNotIndexed( TrackCounters track_counters; gpr_slice k = GRPC_MDSTR_STATUS; gpr_slice v = GRPC_MDSTR_GZIP; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; while (state.KeepRunning()) { GRPC_MDELEM_UNREF(grpc_mdelem_create(k, v, NULL)); } @@ -229,7 +229,7 @@ BENCHMARK(BM_MetadataFromStaticMetadataStringsNotIndexed); static void BM_MetadataRefUnrefExternal(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem el = grpc_mdelem_create( grpc_slice_from_static_string("a"), grpc_slice_from_static_string("b"), reinterpret_cast<grpc_mdelem_data*>(backing_store)); @@ -245,7 +245,7 @@ BENCHMARK(BM_MetadataRefUnrefExternal); static void BM_MetadataRefUnrefInterned(benchmark::State& state) { TrackCounters track_counters; char backing_store[sizeof(grpc_mdelem_data)]; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); grpc_mdelem el = grpc_mdelem_create( @@ -263,7 +263,7 @@ BENCHMARK(BM_MetadataRefUnrefInterned); static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem el = grpc_mdelem_create(grpc_slice_from_static_string("a"), grpc_slice_from_static_string("b"), NULL); while (state.KeepRunning()) { @@ -277,7 +277,7 @@ BENCHMARK(BM_MetadataRefUnrefAllocated); static void BM_MetadataRefUnrefStatic(benchmark::State& state) { TrackCounters track_counters; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_mdelem el = grpc_mdelem_create(GRPC_MDSTR_STATUS, GRPC_MDSTR_200, NULL); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(GRPC_MDELEM_REF(el)); diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index 7ddca45eca..59ee937fe4 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -50,7 +50,7 @@ static void BM_CreateDestroyPollset(benchmark::State& state) { size_t ps_sz = grpc_pollset_size(); grpc_pollset* ps = static_cast<grpc_pollset*>(gpr_malloc(ps_sz)); gpr_mu* mu; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); @@ -60,7 +60,7 @@ static void BM_CreateDestroyPollset(benchmark::State& state) { gpr_mu_lock(mu); grpc_pollset_shutdown(ps, &shutdown_ps_closure); gpr_mu_unlock(mu); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } gpr_free(ps); @@ -114,7 +114,7 @@ static void BM_PollEmptyPollset(benchmark::State& state) { grpc_pollset* ps = static_cast<grpc_pollset*>(gpr_zalloc(ps_sz)); gpr_mu* mu; grpc_pollset_init(ps, &mu); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(mu); while (state.KeepRunning()) { GRPC_ERROR_UNREF(grpc_pollset_work(ps, NULL, 0)); @@ -136,14 +136,14 @@ static void BM_PollAddFd(benchmark::State& state) { grpc_pollset* ps = static_cast<grpc_pollset*>(gpr_zalloc(ps_sz)); gpr_mu* mu; grpc_pollset_init(ps, &mu); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_wakeup_fd wakeup_fd; GPR_ASSERT( GRPC_LOG_IF_ERROR("wakeup_fd_init", grpc_wakeup_fd_init(&wakeup_fd))); grpc_fd* fd = grpc_fd_create(wakeup_fd.read_fd, "xxx"); while (state.KeepRunning()) { grpc_pollset_add_fd(ps, fd); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); } grpc_fd_orphan(fd, NULL, NULL, false /* already_closed */, "xxx"); grpc_closure shutdown_ps_closure; @@ -218,7 +218,7 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) { grpc_pollset* ps = static_cast<grpc_pollset*>(gpr_zalloc(ps_sz)); gpr_mu* mu; grpc_pollset_init(ps, &mu); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; grpc_wakeup_fd wakeup_fd; GRPC_ERROR_UNREF(grpc_wakeup_fd_init(&wakeup_fd)); grpc_fd* wakeup = grpc_fd_create(wakeup_fd.read_fd, "wakeup_read"); diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 075064eca7..4efcafa8e1 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -166,7 +166,7 @@ class EndpointPairFixture : public BaseFixture { fixture_configuration.ApplyCommonServerBuilderConfig(&b); server_ = b.BuildAndStart(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* add server endpoint to server_ * */ diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index 8ba8be0ea4..ca8c26092a 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -171,7 +171,7 @@ void ArgsFinish(ArgsStruct* args) { grpc_pollset_shutdown(args->pollset, &DoNothing_cb); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() grpc_channel_args_destroy(args->channel_args); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); grpc_pollset_destroy(args->pollset); gpr_free(args->pollset); GRPC_COMBINER_UNREF(args->lock, NULL); @@ -195,7 +195,7 @@ void PollPollsetUntilRequestDone(ArgsStruct* args) { time_left.tv_sec, time_left.tv_nsec); GPR_ASSERT(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) >= 0); grpc_pollset_worker* worker = NULL; - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(args->pollset, &worker, @@ -274,7 +274,7 @@ void CheckResolverResultLocked(void* argsp, grpc_error* err) { } TEST(ResolverComponentTest, TestResolvesRelevantRecords) { - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; ArgsStruct args; ArgsInit(&args); args.expected_addrs = ParseExpectedAddrs(FLAGS_expected_addrs); @@ -294,7 +294,7 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecords) { (void*)&args, grpc_combiner_scheduler(args.lock)); grpc_resolver_next_locked(resolver, &args.channel_args, &on_resolver_result_changed); - ExecCtx::Get()->Flush(); + grpc_core::ExecCtx::Get()->Flush(); PollPollsetUntilRequestDone(&args); GRPC_RESOLVER_UNREF(resolver, NULL); ArgsFinish(&args); diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index b9514e6306..ae658ff87c 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -82,7 +82,7 @@ class EndpointPairFixture { ApplyCommonServerBuilderConfig(&b); server_ = b.BuildAndStart(); - ExecCtx _local_exec_ctx; + grpc_core::ExecCtx _local_exec_ctx; /* add server endpoint to server_ */ { |