From 4ffec8c53e2e92d5e135c925175f493590a0282b Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 9 Jan 2020 13:05:58 -0800 Subject: [PATCH] s/combiner/logical_thread --- .../dns_resolver_connectivity_test.cc | 10 +++++----- .../resolvers/dns_resolver_cooldown_test.cc | 20 +++++++++---------- .../resolvers/dns_resolver_test.cc | 13 ++++++------ .../resolvers/fake_resolver_test.cc | 8 ++++---- .../resolvers/sockaddr_resolver_test.cc | 10 +++++----- 5 files changed, 31 insertions(+), 30 deletions(-) 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 88802e993c8..1064653c1d0 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -33,7 +33,7 @@ static gpr_mu g_mu; static bool g_fail_resolution = true; -static grpc_core::RefCountedPtr* g_combiner; +static grpc_core::RefCountedPtr* g_logical_thread; static void my_resolve_address(const char* addr, const char* /*default_port*/, grpc_pollset_set* /*interested_parties*/, @@ -66,7 +66,7 @@ static grpc_ares_request* my_dns_lookup_ares_locked( std::unique_ptr* addresses, bool /*check_grpclb*/, char** /*service_config_json*/, int /*query_timeout_ms*/, - grpc_core::RefCountedPtr /*combiner*/) { + grpc_core::RefCountedPtr /*logical_thread*/) { gpr_mu_lock(&g_mu); GPR_ASSERT(0 == strcmp("test", addr)); grpc_error* error = GRPC_ERROR_NONE; @@ -99,7 +99,7 @@ static grpc_core::OrphanablePtr create_resolver( GPR_ASSERT(uri); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = std::move(result_handler); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -163,8 +163,8 @@ int main(int argc, char** argv) { gpr_mu_init(&g_mu); { grpc_core::ExecCtx exec_ctx; - auto combiner = grpc_core::MakeRefCounted(); - g_combiner = &combiner; + auto logical_thread = grpc_core::MakeRefCounted(); + g_logical_thread = &logical_thread; grpc_set_resolver_impl(&test_resolver); grpc_dns_lookup_ares_locked = my_dns_lookup_ares_locked; grpc_cancel_ares_request_locked = my_cancel_ares_request_locked; diff --git a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc index c42ff843e6b..cac30472760 100644 --- a/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc @@ -37,14 +37,14 @@ constexpr int kMinResolutionPeriodForCheckMs = 900; extern grpc_address_resolver_vtable* grpc_resolve_address_impl; static grpc_address_resolver_vtable* default_resolve_address; -static grpc_core::RefCountedPtr* g_combiner; +static grpc_core::RefCountedPtr* g_logical_thread; static grpc_ares_request* (*g_default_dns_lookup_ares_locked)( const char* dns_server, const char* name, const char* default_port, grpc_pollset_set* interested_parties, grpc_closure* on_done, std::unique_ptr* addresses, bool check_grpclb, char** service_config_json, int query_timeout_ms, - grpc_core::RefCountedPtr combiner); + grpc_core::RefCountedPtr logical_thread); // Counter incremented by test_resolve_address_impl indicating the number of // times a system-level resolution has happened. @@ -95,11 +95,11 @@ static grpc_ares_request* test_dns_lookup_ares_locked( grpc_pollset_set* /*interested_parties*/, grpc_closure* on_done, std::unique_ptr* addresses, bool check_grpclb, char** service_config_json, int query_timeout_ms, - grpc_core::RefCountedPtr combiner) { + grpc_core::RefCountedPtr logical_thread) { grpc_ares_request* result = g_default_dns_lookup_ares_locked( dns_server, name, default_port, g_iomgr_args.pollset_set, on_done, addresses, check_grpclb, service_config_json, query_timeout_ms, - std::move(combiner)); + std::move(logical_thread)); ++g_resolution_count; static grpc_millis last_resolution_time = 0; grpc_millis now = @@ -272,7 +272,7 @@ static void on_first_resolution(OnResolutionCallbackArg* cb_arg) { gpr_mu_unlock(g_iomgr_args.mu); } -static void start_test_under_combiner(void* arg) { +static void start_test_under_logical_thread(void* arg) { OnResolutionCallbackArg* res_cb_arg = static_cast(arg); res_cb_arg->result_handler = new ResultHandler(); @@ -284,7 +284,7 @@ static void start_test_under_combiner(void* arg) { GPR_ASSERT(uri != nullptr); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = std::unique_ptr( res_cb_arg->result_handler); g_resolution_count = 0; @@ -308,8 +308,8 @@ static void test_cooldown() { OnResolutionCallbackArg* res_cb_arg = new OnResolutionCallbackArg(); res_cb_arg->uri_str = "dns:127.0.0.1"; - (*g_combiner) - ->Run([res_cb_arg]() { start_test_under_combiner(res_cb_arg); }, + (*g_logical_thread) + ->Run([res_cb_arg]() { start_test_under_logical_thread(res_cb_arg); }, DEBUG_LOCATION); grpc_core::ExecCtx::Get()->Flush(); poll_pollset_until_request_done(&g_iomgr_args); @@ -322,8 +322,8 @@ int main(int argc, char** argv) { { grpc_core::ExecCtx exec_ctx; - auto combiner = grpc_core::MakeRefCounted(); - g_combiner = &combiner; + auto logical_thread = grpc_core::MakeRefCounted(); + g_logical_thread = &logical_thread; g_default_dns_lookup_ares_locked = grpc_dns_lookup_ares_locked; grpc_dns_lookup_ares_locked = test_dns_lookup_ares_locked; diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc index db103398a38..8ee63f303dc 100644 --- a/test/core/client_channel/resolvers/dns_resolver_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_test.cc @@ -25,10 +25,10 @@ #include "src/core/ext/filters/client_channel/resolver_registry.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/iomgr/combiner.h" +#include "src/core/lib/iomgr/logical_thread.h" #include "test/core/util/test_config.h" -static grpc_core::RefCountedPtr* g_combiner; +static grpc_core::RefCountedPtr* g_logical_thread; class TestResultHandler : public grpc_core::Resolver::ResultHandler { void ReturnResult(grpc_core::Resolver::Result /*result*/) override {} @@ -44,7 +44,7 @@ static void test_succeeds(grpc_core::ResolverFactory* factory, GPR_ASSERT(uri); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = grpc_core::MakeUnique(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -61,7 +61,7 @@ static void test_fails(grpc_core::ResolverFactory* factory, GPR_ASSERT(uri); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = grpc_core::MakeUnique(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -75,8 +75,9 @@ int main(int argc, char** argv) { { grpc_core::ExecCtx exec_ctx; { - auto combiner = grpc_core::MakeRefCounted(); - g_combiner = &combiner; + auto logical_thread = + grpc_core::MakeRefCounted(); + g_logical_thread = &logical_thread; grpc_core::ResolverFactory* dns = grpc_core::ResolverRegistry::LookupResolverFactory("dns"); diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 22786b62883..cbd746c8f6b 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -63,7 +63,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler { }; static grpc_core::OrphanablePtr build_fake_resolver( - grpc_core::RefCountedPtr combiner, + grpc_core::RefCountedPtr logical_thread, grpc_core::FakeResolverResponseGenerator* response_generator, std::unique_ptr result_handler) { grpc_core::ResolverFactory* factory = @@ -74,7 +74,7 @@ static grpc_core::OrphanablePtr build_fake_resolver( grpc_channel_args channel_args = {1, &generator_arg}; grpc_core::ResolverArgs args; args.args = &channel_args; - args.combiner = std::move(combiner); + args.logical_thread = std::move(logical_thread); args.result_handler = std::move(result_handler); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -118,7 +118,7 @@ static grpc_core::Resolver::Result create_new_resolver_result() { static void test_fake_resolver() { grpc_core::ExecCtx exec_ctx; - grpc_core::RefCountedPtr combiner = + grpc_core::RefCountedPtr logical_thread = grpc_core::MakeRefCounted(); // Create resolver. ResultHandler* result_handler = new ResultHandler(); @@ -126,7 +126,7 @@ static void test_fake_resolver() { response_generator = grpc_core::MakeRefCounted(); grpc_core::OrphanablePtr resolver = build_fake_resolver( - combiner, response_generator.get(), + logical_thread, response_generator.get(), std::unique_ptr(result_handler)); GPR_ASSERT(resolver.get() != nullptr); resolver->StartLocked(); diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc index 7984f8e572a..be17de306b9 100644 --- a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc +++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc @@ -28,7 +28,7 @@ #include "test/core/util/test_config.h" -static grpc_core::RefCountedPtr* g_combiner; +static grpc_core::RefCountedPtr* g_logical_thread; class ResultHandler : public grpc_core::Resolver::ResultHandler { public: @@ -46,7 +46,7 @@ static void test_succeeds(grpc_core::ResolverFactory* factory, GPR_ASSERT(uri); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = grpc_core::MakeUnique(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -67,7 +67,7 @@ static void test_fails(grpc_core::ResolverFactory* factory, GPR_ASSERT(uri); grpc_core::ResolverArgs args; args.uri = uri; - args.combiner = *g_combiner; + args.logical_thread = *g_logical_thread; args.result_handler = grpc_core::MakeUnique(); grpc_core::OrphanablePtr resolver = factory->CreateResolver(std::move(args)); @@ -80,8 +80,8 @@ int main(int argc, char** argv) { grpc_init(); { grpc_core::ExecCtx exec_ctx; - auto combiner = grpc_core::MakeRefCounted(); - g_combiner = &combiner; + auto logical_thread = grpc_core::MakeRefCounted(); + g_logical_thread = &logical_thread; grpc_core::ResolverFactory* ipv4 = grpc_core::ResolverRegistry::LookupResolverFactory("ipv4");