grpc 1.49.1 → 1.50.0.pre1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (270) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +54 -153
  3. data/include/grpc/event_engine/endpoint_config.h +11 -5
  4. data/include/grpc/event_engine/event_engine.h +1 -1
  5. data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
  6. data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
  7. data/include/grpc/impl/codegen/atm_windows.h +0 -2
  8. data/include/grpc/impl/codegen/grpc_types.h +6 -0
  9. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
  10. data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
  11. data/src/core/ext/filters/client_channel/client_channel.cc +33 -22
  12. data/src/core/ext/filters/client_channel/client_channel.h +1 -1
  13. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
  14. data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
  15. data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
  16. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
  17. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +112 -96
  20. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
  21. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
  22. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
  23. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
  24. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
  25. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
  26. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
  27. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
  28. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
  29. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
  30. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +84 -96
  31. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
  32. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
  33. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
  34. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
  35. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
  36. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
  37. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +13 -15
  38. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
  39. data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
  40. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
  41. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
  42. data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
  43. data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
  44. data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
  45. data/src/core/ext/filters/client_channel/subchannel.h +12 -3
  46. data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
  47. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
  48. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
  49. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
  50. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
  51. data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
  52. data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
  53. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
  54. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
  55. data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
  56. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
  57. data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
  58. data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
  59. data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
  60. data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
  61. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
  62. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
  63. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
  64. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
  65. data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
  66. data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
  67. data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
  68. data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
  69. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
  70. data/src/core/ext/xds/certificate_provider_store.cc +63 -3
  71. data/src/core/ext/xds/certificate_provider_store.h +9 -1
  72. data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
  73. data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
  74. data/src/core/ext/xds/xds_api.cc +21 -17
  75. data/src/core/ext/xds/xds_api.h +7 -0
  76. data/src/core/ext/xds/xds_bootstrap.cc +5 -537
  77. data/src/core/ext/xds/xds_bootstrap.h +39 -111
  78. data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
  79. data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
  80. data/src/core/ext/xds/xds_client.cc +219 -145
  81. data/src/core/ext/xds/xds_client.h +19 -17
  82. data/src/core/ext/xds/xds_client_grpc.cc +18 -80
  83. data/src/core/ext/xds/xds_client_grpc.h +2 -25
  84. data/src/core/ext/xds/xds_client_stats.cc +4 -4
  85. data/src/core/ext/xds/xds_cluster.cc +87 -79
  86. data/src/core/ext/xds/xds_cluster.h +5 -5
  87. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
  88. data/src/core/ext/xds/xds_common_types.cc +13 -5
  89. data/src/core/ext/xds/xds_endpoint.cc +8 -6
  90. data/src/core/ext/xds/xds_endpoint.h +3 -4
  91. data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
  92. data/src/core/ext/xds/xds_listener.cc +25 -20
  93. data/src/core/ext/xds/xds_listener.h +3 -4
  94. data/src/core/ext/xds/xds_resource_type.h +11 -8
  95. data/src/core/ext/xds/xds_route_config.cc +15 -16
  96. data/src/core/ext/xds/xds_route_config.h +3 -3
  97. data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
  98. data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
  99. data/src/core/lib/backoff/backoff.cc +2 -4
  100. data/src/core/lib/channel/call_finalization.h +1 -3
  101. data/src/core/lib/channel/channel_args.h +114 -14
  102. data/src/core/lib/channel/channel_trace.cc +3 -4
  103. data/src/core/lib/channel/promise_based_filter.cc +18 -19
  104. data/src/core/lib/channel/status_util.cc +27 -0
  105. data/src/core/lib/channel/status_util.h +10 -0
  106. data/src/core/lib/config/core_configuration.cc +5 -1
  107. data/src/core/lib/config/core_configuration.h +33 -0
  108. data/src/core/lib/debug/stats.cc +26 -30
  109. data/src/core/lib/debug/stats.h +2 -12
  110. data/src/core/lib/debug/stats_data.cc +118 -614
  111. data/src/core/lib/debug/stats_data.h +67 -465
  112. data/src/core/lib/debug/trace.cc +0 -2
  113. data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
  114. data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
  115. data/src/core/lib/event_engine/forkable.cc +1 -1
  116. data/src/core/lib/event_engine/poller.h +14 -12
  117. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
  118. data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
  119. data/src/core/lib/event_engine/thread_pool.cc +131 -94
  120. data/src/core/lib/event_engine/thread_pool.h +56 -23
  121. data/src/core/lib/event_engine/time_util.cc +30 -0
  122. data/src/core/lib/event_engine/time_util.h +32 -0
  123. data/src/core/lib/event_engine/utils.cc +0 -5
  124. data/src/core/lib/event_engine/utils.h +0 -4
  125. data/src/core/lib/event_engine/windows/iocp.cc +13 -7
  126. data/src/core/lib/event_engine/windows/iocp.h +2 -1
  127. data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
  128. data/src/core/lib/experiments/config.cc +146 -0
  129. data/src/core/lib/experiments/config.h +43 -0
  130. data/src/core/lib/experiments/experiments.cc +75 -0
  131. data/src/core/lib/experiments/experiments.h +56 -0
  132. data/src/core/lib/gpr/alloc.cc +1 -9
  133. data/src/core/lib/gpr/log_windows.cc +0 -1
  134. data/src/core/lib/gpr/string_util_windows.cc +3 -30
  135. data/src/core/lib/gpr/sync_abseil.cc +0 -14
  136. data/src/core/lib/gpr/sync_posix.cc +0 -14
  137. data/src/core/lib/gpr/time_posix.cc +0 -6
  138. data/src/core/lib/gpr/time_precise.h +1 -1
  139. data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
  140. data/src/core/lib/gpr/useful.h +11 -0
  141. data/src/core/lib/{gpr → gprpp}/env.h +25 -12
  142. data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
  143. data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
  144. data/src/core/lib/gprpp/env_windows.cc +56 -0
  145. data/src/core/lib/gprpp/fork.cc +14 -22
  146. data/src/core/lib/gprpp/fork.h +0 -8
  147. data/src/core/lib/gprpp/global_config_env.cc +7 -6
  148. data/src/core/lib/gprpp/notification.h +67 -0
  149. data/src/core/lib/gprpp/packed_table.h +40 -0
  150. data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
  151. data/src/core/lib/gprpp/sorted_pack.h +98 -0
  152. data/src/core/lib/gprpp/status_helper.h +6 -0
  153. data/src/core/lib/gprpp/table.h +9 -1
  154. data/src/core/lib/gprpp/tchar.cc +49 -0
  155. data/src/core/lib/gprpp/tchar.h +33 -0
  156. data/src/core/lib/gprpp/time.cc +21 -0
  157. data/src/core/lib/gprpp/time.h +55 -0
  158. data/src/core/lib/gprpp/validation_errors.cc +61 -0
  159. data/src/core/lib/gprpp/validation_errors.h +110 -0
  160. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
  161. data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
  162. data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
  163. data/src/core/lib/iomgr/call_combiner.cc +0 -8
  164. data/src/core/lib/iomgr/closure.h +0 -1
  165. data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
  166. data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
  167. data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
  168. data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
  169. data/src/core/lib/iomgr/exec_ctx.cc +0 -10
  170. data/src/core/lib/iomgr/exec_ctx.h +7 -31
  171. data/src/core/lib/iomgr/iocp_windows.cc +1 -2
  172. data/src/core/lib/iomgr/iomgr.cc +6 -8
  173. data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
  174. data/src/core/lib/iomgr/pollset.h +1 -1
  175. data/src/core/lib/iomgr/pollset_set.h +0 -1
  176. data/src/core/lib/iomgr/resolve_address.h +1 -0
  177. data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
  178. data/src/core/lib/iomgr/resolve_address_posix.cc +1 -0
  179. data/src/core/lib/iomgr/resolve_address_windows.cc +1 -0
  180. data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
  181. data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
  182. data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
  183. data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
  184. data/src/core/lib/iomgr/tcp_client.cc +6 -7
  185. data/src/core/lib/iomgr/tcp_client.h +11 -11
  186. data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
  187. data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
  188. data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
  189. data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
  190. data/src/core/lib/iomgr/tcp_posix.cc +131 -114
  191. data/src/core/lib/iomgr/tcp_posix.h +3 -1
  192. data/src/core/lib/iomgr/tcp_server.cc +5 -4
  193. data/src/core/lib/iomgr/tcp_server.h +9 -6
  194. data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
  195. data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
  196. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
  197. data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
  198. data/src/core/lib/iomgr/tcp_windows.cc +0 -1
  199. data/src/core/lib/iomgr/tcp_windows.h +0 -1
  200. data/src/core/lib/iomgr/timer_generic.cc +4 -4
  201. data/src/core/lib/iomgr/timer_manager.cc +1 -2
  202. data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
  203. data/src/core/lib/json/json_object_loader.cc +21 -52
  204. data/src/core/lib/json/json_object_loader.h +56 -76
  205. data/src/core/lib/json/json_util.cc +2 -1
  206. data/src/core/lib/load_balancing/lb_policy.h +5 -5
  207. data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
  208. data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
  209. data/src/core/lib/promise/activity.h +2 -3
  210. data/src/core/lib/promise/context.h +1 -1
  211. data/src/core/lib/promise/sleep.cc +16 -4
  212. data/src/core/lib/promise/sleep.h +8 -2
  213. data/src/core/lib/resolver/resolver.h +13 -3
  214. data/src/core/lib/resource_quota/api.cc +9 -0
  215. data/src/core/lib/resource_quota/api.h +6 -0
  216. data/src/core/lib/resource_quota/arena.cc +1 -3
  217. data/src/core/lib/resource_quota/memory_quota.cc +8 -24
  218. data/src/core/lib/resource_quota/memory_quota.h +6 -19
  219. data/src/core/lib/resource_quota/periodic_update.cc +2 -3
  220. data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
  221. data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
  222. data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
  223. data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
  224. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
  225. data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
  226. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
  227. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
  228. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
  229. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
  230. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
  231. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
  232. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
  233. data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
  234. data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
  235. data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
  236. data/src/core/lib/surface/call.cc +1 -11
  237. data/src/core/lib/surface/channel.cc +3 -2
  238. data/src/core/lib/surface/completion_queue.cc +16 -28
  239. data/src/core/lib/surface/completion_queue.h +1 -1
  240. data/src/core/lib/surface/completion_queue_factory.cc +5 -0
  241. data/src/core/lib/surface/init.cc +16 -11
  242. data/src/core/lib/surface/init_internally.cc +24 -0
  243. data/src/core/lib/surface/init_internally.h +28 -0
  244. data/src/core/lib/surface/server.cc +1 -7
  245. data/src/core/lib/surface/server.h +4 -6
  246. data/src/core/lib/surface/version.cc +2 -2
  247. data/src/core/lib/transport/bdp_estimator.cc +1 -3
  248. data/src/core/lib/transport/metadata_batch.cc +2 -3
  249. data/src/core/lib/transport/metadata_batch.h +9 -7
  250. data/src/core/lib/transport/parsed_metadata.h +4 -2
  251. data/src/core/lib/transport/status_conversion.cc +1 -3
  252. data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
  253. data/src/core/lib/transport/transport.h +0 -1
  254. data/src/core/lib/transport/transport_impl.h +0 -1
  255. data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
  256. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
  257. data/src/ruby/lib/grpc/version.rb +1 -1
  258. data/src/ruby/spec/channel_spec.rb +5 -0
  259. data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
  260. data/src/ruby/spec/user_agent_spec.rb +1 -1
  261. metadata +33 -19
  262. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
  263. data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
  264. data/src/core/ext/xds/certificate_provider_registry.h +0 -59
  265. data/src/core/lib/event_engine/promise.h +0 -78
  266. data/src/core/lib/gpr/env_windows.cc +0 -74
  267. data/src/core/lib/gpr/string_windows.h +0 -32
  268. data/src/core/lib/profiling/basic_timers.cc +0 -295
  269. data/src/core/lib/profiling/stap_timers.cc +0 -50
  270. data/src/core/lib/profiling/timers.h +0 -94
@@ -0,0 +1,60 @@
1
+ //
2
+ //
3
+ // Copyright 2020 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ #include <grpc/support/port_platform.h>
20
+
21
+ #include "src/core/lib/security/certificate_provider/certificate_provider_registry.h"
22
+
23
+ #include <string.h>
24
+
25
+ #include <algorithm>
26
+ #include <utility>
27
+ #include <vector>
28
+
29
+ #include <grpc/support/log.h>
30
+
31
+ namespace grpc_core {
32
+
33
+ void CertificateProviderRegistry::Builder::RegisterCertificateProviderFactory(
34
+ std::unique_ptr<CertificateProviderFactory> factory) {
35
+ gpr_log(GPR_DEBUG, "registering certificate provider factory for \"%s\"",
36
+ factory->name());
37
+ for (size_t i = 0; i < factories_.size(); ++i) {
38
+ GPR_ASSERT(strcmp(factories_[i]->name(), factory->name()) != 0);
39
+ }
40
+ factories_.push_back(std::move(factory));
41
+ }
42
+
43
+ CertificateProviderRegistry CertificateProviderRegistry::Builder::Build() {
44
+ CertificateProviderRegistry r;
45
+ r.factories_ = std::move(factories_);
46
+ return r;
47
+ }
48
+
49
+ CertificateProviderFactory*
50
+ CertificateProviderRegistry::LookupCertificateProviderFactory(
51
+ absl::string_view name) const {
52
+ for (size_t i = 0; i < factories_.size(); ++i) {
53
+ if (name == factories_[i]->name()) {
54
+ return factories_[i].get();
55
+ }
56
+ }
57
+ return nullptr;
58
+ }
59
+
60
+ } // namespace grpc_core
@@ -0,0 +1,70 @@
1
+ //
2
+ //
3
+ // Copyright 2020 gRPC authors.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ //
18
+
19
+ #ifndef GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
20
+ #define GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
21
+
22
+ #include <grpc/support/port_platform.h>
23
+
24
+ #include <memory>
25
+ #include <vector>
26
+
27
+ #include "absl/strings/string_view.h"
28
+
29
+ #include "src/core/lib/security/certificate_provider/certificate_provider_factory.h"
30
+
31
+ namespace grpc_core {
32
+
33
+ // Global registry for all the certificate provider plugins.
34
+ class CertificateProviderRegistry {
35
+ public:
36
+ class Builder {
37
+ public:
38
+ // Register a provider with the registry. Can only be called after calling
39
+ // InitRegistry(). The key of the factory is extracted from factory
40
+ // parameter with method CertificateProviderFactory::name. If the same key
41
+ // is registered twice, an exception is raised.
42
+ void RegisterCertificateProviderFactory(
43
+ std::unique_ptr<CertificateProviderFactory> factory);
44
+
45
+ CertificateProviderRegistry Build();
46
+
47
+ private:
48
+ std::vector<std::unique_ptr<CertificateProviderFactory>> factories_;
49
+ };
50
+
51
+ CertificateProviderRegistry(const CertificateProviderRegistry&) = delete;
52
+ CertificateProviderRegistry& operator=(const CertificateProviderRegistry&) =
53
+ delete;
54
+ CertificateProviderRegistry(CertificateProviderRegistry&&) = default;
55
+ CertificateProviderRegistry& operator=(CertificateProviderRegistry&&) =
56
+ default;
57
+
58
+ // Returns the factory for the plugin keyed by name.
59
+ CertificateProviderFactory* LookupCertificateProviderFactory(
60
+ absl::string_view name) const;
61
+
62
+ private:
63
+ CertificateProviderRegistry() = default;
64
+
65
+ std::vector<std::unique_ptr<CertificateProviderFactory>> factories_;
66
+ };
67
+
68
+ } // namespace grpc_core
69
+
70
+ #endif // GRPC_CORE_LIB_SECURITY_CERTIFICATE_PROVIDER_CERTIFICATE_PROVIDER_REGISTRY_H
@@ -32,6 +32,7 @@
32
32
  #include "src/core/lib/security/credentials/channel_creds_registry.h"
33
33
  #include "src/core/lib/security/credentials/credentials.h"
34
34
  #include "src/core/lib/security/credentials/fake/fake_credentials.h"
35
+ #include "src/core/lib/security/credentials/google_default/google_default_credentials.h" // IWYU pragma: keep
35
36
 
36
37
  namespace grpc_core {
37
38
 
@@ -29,6 +29,7 @@
29
29
  #include "absl/strings/str_format.h"
30
30
  #include "absl/strings/str_replace.h"
31
31
  #include "absl/strings/string_view.h"
32
+ #include "absl/types/optional.h"
32
33
 
33
34
  #include <grpc/grpc.h>
34
35
  #include <grpc/grpc_security.h>
@@ -36,8 +37,7 @@
36
37
  #include <grpc/support/log.h>
37
38
  #include <grpc/support/string_util.h>
38
39
 
39
- #include "src/core/lib/gpr/env.h"
40
- #include "src/core/lib/gprpp/memory.h"
40
+ #include "src/core/lib/gprpp/env.h"
41
41
  #include "src/core/lib/http/httpcli_ssl_credentials.h"
42
42
  #include "src/core/lib/iomgr/closure.h"
43
43
  #include "src/core/lib/json/json.h"
@@ -237,12 +237,12 @@ void AwsExternalAccountCredentials::AddMetadataRequestHeaders(
237
237
  }
238
238
 
239
239
  void AwsExternalAccountCredentials::RetrieveRegion() {
240
- UniquePtr<char> region_from_env(gpr_getenv(kRegionEnvVar));
241
- if (region_from_env == nullptr) {
242
- region_from_env = UniquePtr<char>(gpr_getenv(kDefaultRegionEnvVar));
240
+ auto region_from_env = GetEnv(kRegionEnvVar);
241
+ if (!region_from_env.has_value()) {
242
+ region_from_env = GetEnv(kDefaultRegionEnvVar);
243
243
  }
244
- if (region_from_env != nullptr) {
245
- region_ = std::string(region_from_env.get());
244
+ if (region_from_env.has_value()) {
245
+ region_ = std::move(*region_from_env);
246
246
  if (url_.empty()) {
247
247
  RetrieveSigningKeys();
248
248
  } else {
@@ -350,15 +350,14 @@ void AwsExternalAccountCredentials::OnRetrieveRoleNameInternal(
350
350
  }
351
351
 
352
352
  void AwsExternalAccountCredentials::RetrieveSigningKeys() {
353
- UniquePtr<char> access_key_id_from_env(gpr_getenv(kAccessKeyIdEnvVar));
354
- UniquePtr<char> secret_access_key_from_env(
355
- gpr_getenv(kSecretAccessKeyEnvVar));
356
- UniquePtr<char> token_from_env(gpr_getenv(kSessionTokenEnvVar));
357
- if (access_key_id_from_env != nullptr &&
358
- secret_access_key_from_env != nullptr && token_from_env != nullptr) {
359
- access_key_id_ = std::string(access_key_id_from_env.get());
360
- secret_access_key_ = std::string(secret_access_key_from_env.get());
361
- token_ = std::string(token_from_env.get());
353
+ auto access_key_id_from_env = GetEnv(kAccessKeyIdEnvVar);
354
+ auto secret_access_key_from_env = GetEnv(kSecretAccessKeyEnvVar);
355
+ auto token_from_env = GetEnv(kSessionTokenEnvVar);
356
+ if (access_key_id_from_env.has_value() &&
357
+ secret_access_key_from_env.has_value() && token_from_env.has_value()) {
358
+ access_key_id_ = std::move(*access_key_id_from_env);
359
+ secret_access_key_ = std::move(*secret_access_key_from_env);
360
+ token_ = std::move(*token_from_env);
362
361
  BuildSubjectToken();
363
362
  return;
364
363
  }
@@ -18,6 +18,7 @@
18
18
 
19
19
  #include "src/core/lib/security/credentials/external/external_account_credentials.h"
20
20
 
21
+ #include <stdint.h>
21
22
  #include <string.h>
22
23
 
23
24
  #include <algorithm>
@@ -509,7 +510,7 @@ void ExternalAccountCredentials::OnImpersenateServiceAccountInternal(
509
510
  "Invalid expire time of service account impersonation response."));
510
511
  return;
511
512
  }
512
- int expire_in = (t - absl::Now()) / absl::Seconds(1);
513
+ int64_t expire_in = (t - absl::Now()) / absl::Seconds(1);
513
514
  std::string body = absl::StrFormat(
514
515
  "{\"access_token\":\"%s\",\"expires_in\":%d,\"token_type\":\"Bearer\"}",
515
516
  access_token, expire_in);
@@ -21,23 +21,20 @@
21
21
  #include <string>
22
22
 
23
23
  #include "absl/strings/str_cat.h"
24
+ #include "absl/types/optional.h"
24
25
 
25
- #include <grpc/support/alloc.h>
26
26
  #include <grpc/support/log.h>
27
27
 
28
- #include "src/core/lib/gpr/env.h"
28
+ #include "src/core/lib/gprpp/env.h"
29
29
  #include "src/core/lib/security/credentials/credentials.h"
30
30
  #include "src/core/lib/security/credentials/google_default/google_default_credentials.h"
31
31
 
32
32
  std::string grpc_get_well_known_google_credentials_file_path_impl(void) {
33
- char* base = gpr_getenv(GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR);
34
- if (base == nullptr) {
33
+ auto base = grpc_core::GetEnv(GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR);
34
+ if (!base.has_value()) {
35
35
  gpr_log(GPR_ERROR, "Could not get " GRPC_GOOGLE_CREDENTIALS_PATH_ENV_VAR
36
36
  " environment variable.");
37
37
  return "";
38
38
  }
39
- std::string result =
40
- absl::StrCat(base, "/", GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX);
41
- gpr_free(base);
42
- return result;
39
+ return absl::StrCat(*base, "/", GRPC_GOOGLE_CREDENTIALS_PATH_SUFFIX);
43
40
  }
@@ -44,7 +44,7 @@
44
44
  #include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h"
45
45
  #include "src/core/lib/channel/channel_args.h"
46
46
  #include "src/core/lib/debug/trace.h"
47
- #include "src/core/lib/gpr/env.h"
47
+ #include "src/core/lib/gprpp/env.h"
48
48
  #include "src/core/lib/gprpp/host_port.h"
49
49
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
50
50
  #include "src/core/lib/gprpp/sync.h"
@@ -54,6 +54,7 @@
54
54
  #include "src/core/lib/iomgr/closure.h"
55
55
  #include "src/core/lib/iomgr/error.h"
56
56
  #include "src/core/lib/iomgr/exec_ctx.h"
57
+ #include "src/core/lib/iomgr/iomgr_fwd.h"
57
58
  #include "src/core/lib/iomgr/load_file.h"
58
59
  #include "src/core/lib/iomgr/polling_entity.h"
59
60
  #include "src/core/lib/iomgr/pollset.h"
@@ -217,7 +218,7 @@ static int is_metadata_server_reachable() {
217
218
  GPR_ASSERT(uri.ok()); // params are hardcoded
218
219
  auto http_request = grpc_core::HttpRequest::Get(
219
220
  std::move(*uri), nullptr /* channel args */, &detector.pollent, &request,
220
- grpc_core::ExecCtx::Get()->Now() + max_detection_delay,
221
+ grpc_core::Timestamp::Now() + max_detection_delay,
221
222
  GRPC_CLOSURE_CREATE(on_metadata_server_detection_http_response, &detector,
222
223
  grpc_schedule_on_exec_ctx),
223
224
  &detector.response,
@@ -398,10 +399,9 @@ static grpc_core::RefCountedPtr<grpc_call_credentials> make_default_call_creds(
398
399
  grpc_error_handle err;
399
400
 
400
401
  /* First, try the environment variable. */
401
- char* path_from_env = gpr_getenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR);
402
- if (path_from_env != nullptr) {
403
- err = create_default_creds_from_path(path_from_env, &call_creds);
404
- gpr_free(path_from_env);
402
+ auto path_from_env = grpc_core::GetEnv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR);
403
+ if (path_from_env.has_value()) {
404
+ err = create_default_creds_from_path(*path_from_env, &call_creds);
405
405
  if (GRPC_ERROR_IS_NONE(err)) return call_creds;
406
406
  *error = grpc_error_add_child(*error, err);
407
407
  }
@@ -59,6 +59,7 @@
59
59
  #include "src/core/lib/iomgr/closure.h"
60
60
  #include "src/core/lib/iomgr/error.h"
61
61
  #include "src/core/lib/iomgr/exec_ctx.h"
62
+ #include "src/core/lib/iomgr/iomgr_fwd.h"
62
63
  #include "src/core/lib/iomgr/polling_entity.h"
63
64
  #include "src/core/lib/security/credentials/credentials.h"
64
65
  #include "src/core/lib/slice/b64.h"
@@ -732,7 +733,7 @@ static void on_openid_config_retrieved(void* user_data,
732
733
  }
733
734
  ctx->http_request = grpc_core::HttpRequest::Get(
734
735
  std::move(*uri), nullptr /* channel args */, &ctx->pollent, &req,
735
- grpc_core::ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay,
736
+ grpc_core::Timestamp::Now() + grpc_jwt_verifier_max_delay,
736
737
  GRPC_CLOSURE_CREATE(on_keys_retrieved, ctx, grpc_schedule_on_exec_ctx),
737
738
  &ctx->responses[HTTP_RESPONSE_KEYS],
738
739
  grpc_core::CreateHttpRequestSSLCredentials());
@@ -863,7 +864,7 @@ static void retrieve_key_and_verify(verifier_cb_ctx* ctx) {
863
864
  }
864
865
  ctx->http_request = grpc_core::HttpRequest::Get(
865
866
  std::move(*uri), nullptr /* channel args */, &ctx->pollent, &req,
866
- grpc_core::ExecCtx::Get()->Now() + grpc_jwt_verifier_max_delay, http_cb,
867
+ grpc_core::Timestamp::Now() + grpc_jwt_verifier_max_delay, http_cb,
867
868
  &ctx->responses[rsp_idx], grpc_core::CreateHttpRequestSSLCredentials());
868
869
  ctx->http_request->Start();
869
870
  gpr_free(host);
@@ -26,7 +26,7 @@
26
26
  #include <grpc/impl/codegen/gpr_types.h>
27
27
 
28
28
  #include "src/core/lib/gprpp/time.h"
29
- #include "src/core/lib/iomgr/pollset.h"
29
+ #include "src/core/lib/iomgr/iomgr_fwd.h"
30
30
  #include "src/core/lib/json/json.h"
31
31
 
32
32
  /* --- Constants. --- */
@@ -49,7 +49,6 @@
49
49
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
50
50
  #include "src/core/lib/http/httpcli_ssl_credentials.h"
51
51
  #include "src/core/lib/iomgr/error.h"
52
- #include "src/core/lib/iomgr/exec_ctx.h"
53
52
  #include "src/core/lib/iomgr/load_file.h"
54
53
  #include "src/core/lib/iomgr/pollset_set.h"
55
54
  #include "src/core/lib/json/json.h"
@@ -335,7 +334,7 @@ grpc_oauth2_token_fetcher_credentials::GetRequestMetadata(
335
334
  if (start_fetch) {
336
335
  fetch_oauth2(new grpc_credentials_metadata_request(Ref()), &pollent_,
337
336
  on_oauth2_token_fetcher_http_response,
338
- grpc_core::ExecCtx::Get()->Now() + refresh_threshold);
337
+ grpc_core::Timestamp::Now() + refresh_threshold);
339
338
  }
340
339
  return
341
340
  [pending_request]()
@@ -120,7 +120,7 @@ gpr_timespec TimeoutSecondsToDeadline(int64_t seconds) {
120
120
 
121
121
  FileWatcherCertificateProvider::FileWatcherCertificateProvider(
122
122
  std::string private_key_path, std::string identity_certificate_path,
123
- std::string root_cert_path, unsigned int refresh_interval_sec)
123
+ std::string root_cert_path, int64_t refresh_interval_sec)
124
124
  : private_key_path_(std::move(private_key_path)),
125
125
  identity_certificate_path_(std::move(identity_certificate_path)),
126
126
  root_cert_path_(std::move(root_cert_path)),
@@ -402,7 +402,8 @@ absl::StatusOr<bool> PrivateKeyAndCertificateMatch(
402
402
  if (cert_chain.empty()) {
403
403
  return absl::InvalidArgumentError("Certificate string is empty.");
404
404
  }
405
- BIO* cert_bio = BIO_new_mem_buf(cert_chain.data(), cert_chain.size());
405
+ BIO* cert_bio =
406
+ BIO_new_mem_buf(cert_chain.data(), static_cast<int>(cert_chain.size()));
406
407
  if (cert_bio == nullptr) {
407
408
  return absl::InvalidArgumentError(
408
409
  "Conversion from certificate string to BIO failed.");
@@ -422,7 +423,7 @@ absl::StatusOr<bool> PrivateKeyAndCertificateMatch(
422
423
  "Extraction of public key from x.509 certificate failed.");
423
424
  }
424
425
  BIO* private_key_bio =
425
- BIO_new_mem_buf(private_key.data(), private_key.size());
426
+ BIO_new_mem_buf(private_key.data(), static_cast<int>(private_key.size()));
426
427
  if (private_key_bio == nullptr) {
427
428
  EVP_PKEY_free(public_evp_pkey);
428
429
  return absl::InvalidArgumentError(
@@ -19,6 +19,8 @@
19
19
 
20
20
  #include <grpc/support/port_platform.h>
21
21
 
22
+ #include <stdint.h>
23
+
22
24
  #include <map>
23
25
  #include <string>
24
26
 
@@ -139,7 +141,7 @@ class FileWatcherCertificateProvider final
139
141
  FileWatcherCertificateProvider(std::string private_key_path,
140
142
  std::string identity_certificate_path,
141
143
  std::string root_cert_path,
142
- unsigned int refresh_interval_sec);
144
+ int64_t refresh_interval_sec);
143
145
 
144
146
  ~FileWatcherCertificateProvider() override;
145
147
 
@@ -176,7 +178,7 @@ class FileWatcherCertificateProvider final
176
178
  std::string private_key_path_;
177
179
  std::string identity_certificate_path_;
178
180
  std::string root_cert_path_;
179
- unsigned int refresh_interval_sec_ = 0;
181
+ int64_t refresh_interval_sec_ = 0;
180
182
 
181
183
  RefCountedPtr<grpc_tls_certificate_distributor> distributor_;
182
184
  Thread refresh_thread_;
@@ -20,6 +20,8 @@
20
20
 
21
21
  #include "src/core/lib/security/credentials/tls/tls_utils.h"
22
22
 
23
+ #include <stddef.h>
24
+
23
25
  #include "absl/strings/ascii.h"
24
26
  #include "absl/strings/match.h"
25
27
  #include "absl/strings/str_cat.h"
@@ -83,7 +85,7 @@ bool VerifySubjectAlternativeName(absl::string_view subject_alternative_name,
83
85
  return false;
84
86
  }
85
87
  if (!absl::EndsWith(normalized_matcher, suffix)) return false;
86
- int suffix_start_index = normalized_matcher.length() - suffix.length();
88
+ size_t suffix_start_index = normalized_matcher.length() - suffix.length();
87
89
  // Asterisk matching across domain labels is not permitted.
88
90
  return suffix_start_index <= 0 /* should not happen */ ||
89
91
  normalized_matcher.find_last_of('.', suffix_start_index - 1) ==
@@ -37,11 +37,14 @@
37
37
  #include "src/core/lib/channel/channel_stack.h"
38
38
  #include "src/core/lib/channel/context.h"
39
39
  #include "src/core/lib/channel/promise_based_filter.h"
40
+ #include "src/core/lib/channel/status_util.h"
40
41
  #include "src/core/lib/gprpp/debug_location.h"
41
42
  #include "src/core/lib/gprpp/ref_counted_ptr.h"
42
43
  #include "src/core/lib/promise/arena_promise.h"
43
44
  #include "src/core/lib/promise/context.h"
45
+ #include "src/core/lib/promise/detail/basic_seq.h"
44
46
  #include "src/core/lib/promise/promise.h"
47
+ #include "src/core/lib/promise/seq.h"
45
48
  #include "src/core/lib/promise/try_seq.h"
46
49
  #include "src/core/lib/resource_quota/arena.h"
47
50
  #include "src/core/lib/security/context/security_context.h"
@@ -157,7 +160,15 @@ ArenaPromise<absl::StatusOr<CallArgs>> ClientAuthFilter::GetCallCredsMetadata(
157
160
 
158
161
  auto client_initial_metadata = std::move(call_args.client_initial_metadata);
159
162
  return TrySeq(
160
- creds->GetRequestMetadata(std::move(client_initial_metadata), &args_),
163
+ Seq(creds->GetRequestMetadata(std::move(client_initial_metadata), &args_),
164
+ [](absl::StatusOr<ClientMetadataHandle> new_metadata) mutable {
165
+ if (!new_metadata.ok()) {
166
+ return absl::StatusOr<ClientMetadataHandle>(
167
+ MaybeRewriteIllegalStatusCode(new_metadata.status(),
168
+ "call credentials"));
169
+ }
170
+ return new_metadata;
171
+ }),
161
172
  [call_args =
162
173
  std::move(call_args)](ClientMetadataHandle new_metadata) mutable {
163
174
  call_args.client_initial_metadata = std::move(new_metadata);
@@ -49,8 +49,6 @@
49
49
  #include "src/core/lib/iomgr/error.h"
50
50
  #include "src/core/lib/iomgr/exec_ctx.h"
51
51
  #include "src/core/lib/iomgr/iomgr_fwd.h"
52
- #include "src/core/lib/iomgr/pollset.h"
53
- #include "src/core/lib/profiling/timers.h"
54
52
  #include "src/core/lib/resource_quota/api.h"
55
53
  #include "src/core/lib/resource_quota/memory_quota.h"
56
54
  #include "src/core/lib/resource_quota/resource_quota.h"
@@ -386,8 +384,6 @@ static void flush_write_staging_buffer(secure_endpoint* ep, uint8_t** cur,
386
384
 
387
385
  static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
388
386
  grpc_closure* cb, void* arg, int max_frame_size) {
389
- GPR_TIMER_SCOPE("secure_endpoint.endpoint_write", 0);
390
-
391
387
  unsigned i;
392
388
  tsi_result result = TSI_OK;
393
389
  secure_endpoint* ep = reinterpret_cast<secure_endpoint*>(secure_ep);
@@ -63,7 +63,6 @@
63
63
  #include "src/core/lib/iomgr/call_combiner.h"
64
64
  #include "src/core/lib/iomgr/exec_ctx.h"
65
65
  #include "src/core/lib/iomgr/polling_entity.h"
66
- #include "src/core/lib/profiling/timers.h"
67
66
  #include "src/core/lib/resource_quota/arena.h"
68
67
  #include "src/core/lib/slice/slice_buffer.h"
69
68
  #include "src/core/lib/slice/slice_internal.h"
@@ -516,8 +515,6 @@ void Call::PublishToParent(Call* parent) {
516
515
 
517
516
  grpc_error_handle FilterStackCall::Create(grpc_call_create_args* args,
518
517
  grpc_call** out_call) {
519
- GPR_TIMER_SCOPE("grpc_call_create", 0);
520
-
521
518
  Channel* channel = args->channel.get();
522
519
 
523
520
  auto add_init_error = [](grpc_error_handle* composite,
@@ -643,7 +640,6 @@ void FilterStackCall::ReleaseCall(void* call, grpc_error_handle /*error*/) {
643
640
  }
644
641
 
645
642
  void FilterStackCall::DestroyCall(void* call, grpc_error_handle /*error*/) {
646
- GPR_TIMER_SCOPE("destroy_call", 0);
647
643
  auto* c = static_cast<FilterStackCall*>(call);
648
644
  c->recv_initial_metadata_.Clear();
649
645
  c->recv_trailing_metadata_.Clear();
@@ -690,8 +686,6 @@ void Call::MaybeUnpublishFromParent() {
690
686
  void FilterStackCall::ExternalUnref() {
691
687
  if (GPR_LIKELY(!ext_ref_.Unref())) return;
692
688
 
693
- GPR_TIMER_SCOPE("grpc_call_unref", 0);
694
-
695
689
  ApplicationCallbackExecCtx callback_exec_ctx;
696
690
  ExecCtx exec_ctx;
697
691
 
@@ -729,7 +723,6 @@ void FilterStackCall::ExecuteBatch(grpc_transport_stream_op_batch* batch,
729
723
  // This is called via the call combiner to start sending a batch down
730
724
  // the filter stack.
731
725
  auto execute_batch_in_call_combiner = [](void* arg, grpc_error_handle) {
732
- GPR_TIMER_SCOPE("execute_batch_in_call_combiner", 0);
733
726
  grpc_transport_stream_op_batch* batch =
734
727
  static_cast<grpc_transport_stream_op_batch*>(arg);
735
728
  auto* call =
@@ -768,6 +761,7 @@ void FilterStackCall::CancelWithError(grpc_error_handle error) {
768
761
  GRPC_ERROR_UNREF(error);
769
762
  return;
770
763
  }
764
+ gpr_atm_rel_store(&peer_string_, 0);
771
765
  InternalRef("termination");
772
766
  // Inform the call combiner of the cancellation, so that it can cancel
773
767
  // any in-flight asynchronous actions that may be holding the call
@@ -928,7 +922,6 @@ void FilterStackCall::PublishAppMetadata(grpc_metadata_batch* b,
928
922
  if (b->count() == 0) return;
929
923
  if (!is_client() && is_trailing) return;
930
924
  if (is_trailing && buffered_metadata_[1] == nullptr) return;
931
- GPR_TIMER_SCOPE("publish_app_metadata", 0);
932
925
  grpc_metadata_array* dest;
933
926
  dest = buffered_metadata_[is_trailing];
934
927
  if (dest->count + b->count() > dest->capacity) {
@@ -1229,7 +1222,6 @@ void FilterStackCall::BatchControl::ReceivingInitialMetadataReady(
1229
1222
  call->RecvInitialFilter(md);
1230
1223
 
1231
1224
  /* TODO(ctiller): this could be moved into recv_initial_filter now */
1232
- GPR_TIMER_SCOPE("validate_filtered_metadata", 0);
1233
1225
  ValidateFilteredMetadata();
1234
1226
 
1235
1227
  absl::optional<Timestamp> deadline = md->get(GrpcTimeoutMetadata());
@@ -1300,8 +1292,6 @@ void FilterStackCall::BatchControl::FinishBatch(grpc_error_handle error) {
1300
1292
  grpc_call_error FilterStackCall::StartBatch(const grpc_op* ops, size_t nops,
1301
1293
  void* notify_tag,
1302
1294
  bool is_notify_tag_closure) {
1303
- GPR_TIMER_SCOPE("call_start_batch", 0);
1304
-
1305
1295
  size_t i;
1306
1296
  const grpc_op* op;
1307
1297
  BatchControl* bctl;
@@ -56,6 +56,7 @@
56
56
  #include "src/core/lib/surface/call.h"
57
57
  #include "src/core/lib/surface/channel_init.h"
58
58
  #include "src/core/lib/surface/channel_stack_type.h"
59
+ #include "src/core/lib/surface/init_internally.h"
59
60
  #include "src/core/lib/transport/transport.h"
60
61
 
61
62
  // IWYU pragma: no_include <type_traits>
@@ -92,7 +93,7 @@ Channel::Channel(bool is_client, std::string target,
92
93
  // accommodate that, we call grpc_init() here and then call
93
94
  // grpc_shutdown() when the channel is actually destroyed, thus
94
95
  // ensuring that shutdown is deferred until that point.
95
- grpc_init();
96
+ InitInternally();
96
97
  auto channelz_node = channelz_node_;
97
98
  *channel_stack_->on_destroy = [channelz_node]() {
98
99
  if (channelz_node != nullptr) {
@@ -100,7 +101,7 @@ Channel::Channel(bool is_client, std::string target,
100
101
  channelz::ChannelTrace::Severity::Info,
101
102
  grpc_slice_from_static_string("Channel destroyed"));
102
103
  }
103
- grpc_shutdown();
104
+ ShutdownInternally();
104
105
  };
105
106
  }
106
107