Tooling to remove redundant grpc_core:: namespace references (#28030)

* Tooling to remove redundant grpc_core:: namespaces

These references tend to show up in our C++ code after C modules get
converted. Many get caught in review, many get missed.

* use it

* clang-format
pull/27770/head
Craig Tiller 4 years ago committed by GitHub
parent fff84402ac
commit 6af45a35ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/core/ext/filters/client_channel/client_channel_plugin.cc
  2. 6
      src/core/ext/filters/client_channel/dynamic_filters.cc
  3. 2
      src/core/ext/filters/client_channel/health/health_check_client.h
  4. 26
      src/core/ext/filters/client_channel/http_connect_handshaker.cc
  5. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  6. 3
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
  7. 4
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h
  8. 5
      src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc
  9. 9
      src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc
  10. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  11. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
  12. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc
  13. 6
      src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
  14. 11
      src/core/ext/filters/client_channel/resolver_registry.cc
  15. 3
      src/core/ext/filters/client_channel/resolver_registry.h
  16. 8
      src/core/ext/filters/client_channel/subchannel.cc
  17. 2
      src/core/ext/filters/fault_injection/fault_injection_filter.cc
  18. 8
      src/core/ext/filters/http/http_filters_plugin.cc
  19. 2
      src/core/ext/filters/server_config_selector/server_config_selector_filter.cc
  20. 8
      src/core/ext/transport/binder/client/binder_connector.cc
  21. 4
      src/core/ext/transport/binder/client/binder_connector.h
  22. 9
      src/core/ext/transport/binder/server/binder_server.cc
  23. 2
      src/core/ext/transport/chttp2/client/insecure/channel_create.cc
  24. 2
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  25. 10
      src/core/ext/transport/chttp2/server/chttp2_server.cc
  26. 14
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  27. 5
      src/core/ext/transport/chttp2/transport/context_list.cc
  28. 5
      src/core/ext/transport/chttp2/transport/context_list.h
  29. 4
      src/core/ext/transport/chttp2/transport/flow_control.h
  30. 24
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  31. 2
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  32. 2
      src/core/ext/transport/chttp2/transport/internal.h
  33. 2
      src/core/ext/xds/certificate_provider_store.h
  34. 3
      src/core/ext/xds/xds_certificate_provider.h
  35. 7
      src/core/ext/xds/xds_channel_stack_modifier.cc
  36. 11
      src/core/ext/xds/xds_client.cc
  37. 4
      src/core/lib/backoff/backoff.cc
  38. 12
      src/core/lib/channel/channel_trace.cc
  39. 2
      src/core/lib/channel/channelz.cc
  40. 4
      src/core/lib/debug/trace.h
  41. 14
      src/core/lib/gprpp/global_config_env.cc
  42. 4
      src/core/lib/gprpp/global_config_env.h
  43. 5
      src/core/lib/gprpp/manual_constructor.h
  44. 2
      src/core/lib/gprpp/orphanable.h
  45. 2
      src/core/lib/gprpp/ref_counted.h
  46. 2
      src/core/lib/gprpp/status_helper.h
  47. 2
      src/core/lib/http/httpcli.cc
  48. 18
      src/core/lib/iomgr/buffer_list.cc
  49. 26
      src/core/lib/iomgr/buffer_list.h
  50. 3
      src/core/lib/iomgr/call_combiner.cc
  51. 22
      src/core/lib/iomgr/exec_ctx.h
  52. 25
      src/core/lib/iomgr/executor.cc
  53. 2
      src/core/lib/iomgr/executor.h
  54. 19
      src/core/lib/iomgr/work_serializer.cc
  55. 8
      src/core/lib/iomgr/work_serializer.h
  56. 2
      src/core/lib/json/json_util.cc
  57. 4
      src/core/lib/security/authorization/grpc_authorization_policy_provider.cc
  58. 4
      src/core/lib/security/authorization/grpc_authorization_policy_provider.h
  59. 4
      src/core/lib/security/credentials/google_default/google_default_credentials.cc
  60. 2
      src/core/lib/security/credentials/jwt/jwt_credentials.cc
  61. 20
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  62. 23
      src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc
  63. 15
      src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h
  64. 6
      src/core/lib/security/security_connector/alts/alts_security_connector.cc
  65. 4
      src/core/lib/security/security_connector/alts/alts_security_connector.h
  66. 4
      src/core/lib/security/security_connector/insecure/insecure_security_connector.cc
  67. 14
      src/core/lib/security/security_connector/insecure/insecure_security_connector.h
  68. 3
      src/core/lib/security/security_connector/load_system_roots_linux.cc
  69. 2
      src/core/lib/security/security_connector/ssl_utils.cc
  70. 2
      src/core/lib/security/security_connector/ssl_utils.h
  71. 4
      src/core/lib/security/transport/security_handshaker.cc
  72. 8
      src/core/lib/slice/slice.cc
  73. 552
      src/core/lib/slice/static_slice.cc
  74. 2
      src/core/lib/surface/builtins.cc
  75. 2
      src/core/lib/surface/channel.h
  76. 2
      src/core/lib/surface/lame_client.cc
  77. 2
      src/core/lib/surface/server.cc
  78. 2
      src/core/lib/transport/bdp_estimator.cc
  79. 8
      src/core/lib/transport/metadata.h
  80. 7
      src/core/lib/transport/metadata_batch.h
  81. 8
      src/core/lib/transport/pid_controller.cc
  82. 1092
      src/core/lib/transport/static_metadata.cc
  83. 2
      src/core/tsi/alts/handshaker/alts_handshaker_client.cc
  84. 14
      test/core/channel/channel_trace_test.cc
  85. 38
      test/core/channel/channelz_test.cc
  86. 48
      test/core/client_channel/service_config_test.cc
  87. 38
      test/core/gpr/useful_test.cc
  88. 6
      test/core/gprpp/stat_test.cc
  89. 3
      test/core/promise/promise_factory_test.cc
  90. 2
      test/core/resource_quota/memory_quota_fuzzer.cc
  91. 561
      test/core/security/tls_security_connector_test.cc
  92. 4
      test/core/transport/bdp_estimator_test.cc
  93. 10
      test/core/transport/byte_stream_test.cc
  94. 40
      test/core/transport/chttp2/context_list_test.cc
  95. 12
      test/core/transport/chttp2/hpack_parser_table_test.cc
  96. 6
      test/core/transport/chttp2/hpack_utils_test.cc
  97. 20
      test/core/transport/chttp2/settings_timeout_test.cc
  98. 2
      test/core/util/stack_tracer.cc
  99. 5
      test/core/util/tls_utils.cc
  100. 2
      test/core/util/tls_utils.h
  101. Some files were not shown because too many files have changed in this diff Show More

@ -66,8 +66,7 @@ void BuildClientChannelConfiguration(CoreConfiguration::Builder* builder) {
GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
[](grpc_channel_stack_builder* builder) {
return grpc_channel_stack_builder_append_filter(
builder, &grpc_core::ClientChannel::kFilterVtable, nullptr,
nullptr);
builder, &ClientChannel::kFilterVtable, nullptr, nullptr);
});
}

@ -79,7 +79,7 @@ RefCountedPtr<DynamicFilters::Call> DynamicFilters::Call::Ref() {
}
RefCountedPtr<DynamicFilters::Call> DynamicFilters::Call::Ref(
const grpc_core::DebugLocation& location, const char* reason) {
const DebugLocation& location, const char* reason) {
IncrementRefCount(location, reason);
return RefCountedPtr<DynamicFilters::Call>(this);
}
@ -112,8 +112,8 @@ void DynamicFilters::Call::IncrementRefCount() {
GRPC_CALL_STACK_REF(CALL_TO_CALL_STACK(this), "");
}
void DynamicFilters::Call::IncrementRefCount(
const grpc_core::DebugLocation& /*location*/, const char* reason) {
void DynamicFilters::Call::IncrementRefCount(const DebugLocation& /*location*/,
const char* reason) {
GRPC_CALL_STACK_REF(CALL_TO_CALL_STACK(this), reason);
}

@ -94,7 +94,7 @@ class HealthCheckClient : public InternallyRefCounted<HealthCheckClient> {
grpc_polling_entity pollent_;
Arena* arena_;
grpc_core::CallCombiner call_combiner_;
CallCombiner call_combiner_;
grpc_call_context_element context_[GRPC_CONTEXT_COUNT] = {};
// The streaming call to the backend. Always non-null.

@ -139,12 +139,11 @@ void HttpConnectHandshaker::HandshakeFailedLocked(grpc_error_handle error) {
void HttpConnectHandshaker::OnWriteDoneScheduler(void* arg,
grpc_error_handle error) {
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&handshaker->request_done_closure_,
&HttpConnectHandshaker::OnWriteDone, handshaker,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_REF(error));
ExecCtx::Run(DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&handshaker->request_done_closure_,
&HttpConnectHandshaker::OnWriteDone,
handshaker, grpc_schedule_on_exec_ctx),
GRPC_ERROR_REF(error));
}
// Callback invoked when finished writing HTTP CONNECT request.
@ -174,12 +173,11 @@ void HttpConnectHandshaker::OnWriteDone(void* arg, grpc_error_handle error) {
void HttpConnectHandshaker::OnReadDoneScheduler(void* arg,
grpc_error_handle error) {
auto* handshaker = static_cast<HttpConnectHandshaker*>(arg);
grpc_core::ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&handshaker->response_read_closure_,
&HttpConnectHandshaker::OnReadDone, handshaker,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_REF(error));
ExecCtx::Run(DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&handshaker->response_read_closure_,
&HttpConnectHandshaker::OnReadDone, handshaker,
grpc_schedule_on_exec_ctx),
GRPC_ERROR_REF(error));
}
// Callback invoked for reading HTTP CONNECT response.
@ -385,8 +383,8 @@ class HttpConnectHandshakerFactory : public HandshakerFactory {
void RegisterHttpConnectHandshaker(CoreConfiguration::Builder* builder) {
builder->handshaker_registry()->RegisterHandshakerFactory(
true /* at_start */, grpc_core::HANDSHAKER_CLIENT,
absl::make_unique<grpc_core::HttpConnectHandshakerFactory>());
true /* at_start */, HANDSHAKER_CLIENT,
absl::make_unique<HttpConnectHandshakerFactory>());
}
} // namespace grpc_core

@ -1322,8 +1322,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
absl::InlinedVector<grpc_arg, 3> args_to_add = {
// The fake resolver response generator, which we use to inject
// address updates into the LB channel.
grpc_core::FakeResolverResponseGenerator::MakeChannelArg(
response_generator),
FakeResolverResponseGenerator::MakeChannelArg(response_generator),
// A channel arg indicating the target is a grpclb load balancer.
grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ADDRESS_IS_GRPCLB_LOAD_BALANCER), 1),

@ -63,8 +63,7 @@ void GrpcLbClientStats::AddCallDropped(const char* token) {
}
}
// Not found, so add a new entry.
drop_token_counts_->emplace_back(
grpc_core::UniquePtr<char>(gpr_strdup(token)), 1);
drop_token_counts_->emplace_back(UniquePtr<char>(gpr_strdup(token)), 1);
}
namespace {

@ -34,10 +34,10 @@ namespace grpc_core {
class GrpcLbClientStats : public RefCounted<GrpcLbClientStats> {
public:
struct DropTokenCount {
grpc_core::UniquePtr<char> token;
UniquePtr<char> token;
int64_t count;
DropTokenCount(grpc_core::UniquePtr<char> token, int64_t count)
DropTokenCount(UniquePtr<char> token, int64_t count)
: token(std::move(token)), count(count) {}
};

@ -747,9 +747,8 @@ class RingHashFactory : public LoadBalancingPolicyFactory {
} // namespace
void GrpcLbPolicyRingHashInit() {
grpc_core::LoadBalancingPolicyRegistry::Builder::
RegisterLoadBalancingPolicyFactory(
absl::make_unique<grpc_core::RingHashFactory>());
LoadBalancingPolicyRegistry::Builder::RegisterLoadBalancingPolicyFactory(
absl::make_unique<RingHashFactory>());
}
void GrpcLbPolicyRingHashShutdown() {}

@ -595,14 +595,13 @@ void XdsClusterResolverLb::UpdateLocked(UpdateArgs args) {
DiscoveryMechanismEntry entry;
if (config.type == XdsClusterResolverLbConfig::DiscoveryMechanism::
DiscoveryMechanismType::EDS) {
entry.discovery_mechanism =
grpc_core::MakeOrphanable<EdsDiscoveryMechanism>(
Ref(DEBUG_LOCATION, "EdsDiscoveryMechanism"),
discovery_mechanisms_.size());
entry.discovery_mechanism = MakeOrphanable<EdsDiscoveryMechanism>(
Ref(DEBUG_LOCATION, "EdsDiscoveryMechanism"),
discovery_mechanisms_.size());
} else if (config.type == XdsClusterResolverLbConfig::DiscoveryMechanism::
DiscoveryMechanismType::LOGICAL_DNS) {
entry.discovery_mechanism =
grpc_core::MakeOrphanable<LogicalDNSDiscoveryMechanism>(
MakeOrphanable<LogicalDNSDiscoveryMechanism>(
Ref(DEBUG_LOCATION, "LogicalDNSDiscoveryMechanism"),
discovery_mechanisms_.size());
} else {

@ -398,10 +398,10 @@ void AresDnsResolver::MaybeStartResolvingLocked() {
const grpc_millis earliest_next_resolution =
last_resolution_timestamp_ + min_time_between_resolutions_;
const grpc_millis ms_until_next_resolution =
earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
earliest_next_resolution - ExecCtx::Get()->Now();
if (ms_until_next_resolution > 0) {
const grpc_millis last_resolution_ago =
grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
ExecCtx::Get()->Now() - last_resolution_timestamp_;
GRPC_CARES_TRACE_LOG(
"resolver:%p In cooldown from last resolution (from %" PRId64
" ms ago). Will resolve again in %" PRId64 " ms",
@ -434,7 +434,7 @@ void AresDnsResolver::StartResolvingLocked() {
enable_srv_queries_ ? &balancer_addresses_ : nullptr,
request_service_config_ ? &service_config_json_ : nullptr,
query_timeout_ms_, work_serializer_);
last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
last_resolution_timestamp_ = ExecCtx::Get()->Now();
GRPC_CARES_TRACE_LOG("resolver:%p Started resolving. pending_request_:%p",
this, pending_request_);
}

@ -60,13 +60,13 @@ class GrpcPolledFdFactory {
/* Creates a new wrapped fd for the current platform */
virtual GrpcPolledFd* NewGrpcPolledFdLocked(
ares_socket_t as, grpc_pollset_set* driver_pollset_set,
std::shared_ptr<grpc_core::WorkSerializer> work_serializer) = 0;
std::shared_ptr<WorkSerializer> work_serializer) = 0;
/* Optionally configures the ares channel after creation */
virtual void ConfigureAresChannelLocked(ares_channel channel) = 0;
};
std::unique_ptr<GrpcPolledFdFactory> NewGrpcPolledFdFactory(
std::shared_ptr<grpc_core::WorkSerializer> work_serializer);
std::shared_ptr<WorkSerializer> work_serializer);
} // namespace grpc_core

@ -133,12 +133,12 @@ class GrpcPolledFdWindows {
}
void ScheduleAndNullReadClosure(grpc_error_handle error) {
grpc_core::ExecCtx::Run(DEBUG_LOCATION, read_closure_, error);
ExecCtx::Run(DEBUG_LOCATION, read_closure_, error);
read_closure_ = nullptr;
}
void ScheduleAndNullWriteClosure(grpc_error_handle error) {
grpc_core::ExecCtx::Run(DEBUG_LOCATION, write_closure_, error);
ExecCtx::Run(DEBUG_LOCATION, write_closure_, error);
write_closure_ = nullptr;
}

@ -239,10 +239,10 @@ void NativeDnsResolver::MaybeStartResolvingLocked() {
const grpc_millis earliest_next_resolution =
last_resolution_timestamp_ + min_time_between_resolutions_;
const grpc_millis ms_until_next_resolution =
earliest_next_resolution - grpc_core::ExecCtx::Get()->Now();
earliest_next_resolution - ExecCtx::Get()->Now();
if (ms_until_next_resolution > 0) {
const grpc_millis last_resolution_ago =
grpc_core::ExecCtx::Get()->Now() - last_resolution_timestamp_;
ExecCtx::Get()->Now() - last_resolution_timestamp_;
gpr_log(GPR_DEBUG,
"In cooldown from last resolution (from %" PRId64
" ms ago). Will resolve again in %" PRId64 " ms",
@ -277,7 +277,7 @@ void NativeDnsResolver::StartResolvingLocked() {
grpc_schedule_on_exec_ctx);
grpc_resolve_address(name_to_resolve_.c_str(), kDefaultSecurePort,
interested_parties_, &on_resolved_, &addresses_);
last_resolution_timestamp_ = grpc_core::ExecCtx::Get()->Now();
last_resolution_timestamp_ = ExecCtx::Get()->Now();
}
//

@ -104,7 +104,7 @@ class RegistryState {
// hurting performance (which is unlikely, since these allocations
// only occur at gRPC initialization time).
absl::InlinedVector<std::unique_ptr<ResolverFactory>, 10> factories_;
grpc_core::UniquePtr<char> default_prefix_;
UniquePtr<char> default_prefix_;
};
static RegistryState* g_state = nullptr;
@ -181,15 +181,14 @@ std::string ResolverRegistry::GetDefaultAuthority(absl::string_view target) {
return authority;
}
grpc_core::UniquePtr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(
const char* target) {
UniquePtr<char> ResolverRegistry::AddDefaultPrefixIfNeeded(const char* target) {
GPR_ASSERT(g_state != nullptr);
URI uri;
std::string canonical_target;
g_state->FindResolverFactory(target, &uri, &canonical_target);
return grpc_core::UniquePtr<char>(canonical_target.empty()
? gpr_strdup(target)
: gpr_strdup(canonical_target.c_str()));
return UniquePtr<char>(canonical_target.empty()
? gpr_strdup(target)
: gpr_strdup(canonical_target.c_str()));
}
} // namespace grpc_core

@ -76,8 +76,7 @@ class ResolverRegistry {
static std::string GetDefaultAuthority(absl::string_view target);
/// Returns \a target with the default prefix prepended, if needed.
static grpc_core::UniquePtr<char> AddDefaultPrefixIfNeeded(
const char* target);
static UniquePtr<char> AddDefaultPrefixIfNeeded(const char* target);
/// Returns the resolver factory for \a scheme.
/// Caller does NOT own the return value.

@ -188,8 +188,8 @@ RefCountedPtr<SubchannelCall> SubchannelCall::Ref() {
return RefCountedPtr<SubchannelCall>(this);
}
RefCountedPtr<SubchannelCall> SubchannelCall::Ref(
const grpc_core::DebugLocation& location, const char* reason) {
RefCountedPtr<SubchannelCall> SubchannelCall::Ref(const DebugLocation& location,
const char* reason) {
IncrementRefCount(location, reason);
return RefCountedPtr<SubchannelCall>(this);
}
@ -287,8 +287,8 @@ void SubchannelCall::IncrementRefCount() {
GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(this), "");
}
void SubchannelCall::IncrementRefCount(
const grpc_core::DebugLocation& /*location*/, const char* reason) {
void SubchannelCall::IncrementRefCount(const DebugLocation& /*location*/,
const char* reason) {
GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(this), reason);
}

@ -495,7 +495,7 @@ extern const grpc_channel_filter FaultInjectionFilterVtable = {
};
void FaultInjectionFilterInit(void) {
grpc_core::FaultInjectionServiceConfigParser::Register();
FaultInjectionServiceConfigParser::Register();
}
void FaultInjectionFilterShutdown(void) {}

@ -76,13 +76,11 @@ void RegisterHttpFilters(CoreConfiguration::Builder* builder) {
optional(GRPC_SERVER_CHANNEL, false, GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION,
&grpc_message_compress_filter);
optional(GRPC_CLIENT_SUBCHANNEL, true,
GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION,
&grpc_core::MessageDecompressFilter);
GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION, &MessageDecompressFilter);
optional(GRPC_CLIENT_DIRECT_CHANNEL, true,
GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION,
&grpc_core::MessageDecompressFilter);
GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION, &MessageDecompressFilter);
optional(GRPC_SERVER_CHANNEL, true, GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION,
&grpc_core::MessageDecompressFilter);
&MessageDecompressFilter);
required(GRPC_CLIENT_SUBCHANNEL, &grpc_http_client_filter);
required(GRPC_CLIENT_DIRECT_CHANNEL, &grpc_http_client_filter);
required(GRPC_SERVER_CHANNEL, &grpc_http_server_filter);

@ -84,7 +84,7 @@ class CallData {
void MaybeResumeRecvTrailingMetadataReady();
grpc_call_context_element* call_context_;
grpc_core::CallCombiner* call_combiner_;
CallCombiner* call_combiner_;
ServiceConfigCallData service_config_call_data_;
// Overall error for the call
grpc_error_handle error_ = GRPC_ERROR_NONE;

@ -113,8 +113,7 @@ class BinderConnector : public grpc_core::SubchannelConnector {
namespace grpc_core {
grpc_core::RefCountedPtr<grpc_core::Subchannel>
BinderClientChannelFactory::CreateSubchannel(
RefCountedPtr<Subchannel> BinderClientChannelFactory::CreateSubchannel(
const grpc_resolved_address& address, const grpc_channel_args* args) {
gpr_log(GPR_INFO, "BinderClientChannelFactory creating subchannel %p", this);
grpc_arg default_authority_arg = grpc_channel_arg_string_create(
@ -123,9 +122,8 @@ BinderClientChannelFactory::CreateSubchannel(
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
grpc_core::RefCountedPtr<grpc_core::Subchannel> s =
grpc_core::Subchannel::Create(
grpc_core::MakeOrphanable<BinderConnector>(), address, new_args);
RefCountedPtr<Subchannel> s =
Subchannel::Create(MakeOrphanable<BinderConnector>(), address, new_args);
return s;
}

@ -32,9 +32,9 @@
namespace grpc_core {
class BinderClientChannelFactory : public grpc_core::ClientChannelFactory {
class BinderClientChannelFactory : public ClientChannelFactory {
public:
grpc_core::RefCountedPtr<grpc_core::Subchannel> CreateSubchannel(
RefCountedPtr<Subchannel> CreateSubchannel(
const grpc_resolved_address& address,
const grpc_channel_args* args) override;
};

@ -173,7 +173,7 @@ class BinderServerListener : public Server::ListenerInterface {
private:
absl::Status OnSetupTransport(transaction_code_t code,
grpc_binder::ReadableParcel* parcel, int uid) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
if (grpc_binder::BinderTransportTxCode(code) !=
grpc_binder::BinderTransportTxCode::SETUP_TRANSPORT) {
return absl::InvalidArgumentError("Not a SETUP_TRANSPORT request");
@ -238,11 +238,10 @@ bool AddBinderPort(const std::string& addr, grpc_server* server,
return false;
}
std::string conn_id = addr.substr(kBinderUriScheme.size());
grpc_core::Server* core_server = server->core_server.get();
Server* core_server = server->core_server.get();
core_server->AddListener(
grpc_core::OrphanablePtr<grpc_core::Server::ListenerInterface>(
new grpc_core::BinderServerListener(
core_server, conn_id, std::move(factory), security_policy)));
OrphanablePtr<Server::ListenerInterface>(new BinderServerListener(
core_server, conn_id, std::move(factory), security_policy)));
return true;
}

@ -53,7 +53,7 @@ grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args,
return nullptr;
}
// Add channel arg containing the server URI.
grpc_core::UniquePtr<char> canonical_target =
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());

@ -113,7 +113,7 @@ grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args,
return nullptr;
}
// Add channel arg containing the server URI.
grpc_core::UniquePtr<char> canonical_target =
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());

@ -821,8 +821,8 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
"Invalid address: addr cannot be a nullptr.");
}
if (strncmp(addr, "external:", 9) == 0) {
return grpc_core::Chttp2ServerListener::CreateWithAcceptor(
server, addr, args, args_modifier);
return Chttp2ServerListener::CreateWithAcceptor(server, addr, args,
args_modifier);
}
*port_num = -1;
grpc_resolved_addresses* resolved = nullptr;
@ -852,9 +852,9 @@ grpc_error_handle Chttp2ServerAddPort(Server* server, const char* addr,
grpc_sockaddr_set_port(&resolved->addrs[i], *port_num);
}
int port_temp = -1;
error = grpc_core::Chttp2ServerListener::Create(
server, &resolved->addrs[i], grpc_channel_args_copy(args),
args_modifier, &port_temp);
error = Chttp2ServerListener::Create(server, &resolved->addrs[i],
grpc_channel_args_copy(args),
args_modifier, &port_temp);
if (error != GRPC_ERROR_NONE) {
error_list.push_back(error);
} else {

@ -2991,11 +2991,10 @@ void Chttp2IncomingByteStream::NextLocked(void* arg,
grpc_slice_buffer_swap(&s->frame_storage,
&s->unprocessed_incoming_frames_buffer);
s->unprocessed_incoming_frames_decompressed = false;
grpc_core::ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
GRPC_ERROR_NONE);
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete, GRPC_ERROR_NONE);
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
grpc_core::ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
if (s->data_parser.parsing_frame != nullptr) {
s->data_parser.parsing_frame->Unref();
s->data_parser.parsing_frame = nullptr;
@ -3004,8 +3003,8 @@ void Chttp2IncomingByteStream::NextLocked(void* arg,
if (bs->remaining_bytes_ != 0) {
s->byte_stream_error = GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Truncated message", &s->read_closed_error, 1);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
ExecCtx::Run(DEBUG_LOCATION, bs->next_action_.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
if (s->data_parser.parsing_frame != nullptr) {
s->data_parser.parsing_frame->Unref();
s->data_parser.parsing_frame = nullptr;
@ -3093,8 +3092,7 @@ grpc_error_handle Chttp2IncomingByteStream::Pull(grpc_slice* slice) {
void Chttp2IncomingByteStream::PublishError(grpc_error_handle error) {
GPR_ASSERT(error != GRPC_ERROR_NONE);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, stream_->on_next,
GRPC_ERROR_REF(error));
ExecCtx::Run(DEBUG_LOCATION, stream_->on_next, GRPC_ERROR_REF(error));
stream_->on_next = nullptr;
GRPC_ERROR_UNREF(stream_->byte_stream_error);
stream_->byte_stream_error = GRPC_ERROR_REF(error);

@ -40,8 +40,7 @@ void ContextList::Append(ContextList** head, grpc_chttp2_stream* s) {
*head = elem;
}
void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
grpc_error_handle error) {
void ContextList::Execute(void* arg, Timestamps* ts, grpc_error_handle error) {
ContextList* head = static_cast<ContextList*>(arg);
ContextList* to_be_freed;
while (head != nullptr) {
@ -58,7 +57,7 @@ void ContextList::Execute(void* arg, grpc_core::Timestamps* ts,
}
void grpc_http2_set_write_timestamps_callback(
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error)) {
void (*fn)(void*, Timestamps*, grpc_error_handle error)) {
write_timestamps_callback_g = fn;
}

@ -35,8 +35,7 @@ class ContextList {
/* Executes a function \a fn with each context in the list and \a ts. It also
* frees up the entire list after this operation. It is intended as a callback
* and hence does not take a ref on \a error */
static void Execute(void* arg, grpc_core::Timestamps* ts,
grpc_error_handle error);
static void Execute(void* arg, Timestamps* ts, grpc_error_handle error);
private:
void* trace_context_ = nullptr;
@ -45,7 +44,7 @@ class ContextList {
};
void grpc_http2_set_write_timestamps_callback(
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error));
void (*fn)(void*, Timestamps*, grpc_error_handle error));
void grpc_http2_set_fn_get_copied_context(void* (*fn)(void*));
} /* namespace grpc_core */

@ -331,10 +331,10 @@ class TransportFlowControl final : public TransportFlowControlBase {
const bool enable_bdp_probe_;
/* bdp estimation */
grpc_core::BdpEstimator bdp_estimator_;
BdpEstimator bdp_estimator_;
/* pid controller */
grpc_core::PidController pid_controller_;
PidController pid_controller_;
grpc_millis last_pid_update_ = 0;
};

@ -420,13 +420,11 @@ void HPackCompressor::Framer::EncodeDynamic(grpc_mdelem elem) {
uint32_t elem_hash = 0;
if (elem_interned) {
// Update filter to see if we can perhaps add this elem.
elem_hash = GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED
? reinterpret_cast<grpc_core::InternedMetadata*>(
GRPC_MDELEM_DATA(elem))
->hash()
: reinterpret_cast<grpc_core::StaticMetadata*>(
GRPC_MDELEM_DATA(elem))
->hash();
elem_hash =
GRPC_MDELEM_STORAGE(elem) == GRPC_MDELEM_STORAGE_INTERNED
? reinterpret_cast<InternedMetadata*>(GRPC_MDELEM_DATA(elem))
->hash()
: reinterpret_cast<StaticMetadata*>(GRPC_MDELEM_DATA(elem))->hash();
bool can_add_to_hashtable =
compressor_->filter_elems_.AddElement(elem_hash % kNumFilterValues);
/* is this elem currently in the decoders table? */
@ -443,7 +441,7 @@ void HPackCompressor::Framer::EncodeDynamic(grpc_mdelem elem) {
/* should this elem be in the table? */
const size_t decoder_space_usage =
grpc_core::MetadataSizeInHPackTable(elem, use_true_binary_metadata_);
MetadataSizeInHPackTable(elem, use_true_binary_metadata_);
const bool decoder_space_available =
decoder_space_usage < kMaxDecoderSpaceUsage;
const bool should_add_elem =
@ -491,10 +489,9 @@ void HPackCompressor::Framer::Encode(GrpcTimeoutMetadata,
grpc_millis deadline) {
char timeout_str[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
grpc_mdelem mdelem;
grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(),
timeout_str);
mdelem = grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_TIMEOUT, grpc_core::UnmanagedMemorySlice(timeout_str));
grpc_http2_encode_timeout(deadline - ExecCtx::Get()->Now(), timeout_str);
mdelem = grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TIMEOUT,
UnmanagedMemorySlice(timeout_str));
EncodeDynamic(mdelem);
GRPC_MDELEM_UNREF(mdelem);
}
@ -533,8 +530,7 @@ HPackCompressor::Framer::Framer(const EncodeHeaderOptions& options,
void HPackCompressor::Framer::Encode(grpc_mdelem md) {
if (GRPC_MDELEM_STORAGE(md) == GRPC_MDELEM_STORAGE_STATIC) {
const uintptr_t static_index =
reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md))
->StaticIndex();
reinterpret_cast<StaticMetadata*>(GRPC_MDELEM_DATA(md))->StaticIndex();
if (static_index < hpack_constants::kLastStaticEntry) {
EmitIndexed(static_cast<uint32_t>(static_index + 1));
return;

@ -238,7 +238,7 @@ class HPackCompressor {
class KeySliceRef {
public:
using Stored = grpc_core::RefCountedPtr<grpc_slice_refcount>;
using Stored = RefCountedPtr<grpc_slice_refcount>;
KeySliceRef(grpc_slice_refcount* ref, uint32_t hash)
: ref_(ref), hash_(hash) {}

@ -259,7 +259,7 @@ class Chttp2IncomingByteStream : public ByteStream {
grpc_chttp2_transport* transport_; // Immutable.
grpc_chttp2_stream* stream_; // Immutable.
grpc_core::RefCount refs_;
RefCount refs_;
/* Accessed only by transport thread when stream->pending_byte_stream == false
* Accessed only by application thread when stream->pending_byte_stream ==

@ -74,7 +74,7 @@ class CertificateProviderStore
store_->ReleaseCertificateProvider(key_, this);
}
grpc_core::RefCountedPtr<grpc_tls_certificate_distributor> distributor()
RefCountedPtr<grpc_tls_certificate_distributor> distributor()
const override {
return certificate_provider_->distributor();
}

@ -34,8 +34,7 @@ class XdsCertificateProvider : public grpc_tls_certificate_provider {
XdsCertificateProvider();
~XdsCertificateProvider() override;
grpc_core::RefCountedPtr<grpc_tls_certificate_distributor> distributor()
const override {
RefCountedPtr<grpc_tls_certificate_distributor> distributor() const override {
return distributor_;
}

@ -99,10 +99,9 @@ XdsChannelStackModifier::GetFromChannelArgs(const grpc_channel_args& args) {
void RegisterXdsChannelStackModifier(CoreConfiguration::Builder* builder) {
builder->channel_init()->RegisterStage(
GRPC_SERVER_CHANNEL, INT_MAX, [](grpc_channel_stack_builder* builder) {
grpc_core::RefCountedPtr<XdsChannelStackModifier>
channel_stack_modifier =
XdsChannelStackModifier::GetFromChannelArgs(
*grpc_channel_stack_builder_get_channel_arguments(builder));
RefCountedPtr<XdsChannelStackModifier> channel_stack_modifier =
XdsChannelStackModifier::GetFromChannelArgs(
*grpc_channel_stack_builder_get_channel_arguments(builder));
if (channel_stack_modifier != nullptr) {
return channel_stack_modifier->ModifyChannelStack(builder);
}

@ -85,7 +85,7 @@ class XdsClient::Notifier {
template <class T>
static void ScheduleNotifyWatchersOnErrorInWorkSerializer(
XdsClient* xds_client, const T& watchers_list, grpc_error_handle error,
const grpc_core::DebugLocation& location) {
const DebugLocation& location) {
xds_client->work_serializer_.Schedule(
[watchers_list, error]()
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client->work_serializer_) {
@ -103,7 +103,7 @@ class XdsClient::Notifier {
template <class T>
static void ScheduleNotifyWatchersOnResourceDoesNotExistInWorkSerializer(
XdsClient* xds_client, const T& watchers_list,
const grpc_core::DebugLocation& location) {
const DebugLocation& location) {
xds_client->work_serializer_.Schedule(
[watchers_list]()
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&xds_client->work_serializer_) {
@ -1490,7 +1490,7 @@ bool XdsClient::ChannelState::AdsCallState::OnResponseReceivedLocked() {
xds_client(), grpc_error_std_string(result.parse_error).c_str());
GRPC_ERROR_UNREF(result.parse_error);
} else {
grpc_millis update_time = grpc_core::ExecCtx::Get()->Now();
grpc_millis update_time = ExecCtx::Get()->Now();
// Update nonce.
auto& state = state_map_[result.type_url];
state.nonce = std::move(result.nonce);
@ -2793,7 +2793,7 @@ namespace {
std::string GetBootstrapContents(const char* fallback_config,
grpc_error_handle* error) {
// First, try GRPC_XDS_BOOTSTRAP env var.
grpc_core::UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
UniquePtr<char> path(gpr_getenv("GRPC_XDS_BOOTSTRAP"));
if (path != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO,
@ -2810,8 +2810,7 @@ std::string GetBootstrapContents(const char* fallback_config,
return contents_str;
}
// Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
grpc_core::UniquePtr<char> env_config(
gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
UniquePtr<char> env_config(gpr_getenv("GRPC_XDS_BOOTSTRAP_CONFIG"));
if (env_config != nullptr) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
gpr_log(GPR_INFO,

@ -55,7 +55,7 @@ BackOff::BackOff(const Options& options)
grpc_millis BackOff::NextAttemptTime() {
if (initial_) {
initial_ = false;
return current_backoff_ + grpc_core::ExecCtx::Get()->Now();
return current_backoff_ + ExecCtx::Get()->Now();
}
current_backoff_ = static_cast<grpc_millis>(
std::min(current_backoff_ * options_.multiplier(),
@ -65,7 +65,7 @@ grpc_millis BackOff::NextAttemptTime() {
options_.jitter() * current_backoff_);
const grpc_millis next_timeout =
static_cast<grpc_millis>(current_backoff_ + jitter);
return next_timeout + grpc_core::ExecCtx::Get()->Now();
return next_timeout + ExecCtx::Get()->Now();
}
void BackOff::Reset() {

@ -46,8 +46,8 @@ ChannelTrace::TraceEvent::TraceEvent(Severity severity, const grpc_slice& data,
RefCountedPtr<BaseNode> referenced_entity)
: severity_(severity),
data_(data),
timestamp_(grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME)),
timestamp_(
grpc_millis_to_timespec(ExecCtx::Get()->Now(), GPR_CLOCK_REALTIME)),
next_(nullptr),
referenced_entity_(std::move(referenced_entity)),
memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {}
@ -55,8 +55,8 @@ ChannelTrace::TraceEvent::TraceEvent(Severity severity, const grpc_slice& data,
ChannelTrace::TraceEvent::TraceEvent(Severity severity, const grpc_slice& data)
: severity_(severity),
data_(data),
timestamp_(grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME)),
timestamp_(
grpc_millis_to_timespec(ExecCtx::Get()->Now(), GPR_CLOCK_REALTIME)),
next_(nullptr),
memory_usage_(sizeof(TraceEvent) + grpc_slice_memory_usage(data)) {}
@ -72,8 +72,8 @@ ChannelTrace::ChannelTrace(size_t max_event_memory)
return; // tracing is disabled if max_event_memory_ == 0
}
gpr_mu_init(&tracer_mu_);
time_created_ = grpc_millis_to_timespec(grpc_core::ExecCtx::Get()->Now(),
GPR_CLOCK_REALTIME);
time_created_ =
grpc_millis_to_timespec(ExecCtx::Get()->Now(), GPR_CLOCK_REALTIME);
}
ChannelTrace::~ChannelTrace() {

@ -398,7 +398,7 @@ void SecurityArgDestroy(void* p) {
xds_certificate_provider->Unref();
}
int SecurityArgCmp(void* p, void* q) { return grpc_core::QsortCompare(p, q); }
int SecurityArgCmp(void* p, void* q) { return QsortCompare(p, q); }
const grpc_arg_pointer_vtable kChannelArgVtable = {
SecurityArgCopy, SecurityArgDestroy, SecurityArgCmp};

@ -56,7 +56,7 @@ class TraceFlagList {
};
namespace testing {
void grpc_tracer_enable_flag(grpc_core::TraceFlag* flag);
void grpc_tracer_enable_flag(TraceFlag* flag);
}
class TraceFlag {
@ -90,7 +90,7 @@ class TraceFlag {
#endif /* defined(GRPC_USE_TRACERS) || !defined(NDEBUG) */
private:
friend void grpc_core::testing::grpc_tracer_enable_flag(TraceFlag* flag);
friend void testing::grpc_tracer_enable_flag(TraceFlag* flag);
friend class TraceFlagList;
void set_enabled(bool enabled) {

@ -58,8 +58,8 @@ void SetGlobalConfigEnvErrorFunction(GlobalConfigEnvErrorFunctionType func) {
g_global_config_env_error_func = func;
}
grpc_core::UniquePtr<char> GlobalConfigEnv::GetValue() {
return grpc_core::UniquePtr<char>(gpr_getenv(GetName()));
UniquePtr<char> GlobalConfigEnv::GetValue() {
return UniquePtr<char>(gpr_getenv(GetName()));
}
void GlobalConfigEnv::SetValue(const char* value) {
@ -80,7 +80,7 @@ static_assert(std::is_trivially_destructible<GlobalConfigEnvBool>::value,
"GlobalConfigEnvBool needs to be trivially destructible.");
bool GlobalConfigEnvBool::Get() {
grpc_core::UniquePtr<char> str = GetValue();
UniquePtr<char> str = GetValue();
if (str == nullptr) {
return default_value_;
}
@ -101,7 +101,7 @@ static_assert(std::is_trivially_destructible<GlobalConfigEnvInt32>::value,
"GlobalConfigEnvInt32 needs to be trivially destructible.");
int32_t GlobalConfigEnvInt32::Get() {
grpc_core::UniquePtr<char> str = GetValue();
UniquePtr<char> str = GetValue();
if (str == nullptr) {
return default_value_;
}
@ -124,10 +124,10 @@ void GlobalConfigEnvInt32::Set(int32_t value) {
static_assert(std::is_trivially_destructible<GlobalConfigEnvString>::value,
"GlobalConfigEnvString needs to be trivially destructible.");
grpc_core::UniquePtr<char> GlobalConfigEnvString::Get() {
grpc_core::UniquePtr<char> str = GetValue();
UniquePtr<char> GlobalConfigEnvString::Get() {
UniquePtr<char> str = GetValue();
if (str == nullptr) {
return grpc_core::UniquePtr<char>(gpr_strdup(default_value_));
return UniquePtr<char>(gpr_strdup(default_value_));
}
return str;
}

@ -43,7 +43,7 @@ class GlobalConfigEnv {
public:
// Returns the value of `name` variable.
grpc_core::UniquePtr<char> GetValue();
UniquePtr<char> GetValue();
// Sets the value of `name` variable.
void SetValue(const char* value);
@ -87,7 +87,7 @@ class GlobalConfigEnvString : public GlobalConfigEnv {
constexpr GlobalConfigEnvString(char* name, const char* default_value)
: GlobalConfigEnv(name), default_value_(default_value) {}
grpc_core::UniquePtr<char> Get();
UniquePtr<char> Get();
void Set(const char* value);
private:

@ -163,9 +163,8 @@ class PolymorphicManualConstructor {
}
typename std::aligned_storage<
grpc_core::manual_ctor_impl::max_size_of<DerivedTypes...>::value,
grpc_core::manual_ctor_impl::max_align_of<DerivedTypes...>::value>::type
space_;
manual_ctor_impl::max_size_of<DerivedTypes...>::value,
manual_ctor_impl::max_align_of<DerivedTypes...>::value>::type space_;
};
template <typename Type>

@ -117,7 +117,7 @@ class InternallyRefCounted : public Orphanable {
refs_.Ref(location, reason);
}
grpc_core::RefCount refs_;
RefCount refs_;
};
} // namespace grpc_core

@ -208,7 +208,7 @@ class PolymorphicRefCount {
};
// NonPolymorphicRefCount does not enforce polymorphic destruction of
// RefCounted. Please refer to grpc_core::RefCounted for more details, and
// RefCounted. Please refer to RefCounted for more details, and
// when in doubt use PolymorphicRefCount.
class NonPolymorphicRefCount {
public:

@ -160,7 +160,7 @@ google_rpc_Status* StatusToProto(const absl::Status& status,
/// This is for internal implementation & test only
absl::Status StatusFromProto(google_rpc_Status* msg) GRPC_MUST_USE_RESULT;
/// The same value of grpc_core::internal::StatusAllocPtr(absl::OkStatus())
/// The same value of internal::StatusAllocPtr(absl::OkStatus())
static constexpr uintptr_t kOkStatusPtr = 0;
/// Returns ptr where the given status is copied into.

@ -98,7 +98,7 @@ class InternalRequest {
private:
void Finish(grpc_error_handle error) {
grpc_polling_entity_del_from_pollset_set(pollent_, context_->pollset_set);
grpc_core::ExecCtx::Run(DEBUG_LOCATION, on_done_, error);
ExecCtx::Run(DEBUG_LOCATION, on_done_, error);
delete this;
}

@ -40,14 +40,14 @@ void fill_gpr_from_timestamp(gpr_timespec* gts, const struct timespec* ts) {
gts->clock_type = GPR_CLOCK_REALTIME;
}
void default_timestamps_callback(void* /*arg*/, grpc_core::Timestamps* /*ts*/,
void default_timestamps_callback(void* /*arg*/, Timestamps* /*ts*/,
grpc_error_handle /*shudown_err*/) {
gpr_log(GPR_DEBUG, "Timestamps callback has not been registered");
}
/** The saved callback function that will be invoked when we get all the
* timestamps that we are going to get for a TracedBuffer. */
void (*timestamps_callback)(void*, grpc_core::Timestamps*,
void (*timestamps_callback)(void*, Timestamps*,
grpc_error_handle shutdown_err) =
default_timestamps_callback;
@ -62,11 +62,11 @@ T read_unaligned(const void* ptr) {
/* Extracts opt stats from the tcp_info struct \a info to \a metrics */
void extract_opt_stats_from_tcp_info(ConnectionMetrics* metrics,
const grpc_core::tcp_info* info) {
const tcp_info* info) {
if (info == nullptr) {
return;
}
if (info->length > offsetof(grpc_core::tcp_info, tcpi_sndbuf_limited)) {
if (info->length > offsetof(tcp_info, tcpi_sndbuf_limited)) {
metrics->recurring_retrans.emplace(info->tcpi_retransmits);
metrics->is_delivery_rate_app_limited.emplace(
info->tcpi_delivery_rate_app_limited);
@ -84,7 +84,7 @@ void extract_opt_stats_from_tcp_info(ConnectionMetrics* metrics,
metrics->rwnd_limited_usec.emplace(info->tcpi_rwnd_limited);
metrics->sndbuf_limited_usec.emplace(info->tcpi_sndbuf_limited);
}
if (info->length > offsetof(grpc_core::tcp_info, tcpi_dsack_dups)) {
if (info->length > offsetof(tcp_info, tcpi_dsack_dups)) {
metrics->data_sent.emplace(info->tcpi_bytes_sent);
metrics->data_retx.emplace(info->tcpi_bytes_retrans);
metrics->packet_spurious_retx.emplace(info->tcpi_dsack_dups);
@ -189,9 +189,9 @@ void extract_opt_stats_from_cmsg(ConnectionMetrics* metrics,
}
}
static int get_socket_tcp_info(grpc_core::tcp_info* info, int fd) {
static int get_socket_tcp_info(tcp_info* info, int fd) {
memset(info, 0, sizeof(*info));
info->length = offsetof(grpc_core::tcp_info, length);
info->length = offsetof(tcp_info, length);
return getsockopt(fd, IPPROTO_TCP, TCP_INFO, info, &(info->length));
}
} /* namespace */
@ -286,7 +286,7 @@ void TracedBuffer::Shutdown(TracedBuffer** head, void* remaining,
}
void grpc_tcp_set_write_timestamps_callback(
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error)) {
void (*fn)(void*, Timestamps*, grpc_error_handle error)) {
timestamps_callback = fn;
}
} /* namespace grpc_core */
@ -295,7 +295,7 @@ void grpc_tcp_set_write_timestamps_callback(
namespace grpc_core {
void grpc_tcp_set_write_timestamps_callback(
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error)) {
void (*fn)(void*, Timestamps*, grpc_error_handle error)) {
// Cast value of fn to void to avoid unused parameter warning.
// Can't comment out the name because some compilers and formatters don't
// like the sequence */* , which would arise from */*fn*/.

@ -96,8 +96,8 @@ struct Timestamps {
uint32_t byte_offset; /* byte offset relative to the start of the RPC */
#ifdef GRPC_LINUX_ERRQUEUE
grpc_core::tcp_info info; /* tcp_info collected on sendmsg */
#endif /* GRPC_LINUX_ERRQUEUE */
tcp_info info; /* tcp_info collected on sendmsg */
#endif /* GRPC_LINUX_ERRQUEUE */
};
/** TracedBuffer is a class to keep track of timestamps for a specific buffer in
@ -105,7 +105,7 @@ struct Timestamps {
* this class would only be used by Linux platforms. For all other platforms,
* TracedBuffer would be an empty class.
*
* The timestamps collected are according to grpc_core::Timestamps declared
* The timestamps collected are according to Timestamps declared
* above.
*
* A TracedBuffer list is kept track of using the head element of the list. If
@ -120,33 +120,33 @@ class TracedBuffer {
/** Add a new entry in the TracedBuffer list pointed to by head. Also saves
* sendmsg_time with the current timestamp. */
static void AddNewEntry(grpc_core::TracedBuffer** head, uint32_t seq_no,
int fd, void* arg);
static void AddNewEntry(TracedBuffer** head, uint32_t seq_no, int fd,
void* arg);
/** Processes a received timestamp based on sock_extended_err and
* scm_timestamping structures. It will invoke the timestamps callback if the
* timestamp type is SCM_TSTAMP_ACK. */
static void ProcessTimestamp(grpc_core::TracedBuffer** head,
static void ProcessTimestamp(TracedBuffer** head,
struct sock_extended_err* serr,
struct cmsghdr* opt_stats,
struct scm_timestamping* tss);
/** Cleans the list by calling the callback for each traced buffer in the list
* with timestamps that it has. */
static void Shutdown(grpc_core::TracedBuffer** head, void* remaining,
static void Shutdown(TracedBuffer** head, void* remaining,
grpc_error_handle shutdown_err);
private:
uint32_t seq_no_; /* The sequence number for the last byte in the buffer */
void* arg_; /* The arg to pass to timestamps_callback */
grpc_core::Timestamps ts_; /* The timestamps corresponding to this buffer */
grpc_core::TracedBuffer* next_; /* The next TracedBuffer in the list */
uint32_t seq_no_; /* The sequence number for the last byte in the buffer */
void* arg_; /* The arg to pass to timestamps_callback */
Timestamps ts_; /* The timestamps corresponding to this buffer */
TracedBuffer* next_; /* The next TracedBuffer in the list */
};
#else /* GRPC_LINUX_ERRQUEUE */
class TracedBuffer {
public:
/* Phony shutdown function */
static void Shutdown(grpc_core::TracedBuffer** /*head*/, void* /*remaining*/,
static void Shutdown(TracedBuffer** /*head*/, void* /*remaining*/,
grpc_error_handle shutdown_err) {
GRPC_ERROR_UNREF(shutdown_err);
}
@ -156,7 +156,7 @@ class TracedBuffer {
/** Sets the callback function to call when timestamps for a write are
* collected. The callback does not own a reference to error. */
void grpc_tcp_set_write_timestamps_callback(
void (*fn)(void*, grpc_core::Timestamps*, grpc_error_handle error));
void (*fn)(void*, Timestamps*, grpc_error_handle error));
} /* namespace grpc_core */

@ -91,8 +91,7 @@ void CallCombiner::TsanClosure(void* arg, grpc_error_handle error) {
} else {
lock.reset();
}
grpc_core::Closure::Run(DEBUG_LOCATION, self->original_closure_,
GRPC_ERROR_REF(error));
Closure::Run(DEBUG_LOCATION, self->original_closure_, GRPC_ERROR_REF(error));
if (lock != nullptr) {
TSAN_ANNOTATE_RWLOCK_RELEASED(&lock->taken, true);
bool prev = true;

@ -73,10 +73,10 @@ class Combiner;
* Generally, to create an exec_ctx instance, add the following line at the top
* of the public API entry point or at the start of a thread's work function :
*
* grpc_core::ExecCtx exec_ctx;
* ExecCtx exec_ctx;
*
* Access the created ExecCtx instance using :
* grpc_core::ExecCtx::Get()
* ExecCtx::Get()
*
* Specific responsibilities (this may grow in the future):
* - track a list of core work that needs to be delayed until the base of the
@ -90,7 +90,7 @@ class Combiner;
* - Instance of this must ALWAYS be constructed on the stack, never
* heap allocated.
* - Do not pass exec_ctx as a parameter to a function. Always access it using
* grpc_core::ExecCtx::Get().
* ExecCtx::Get().
* - NOTE: In the future, the convention is likely to change to allow only one
* ExecCtx on a thread's stack at the same time. The TODO below
* discusses this plan in more detail.
@ -108,14 +108,14 @@ class ExecCtx {
/** Default Constructor */
ExecCtx() : flags_(GRPC_EXEC_CTX_FLAG_IS_FINISHED) {
grpc_core::Fork::IncExecCtxCount();
Fork::IncExecCtxCount();
Set(this);
}
/** Parameterised Constructor */
explicit ExecCtx(uintptr_t fl) : flags_(fl) {
if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
grpc_core::Fork::IncExecCtxCount();
Fork::IncExecCtxCount();
}
Set(this);
}
@ -126,7 +126,7 @@ class ExecCtx {
Flush();
Set(last_exec_ctx_);
if (!(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
grpc_core::Fork::DecExecCtxCount();
Fork::DecExecCtxCount();
}
}
@ -276,7 +276,7 @@ class ExecCtx {
* stacks of core re-entries. Instead, any application callbacks instead should
* not be invoked until other core work is done and other application callbacks
* have completed. To accomplish this, any application callback should be
* enqueued using grpc_core::ApplicationCallbackExecCtx::Enqueue .
* enqueued using ApplicationCallbackExecCtx::Enqueue .
*
* CONVENTIONS:
* - Instances of this must ALWAYS be constructed on the stack, never
@ -289,8 +289,8 @@ class ExecCtx {
* Generally, core entry points that may trigger application-level callbacks
* will have the following declarations:
*
* grpc_core::ApplicationCallbackExecCtx callback_exec_ctx;
* grpc_core::ExecCtx exec_ctx;
* ApplicationCallbackExecCtx callback_exec_ctx;
* ExecCtx exec_ctx;
*
* This ordering is important to make sure that the ApplicationCallbackExecCtx
* is destroyed after the ExecCtx (to prevent the re-entry problem described
@ -320,7 +320,7 @@ class ApplicationCallbackExecCtx {
}
callback_exec_ctx_ = nullptr;
if (!(GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags_)) {
grpc_core::Fork::DecExecCtxCount();
Fork::DecExecCtxCount();
}
} else {
GPR_DEBUG_ASSERT(head_ == nullptr);
@ -335,7 +335,7 @@ class ApplicationCallbackExecCtx {
static void Set(ApplicationCallbackExecCtx* exec_ctx, uintptr_t flags) {
if (Get() == nullptr) {
if (!(GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD & flags)) {
grpc_core::Fork::IncExecCtxCount();
Fork::IncExecCtxCount();
}
callback_exec_ctx_ = exec_ctx;
}

@ -108,7 +108,7 @@ size_t Executor::RunClosures(const char* executor_name,
// invoked on its destruction, which will be after completing any closures in
// the executor's closure list (which were explicitly scheduled onto the
// executor).
grpc_core::ApplicationCallbackExecCtx callback_exec_ctx(
ApplicationCallbackExecCtx callback_exec_ctx(
GRPC_APP_CALLBACK_EXEC_CTX_FLAG_IS_INTERNAL_THREAD);
grpc_closure* c = list.head;
@ -126,7 +126,7 @@ size_t Executor::RunClosures(const char* executor_name,
GRPC_ERROR_UNREF(error);
c = next;
n++;
grpc_core::ExecCtx::Get()->Flush();
ExecCtx::Get()->Flush();
}
return n;
@ -156,12 +156,11 @@ void Executor::SetThreading(bool threading) {
gpr_cv_init(&thd_state_[i].cv);
thd_state_[i].id = i;
thd_state_[i].name = name_;
thd_state_[i].thd = grpc_core::Thread();
thd_state_[i].thd = Thread();
thd_state_[i].elems = GRPC_CLOSURE_LIST_INIT;
}
thd_state_[0].thd =
grpc_core::Thread(name_, &Executor::ThreadMain, &thd_state_[0]);
thd_state_[0].thd = Thread(name_, &Executor::ThreadMain, &thd_state_[0]);
thd_state_[0].thd.Start();
} else { // !threading
if (curr_num_threads == 0) {
@ -202,7 +201,7 @@ void Executor::SetThreading(bool threading) {
// finish. Thus, never call Executor::SetThreading(false) in the middle of
// an application.
// TODO(guantaol): create another method to finish all the pending closures
// registered in the background poller by grpc_core::Executor.
// registered in the background poller by Executor.
grpc_iomgr_platform_shutdown_background_closure();
}
@ -215,7 +214,7 @@ void Executor::ThreadMain(void* arg) {
ThreadState* ts = static_cast<ThreadState*>(arg);
g_this_thread_state = ts;
grpc_core::ExecCtx exec_ctx(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD);
ExecCtx exec_ctx(GRPC_EXEC_CTX_FLAG_IS_INTERNAL_THREAD);
size_t subtract_depth = 0;
for (;;) {
@ -242,7 +241,7 @@ void Executor::ThreadMain(void* arg) {
EXECUTOR_TRACE("(%s) [%" PRIdPTR "]: execute", ts->name, ts->id);
grpc_core::ExecCtx::Get()->InvalidateNow();
ExecCtx::Get()->InvalidateNow();
subtract_depth = RunClosures(ts->name, closures);
}
@ -267,8 +266,7 @@ void Executor::Enqueue(grpc_closure* closure, grpc_error_handle error,
#else
EXECUTOR_TRACE("(%s) schedule %p inline", name_, closure);
#endif
grpc_closure_list_append(grpc_core::ExecCtx::Get()->closure_list(),
closure, error);
grpc_closure_list_append(ExecCtx::Get()->closure_list(), closure, error);
return;
}
@ -278,8 +276,7 @@ void Executor::Enqueue(grpc_closure* closure, grpc_error_handle error,
ThreadState* ts = g_this_thread_state;
if (ts == nullptr) {
ts = &thd_state_[grpc_core::HashPointer(grpc_core::ExecCtx::Get(),
cur_thread_count)];
ts = &thd_state_[HashPointer(ExecCtx::Get(), cur_thread_count)];
}
ThreadState* orig_ts = ts;
@ -356,8 +353,8 @@ void Executor::Enqueue(grpc_closure* closure, grpc_error_handle error,
// always increment num_threads under the 'adding_thread_lock')
gpr_atm_rel_store(&num_threads_, cur_thread_count + 1);
thd_state_[cur_thread_count].thd = grpc_core::Thread(
name_, &Executor::ThreadMain, &thd_state_[cur_thread_count]);
thd_state_[cur_thread_count].thd =
Thread(name_, &Executor::ThreadMain, &thd_state_[cur_thread_count]);
thd_state_[cur_thread_count].thd.Start();
}
gpr_spinlock_unlock(&adding_thread_lock_);

@ -36,7 +36,7 @@ struct ThreadState {
size_t depth; // Number of closures in the closure list
bool shutdown;
bool queued_long_job;
grpc_core::Thread thd;
Thread thd;
};
enum class ExecutorType {

@ -26,17 +26,14 @@ DebugOnlyTraceFlag grpc_work_serializer_trace(false, "work_serializer");
class WorkSerializer::WorkSerializerImpl : public Orphanable {
public:
void Run(std::function<void()> callback,
const grpc_core::DebugLocation& location);
void Schedule(std::function<void()> callback,
const grpc_core::DebugLocation& location);
void Run(std::function<void()> callback, const DebugLocation& location);
void Schedule(std::function<void()> callback, const DebugLocation& location);
void DrainQueue();
void Orphan() override;
private:
struct CallbackWrapper {
CallbackWrapper(std::function<void()> cb,
const grpc_core::DebugLocation& loc)
CallbackWrapper(std::function<void()> cb, const DebugLocation& loc)
: callback(std::move(cb)), location(loc) {}
MultiProducerSingleConsumerQueue::Node mpscq_node;
@ -75,8 +72,8 @@ class WorkSerializer::WorkSerializerImpl : public Orphanable {
MultiProducerSingleConsumerQueue queue_;
};
void WorkSerializer::WorkSerializerImpl::Run(
std::function<void()> callback, const grpc_core::DebugLocation& location) {
void WorkSerializer::WorkSerializerImpl::Run(std::function<void()> callback,
const DebugLocation& location) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
gpr_log(GPR_INFO, "WorkSerializer::Run() %p Scheduling callback [%s:%d]",
this, location.file(), location.line());
@ -108,7 +105,7 @@ void WorkSerializer::WorkSerializerImpl::Run(
}
void WorkSerializer::WorkSerializerImpl::Schedule(
std::function<void()> callback, const grpc_core::DebugLocation& location) {
std::function<void()> callback, const DebugLocation& location) {
CallbackWrapper* cb_wrapper =
new CallbackWrapper(std::move(callback), location);
if (GRPC_TRACE_FLAG_ENABLED(grpc_work_serializer_trace)) {
@ -215,12 +212,12 @@ WorkSerializer::WorkSerializer()
WorkSerializer::~WorkSerializer() {}
void WorkSerializer::Run(std::function<void()> callback,
const grpc_core::DebugLocation& location) {
const DebugLocation& location) {
impl_->Run(std::move(callback), location);
}
void WorkSerializer::Schedule(std::function<void()> callback,
const grpc_core::DebugLocation& location) {
const DebugLocation& location) {
impl_->Schedule(std::move(callback), location);
}

@ -72,15 +72,13 @@ class ABSL_LOCKABLE WorkSerializer {
// }
// void callback() ABSL_EXCLUSIVE_LOCKS_REQUIRED(work_serializer) { ... }
//
// TODO(yashkt): Replace grpc_core::DebugLocation with absl::SourceLocation
// TODO(yashkt): Replace DebugLocation with absl::SourceLocation
// once we can start using it directly.
void Run(std::function<void()> callback,
const grpc_core::DebugLocation& location);
void Run(std::function<void()> callback, const DebugLocation& location);
// Schedule \a callback to be run later when the queue of callbacks is
// drained.
void Schedule(std::function<void()> callback,
const grpc_core::DebugLocation& location);
void Schedule(std::function<void()> callback, const DebugLocation& location);
// Drains the queue of callbacks.
void DrainQueue();

@ -30,7 +30,7 @@ bool ParseDurationFromJson(const Json& field, grpc_millis* duration) {
if (field.type() != Json::Type::STRING) return false;
size_t len = field.string_value().size();
if (field.string_value()[len - 1] != 's') return false;
grpc_core::UniquePtr<char> buf(gpr_strdup(field.string_value().c_str()));
UniquePtr<char> buf(gpr_strdup(field.string_value().c_str()));
*(buf.get() + len - 1) = '\0'; // Remove trailing 's'.
char* decimal_point = strchr(buf.get(), '.');
int nanos = 0;

@ -110,7 +110,7 @@ FileWatcherAuthorizationPolicyProvider::FileWatcherAuthorizationPolicyProvider(
}
}
};
refresh_thread_ = absl::make_unique<grpc_core::Thread>(
refresh_thread_ = absl::make_unique<Thread>(
"FileWatcherAuthorizationPolicyProvider_refreshing_thread", thread_lambda,
WeakRef().release());
refresh_thread_->Start();
@ -130,7 +130,7 @@ absl::Status FileWatcherAuthorizationPolicyProvider::ForceUpdate() {
if (!rbac_policies_or.ok()) {
return rbac_policies_or.status();
}
grpc_core::MutexLock lock(&mu_);
MutexLock lock(&mu_);
allow_engine_ = MakeRefCounted<GrpcAuthorizationEngine>(
std::move(rbac_policies_or->allow_policy));
deny_engine_ = MakeRefCounted<GrpcAuthorizationEngine>(

@ -77,7 +77,7 @@ class FileWatcherAuthorizationPolicyProvider
void Orphan() override;
AuthorizationEngines engines() override {
grpc_core::MutexLock lock(&mu_);
MutexLock lock(&mu_);
return {allow_engine_, deny_engine_};
}
@ -92,7 +92,7 @@ class FileWatcherAuthorizationPolicyProvider
std::unique_ptr<Thread> refresh_thread_;
gpr_event shutdown_event_;
grpc_core::Mutex mu_;
Mutex mu_;
// Engines created using authz_policy_.
RefCountedPtr<AuthorizationEngine> allow_engine_ ABSL_GUARDED_BY(mu_);
RefCountedPtr<AuthorizationEngine> deny_engine_ ABSL_GUARDED_BY(mu_);

@ -439,9 +439,9 @@ void set_gce_tenancy_checker_for_testing(grpc_gce_tenancy_checker checker) {
}
void grpc_flush_cached_google_default_credentials(void) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
gpr_once_init(&g_once, init_default_credentials);
grpc_core::MutexLock lock(g_state_mu);
MutexLock lock(g_state_mu);
g_metadata_server_available = 0;
}

@ -182,7 +182,7 @@ grpc_call_credentials* grpc_service_account_jwt_access_credentials_create(
namespace grpc_core {
absl::StatusOr<std::string> RemoveServiceNameFromJwtUri(absl::string_view uri) {
auto parsed = grpc_core::URI::Parse(uri);
auto parsed = URI::Parse(uri);
if (!parsed.ok()) {
return parsed.status();
}

@ -584,8 +584,8 @@ class StsTokenFetcherCredentials
channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */
grpc_httpcli_post(
http_context, pollent, grpc_core::ResourceQuota::Default(), &request,
body, body_length, deadline,
http_context, pollent, ResourceQuota::Default(), &request, body,
body_length, deadline,
GRPC_CLOSURE_INIT(&http_post_cb_closure_, response_cb, metadata_req,
grpc_schedule_on_exec_ctx),
&metadata_req->response);
@ -636,14 +636,14 @@ class StsTokenFetcherCredentials
URI sts_url_;
grpc_closure http_post_cb_closure_;
grpc_core::UniquePtr<char> resource_;
grpc_core::UniquePtr<char> audience_;
grpc_core::UniquePtr<char> scope_;
grpc_core::UniquePtr<char> requested_token_type_;
grpc_core::UniquePtr<char> subject_token_path_;
grpc_core::UniquePtr<char> subject_token_type_;
grpc_core::UniquePtr<char> actor_token_path_;
grpc_core::UniquePtr<char> actor_token_type_;
UniquePtr<char> resource_;
UniquePtr<char> audience_;
UniquePtr<char> scope_;
UniquePtr<char> requested_token_type_;
UniquePtr<char> subject_token_path_;
UniquePtr<char> subject_token_type_;
UniquePtr<char> actor_token_path_;
UniquePtr<char> actor_token_type_;
};
} // namespace

@ -31,17 +31,16 @@
namespace grpc_core {
StaticDataCertificateProvider::StaticDataCertificateProvider(
std::string root_certificate,
grpc_core::PemKeyCertPairList pem_key_cert_pairs)
std::string root_certificate, PemKeyCertPairList pem_key_cert_pairs)
: distributor_(MakeRefCounted<grpc_tls_certificate_distributor>()),
root_certificate_(std::move(root_certificate)),
pem_key_cert_pairs_(std::move(pem_key_cert_pairs)) {
distributor_->SetWatchStatusCallback([this](std::string cert_name,
bool root_being_watched,
bool identity_being_watched) {
grpc_core::MutexLock lock(&mu_);
MutexLock lock(&mu_);
absl::optional<std::string> root_certificate;
absl::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs;
absl::optional<PemKeyCertPairList> pem_key_cert_pairs;
StaticDataCertificateProvider::WatcherInfo& info = watcher_info_[cert_name];
if (!info.root_being_watched && root_being_watched &&
!root_certificate_.empty()) {
@ -123,15 +122,15 @@ FileWatcherCertificateProvider::FileWatcherCertificateProvider(
provider->ForceUpdate();
}
};
refresh_thread_ = grpc_core::Thread(
"FileWatcherCertificateProvider_refreshing_thread", thread_lambda, this);
refresh_thread_ = Thread("FileWatcherCertificateProvider_refreshing_thread",
thread_lambda, this);
refresh_thread_.Start();
distributor_->SetWatchStatusCallback([this](std::string cert_name,
bool root_being_watched,
bool identity_being_watched) {
grpc_core::MutexLock lock(&mu_);
MutexLock lock(&mu_);
absl::optional<std::string> root_certificate;
absl::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs;
absl::optional<PemKeyCertPairList> pem_key_cert_pairs;
FileWatcherCertificateProvider::WatcherInfo& info =
watcher_info_[cert_name];
if (!info.root_being_watched && root_being_watched &&
@ -180,7 +179,7 @@ FileWatcherCertificateProvider::~FileWatcherCertificateProvider() {
void FileWatcherCertificateProvider::ForceUpdate() {
absl::optional<std::string> root_certificate;
absl::optional<grpc_core::PemKeyCertPairList> pem_key_cert_pairs;
absl::optional<PemKeyCertPairList> pem_key_cert_pairs;
if (!root_cert_path_.empty()) {
root_certificate = ReadRootCertificatesFromFile(root_cert_path_);
}
@ -188,7 +187,7 @@ void FileWatcherCertificateProvider::ForceUpdate() {
pem_key_cert_pairs = ReadIdentityKeyCertPairFromFiles(
private_key_path_, identity_certificate_path_);
}
grpc_core::MutexLock lock(&mu_);
MutexLock lock(&mu_);
const bool root_cert_changed =
(!root_certificate.has_value() && !root_certificate_.empty()) ||
(root_certificate.has_value() && root_certificate_ != *root_certificate);
@ -221,7 +220,7 @@ void FileWatcherCertificateProvider::ForceUpdate() {
const std::string& cert_name = p.first;
const WatcherInfo& info = p.second;
absl::optional<std::string> root_to_report;
absl::optional<grpc_core::PemKeyCertPairList> identity_to_report;
absl::optional<PemKeyCertPairList> identity_to_report;
// Set key materials to the distributor if their contents changed.
if (info.root_being_watched && !root_certificate_.empty() &&
root_cert_changed) {
@ -279,7 +278,7 @@ namespace {
// it logs the error and returns 0.
time_t GetModificationTime(const char* filename) {
time_t ts = 0;
absl::Status status = grpc_core::GetFileModificationTime(filename, &ts);
absl::Status status = GetFileModificationTime(filename, &ts);
return ts;
}

@ -59,9 +59,8 @@ namespace grpc_core {
class StaticDataCertificateProvider final
: public grpc_tls_certificate_provider {
public:
StaticDataCertificateProvider(
std::string root_certificate,
grpc_core::PemKeyCertPairList pem_key_cert_pairs);
StaticDataCertificateProvider(std::string root_certificate,
PemKeyCertPairList pem_key_cert_pairs);
~StaticDataCertificateProvider() override;
@ -76,9 +75,9 @@ class StaticDataCertificateProvider final
};
RefCountedPtr<grpc_tls_certificate_distributor> distributor_;
std::string root_certificate_;
grpc_core::PemKeyCertPairList pem_key_cert_pairs_;
PemKeyCertPairList pem_key_cert_pairs_;
// Guards members below.
grpc_core::Mutex mu_;
Mutex mu_;
// Stores each cert_name we get from the distributor callback and its watcher
// information.
std::map<std::string, WatcherInfo> watcher_info_;
@ -122,15 +121,15 @@ class FileWatcherCertificateProvider final
unsigned int refresh_interval_sec_ = 0;
RefCountedPtr<grpc_tls_certificate_distributor> distributor_;
grpc_core::Thread refresh_thread_;
Thread refresh_thread_;
gpr_event shutdown_event_;
// Guards members below.
grpc_core::Mutex mu_;
Mutex mu_;
// The most-recent credential data. It will be empty if the most recent read
// attempt failed.
std::string root_certificate_ ABSL_GUARDED_BY(mu_);
grpc_core::PemKeyCertPairList pem_key_cert_pairs_ ABSL_GUARDED_BY(mu_);
PemKeyCertPairList pem_key_cert_pairs_ ABSL_GUARDED_BY(mu_);
// Stores each cert_name we get from the distributor callback and its watcher
// information.
std::map<std::string, WatcherInfo> watcher_info_ ABSL_GUARDED_BY(mu_);

@ -187,8 +187,8 @@ class grpc_alts_server_security_connector final
namespace grpc_core {
namespace internal {
grpc_core::RefCountedPtr<grpc_auth_context>
grpc_alts_auth_context_from_tsi_peer(const tsi_peer* peer) {
RefCountedPtr<grpc_auth_context> grpc_alts_auth_context_from_tsi_peer(
const tsi_peer* peer) {
if (peer == nullptr) {
gpr_log(GPR_ERROR,
"Invalid arguments to grpc_alts_auth_context_from_tsi_peer()");
@ -243,7 +243,7 @@ grpc_alts_auth_context_from_tsi_peer(const tsi_peer* peer) {
return nullptr;
}
/* Create auth context. */
auto ctx = grpc_core::MakeRefCounted<grpc_auth_context>(nullptr);
auto ctx = MakeRefCounted<grpc_auth_context>(nullptr);
grpc_auth_context_add_cstring_property(
ctx.get(), GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME,
GRPC_ALTS_TRANSPORT_SECURITY_TYPE);

@ -66,8 +66,8 @@ namespace grpc_core {
namespace internal {
/* Exposed only for testing. */
grpc_core::RefCountedPtr<grpc_auth_context>
grpc_alts_auth_context_from_tsi_peer(const tsi_peer* peer);
RefCountedPtr<grpc_auth_context> grpc_alts_auth_context_from_tsi_peer(
const tsi_peer* peer);
} // namespace internal
} // namespace grpc_core

@ -95,7 +95,7 @@ int InsecureChannelSecurityConnector::cmp(
// created with the security level of TSI_SECURITY_NONE.
void InsecureServerSecurityConnector::add_handshakers(
const grpc_channel_args* args, grpc_pollset_set* /* interested_parties */,
grpc_core::HandshakeManager* handshake_manager) {
HandshakeManager* handshake_manager) {
tsi_handshaker* handshaker = nullptr;
// Re-use local_tsi_handshaker_create as a minimalist handshaker.
GPR_ASSERT(tsi_local_handshaker_create(false /* is_client */, &handshaker) ==
@ -105,7 +105,7 @@ void InsecureServerSecurityConnector::add_handshakers(
void InsecureServerSecurityConnector::check_peer(
tsi_peer peer, grpc_endpoint* /*ep*/,
grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
RefCountedPtr<grpc_auth_context>* auth_context,
grpc_closure* on_peer_checked) {
*auth_context = MakeAuthContext();
tsi_peer_destruct(&peer);

@ -39,8 +39,8 @@ class InsecureChannelSecurityConnector
: public grpc_channel_security_connector {
public:
InsecureChannelSecurityConnector(
grpc_core::RefCountedPtr<grpc_channel_credentials> channel_creds,
grpc_core::RefCountedPtr<grpc_call_credentials> request_metadata_creds)
RefCountedPtr<grpc_channel_credentials> channel_creds,
RefCountedPtr<grpc_call_credentials> request_metadata_creds)
: grpc_channel_security_connector(/* url_scheme */ nullptr,
std::move(channel_creds),
std::move(request_metadata_creds)) {}
@ -54,10 +54,10 @@ class InsecureChannelSecurityConnector
void add_handshakers(const grpc_channel_args* args,
grpc_pollset_set* /* interested_parties */,
grpc_core::HandshakeManager* handshake_manager) override;
HandshakeManager* handshake_manager) override;
void check_peer(tsi_peer peer, grpc_endpoint* ep,
grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
RefCountedPtr<grpc_auth_context>* auth_context,
grpc_closure* on_peer_checked) override;
void cancel_check_peer(grpc_closure* /*on_peer_checked*/,
@ -71,16 +71,16 @@ class InsecureChannelSecurityConnector
class InsecureServerSecurityConnector : public grpc_server_security_connector {
public:
explicit InsecureServerSecurityConnector(
grpc_core::RefCountedPtr<grpc_server_credentials> server_creds)
RefCountedPtr<grpc_server_credentials> server_creds)
: grpc_server_security_connector(nullptr /* url_scheme */,
std::move(server_creds)) {}
void add_handshakers(const grpc_channel_args* args,
grpc_pollset_set* /* interested_parties */,
grpc_core::HandshakeManager* handshake_manager) override;
HandshakeManager* handshake_manager) override;
void check_peer(tsi_peer peer, grpc_endpoint* ep,
grpc_core::RefCountedPtr<grpc_auth_context>* auth_context,
RefCountedPtr<grpc_auth_context>* auth_context,
grpc_closure* on_peer_checked) override;
void cancel_check_peer(grpc_closure* /*on_peer_checked*/,

@ -145,8 +145,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) {
grpc_slice LoadSystemRootCerts() {
grpc_slice result = grpc_empty_slice();
// Prioritize user-specified custom directory if flag is set.
grpc_core::UniquePtr<char> custom_dir =
GPR_GLOBAL_CONFIG_GET(grpc_system_ssl_roots_dir);
UniquePtr<char> custom_dir = GPR_GLOBAL_CONFIG_GET(grpc_system_ssl_roots_dir);
if (strlen(custom_dir.get()) > 0) {
result = CreateRootCertsBundle(custom_dir.get());
}

@ -563,7 +563,7 @@ grpc_slice DefaultSslRootStore::ComputePemRootCerts() {
const bool not_use_system_roots =
GPR_GLOBAL_CONFIG_GET(grpc_not_use_system_ssl_roots);
// First try to load the roots from the configuration.
grpc_core::UniquePtr<char> default_root_certs_path =
UniquePtr<char> default_root_certs_path =
GPR_GLOBAL_CONFIG_GET(grpc_default_ssl_roots_file_path);
if (strlen(default_root_certs_path.get()) > 0) {
GRPC_LOG_IF_ERROR(

@ -181,7 +181,7 @@ class PemKeyCertPair {
std::string cert_chain_;
};
typedef absl::InlinedVector<grpc_core::PemKeyCertPair, 1> PemKeyCertPairList;
typedef absl::InlinedVector<PemKeyCertPair, 1> PemKeyCertPairList;
} // namespace grpc_core

@ -440,7 +440,7 @@ grpc_error_handle SecurityHandshaker::DoHandshakerNextLocked(
void SecurityHandshaker::OnHandshakeDataReceivedFromPeerFnScheduler(
void* arg, grpc_error_handle error) {
SecurityHandshaker* h = static_cast<SecurityHandshaker*>(arg);
grpc_core::ExecCtx::Run(
ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&h->on_handshake_data_received_from_peer_,
&SecurityHandshaker::OnHandshakeDataReceivedFromPeerFn,
@ -473,7 +473,7 @@ void SecurityHandshaker::OnHandshakeDataReceivedFromPeerFn(
void SecurityHandshaker::OnHandshakeDataSentToPeerFnScheduler(
void* arg, grpc_error_handle error) {
SecurityHandshaker* h = static_cast<SecurityHandshaker*>(arg);
grpc_core::ExecCtx::Run(
ExecCtx::Run(
DEBUG_LOCATION,
GRPC_CLOSURE_INIT(&h->on_handshake_data_sent_to_peer_,
&SecurityHandshaker::OnHandshakeDataSentToPeerFn, h,

@ -139,7 +139,7 @@ class NewWithLenSliceRefcount {
/** grpc_slice_from_moved_(string|buffer) ref count .*/
class MovedStringSliceRefCount {
public:
explicit MovedStringSliceRefCount(grpc_core::UniquePtr<char>&& str)
explicit MovedStringSliceRefCount(UniquePtr<char>&& str)
: base_(grpc_slice_refcount::Type::REGULAR, &refs_, Destroy, this,
&base_),
str_(std::move(str)) {}
@ -152,8 +152,8 @@ class MovedStringSliceRefCount {
}
grpc_slice_refcount base_;
grpc_core::RefCount refs_;
grpc_core::UniquePtr<char> str_;
RefCount refs_;
UniquePtr<char> str_;
};
// grpc_slice_from_cpp_string() ref count.
@ -172,7 +172,7 @@ class MovedCppStringSliceRefCount {
}
grpc_slice_refcount base_;
grpc_core::RefCount refs_;
RefCount refs_;
std::string str_;
};

@ -130,7 +130,7 @@ const uint8_t g_static_metadata_bytes[] = {
97, 116, 101, 44, 103, 122, 105, 112, 105, 100, 101, 110, 116, 105, 116,
121, 44, 100, 101, 102, 108, 97, 116, 101, 44, 103, 122, 105, 112};
grpc_slice_refcount grpc_core::StaticSliceRefcount::kStaticSubRefcount;
grpc_slice_refcount StaticSliceRefcount::kStaticSubRefcount;
StaticSliceRefcount g_static_metadata_slice_refcounts[GRPC_STATIC_MDSTR_COUNT] =
{
@ -195,335 +195,225 @@ StaticSliceRefcount g_static_metadata_slice_refcounts[GRPC_STATIC_MDSTR_COUNT] =
const StaticMetadataSlice
g_static_metadata_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[0].base, 5,
g_static_metadata_bytes + 0),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[1].base, 7,
g_static_metadata_bytes + 5),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[3].base, 10,
g_static_metadata_bytes + 19),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[5].base, 12,
g_static_metadata_bytes + 36),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[6].base, 11,
g_static_metadata_bytes + 48),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[7].base, 16,
g_static_metadata_bytes + 59),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[8].base, 13,
g_static_metadata_bytes + 75),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[9].base, 20,
g_static_metadata_bytes + 88),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[10].base, 21,
g_static_metadata_bytes + 108),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[11].base, 13,
g_static_metadata_bytes + 129),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[12].base, 14,
g_static_metadata_bytes + 142),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[13].base, 12,
g_static_metadata_bytes + 156),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[14].base, 16,
g_static_metadata_bytes + 168),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[15].base, 15,
g_static_metadata_bytes + 184),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[16].base, 30,
g_static_metadata_bytes + 199),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[17].base, 37,
g_static_metadata_bytes + 229),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[18].base, 10,
g_static_metadata_bytes + 266),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[19].base, 4,
g_static_metadata_bytes + 276),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[20].base, 26,
g_static_metadata_bytes + 280),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[21].base, 22,
g_static_metadata_bytes + 306),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[22].base, 27,
g_static_metadata_bytes + 328),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[23].base, 12,
g_static_metadata_bytes + 355),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[24].base, 1,
g_static_metadata_bytes + 367),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[25].base, 1,
g_static_metadata_bytes + 368),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[26].base, 1,
g_static_metadata_bytes + 369),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[27].base, 1,
g_static_metadata_bytes + 370),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[28].base, 0,
g_static_metadata_bytes + 371),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[29].base, 19,
g_static_metadata_bytes + 371),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[30].base, 12,
g_static_metadata_bytes + 390),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[31].base, 30,
g_static_metadata_bytes + 402),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[32].base, 31,
g_static_metadata_bytes + 432),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[33].base, 36,
g_static_metadata_bytes + 463),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[34].base, 65,
g_static_metadata_bytes + 499),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[35].base, 65,
g_static_metadata_bytes + 564),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[36].base, 28,
g_static_metadata_bytes + 629),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[37].base, 80,
g_static_metadata_bytes + 657),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[38].base, 80,
g_static_metadata_bytes + 737),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[39].base, 7,
g_static_metadata_bytes + 817),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[40].base, 4,
g_static_metadata_bytes + 824),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[41].base, 11,
g_static_metadata_bytes + 828),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[42].base, 2,
g_static_metadata_bytes + 839),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[43].base, 8,
g_static_metadata_bytes + 841),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[44].base, 3,
g_static_metadata_bytes + 849),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[45].base, 4,
g_static_metadata_bytes + 852),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[46].base, 1,
g_static_metadata_bytes + 856),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[47].base, 11,
g_static_metadata_bytes + 857),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[48].base, 4,
g_static_metadata_bytes + 868),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[49].base, 5,
g_static_metadata_bytes + 872),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 877),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[51].base, 3,
g_static_metadata_bytes + 880),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[52].base, 3,
g_static_metadata_bytes + 883),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[53].base, 3,
g_static_metadata_bytes + 886),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[54].base, 3,
g_static_metadata_bytes + 889),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[55].base, 3,
g_static_metadata_bytes + 892),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[56].base, 3,
g_static_metadata_bytes + 895),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[57].base, 14,
g_static_metadata_bytes + 898),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[58].base, 13,
g_static_metadata_bytes + 912),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[59].base, 15,
g_static_metadata_bytes + 925),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[60].base, 13,
g_static_metadata_bytes + 940),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[61].base, 6,
g_static_metadata_bytes + 953),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[62].base, 27,
g_static_metadata_bytes + 959),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[63].base, 3,
g_static_metadata_bytes + 986),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[64].base, 5,
g_static_metadata_bytes + 989),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[65].base, 13,
g_static_metadata_bytes + 994),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[66].base, 13,
g_static_metadata_bytes + 1007),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[67].base, 19,
g_static_metadata_bytes + 1020),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[68].base, 16,
g_static_metadata_bytes + 1039),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[69].base, 14,
g_static_metadata_bytes + 1055),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[70].base, 16,
g_static_metadata_bytes + 1069),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[71].base, 13,
g_static_metadata_bytes + 1085),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[72].base, 6,
g_static_metadata_bytes + 1098),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[73].base, 4,
g_static_metadata_bytes + 1104),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[74].base, 4,
g_static_metadata_bytes + 1108),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[75].base, 6,
g_static_metadata_bytes + 1112),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[76].base, 7,
g_static_metadata_bytes + 1118),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[77].base, 4,
g_static_metadata_bytes + 1125),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[78].base, 8,
g_static_metadata_bytes + 1129),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[79].base, 17,
g_static_metadata_bytes + 1137),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[80].base, 13,
g_static_metadata_bytes + 1154),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[81].base, 8,
g_static_metadata_bytes + 1167),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[82].base, 19,
g_static_metadata_bytes + 1175),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[83].base, 13,
g_static_metadata_bytes + 1194),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[84].base, 4,
g_static_metadata_bytes + 1207),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[85].base, 8,
g_static_metadata_bytes + 1211),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[86].base, 12,
g_static_metadata_bytes + 1219),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[87].base, 18,
g_static_metadata_bytes + 1231),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[88].base, 19,
g_static_metadata_bytes + 1249),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[89].base, 5,
g_static_metadata_bytes + 1268),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[90].base, 7,
g_static_metadata_bytes + 1273),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[91].base, 7,
g_static_metadata_bytes + 1280),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[92].base, 11,
g_static_metadata_bytes + 1287),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[93].base, 6,
g_static_metadata_bytes + 1298),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[94].base, 10,
g_static_metadata_bytes + 1304),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[95].base, 25,
g_static_metadata_bytes + 1314),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[96].base, 17,
g_static_metadata_bytes + 1339),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[97].base, 4,
g_static_metadata_bytes + 1356),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[98].base, 3,
g_static_metadata_bytes + 1360),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[99].base, 16,
g_static_metadata_bytes + 1363),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[100].base, 1,
g_static_metadata_bytes + 1379),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[101].base, 8,
g_static_metadata_bytes + 1380),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[102].base, 16,
g_static_metadata_bytes + 1388),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[103].base, 4,
g_static_metadata_bytes + 1404),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[104].base, 3,
g_static_metadata_bytes + 1408),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[105].base, 11,
g_static_metadata_bytes + 1411),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[106].base, 16,
g_static_metadata_bytes + 1422),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[107].base, 13,
g_static_metadata_bytes + 1438),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[108].base, 12,
g_static_metadata_bytes + 1451),
grpc_core::StaticMetadataSlice(
&g_static_metadata_slice_refcounts[109].base, 21,
g_static_metadata_bytes + 1463),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[0].base, 5,
g_static_metadata_bytes + 0),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[1].base, 7,
g_static_metadata_bytes + 5),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[2].base, 7,
g_static_metadata_bytes + 12),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[3].base, 10,
g_static_metadata_bytes + 19),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[4].base, 7,
g_static_metadata_bytes + 29),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[5].base, 12,
g_static_metadata_bytes + 36),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[6].base, 11,
g_static_metadata_bytes + 48),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[7].base, 16,
g_static_metadata_bytes + 59),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[8].base, 13,
g_static_metadata_bytes + 75),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[9].base, 20,
g_static_metadata_bytes + 88),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[10].base, 21,
g_static_metadata_bytes + 108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[11].base, 13,
g_static_metadata_bytes + 129),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[12].base, 14,
g_static_metadata_bytes + 142),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[13].base, 12,
g_static_metadata_bytes + 156),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[14].base, 16,
g_static_metadata_bytes + 168),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[15].base, 15,
g_static_metadata_bytes + 184),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[16].base, 30,
g_static_metadata_bytes + 199),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[17].base, 37,
g_static_metadata_bytes + 229),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[18].base, 10,
g_static_metadata_bytes + 266),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[19].base, 4,
g_static_metadata_bytes + 276),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[20].base, 26,
g_static_metadata_bytes + 280),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[21].base, 22,
g_static_metadata_bytes + 306),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[22].base, 27,
g_static_metadata_bytes + 328),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[23].base, 12,
g_static_metadata_bytes + 355),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[24].base, 1,
g_static_metadata_bytes + 367),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[25].base, 1,
g_static_metadata_bytes + 368),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[26].base, 1,
g_static_metadata_bytes + 369),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[27].base, 1,
g_static_metadata_bytes + 370),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[28].base, 0,
g_static_metadata_bytes + 371),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[29].base, 19,
g_static_metadata_bytes + 371),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[30].base, 12,
g_static_metadata_bytes + 390),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[31].base, 30,
g_static_metadata_bytes + 402),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[32].base, 31,
g_static_metadata_bytes + 432),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[33].base, 36,
g_static_metadata_bytes + 463),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[34].base, 65,
g_static_metadata_bytes + 499),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[35].base, 65,
g_static_metadata_bytes + 564),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[36].base, 28,
g_static_metadata_bytes + 629),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[37].base, 80,
g_static_metadata_bytes + 657),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[38].base, 80,
g_static_metadata_bytes + 737),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[39].base, 7,
g_static_metadata_bytes + 817),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[40].base, 4,
g_static_metadata_bytes + 824),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[41].base, 11,
g_static_metadata_bytes + 828),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[42].base, 2,
g_static_metadata_bytes + 839),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[43].base, 8,
g_static_metadata_bytes + 841),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[44].base, 3,
g_static_metadata_bytes + 849),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[45].base, 4,
g_static_metadata_bytes + 852),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[46].base, 1,
g_static_metadata_bytes + 856),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[47].base, 11,
g_static_metadata_bytes + 857),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[48].base, 4,
g_static_metadata_bytes + 868),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[49].base, 5,
g_static_metadata_bytes + 872),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[50].base, 3,
g_static_metadata_bytes + 877),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[51].base, 3,
g_static_metadata_bytes + 880),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[52].base, 3,
g_static_metadata_bytes + 883),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[53].base, 3,
g_static_metadata_bytes + 886),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[54].base, 3,
g_static_metadata_bytes + 889),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[55].base, 3,
g_static_metadata_bytes + 892),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[56].base, 3,
g_static_metadata_bytes + 895),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[57].base, 14,
g_static_metadata_bytes + 898),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[58].base, 13,
g_static_metadata_bytes + 912),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[59].base, 15,
g_static_metadata_bytes + 925),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[60].base, 13,
g_static_metadata_bytes + 940),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[61].base, 6,
g_static_metadata_bytes + 953),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[62].base, 27,
g_static_metadata_bytes + 959),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[63].base, 3,
g_static_metadata_bytes + 986),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[64].base, 5,
g_static_metadata_bytes + 989),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[65].base, 13,
g_static_metadata_bytes + 994),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[66].base, 13,
g_static_metadata_bytes + 1007),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[67].base, 19,
g_static_metadata_bytes + 1020),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[68].base, 16,
g_static_metadata_bytes + 1039),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[69].base, 14,
g_static_metadata_bytes + 1055),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[70].base, 16,
g_static_metadata_bytes + 1069),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[71].base, 13,
g_static_metadata_bytes + 1085),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[72].base, 6,
g_static_metadata_bytes + 1098),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[73].base, 4,
g_static_metadata_bytes + 1104),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[74].base, 4,
g_static_metadata_bytes + 1108),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[75].base, 6,
g_static_metadata_bytes + 1112),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[76].base, 7,
g_static_metadata_bytes + 1118),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[77].base, 4,
g_static_metadata_bytes + 1125),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[78].base, 8,
g_static_metadata_bytes + 1129),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[79].base, 17,
g_static_metadata_bytes + 1137),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[80].base, 13,
g_static_metadata_bytes + 1154),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[81].base, 8,
g_static_metadata_bytes + 1167),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[82].base, 19,
g_static_metadata_bytes + 1175),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[83].base, 13,
g_static_metadata_bytes + 1194),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[84].base, 4,
g_static_metadata_bytes + 1207),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[85].base, 8,
g_static_metadata_bytes + 1211),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[86].base, 12,
g_static_metadata_bytes + 1219),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[87].base, 18,
g_static_metadata_bytes + 1231),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[88].base, 19,
g_static_metadata_bytes + 1249),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[89].base, 5,
g_static_metadata_bytes + 1268),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[90].base, 7,
g_static_metadata_bytes + 1273),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[91].base, 7,
g_static_metadata_bytes + 1280),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[92].base, 11,
g_static_metadata_bytes + 1287),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[93].base, 6,
g_static_metadata_bytes + 1298),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[94].base, 10,
g_static_metadata_bytes + 1304),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[95].base, 25,
g_static_metadata_bytes + 1314),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[96].base, 17,
g_static_metadata_bytes + 1339),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[97].base, 4,
g_static_metadata_bytes + 1356),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[98].base, 3,
g_static_metadata_bytes + 1360),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[99].base, 16,
g_static_metadata_bytes + 1363),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[100].base, 1,
g_static_metadata_bytes + 1379),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[101].base, 8,
g_static_metadata_bytes + 1380),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[102].base, 16,
g_static_metadata_bytes + 1388),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[103].base, 4,
g_static_metadata_bytes + 1404),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[104].base, 3,
g_static_metadata_bytes + 1408),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[105].base, 11,
g_static_metadata_bytes + 1411),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[106].base, 16,
g_static_metadata_bytes + 1422),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[107].base, 13,
g_static_metadata_bytes + 1438),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[108].base, 12,
g_static_metadata_bytes + 1451),
StaticMetadataSlice(&g_static_metadata_slice_refcounts[109].base, 21,
g_static_metadata_bytes + 1463),
};
} // namespace grpc_core

@ -42,7 +42,7 @@ void RegisterBuiltins(CoreConfiguration::Builder* builder) {
builder->channel_init()->RegisterStage(
GRPC_SERVER_CHANNEL, INT_MAX, [](grpc_channel_stack_builder* builder) {
return grpc_channel_stack_builder_prepend_filter(
builder, &grpc_core::Server::kServerTopFilter, nullptr, nullptr);
builder, &Server::kServerTopFilter, nullptr, nullptr);
});
}

@ -85,7 +85,7 @@ struct RegisteredCall {
};
struct CallRegistrationTable {
grpc_core::Mutex mu;
Mutex mu;
// The map key should be owned strings rather than unowned char*'s to
// guarantee that it outlives calls on the core channel (which may outlast the
// C++ or other wrapped language Channel that registered these calls).

@ -141,7 +141,7 @@ void ErrorDestroy(void* p) {
delete error;
}
}
int ErrorCompare(void* p, void* q) { return grpc_core::QsortCompare(p, q); }
int ErrorCompare(void* p, void* q) { return QsortCompare(p, q); }
const grpc_arg_pointer_vtable kLameFilterErrorArgVtable = {
ErrorCopy, ErrorDestroy, ErrorCompare};

@ -601,7 +601,7 @@ void Server::Start() {
grpc_error_handle Server::SetupTransport(
grpc_transport* transport, grpc_pollset* accepting_pollset,
const grpc_channel_args* args,
const RefCountedPtr<grpc_core::channelz::SocketNode>& socket_node) {
const RefCountedPtr<channelz::SocketNode>& socket_node) {
// Create channel.
grpc_error_handle error = GRPC_ERROR_NONE;
grpc_channel* channel = grpc_channel_create(

@ -81,7 +81,7 @@ grpc_millis BdpEstimator::CompletePing() {
}
ping_state_ = PingState::UNSCHEDULED;
accumulator_ = 0;
return grpc_core::ExecCtx::Get()->Now() + inter_ping_delay_;
return ExecCtx::Get()->Now() + inter_ping_delay_;
}
} // namespace grpc_core

@ -313,10 +313,10 @@ class AllocatedMetadata : public RefcountedMdBase {
// TODO(arjunroy): Change to use strongly typed slices instead.
struct NoRefKey {};
AllocatedMetadata(const grpc_slice& key, const grpc_slice& value);
AllocatedMetadata(const grpc_core::ManagedMemorySlice& key,
const grpc_core::UnmanagedMemorySlice& value);
AllocatedMetadata(const grpc_core::ExternallyManagedSlice& key,
const grpc_core::UnmanagedMemorySlice& value);
AllocatedMetadata(const ManagedMemorySlice& key,
const UnmanagedMemorySlice& value);
AllocatedMetadata(const ExternallyManagedSlice& key,
const UnmanagedMemorySlice& value);
AllocatedMetadata(const grpc_slice& key, const grpc_slice& value,
const NoRefKey*);
~AllocatedMetadata();

@ -95,7 +95,7 @@ struct GrpcTimeoutMetadata {
if (timeout == GRPC_MILLIS_INF_FUTURE) {
return GRPC_MILLIS_INF_FUTURE;
}
return grpc_core::ExecCtx::Get()->Now() + timeout;
return ExecCtx::Get()->Now() + timeout;
}
static grpc_slice Encode(ValueType x) {
char timeout[GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE];
@ -820,9 +820,8 @@ absl::optional<absl::string_view> MetadataMap<Traits...>::GetValue(
// Find all values for the specified key.
absl::InlinedVector<absl::string_view, 1> values;
for (grpc_linked_mdelem* md = list_.head; md != nullptr; md = md->next) {
absl::string_view key = grpc_core::StringViewFromSlice(GRPC_MDKEY(md->md));
absl::string_view value =
grpc_core::StringViewFromSlice(GRPC_MDVALUE(md->md));
absl::string_view key = StringViewFromSlice(GRPC_MDKEY(md->md));
absl::string_view value = StringViewFromSlice(GRPC_MDVALUE(md->md));
if (target_key == key) values.push_back(value);
}
// If none found, no match.

@ -31,8 +31,8 @@ double PidController::Update(double error, double dt) {
if (dt <= 0) return last_control_value_;
/* integrate error using the trapezoid rule */
error_integral_ += dt * (last_error_ + error) * 0.5;
error_integral_ = grpc_core::Clamp(error_integral_, -args_.integral_range(),
args_.integral_range());
error_integral_ =
Clamp(error_integral_, -args_.integral_range(), args_.integral_range());
double diff_error = (error - last_error_) / dt;
/* calculate derivative of control value vs time */
double dc_dt = args_.gain_p() * error + args_.gain_i() * error_integral_ +
@ -40,8 +40,8 @@ double PidController::Update(double error, double dt) {
/* and perform trapezoidal integration */
double new_control_value =
last_control_value_ + dt * (last_dc_dt_ + dc_dt) * 0.5;
new_control_value = grpc_core::Clamp(
new_control_value, args_.min_control_value(), args_.max_control_value());
new_control_value = Clamp(new_control_value, args_.min_control_value(),
args_.max_control_value());
last_error_ = error;
last_dc_dt_ = dc_dt;
last_control_value_ = new_control_value;

File diff suppressed because it is too large Load Diff

@ -849,7 +849,7 @@ void alts_handshaker_client_on_status_received_for_testing(
reinterpret_cast<alts_grpc_handshaker_client*>(c);
client->handshake_status_code = status;
client->handshake_status_details = grpc_empty_slice();
grpc_core::Closure::Run(DEBUG_LOCATION, &client->on_status_received, error);
Closure::Run(DEBUG_LOCATION, &client->on_status_received, error);
}
} // namespace internal

@ -123,7 +123,7 @@ const int kEventListMemoryLimit = 1024 * 1024;
// Tests basic ChannelTrace functionality like construction, adding trace, and
// lookups by uuid.
TEST(ChannelTracerTest, BasicTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
@ -146,7 +146,7 @@ TEST(ChannelTracerTest, BasicTest) {
// subchannles. This exercises the ref/unref patterns since the parent tracer
// and this function will both hold refs to the subchannel.
TEST(ChannelTracerTest, ComplexTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
@ -193,7 +193,7 @@ TEST(ChannelTracerTest, ComplexTest) {
// have connections. Ensures that everything lives as long as it should then
// gets deleted.
TEST(ChannelTracerTest, TestNesting) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelTrace tracer(kEventListMemoryLimit);
AddSimpleTrace(&tracer);
AddSimpleTrace(&tracer);
@ -240,7 +240,7 @@ TEST(ChannelTracerTest, TestNesting) {
}
TEST(ChannelTracerTest, TestSmallMemoryLimit) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// doesn't make sense, but serves a testing purpose for the channel tracing
// bookkeeping. All tracing events added should will get immediately garbage
// collected.
@ -264,7 +264,7 @@ TEST(ChannelTracerTest, TestSmallMemoryLimit) {
}
TEST(ChannelTracerTest, TestEviction) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
const int kTraceEventSize = GetSizeofTraceEvent();
const int kNumEvents = 5;
ChannelTrace tracer(kTraceEventSize * kNumEvents);
@ -281,7 +281,7 @@ TEST(ChannelTracerTest, TestEviction) {
}
TEST(ChannelTracerTest, TestMultipleEviction) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
const int kTraceEventSize = GetSizeofTraceEvent();
const int kNumEvents = 5;
ChannelTrace tracer(kTraceEventSize * kNumEvents);
@ -300,7 +300,7 @@ TEST(ChannelTracerTest, TestMultipleEviction) {
}
TEST(ChannelTracerTest, TestTotalEviction) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
const int kTraceEventSize = GetSizeofTraceEvent();
const int kNumEvents = 5;
ChannelTrace tracer(kTraceEventSize * kNumEvents);

@ -248,7 +248,7 @@ gpr_timespec GetLastCallStartedTime(CallCountingHelper* channel) {
void ChannelzSleep(int64_t sleep_us) {
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(sleep_us, GPR_TIMESPAN)));
grpc_core::ExecCtx::Get()->InvalidateNow();
ExecCtx::Get()->InvalidateNow();
}
} // anonymous namespace
@ -256,7 +256,7 @@ void ChannelzSleep(int64_t sleep_us) {
class ChannelzChannelTest : public ::testing::TestWithParam<size_t> {};
TEST_P(ChannelzChannelTest, BasicChannel) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channel(GetParam());
ChannelNode* channelz_channel =
grpc_channel_get_channelz_node(channel.channel());
@ -264,7 +264,7 @@ TEST_P(ChannelzChannelTest, BasicChannel) {
}
TEST(ChannelzChannelTest, ChannelzDisabled) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// explicitly disable channelz
grpc_arg arg[] = {
grpc_channel_arg_integer_create(
@ -281,7 +281,7 @@ TEST(ChannelzChannelTest, ChannelzDisabled) {
}
TEST_P(ChannelzChannelTest, BasicChannelAPIFunctionality) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channel(GetParam());
ChannelNode* channelz_channel =
grpc_channel_get_channelz_node(channel.channel());
@ -299,7 +299,7 @@ TEST_P(ChannelzChannelTest, BasicChannelAPIFunctionality) {
}
TEST_P(ChannelzChannelTest, LastCallStartedTime) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
CallCountingHelper counter;
// start a call to set the last call started timestamp
counter.RecordCallStarted();
@ -337,25 +337,25 @@ class ChannelzRegistryBasedTest : public ::testing::TestWithParam<size_t> {
};
TEST_F(ChannelzRegistryBasedTest, BasicGetTopChannelsTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channel;
ValidateGetTopChannels(1);
}
TEST_F(ChannelzRegistryBasedTest, NoChannelsTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ValidateGetTopChannels(0);
}
TEST_F(ChannelzRegistryBasedTest, ManyChannelsTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channels[10];
(void)channels; // suppress unused variable error
ValidateGetTopChannels(10);
}
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsPagination) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// This is over the pagination limit.
ChannelFixture channels[150];
(void)channels; // suppress unused variable error
@ -383,7 +383,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsPagination) {
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidCheck) {
const intptr_t kNumChannels = 50;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channels[kNumChannels];
(void)channels; // suppress unused variable error
std::string json_str = ChannelzRegistry::GetTopChannels(0);
@ -402,7 +402,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidCheck) {
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMiddleUuidCheck) {
const intptr_t kNumChannels = 50;
const intptr_t kMidQuery = 40;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channels[kNumChannels];
(void)channels; // suppress unused variable error
// Only query for the end of the channels.
@ -420,7 +420,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMiddleUuidCheck) {
}
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsNoHitUuid) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture pre_channels[40]; // will take uuid[1, 40]
(void)pre_channels; // suppress unused variable error
ServerFixture servers[10]; // will take uuid[41, 50]
@ -442,7 +442,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsNoHitUuid) {
}
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMoreGaps) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channel_with_uuid1;
{ ServerFixture channel_with_uuid2; }
ChannelFixture channel_with_uuid3;
@ -472,7 +472,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMoreGaps) {
TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidAfterCompaction) {
const intptr_t kLoopIterations = 50;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
std::vector<std::unique_ptr<ChannelFixture>> even_channels;
{
// these will delete and unregister themselves after this block.
@ -497,7 +497,7 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsUuidAfterCompaction) {
}
TEST_F(ChannelzRegistryBasedTest, InternalChannelTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ChannelFixture channels[10];
(void)channels; // suppress unused variable error
// create an internal channel
@ -516,7 +516,7 @@ TEST_F(ChannelzRegistryBasedTest, InternalChannelTest) {
}
TEST(ChannelzServerTest, BasicServerAPIFunctionality) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ServerFixture server(10);
ServerNode* channelz_server = server.server()->core_server->channelz_node();
channelz_server->RecordCallStarted();
@ -533,18 +533,18 @@ TEST(ChannelzServerTest, BasicServerAPIFunctionality) {
}
TEST_F(ChannelzRegistryBasedTest, BasicGetServersTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ServerFixture server;
ValidateGetServers(1);
}
TEST_F(ChannelzRegistryBasedTest, NoServersTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ValidateGetServers(0);
}
TEST_F(ChannelzRegistryBasedTest, ManyServersTest) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
ServerFixture servers[10];
(void)servers; // suppress unused variable error
ValidateGetServers(10);

@ -491,7 +491,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigPickFirst) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
auto lb_config = parsed_config->parsed_lb_config();
EXPECT_STREQ(lb_config->name(), "pick_first");
@ -503,9 +503,8 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigRoundRobin) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
auto parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
auto parsed_config = static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
auto lb_config = parsed_config->parsed_lb_config();
EXPECT_STREQ(lb_config->name(), "round_robin");
}
@ -518,7 +517,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigGrpclb) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
auto lb_config = parsed_config->parsed_lb_config();
EXPECT_STREQ(lb_config->name(), "grpclb");
@ -541,7 +540,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingConfigXds) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
auto lb_config = parsed_config->parsed_lb_config();
EXPECT_STREQ(lb_config->name(), "xds_cluster_resolver_experimental");
@ -586,7 +585,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingPolicy) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
EXPECT_EQ(parsed_config->parsed_deprecated_lb_policy(), "pick_first");
}
@ -597,7 +596,7 @@ TEST_F(ClientChannelParserTest, ValidLoadBalancingPolicyAllCaps) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
EXPECT_EQ(parsed_config->parsed_deprecated_lb_policy(), "pick_first");
}
@ -648,10 +647,10 @@ TEST_F(ClientChannelParserTest, ValidTimeout) {
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
auto parsed_config = ((*vector_ptr)[0]).get();
EXPECT_EQ((static_cast<grpc_core::internal::ClientChannelMethodParsedConfig*>(
parsed_config))
->timeout(),
5000);
EXPECT_EQ(
(static_cast<internal::ClientChannelMethodParsedConfig*>(parsed_config))
->timeout(),
5000);
}
TEST_F(ClientChannelParserTest, InvalidTimeout) {
@ -694,13 +693,11 @@ TEST_F(ClientChannelParserTest, ValidWaitForReady) {
ASSERT_NE(vector_ptr, nullptr);
auto parsed_config = ((*vector_ptr)[0]).get();
ASSERT_TRUE(
(static_cast<grpc_core::internal::ClientChannelMethodParsedConfig*>(
parsed_config))
(static_cast<internal::ClientChannelMethodParsedConfig*>(parsed_config))
->wait_for_ready()
.has_value());
EXPECT_TRUE(
(static_cast<grpc_core::internal::ClientChannelMethodParsedConfig*>(
parsed_config))
(static_cast<internal::ClientChannelMethodParsedConfig*>(parsed_config))
->wait_for_ready()
.value());
}
@ -737,7 +734,7 @@ TEST_F(ClientChannelParserTest, ValidHealthCheck) {
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::ClientChannelGlobalParsedConfig*>(
static_cast<internal::ClientChannelGlobalParsedConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->health_check_service_name(),
@ -789,9 +786,8 @@ TEST_F(RetryParserTest, ValidRetryThrottling) {
grpc_error_handle error = GRPC_ERROR_NONE;
auto svc_cfg = ServiceConfig::Create(nullptr, test_json, &error);
ASSERT_EQ(error, GRPC_ERROR_NONE) << grpc_error_std_string(error);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryGlobalConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
const auto* parsed_config = static_cast<internal::RetryGlobalConfig*>(
svc_cfg->GetGlobalParsedConfig(0));
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->max_milli_tokens(), 2000);
EXPECT_EQ(parsed_config->milli_token_ratio(), 1000);
@ -878,8 +874,7 @@ TEST_F(RetryParserTest, ValidRetryPolicy) {
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryMethodConfig*>(
((*vector_ptr)[0]).get());
static_cast<internal::RetryMethodConfig*>(((*vector_ptr)[0]).get());
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->max_attempts(), 3);
EXPECT_EQ(parsed_config->initial_backoff(), 1000);
@ -1264,8 +1259,7 @@ TEST_F(RetryParserTest, ValidRetryPolicyWithPerAttemptRecvTimeout) {
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryMethodConfig*>(
((*vector_ptr)[0]).get());
static_cast<internal::RetryMethodConfig*>(((*vector_ptr)[0]).get());
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->max_attempts(), 2);
EXPECT_EQ(parsed_config->initial_backoff(), 1000);
@ -1301,8 +1295,7 @@ TEST_F(RetryParserTest,
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryMethodConfig*>(
((*vector_ptr)[0]).get());
static_cast<internal::RetryMethodConfig*>(((*vector_ptr)[0]).get());
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->max_attempts(), 2);
EXPECT_EQ(parsed_config->initial_backoff(), 1000);
@ -1340,8 +1333,7 @@ TEST_F(RetryParserTest,
grpc_slice_from_static_string("/TestServ/TestMethod"));
ASSERT_NE(vector_ptr, nullptr);
const auto* parsed_config =
static_cast<grpc_core::internal::RetryMethodConfig*>(
((*vector_ptr)[0]).get());
static_cast<internal::RetryMethodConfig*>(((*vector_ptr)[0]).get());
ASSERT_NE(parsed_config, nullptr);
EXPECT_EQ(parsed_config->max_attempts(), 2);
EXPECT_EQ(parsed_config->initial_backoff(), 1000);

@ -25,16 +25,16 @@
namespace grpc_core {
TEST(UsefulTest, ClampWorks) {
EXPECT_EQ(grpc_core::Clamp(1, 0, 2), 1);
EXPECT_EQ(grpc_core::Clamp(0, 0, 2), 0);
EXPECT_EQ(grpc_core::Clamp(2, 0, 2), 2);
EXPECT_EQ(grpc_core::Clamp(-1, 0, 2), 0);
EXPECT_EQ(grpc_core::Clamp(3, 0, 2), 2);
EXPECT_EQ(Clamp(1, 0, 2), 1);
EXPECT_EQ(Clamp(0, 0, 2), 0);
EXPECT_EQ(Clamp(2, 0, 2), 2);
EXPECT_EQ(Clamp(-1, 0, 2), 0);
EXPECT_EQ(Clamp(3, 0, 2), 2);
}
TEST(UsefulTest, Rotate) {
EXPECT_EQ(grpc_core::RotateLeft(0x80000001u, 1u), 3);
EXPECT_EQ(grpc_core::RotateRight(0x80000001u, 1u), 0xc0000000);
EXPECT_EQ(RotateLeft(0x80000001u, 1u), 3);
EXPECT_EQ(RotateRight(0x80000001u, 1u), 0xc0000000);
}
TEST(UsefulTest, ArraySize) {
@ -48,18 +48,18 @@ TEST(UsefulTest, ArraySize) {
TEST(UsefulTest, BitOps) {
uint32_t bitset = 0;
EXPECT_EQ(grpc_core::BitCount((1u << 31) - 1), 31);
EXPECT_EQ(grpc_core::BitCount(1u << 3), 1);
EXPECT_EQ(grpc_core::BitCount(0), 0);
EXPECT_EQ(grpc_core::SetBit(&bitset, 3), 8);
EXPECT_EQ(grpc_core::BitCount(bitset), 1);
EXPECT_EQ(grpc_core::GetBit(bitset, 3), 1);
EXPECT_EQ(grpc_core::SetBit(&bitset, 1), 10);
EXPECT_EQ(grpc_core::BitCount(bitset), 2);
EXPECT_EQ(grpc_core::ClearBit(&bitset, 3), 2);
EXPECT_EQ(grpc_core::BitCount(bitset), 1);
EXPECT_EQ(grpc_core::GetBit(bitset, 3), 0);
EXPECT_EQ(grpc_core::BitCount(std::numeric_limits<uint64_t>::max()), 64);
EXPECT_EQ(BitCount((1u << 31) - 1), 31);
EXPECT_EQ(BitCount(1u << 3), 1);
EXPECT_EQ(BitCount(0), 0);
EXPECT_EQ(SetBit(&bitset, 3), 8);
EXPECT_EQ(BitCount(bitset), 1);
EXPECT_EQ(GetBit(bitset, 3), 1);
EXPECT_EQ(SetBit(&bitset, 1), 10);
EXPECT_EQ(BitCount(bitset), 2);
EXPECT_EQ(ClearBit(&bitset, 3), 2);
EXPECT_EQ(BitCount(bitset), 1);
EXPECT_EQ(GetBit(bitset, 3), 0);
EXPECT_EQ(BitCount(std::numeric_limits<uint64_t>::max()), 64);
}
} // namespace grpc_core

@ -46,8 +46,7 @@ TEST(STAT, GetTimestampOnTmpFile) {
fclose(tmp);
// Check the last modified date is correctly set.
time_t timestamp = 0;
absl::Status status =
grpc_core::GetFileModificationTime(tmp_name, &timestamp);
absl::Status status = GetFileModificationTime(tmp_name, &timestamp);
EXPECT_EQ(status.code(), absl::StatusCode::kOk);
EXPECT_GT(timestamp, 0);
// Clean up.
@ -57,8 +56,7 @@ TEST(STAT, GetTimestampOnTmpFile) {
TEST(STAT, GetTimestampOnFailure) {
time_t timestamp = 0;
absl::Status status =
grpc_core::GetFileModificationTime("/DOES_NOT_EXIST", &timestamp);
absl::Status status = GetFileModificationTime("/DOES_NOT_EXIST", &timestamp);
EXPECT_EQ(status.code(), absl::StatusCode::kInternal);
// Check the last modified date is not set.
EXPECT_EQ(timestamp, 0);

@ -55,8 +55,7 @@ TEST(AdaptorTest, FactoryFromBindFrontPromise) {
}
TEST(AdaptorTest, FactoryFromCapturePromise) {
EXPECT_EQ(MakeFactory<void>(
grpc_core::Capture([](int* i) { return Poll<int>(*i); }, 42))
EXPECT_EQ(MakeFactory<void>(Capture([](int* i) { return Poll<int>(*i); }, 42))
.Once()(),
Poll<int>(42));
}

@ -43,7 +43,7 @@ ReclamationPass MapReclamationPass(memory_quota_fuzzer::Reclaimer::Pass pass) {
class Fuzzer {
public:
void Run(const memory_quota_fuzzer::Msg& msg) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
RunMsg(msg);
do {
memory_quotas_.clear();

File diff suppressed because it is too large Load Diff

@ -61,7 +61,7 @@ namespace {
void AddSamples(BdpEstimator* estimator, int64_t* samples, size_t n) {
estimator->AddIncomingBytes(1234567);
inc_time();
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
estimator->SchedulePing();
estimator->StartPing();
for (size_t i = 0; i < n; i++) {
@ -69,7 +69,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)));
grpc_core::ExecCtx::Get()->InvalidateNow();
ExecCtx::Get()->InvalidateNow();
estimator->CompletePing();
}

@ -41,7 +41,7 @@ void NotCalledClosure(void* /*arg*/, grpc_error_handle /*error*/) {
}
TEST(SliceBufferByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@ -73,7 +73,7 @@ TEST(SliceBufferByteStream, Basic) {
}
TEST(SliceBufferByteStream, Shutdown) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// Create and populate slice buffer.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@ -117,7 +117,7 @@ TEST(SliceBufferByteStream, Shutdown) {
//
TEST(CachingByteStream, Basic) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@ -152,7 +152,7 @@ TEST(CachingByteStream, Basic) {
}
TEST(CachingByteStream, Reset) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);
@ -194,7 +194,7 @@ TEST(CachingByteStream, Reset) {
}
TEST(CachingByteStream, SharedCache) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
// Create and populate slice buffer byte stream.
grpc_slice_buffer buffer;
grpc_slice_buffer_init(&buffer);

@ -40,7 +40,7 @@ const uint32_t kByteOffset = 123;
void* PhonyArgsCopier(void* arg) { return arg; }
void TestExecuteFlushesListVerifier(void* arg, grpc_core::Timestamps* ts,
void TestExecuteFlushesListVerifier(void* arg, Timestamps* ts,
grpc_error_handle error) {
ASSERT_NE(arg, nullptr);
EXPECT_EQ(error, GRPC_ERROR_NONE);
@ -66,14 +66,13 @@ class ContextListTest : public ::testing::Test {
* Also tests that arg and byte_counter are passed correctly.
*/
TEST_F(ContextListTest, ExecuteFlushesList) {
grpc_core::ContextList* list = nullptr;
ContextList* list = nullptr;
const int kNumElems = 5;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
grpc_stream_refcount ref;
GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref");
grpc_endpoint* mock_endpoint = grpc_mock_endpoint_create(discard_write);
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
grpc_transport* t = grpc_create_chttp2_transport(args, mock_endpoint, true);
grpc_channel_args_destroy(args);
std::vector<grpc_chttp2_stream*> s;
@ -88,10 +87,10 @@ TEST_F(ContextListTest, ExecuteFlushesList) {
s[i]->context = &verifier_called[i];
s[i]->byte_counter = kByteOffset;
gpr_atm_rel_store(&verifier_called[i], static_cast<gpr_atm>(0));
grpc_core::ContextList::Append(&list, s[i]);
ContextList::Append(&list, s[i]);
}
grpc_core::Timestamps ts;
grpc_core::ContextList::Execute(list, &ts, GRPC_ERROR_NONE);
Timestamps ts;
ContextList::Execute(list, &ts, GRPC_ERROR_NONE);
for (auto i = 0; i < kNumElems; i++) {
EXPECT_EQ(gpr_atm_acq_load(&verifier_called[i]), static_cast<gpr_atm>(1));
grpc_transport_destroy_stream(reinterpret_cast<grpc_transport*>(t),
@ -105,29 +104,28 @@ TEST_F(ContextListTest, ExecuteFlushesList) {
}
TEST_F(ContextListTest, EmptyList) {
grpc_core::ContextList* list = nullptr;
grpc_core::ExecCtx exec_ctx;
grpc_core::Timestamps ts;
grpc_core::ContextList::Execute(list, &ts, GRPC_ERROR_NONE);
ContextList* list = nullptr;
ExecCtx exec_ctx;
Timestamps ts;
ContextList::Execute(list, &ts, GRPC_ERROR_NONE);
exec_ctx.Flush();
}
TEST_F(ContextListTest, EmptyListEmptyTimestamp) {
grpc_core::ContextList* list = nullptr;
grpc_core::ExecCtx exec_ctx;
grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE);
ContextList* list = nullptr;
ExecCtx exec_ctx;
ContextList::Execute(list, nullptr, GRPC_ERROR_NONE);
exec_ctx.Flush();
}
TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) {
grpc_core::ContextList* list = nullptr;
ContextList* list = nullptr;
const int kNumElems = 5;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
grpc_stream_refcount ref;
GRPC_STREAM_REF_INIT(&ref, 1, nullptr, nullptr, "phony ref");
grpc_endpoint* mock_endpoint = grpc_mock_endpoint_create(discard_write);
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
grpc_transport* t = grpc_create_chttp2_transport(args, mock_endpoint, true);
grpc_channel_args_destroy(args);
std::vector<grpc_chttp2_stream*> s;
@ -142,9 +140,9 @@ TEST_F(ContextListTest, NonEmptyListEmptyTimestamp) {
s[i]->context = &verifier_called[i];
s[i]->byte_counter = kByteOffset;
gpr_atm_rel_store(&verifier_called[i], static_cast<gpr_atm>(0));
grpc_core::ContextList::Append(&list, s[i]);
ContextList::Append(&list, s[i]);
}
grpc_core::ContextList::Execute(list, nullptr, GRPC_ERROR_NONE);
ContextList::Execute(list, nullptr, GRPC_ERROR_NONE);
for (auto i = 0; i < kNumElems; i++) {
EXPECT_EQ(gpr_atm_acq_load(&verifier_called[i]), static_cast<gpr_atm>(1));
grpc_transport_destroy_stream(reinterpret_cast<grpc_transport*>(t),

@ -47,7 +47,7 @@ void AssertIndex(const HPackTable* tbl, uint32_t idx, const char* key,
} // namespace
TEST(HpackParserTableTest, StaticTable) {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
HPackTable tbl;
AssertIndex(&tbl, 1, ":authority", "");
@ -117,7 +117,7 @@ TEST(HpackParserTableTest, ManyAdditions) {
HPackTable tbl;
int i;
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
for (i = 0; i < 100000; i++) {
grpc_mdelem elem;
@ -126,13 +126,13 @@ TEST(HpackParserTableTest, ManyAdditions) {
elem = grpc_mdelem_from_slices(grpc_slice_from_cpp_string(key),
grpc_slice_from_cpp_string(value));
ASSERT_EQ(tbl.Add(HPackTable::Memento(elem)), GRPC_ERROR_NONE);
AssertIndex(&tbl, 1 + grpc_core::hpack_constants::kLastStaticEntry,
key.c_str(), value.c_str());
AssertIndex(&tbl, 1 + hpack_constants::kLastStaticEntry, key.c_str(),
value.c_str());
if (i) {
std::string key = absl::StrCat("K.", i - 1);
std::string value = absl::StrCat("VALUE.", i - 1);
AssertIndex(&tbl, 2 + grpc_core::hpack_constants::kLastStaticEntry,
key.c_str(), value.c_str());
AssertIndex(&tbl, 2 + hpack_constants::kLastStaticEntry, key.c_str(),
value.c_str());
}
}
}

@ -29,7 +29,7 @@ static void VerifyAsciiHeaderSize(const char* key, const char* value,
grpc_mdelem elem = grpc_mdelem_from_slices(
maybe_intern(grpc_slice_from_static_string(key), intern_key),
maybe_intern(grpc_slice_from_static_string(value), intern_value));
size_t elem_size = grpc_core::MetadataSizeInHPackTable(elem, false);
size_t elem_size = MetadataSizeInHPackTable(elem, false);
size_t expected_size = 32 + strlen(key) + strlen(value);
GPR_ASSERT(expected_size == elem_size);
GRPC_MDELEM_UNREF(elem);
@ -43,7 +43,7 @@ static void VerifyBinaryHeaderSize(const char* key, const uint8_t* value,
maybe_intern(grpc_slice_from_static_buffer(value, value_len),
intern_value));
GPR_ASSERT(grpc_is_binary_header(GRPC_MDKEY(elem)));
size_t elem_size = grpc_core::MetadataSizeInHPackTable(elem, false);
size_t elem_size = MetadataSizeInHPackTable(elem, false);
grpc_slice value_slice = grpc_slice_from_copied_buffer(
reinterpret_cast<const char*>(value), value_len);
grpc_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
@ -69,7 +69,7 @@ TEST_P(MetadataTest, MetadataSize) {
gpr_log(GPR_INFO, "test_mdelem_size: intern_key=%d intern_value=%d",
intern_key, intern_value);
grpc_init();
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
uint8_t binary_value[BUFFER_SIZE] = {0};
for (uint8_t i = 0; i < BUFFER_SIZE; i++) {

@ -108,7 +108,7 @@ class Client {
: server_address_(server_address) {}
void Connect() {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
grpc_resolved_addresses* server_addresses = nullptr;
grpc_error_handle error =
grpc_blocking_resolve_address(server_address_, "80", &server_addresses);
@ -119,11 +119,10 @@ class Client {
grpc_pollset_set* pollset_set = grpc_pollset_set_create();
grpc_pollset_set_add_pollset(pollset_set, pollset_);
EventState state;
grpc_channel_args* args =
grpc_core::EnsureResourceQuotaInChannelArgs(nullptr);
grpc_channel_args* args = EnsureResourceQuotaInChannelArgs(nullptr);
grpc_tcp_client_connect(state.closure(), &endpoint_, pollset_set, args,
server_addresses->addrs,
grpc_core::ExecCtx::Get()->Now() + 1000);
ExecCtx::Get()->Now() + 1000);
grpc_channel_args_destroy(args);
ASSERT_TRUE(PollUntilDone(
&state,
@ -137,13 +136,13 @@ class Client {
// Reads until an error is returned.
// Returns true if an error was encountered before the deadline.
bool ReadUntilError() {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
grpc_slice_buffer read_buffer;
grpc_slice_buffer_init(&read_buffer);
bool retval = true;
// Use a deadline of 3 seconds, which is a lot more than we should
// need for a 1-second timeout, but this helps avoid flakes.
grpc_millis deadline = grpc_core::ExecCtx::Get()->Now() + 3000;
grpc_millis deadline = ExecCtx::Get()->Now() + 3000;
while (true) {
EventState state;
grpc_endpoint_read(endpoint_, &read_buffer, state.closure(),
@ -163,7 +162,7 @@ class Client {
}
void Shutdown() {
grpc_core::ExecCtx exec_ctx;
ExecCtx exec_ctx;
grpc_endpoint_destroy(endpoint_);
grpc_pollset_shutdown(pollset_,
GRPC_CLOSURE_CREATE(&Client::PollsetDestroy, pollset_,
@ -209,13 +208,12 @@ class Client {
gpr_mu_lock(mu_);
GRPC_LOG_IF_ERROR(
"grpc_pollset_work",
grpc_pollset_work(pollset_, &worker,
grpc_core::ExecCtx::Get()->Now() + 100));
grpc_pollset_work(pollset_, &worker, ExecCtx::Get()->Now() + 100));
// Flushes any work scheduled before or during polling.
grpc_core::ExecCtx::Get()->Flush();
ExecCtx::Get()->Flush();
gpr_mu_unlock(mu_);
if (state != nullptr && state->done()) return true;
if (grpc_core::ExecCtx::Get()->Now() >= deadline) return false;
if (ExecCtx::Get()->Now() >= deadline) return false;
}
}

@ -103,7 +103,7 @@ std::string GetCurrentStackTrace() {
void InitializeStackTracer(const char* argv0) {
absl::InitializeSymbolizer(argv0);
grpc_core::SetCurrentStackTraceProvider(&GetCurrentStackTrace);
SetCurrentStackTraceProvider(&GetCurrentStackTrace);
}
} // namespace testing

@ -128,9 +128,8 @@ void AsyncExternalVerifier::Destruct(void* user_data) {
auto* self = static_cast<AsyncExternalVerifier*>(user_data);
// Spawn a detached thread to destroy the verifier, to make sure that we don't
// try to join the worker thread from within the worker thread.
grpc_core::Thread destroy_thread(
"DestroyExternalVerifier", DestroyExternalVerifier, self, nullptr,
grpc_core::Thread::Options().set_joinable(false));
Thread destroy_thread("DestroyExternalVerifier", DestroyExternalVerifier,
self, nullptr, Thread::Options().set_joinable(false));
destroy_thread.Start();
}

@ -125,7 +125,7 @@ class AsyncExternalVerifier {
static void WorkerThread(void* arg);
bool success_ = false;
grpc_core::Thread thread_;
Thread thread_;
grpc_tls_certificate_verifier_external base_;
Mutex mu_;
std::deque<Request> queue_ ABSL_GUARDED_BY(mu_);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save