grpc 1.8.7 → 1.9.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 (488) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +549 -325
  3. data/include/grpc/impl/codegen/grpc_types.h +1 -2
  4. data/include/grpc/impl/codegen/port_platform.h +46 -5
  5. data/include/grpc/impl/codegen/slice.h +1 -2
  6. data/include/grpc/module.modulemap +0 -2
  7. data/include/grpc/slice_buffer.h +1 -2
  8. data/include/grpc/support/log.h +4 -2
  9. data/include/grpc/support/thd.h +4 -1
  10. data/include/grpc/support/tls.h +6 -0
  11. data/include/grpc/support/tls_gcc.h +5 -40
  12. data/include/grpc/support/tls_msvc.h +9 -0
  13. data/include/grpc/support/tls_pthread.h +9 -0
  14. data/src/core/ext/filters/client_channel/backup_poller.cc +32 -29
  15. data/src/core/ext/filters/client_channel/backup_poller.h +2 -2
  16. data/src/core/ext/filters/client_channel/channel_connectivity.cc +26 -32
  17. data/src/core/ext/filters/client_channel/client_channel.cc +325 -356
  18. data/src/core/ext/filters/client_channel/client_channel.h +4 -12
  19. data/src/core/ext/filters/client_channel/client_channel_factory.cc +9 -14
  20. data/src/core/ext/filters/client_channel/client_channel_factory.h +7 -20
  21. data/src/core/ext/filters/client_channel/client_channel_plugin.cc +7 -10
  22. data/src/core/ext/filters/client_channel/connector.cc +6 -7
  23. data/src/core/ext/filters/client_channel/connector.h +6 -16
  24. data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +38 -50
  25. data/src/core/ext/filters/client_channel/http_connect_handshaker.h +0 -8
  26. data/src/core/ext/filters/client_channel/http_proxy.cc +9 -13
  27. data/src/core/ext/filters/client_channel/http_proxy.h +0 -8
  28. data/src/core/ext/filters/client_channel/lb_policy.cc +72 -94
  29. data/src/core/ext/filters/client_channel/lb_policy.h +83 -92
  30. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +14 -19
  31. data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +0 -8
  32. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +474 -591
  33. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h +0 -8
  34. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +2 -10
  35. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +6 -6
  36. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +0 -8
  37. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +0 -9
  38. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +0 -9
  39. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +3 -4
  40. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +9 -12
  41. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +160 -182
  42. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +182 -221
  43. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +24 -35
  44. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +9 -20
  45. data/src/core/ext/filters/client_channel/lb_policy_factory.cc +6 -9
  46. data/src/core/ext/filters/client_channel/lb_policy_factory.h +4 -15
  47. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +3 -3
  48. data/src/core/ext/filters/client_channel/lb_policy_registry.h +1 -9
  49. data/src/core/ext/filters/client_channel/parse_address.cc +1 -1
  50. data/src/core/ext/filters/client_channel/parse_address.h +0 -8
  51. data/src/core/ext/filters/client_channel/proxy_mapper.cc +6 -8
  52. data/src/core/ext/filters/client_channel/proxy_mapper.h +6 -16
  53. data/src/core/ext/filters/client_channel/proxy_mapper_registry.cc +13 -17
  54. data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +2 -12
  55. data/src/core/ext/filters/client_channel/resolver.cc +11 -13
  56. data/src/core/ext/filters/client_channel/resolver.h +14 -25
  57. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +57 -70
  58. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +2 -12
  59. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +23 -31
  60. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +27 -45
  61. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -15
  62. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +9 -11
  63. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +53 -66
  64. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +25 -33
  65. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h +1 -9
  66. data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +26 -35
  67. data/src/core/ext/filters/client_channel/resolver_factory.cc +2 -3
  68. data/src/core/ext/filters/client_channel/resolver_factory.h +2 -12
  69. data/src/core/ext/filters/client_channel/resolver_registry.cc +12 -15
  70. data/src/core/ext/filters/client_channel/resolver_registry.h +3 -12
  71. data/src/core/ext/filters/client_channel/retry_throttle.h +0 -8
  72. data/src/core/ext/filters/client_channel/subchannel.cc +289 -301
  73. data/src/core/ext/filters/client_channel/subchannel.h +57 -84
  74. data/src/core/ext/filters/client_channel/subchannel_index.cc +30 -33
  75. data/src/core/ext/filters/client_channel/subchannel_index.h +4 -16
  76. data/src/core/ext/filters/client_channel/uri_parser.cc +13 -17
  77. data/src/core/ext/filters/client_channel/uri_parser.h +1 -10
  78. data/src/core/ext/filters/deadline/deadline_filter.cc +49 -67
  79. data/src/core/ext/filters/deadline/deadline_filter.h +4 -14
  80. data/src/core/ext/filters/http/client/http_client_filter.cc +60 -77
  81. data/src/core/ext/filters/http/client/http_client_filter.h +0 -8
  82. data/src/core/ext/filters/http/http_filters_plugin.cc +4 -6
  83. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +63 -79
  84. data/src/core/ext/filters/http/message_compress/message_compress_filter.h +0 -8
  85. data/src/core/ext/filters/http/server/http_server_filter.cc +57 -71
  86. data/src/core/ext/filters/http/server/http_server_filter.h +0 -8
  87. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc +19 -24
  88. data/src/core/ext/filters/load_reporting/server_load_reporting_filter.h +0 -8
  89. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc +3 -3
  90. data/src/core/ext/filters/load_reporting/server_load_reporting_plugin.h +0 -8
  91. data/src/core/ext/filters/max_age/max_age_filter.cc +49 -62
  92. data/src/core/ext/filters/max_age/max_age_filter.h +0 -8
  93. data/src/core/ext/filters/message_size/message_size_filter.cc +23 -29
  94. data/src/core/ext/filters/message_size/message_size_filter.h +0 -8
  95. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +15 -18
  96. data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +0 -8
  97. data/src/core/ext/filters/workarounds/workaround_utils.h +0 -8
  98. data/src/core/ext/transport/chttp2/alpn/alpn.h +0 -8
  99. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +33 -40
  100. data/src/core/ext/transport/chttp2/client/chttp2_connector.h +0 -8
  101. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +15 -17
  102. data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +8 -8
  103. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +23 -28
  104. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +50 -57
  105. data/src/core/ext/transport/chttp2/server/chttp2_server.h +1 -10
  106. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +3 -3
  107. data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +7 -10
  108. data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +5 -6
  109. data/src/core/ext/transport/chttp2/transport/bin_decoder.cc +7 -9
  110. data/src/core/ext/transport/chttp2/transport/bin_decoder.h +2 -11
  111. data/src/core/ext/transport/chttp2/transport/bin_encoder.h +1 -9
  112. data/src/core/ext/transport/chttp2/transport/chttp2_plugin.cc +10 -2
  113. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +516 -636
  114. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +4 -11
  115. data/src/core/ext/transport/chttp2/transport/flow_control.cc +29 -13
  116. data/src/core/ext/transport/chttp2/transport/flow_control.h +196 -53
  117. data/src/core/ext/transport/chttp2/transport/frame.h +0 -8
  118. data/src/core/ext/transport/chttp2/transport/frame_data.cc +31 -33
  119. data/src/core/ext/transport/chttp2/transport/frame_data.h +3 -12
  120. data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +2 -3
  121. data/src/core/ext/transport/chttp2/transport/frame_goaway.h +1 -10
  122. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -6
  123. data/src/core/ext/transport/chttp2/transport/frame_ping.h +1 -9
  124. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -3
  125. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.h +1 -10
  126. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +8 -3
  127. data/src/core/ext/transport/chttp2/transport/frame_settings.h +1 -10
  128. data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +8 -8
  129. data/src/core/ext/transport/chttp2/transport/frame_window_update.h +5 -11
  130. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +63 -81
  131. data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +2 -12
  132. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +230 -318
  133. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +6 -19
  134. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +14 -20
  135. data/src/core/ext/transport/chttp2/transport/hpack_table.h +5 -16
  136. data/src/core/ext/transport/chttp2/transport/http2_settings.h +0 -7
  137. data/src/core/ext/transport/chttp2/transport/huffsyms.h +0 -8
  138. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +8 -11
  139. data/src/core/ext/transport/chttp2/transport/incoming_metadata.h +4 -13
  140. data/src/core/ext/transport/chttp2/transport/internal.h +51 -75
  141. data/src/core/ext/transport/chttp2/transport/parsing.cc +83 -109
  142. data/src/core/ext/transport/chttp2/transport/stream_lists.cc +2 -0
  143. data/src/core/ext/transport/chttp2/transport/stream_map.h +0 -8
  144. data/src/core/ext/transport/chttp2/transport/varint.h +0 -8
  145. data/src/core/ext/transport/chttp2/transport/writing.cc +61 -65
  146. data/src/core/ext/transport/inproc/inproc_plugin.cc +2 -4
  147. data/src/core/ext/transport/inproc/inproc_transport.cc +177 -188
  148. data/src/core/ext/transport/inproc/inproc_transport.h +0 -8
  149. data/src/core/lib/backoff/backoff.cc +39 -44
  150. data/src/core/lib/backoff/backoff.h +61 -57
  151. data/src/core/lib/channel/channel_args.cc +8 -10
  152. data/src/core/lib/channel/channel_args.h +4 -13
  153. data/src/core/lib/channel/channel_stack.cc +19 -27
  154. data/src/core/lib/channel/channel_stack.h +27 -47
  155. data/src/core/lib/channel/channel_stack_builder.cc +11 -14
  156. data/src/core/lib/channel/channel_stack_builder.h +4 -15
  157. data/src/core/lib/channel/connected_channel.cc +23 -36
  158. data/src/core/lib/channel/connected_channel.h +1 -10
  159. data/src/core/lib/channel/handshaker.cc +31 -40
  160. data/src/core/lib/channel/handshaker.h +14 -25
  161. data/src/core/lib/channel/handshaker_factory.cc +6 -6
  162. data/src/core/lib/channel/handshaker_factory.h +5 -15
  163. data/src/core/lib/channel/handshaker_registry.cc +9 -13
  164. data/src/core/lib/channel/handshaker_registry.h +2 -11
  165. data/src/core/lib/compression/algorithm_metadata.h +0 -8
  166. data/src/core/lib/compression/message_compress.cc +19 -23
  167. data/src/core/lib/compression/message_compress.h +2 -12
  168. data/src/core/lib/compression/stream_compression.cc +1 -1
  169. data/src/core/lib/compression/stream_compression.h +0 -8
  170. data/src/core/lib/compression/stream_compression_gzip.cc +12 -11
  171. data/src/core/lib/compression/stream_compression_gzip.h +0 -8
  172. data/src/core/lib/compression/stream_compression_identity.h +0 -8
  173. data/src/core/lib/debug/stats.cc +4 -4
  174. data/src/core/lib/debug/stats.h +9 -19
  175. data/src/core/lib/debug/stats_data.cc +85 -116
  176. data/src/core/lib/debug/stats_data.h +236 -312
  177. data/src/core/lib/debug/trace.cc +1 -1
  178. data/src/core/lib/debug/trace.h +0 -12
  179. data/src/core/lib/{support → gpr++}/abstract.h +8 -3
  180. data/src/core/lib/{support → gpr++}/atomic.h +5 -5
  181. data/src/core/lib/{support → gpr++}/atomic_with_atm.h +3 -3
  182. data/src/core/lib/{support → gpr++}/atomic_with_std.h +3 -3
  183. data/src/core/lib/gpr++/debug_location.h +52 -0
  184. data/src/core/lib/gpr++/inlined_vector.h +112 -0
  185. data/src/core/lib/{support → gpr++}/manual_constructor.h +2 -2
  186. data/src/core/lib/{support → gpr++}/memory.h +3 -3
  187. data/src/core/lib/gpr++/orphanable.h +171 -0
  188. data/src/core/lib/gpr++/ref_counted.h +133 -0
  189. data/src/core/lib/gpr++/ref_counted_ptr.h +99 -0
  190. data/src/core/lib/{support → gpr}/alloc.cc +0 -0
  191. data/src/core/lib/{support → gpr}/arena.cc +1 -1
  192. data/src/core/lib/{support → gpr}/arena.h +3 -11
  193. data/src/core/lib/{support → gpr}/atm.cc +0 -0
  194. data/src/core/lib/{support → gpr}/avl.cc +0 -0
  195. data/src/core/lib/{support → gpr}/cmdline.cc +1 -1
  196. data/src/core/lib/{support → gpr}/cpu_iphone.cc +0 -0
  197. data/src/core/lib/{support → gpr}/cpu_linux.cc +0 -0
  198. data/src/core/lib/{support → gpr}/cpu_posix.cc +0 -0
  199. data/src/core/lib/{support → gpr}/cpu_windows.cc +0 -0
  200. data/src/core/lib/{support → gpr}/env.h +3 -11
  201. data/src/core/lib/{support → gpr}/env_linux.cc +2 -2
  202. data/src/core/lib/{support → gpr}/env_posix.cc +4 -4
  203. data/src/core/lib/{support → gpr}/env_windows.cc +3 -3
  204. data/src/core/lib/{support → gpr}/fork.cc +3 -3
  205. data/src/core/lib/{support → gpr}/fork.h +3 -3
  206. data/src/core/lib/{support → gpr}/host_port.cc +1 -1
  207. data/src/core/lib/{support → gpr}/log.cc +3 -3
  208. data/src/core/lib/{support → gpr}/log_android.cc +3 -3
  209. data/src/core/lib/{support → gpr}/log_linux.cc +1 -1
  210. data/src/core/lib/{support → gpr}/log_posix.cc +5 -5
  211. data/src/core/lib/{support → gpr}/log_windows.cc +3 -3
  212. data/src/core/lib/{support → gpr}/mpscq.cc +1 -1
  213. data/src/core/lib/{support → gpr}/mpscq.h +3 -10
  214. data/src/core/lib/{support → gpr}/murmur_hash.cc +1 -1
  215. data/src/core/lib/{support → gpr}/murmur_hash.h +3 -11
  216. data/src/core/lib/{support → gpr}/spinlock.h +3 -3
  217. data/src/core/lib/{support → gpr}/string.cc +1 -1
  218. data/src/core/lib/{support → gpr}/string.h +3 -10
  219. data/src/core/lib/{support → gpr}/string_posix.cc +0 -0
  220. data/src/core/lib/{support → gpr}/string_util_windows.cc +2 -2
  221. data/src/core/lib/{support → gpr}/string_windows.cc +1 -1
  222. data/src/core/lib/{support → gpr}/string_windows.h +3 -11
  223. data/src/core/lib/{support → gpr}/subprocess_posix.cc +0 -0
  224. data/src/core/lib/{support → gpr}/subprocess_windows.cc +2 -2
  225. data/src/core/lib/{support → gpr}/sync.cc +0 -0
  226. data/src/core/lib/{support → gpr}/sync_posix.cc +10 -1
  227. data/src/core/lib/{support → gpr}/sync_windows.cc +0 -0
  228. data/src/core/lib/{support → gpr}/thd.cc +0 -0
  229. data/src/core/lib/{support → gpr}/thd_internal.h +3 -3
  230. data/src/core/lib/{support → gpr}/thd_posix.cc +18 -2
  231. data/src/core/lib/{support → gpr}/thd_windows.cc +2 -1
  232. data/src/core/lib/{support → gpr}/time.cc +0 -0
  233. data/src/core/lib/{support → gpr}/time_posix.cc +2 -4
  234. data/src/core/lib/{support → gpr}/time_precise.cc +1 -1
  235. data/src/core/lib/{support → gpr}/time_precise.h +3 -11
  236. data/src/core/lib/{support → gpr}/time_windows.cc +1 -3
  237. data/src/core/lib/{support → gpr}/tls_pthread.cc +0 -0
  238. data/src/core/lib/{support → gpr}/tmpfile.h +3 -11
  239. data/src/core/lib/{support → gpr}/tmpfile_msys.cc +2 -2
  240. data/src/core/lib/{support → gpr}/tmpfile_posix.cc +2 -2
  241. data/src/core/lib/{support → gpr}/tmpfile_windows.cc +2 -2
  242. data/src/core/lib/{support → gpr}/wrap_memcpy.cc +0 -0
  243. data/src/core/lib/http/format_request.cc +1 -1
  244. data/src/core/lib/http/format_request.h +0 -8
  245. data/src/core/lib/http/httpcli.cc +55 -74
  246. data/src/core/lib/http/httpcli.h +13 -22
  247. data/src/core/lib/http/httpcli_security_connector.cc +27 -33
  248. data/src/core/lib/http/parser.h +0 -8
  249. data/src/core/lib/iomgr/block_annotate.h +10 -17
  250. data/src/core/lib/iomgr/call_combiner.cc +14 -17
  251. data/src/core/lib/iomgr/call_combiner.h +16 -34
  252. data/src/core/lib/iomgr/closure.h +24 -37
  253. data/src/core/lib/iomgr/combiner.cc +62 -66
  254. data/src/core/lib/iomgr/combiner.h +6 -16
  255. data/src/core/lib/iomgr/endpoint.cc +15 -21
  256. data/src/core/lib/iomgr/endpoint.h +16 -33
  257. data/src/core/lib/iomgr/endpoint_pair.h +0 -8
  258. data/src/core/lib/iomgr/endpoint_pair_posix.cc +4 -5
  259. data/src/core/lib/iomgr/endpoint_pair_windows.cc +4 -6
  260. data/src/core/lib/iomgr/error.cc +2 -6
  261. data/src/core/lib/iomgr/error.h +4 -9
  262. data/src/core/lib/iomgr/error_internal.h +0 -8
  263. data/src/core/lib/iomgr/ev_epoll1_linux.cc +110 -117
  264. data/src/core/lib/iomgr/ev_epoll1_linux.h +0 -8
  265. data/src/core/lib/iomgr/ev_epollex_linux.cc +111 -141
  266. data/src/core/lib/iomgr/ev_epollex_linux.h +0 -8
  267. data/src/core/lib/iomgr/ev_epollsig_linux.cc +83 -109
  268. data/src/core/lib/iomgr/ev_epollsig_linux.h +2 -10
  269. data/src/core/lib/iomgr/ev_poll_posix.cc +103 -125
  270. data/src/core/lib/iomgr/ev_poll_posix.h +0 -8
  271. data/src/core/lib/iomgr/ev_posix.cc +35 -50
  272. data/src/core/lib/iomgr/ev_posix.h +27 -53
  273. data/src/core/lib/iomgr/exec_ctx.cc +46 -78
  274. data/src/core/lib/iomgr/exec_ctx.h +127 -60
  275. data/src/core/lib/iomgr/executor.cc +34 -38
  276. data/src/core/lib/iomgr/executor.h +3 -11
  277. data/src/core/lib/iomgr/fork_posix.cc +13 -12
  278. data/src/core/lib/iomgr/gethostname.h +0 -8
  279. data/src/core/lib/iomgr/gethostname_sysconf.cc +1 -1
  280. data/src/core/lib/iomgr/iocp_windows.cc +14 -16
  281. data/src/core/lib/iomgr/iocp_windows.h +1 -10
  282. data/src/core/lib/iomgr/iomgr.cc +60 -59
  283. data/src/core/lib/iomgr/iomgr.h +3 -12
  284. data/src/core/lib/iomgr/iomgr_internal.h +0 -8
  285. data/src/core/lib/iomgr/iomgr_uv.cc +2 -3
  286. data/src/core/lib/iomgr/iomgr_uv.h +0 -8
  287. data/src/core/lib/iomgr/is_epollexclusive_available.cc +1 -1
  288. data/src/core/lib/iomgr/load_file.cc +1 -1
  289. data/src/core/lib/iomgr/load_file.h +0 -8
  290. data/src/core/lib/iomgr/lockfree_event.cc +7 -8
  291. data/src/core/lib/iomgr/lockfree_event.h +3 -3
  292. data/src/core/lib/iomgr/polling_entity.cc +6 -10
  293. data/src/core/lib/iomgr/polling_entity.h +2 -11
  294. data/src/core/lib/iomgr/pollset.h +4 -13
  295. data/src/core/lib/iomgr/pollset_set.h +5 -18
  296. data/src/core/lib/iomgr/pollset_set_uv.cc +5 -10
  297. data/src/core/lib/iomgr/pollset_set_windows.cc +5 -10
  298. data/src/core/lib/iomgr/pollset_uv.cc +8 -9
  299. data/src/core/lib/iomgr/pollset_uv.h +0 -8
  300. data/src/core/lib/iomgr/pollset_windows.cc +14 -15
  301. data/src/core/lib/iomgr/pollset_windows.h +0 -8
  302. data/src/core/lib/iomgr/port.h +6 -1
  303. data/src/core/lib/iomgr/resolve_address.h +1 -10
  304. data/src/core/lib/iomgr/resolve_address_posix.cc +10 -12
  305. data/src/core/lib/iomgr/resolve_address_uv.cc +7 -8
  306. data/src/core/lib/iomgr/resolve_address_windows.cc +8 -9
  307. data/src/core/lib/iomgr/resource_quota.cc +77 -107
  308. data/src/core/lib/iomgr/resource_quota.h +8 -25
  309. data/src/core/lib/iomgr/sockaddr_utils.cc +1 -1
  310. data/src/core/lib/iomgr/sockaddr_utils.h +0 -8
  311. data/src/core/lib/iomgr/socket_factory_posix.cc +1 -1
  312. data/src/core/lib/iomgr/socket_factory_posix.h +0 -8
  313. data/src/core/lib/iomgr/socket_mutator.cc +1 -1
  314. data/src/core/lib/iomgr/socket_mutator.h +1 -9
  315. data/src/core/lib/iomgr/socket_utils.h +0 -8
  316. data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -1
  317. data/src/core/lib/iomgr/socket_utils_posix.h +0 -8
  318. data/src/core/lib/iomgr/socket_windows.cc +8 -11
  319. data/src/core/lib/iomgr/socket_windows.h +3 -14
  320. data/src/core/lib/iomgr/tcp_client.h +1 -10
  321. data/src/core/lib/iomgr/tcp_client_posix.cc +94 -78
  322. data/src/core/lib/iomgr/tcp_client_posix.h +36 -8
  323. data/src/core/lib/iomgr/tcp_client_uv.cc +16 -23
  324. data/src/core/lib/iomgr/tcp_client_windows.cc +22 -25
  325. data/src/core/lib/iomgr/tcp_posix.cc +131 -153
  326. data/src/core/lib/iomgr/tcp_posix.h +3 -12
  327. data/src/core/lib/iomgr/tcp_server.h +6 -17
  328. data/src/core/lib/iomgr/tcp_server_posix.cc +31 -35
  329. data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -8
  330. data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +1 -1
  331. data/src/core/lib/iomgr/tcp_server_uv.cc +23 -34
  332. data/src/core/lib/iomgr/tcp_server_windows.cc +24 -34
  333. data/src/core/lib/iomgr/tcp_uv.cc +42 -56
  334. data/src/core/lib/iomgr/tcp_uv.h +0 -8
  335. data/src/core/lib/iomgr/tcp_windows.cc +43 -50
  336. data/src/core/lib/iomgr/tcp_windows.h +1 -9
  337. data/src/core/lib/iomgr/time_averaged_stats.h +0 -8
  338. data/src/core/lib/iomgr/timer.h +6 -15
  339. data/src/core/lib/iomgr/timer_generic.cc +22 -27
  340. data/src/core/lib/iomgr/timer_heap.h +0 -8
  341. data/src/core/lib/iomgr/timer_manager.cc +17 -19
  342. data/src/core/lib/iomgr/timer_manager.h +0 -8
  343. data/src/core/lib/iomgr/timer_uv.cc +12 -14
  344. data/src/core/lib/iomgr/udp_server.cc +148 -54
  345. data/src/core/lib/iomgr/udp_server.h +16 -21
  346. data/src/core/lib/iomgr/unix_sockets_posix.h +0 -8
  347. data/src/core/lib/iomgr/wakeup_fd_cv.cc +4 -4
  348. data/src/core/lib/iomgr/wakeup_fd_cv.h +12 -20
  349. data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
  350. data/src/core/lib/iomgr/wakeup_fd_pipe.h +0 -8
  351. data/src/core/lib/iomgr/wakeup_fd_posix.h +0 -8
  352. data/src/core/lib/json/json.h +0 -8
  353. data/src/core/lib/json/json_reader.h +0 -8
  354. data/src/core/lib/json/json_writer.h +0 -8
  355. data/src/core/lib/profiling/basic_timers.cc +3 -2
  356. data/src/core/lib/profiling/timers.h +0 -8
  357. data/src/core/lib/security/context/security_context.cc +9 -10
  358. data/src/core/lib/security/context/security_context.h +0 -8
  359. data/src/core/lib/security/credentials/composite/composite_credentials.cc +23 -28
  360. data/src/core/lib/security/credentials/composite/composite_credentials.h +0 -8
  361. data/src/core/lib/security/credentials/credentials.cc +33 -42
  362. data/src/core/lib/security/credentials/credentials.h +24 -43
  363. data/src/core/lib/security/credentials/credentials_metadata.cc +2 -2
  364. data/src/core/lib/security/credentials/fake/fake_credentials.cc +16 -22
  365. data/src/core/lib/security/credentials/fake/fake_credentials.h +0 -8
  366. data/src/core/lib/security/credentials/google_default/credentials_generic.cc +3 -3
  367. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +28 -34
  368. data/src/core/lib/security/credentials/google_default/google_default_credentials.h +0 -8
  369. data/src/core/lib/security/credentials/iam/iam_credentials.cc +9 -13
  370. data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
  371. data/src/core/lib/security/credentials/jwt/json_token.h +0 -8
  372. data/src/core/lib/security/credentials/jwt/jwt_credentials.cc +14 -20
  373. data/src/core/lib/security/credentials/jwt/jwt_credentials.h +1 -10
  374. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +56 -72
  375. data/src/core/lib/security/credentials/jwt/jwt_verifier.h +5 -17
  376. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +47 -55
  377. data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +3 -12
  378. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +23 -28
  379. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +8 -13
  380. data/src/core/lib/security/credentials/ssl/ssl_credentials.h +0 -8
  381. data/src/core/lib/security/transport/auth_filters.h +0 -8
  382. data/src/core/lib/security/transport/client_auth_filter.cc +45 -54
  383. data/src/core/lib/security/transport/lb_targets_info.cc +2 -2
  384. data/src/core/lib/security/transport/lb_targets_info.h +0 -8
  385. data/src/core/lib/security/transport/secure_endpoint.cc +54 -68
  386. data/src/core/lib/security/transport/secure_endpoint.h +0 -8
  387. data/src/core/lib/security/transport/security_connector.cc +62 -86
  388. data/src/core/lib/security/transport/security_connector.h +22 -39
  389. data/src/core/lib/security/transport/security_handshaker.cc +83 -106
  390. data/src/core/lib/security/transport/security_handshaker.h +1 -10
  391. data/src/core/lib/security/transport/server_auth_filter.cc +31 -38
  392. data/src/core/lib/security/transport/tsi_error.h +0 -8
  393. data/src/core/lib/security/util/json_util.h +0 -8
  394. data/src/core/lib/slice/b64.cc +5 -6
  395. data/src/core/lib/slice/b64.h +3 -12
  396. data/src/core/lib/slice/percent_encoding.h +0 -8
  397. data/src/core/lib/slice/slice.cc +8 -9
  398. data/src/core/lib/slice/slice_buffer.cc +11 -16
  399. data/src/core/lib/slice/slice_hash_table.cc +5 -7
  400. data/src/core/lib/slice/slice_hash_table.h +2 -12
  401. data/src/core/lib/slice/slice_intern.cc +4 -5
  402. data/src/core/lib/slice/slice_internal.h +4 -15
  403. data/src/core/lib/slice/slice_string_helpers.cc +1 -1
  404. data/src/core/lib/slice/slice_string_helpers.h +1 -9
  405. data/src/core/lib/surface/alarm.cc +11 -14
  406. data/src/core/lib/surface/alarm_internal.h +0 -8
  407. data/src/core/lib/surface/byte_buffer.cc +2 -3
  408. data/src/core/lib/surface/byte_buffer_reader.cc +7 -9
  409. data/src/core/lib/surface/call.cc +198 -241
  410. data/src/core/lib/surface/call.h +9 -23
  411. data/src/core/lib/surface/call_details.cc +3 -4
  412. data/src/core/lib/surface/call_log_batch.cc +1 -1
  413. data/src/core/lib/surface/call_test_only.h +0 -8
  414. data/src/core/lib/surface/channel.cc +53 -64
  415. data/src/core/lib/surface/channel.h +12 -23
  416. data/src/core/lib/surface/channel_init.cc +2 -3
  417. data/src/core/lib/surface/channel_init.h +2 -12
  418. data/src/core/lib/surface/channel_ping.cc +7 -9
  419. data/src/core/lib/surface/channel_stack_type.h +0 -8
  420. data/src/core/lib/surface/completion_queue.cc +158 -176
  421. data/src/core/lib/surface/completion_queue.h +9 -20
  422. data/src/core/lib/surface/completion_queue_factory.h +0 -8
  423. data/src/core/lib/surface/event_string.cc +1 -1
  424. data/src/core/lib/surface/event_string.h +0 -8
  425. data/src/core/lib/surface/init.cc +27 -25
  426. data/src/core/lib/surface/init.h +0 -8
  427. data/src/core/lib/surface/init_secure.cc +2 -2
  428. data/src/core/lib/surface/lame_client.cc +30 -33
  429. data/src/core/lib/surface/lame_client.h +0 -8
  430. data/src/core/lib/surface/server.cc +151 -203
  431. data/src/core/lib/surface/server.h +7 -16
  432. data/src/core/lib/surface/validate_metadata.h +0 -8
  433. data/src/core/lib/surface/version.cc +2 -2
  434. data/src/core/lib/transport/bdp_estimator.cc +2 -2
  435. data/src/core/lib/transport/bdp_estimator.h +1 -1
  436. data/src/core/lib/transport/byte_stream.cc +24 -38
  437. data/src/core/lib/transport/byte_stream.h +10 -25
  438. data/src/core/lib/transport/connectivity_state.cc +9 -13
  439. data/src/core/lib/transport/connectivity_state.h +4 -14
  440. data/src/core/lib/transport/error_utils.cc +6 -6
  441. data/src/core/lib/transport/error_utils.h +2 -11
  442. data/src/core/lib/transport/metadata.cc +21 -23
  443. data/src/core/lib/transport/metadata.h +8 -20
  444. data/src/core/lib/transport/metadata_batch.cc +34 -45
  445. data/src/core/lib/transport/metadata_batch.h +18 -32
  446. data/src/core/lib/transport/service_config.cc +11 -15
  447. data/src/core/lib/transport/service_config.h +3 -13
  448. data/src/core/lib/transport/static_metadata.cc +1 -1
  449. data/src/core/lib/transport/static_metadata.h +1 -7
  450. data/src/core/lib/transport/status_conversion.cc +2 -3
  451. data/src/core/lib/transport/status_conversion.h +1 -10
  452. data/src/core/lib/transport/timeout_encoding.cc +1 -1
  453. data/src/core/lib/transport/timeout_encoding.h +1 -9
  454. data/src/core/lib/transport/transport.cc +36 -50
  455. data/src/core/lib/transport/transport.h +28 -30
  456. data/src/core/lib/transport/transport_impl.h +12 -23
  457. data/src/core/lib/transport/transport_op_string.cc +2 -2
  458. data/src/core/plugin_registry/grpc_plugin_registry.cc +34 -34
  459. data/src/core/tsi/fake_transport_security.cc +7 -10
  460. data/src/core/tsi/fake_transport_security.h +0 -8
  461. data/src/core/tsi/gts_transport_security.cc +2 -2
  462. data/src/core/tsi/gts_transport_security.h +0 -8
  463. data/src/core/tsi/ssl_transport_security.cc +3 -0
  464. data/src/core/tsi/ssl_transport_security.h +0 -8
  465. data/src/core/tsi/ssl_types.h +0 -8
  466. data/src/core/tsi/transport_security.h +1 -9
  467. data/src/core/tsi/transport_security_adapter.h +0 -8
  468. data/src/core/tsi/transport_security_grpc.cc +11 -18
  469. data/src/core/tsi/transport_security_grpc.h +9 -21
  470. data/src/core/tsi/transport_security_interface.h +0 -8
  471. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +0 -30
  472. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +2 -48
  473. data/src/ruby/lib/grpc/version.rb +1 -1
  474. data/src/ruby/spec/channel_connection_spec.rb +2 -1
  475. data/src/ruby/spec/client_auth_spec.rb +1 -1
  476. data/src/ruby/spec/client_server_spec.rb +2 -2
  477. data/src/ruby/spec/generic/active_call_spec.rb +1 -1
  478. data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
  479. data/src/ruby/spec/generic/interceptor_registry_spec.rb +1 -1
  480. data/src/ruby/spec/generic/rpc_server_spec.rb +12 -12
  481. data/src/ruby/spec/google_rpc_status_utils_spec.rb +3 -2
  482. data/src/ruby/spec/pb/health/checker_spec.rb +1 -1
  483. data/src/ruby/spec/server_spec.rb +9 -9
  484. data/src/ruby/spec/support/helpers.rb +35 -1
  485. metadata +68 -66
  486. data/include/grpc/impl/codegen/exec_ctx_fwd.h +0 -26
  487. data/include/grpc/support/histogram.h +0 -64
  488. data/src/core/lib/support/histogram.cc +0 -227
@@ -33,10 +33,6 @@ extern grpc_core::TraceFlag grpc_trace_operation_failures;
33
33
  extern grpc_core::DebugOnlyTraceFlag grpc_trace_pending_tags;
34
34
  extern grpc_core::DebugOnlyTraceFlag grpc_trace_cq_refcount;
35
35
 
36
- #ifdef __cplusplus
37
- extern "C" {
38
- #endif
39
-
40
36
  typedef struct grpc_cq_completion {
41
37
  gpr_mpscq_node node;
42
38
 
@@ -44,8 +40,7 @@ typedef struct grpc_cq_completion {
44
40
  void* tag;
45
41
  /** done callback - called when this queue element is no longer
46
42
  needed by the completion queue */
47
- void (*done)(grpc_exec_ctx* exec_ctx, void* done_arg,
48
- struct grpc_cq_completion* c);
43
+ void (*done)(void* done_arg, struct grpc_cq_completion* c);
49
44
  void* done_arg;
50
45
  /** next pointer; low bit is used to indicate success or not */
51
46
  uintptr_t next;
@@ -54,17 +49,17 @@ typedef struct grpc_cq_completion {
54
49
  #ifndef NDEBUG
55
50
  void grpc_cq_internal_ref(grpc_completion_queue* cc, const char* reason,
56
51
  const char* file, int line);
57
- void grpc_cq_internal_unref(grpc_exec_ctx* exec_ctx, grpc_completion_queue* cc,
58
- const char* reason, const char* file, int line);
52
+ void grpc_cq_internal_unref(grpc_completion_queue* cc, const char* reason,
53
+ const char* file, int line);
59
54
  #define GRPC_CQ_INTERNAL_REF(cc, reason) \
60
55
  grpc_cq_internal_ref(cc, reason, __FILE__, __LINE__)
61
- #define GRPC_CQ_INTERNAL_UNREF(ec, cc, reason) \
62
- grpc_cq_internal_unref(ec, cc, reason, __FILE__, __LINE__)
56
+ #define GRPC_CQ_INTERNAL_UNREF(cc, reason) \
57
+ grpc_cq_internal_unref(cc, reason, __FILE__, __LINE__)
63
58
  #else
64
59
  void grpc_cq_internal_ref(grpc_completion_queue* cc);
65
- void grpc_cq_internal_unref(grpc_exec_ctx* exec_ctx, grpc_completion_queue* cc);
60
+ void grpc_cq_internal_unref(grpc_completion_queue* cc);
66
61
  #define GRPC_CQ_INTERNAL_REF(cc, reason) grpc_cq_internal_ref(cc)
67
- #define GRPC_CQ_INTERNAL_UNREF(ec, cc, reason) grpc_cq_internal_unref(ec, cc)
62
+ #define GRPC_CQ_INTERNAL_UNREF(cc, reason) grpc_cq_internal_unref(cc)
68
63
  #endif
69
64
 
70
65
  /* Initializes global variables used by completion queues */
@@ -78,10 +73,8 @@ bool grpc_cq_begin_op(grpc_completion_queue* cc, void* tag);
78
73
 
79
74
  /* Queue a GRPC_OP_COMPLETED operation; tag must correspond to the tag passed to
80
75
  grpc_cq_begin_op */
81
- void grpc_cq_end_op(grpc_exec_ctx* exec_ctx, grpc_completion_queue* cc,
82
- void* tag, grpc_error* error,
83
- void (*done)(grpc_exec_ctx* exec_ctx, void* done_arg,
84
- grpc_cq_completion* storage),
76
+ void grpc_cq_end_op(grpc_completion_queue* cc, void* tag, grpc_error* error,
77
+ void (*done)(void* done_arg, grpc_cq_completion* storage),
85
78
  void* done_arg, grpc_cq_completion* storage);
86
79
 
87
80
  grpc_pollset* grpc_cq_pollset(grpc_completion_queue* cc);
@@ -95,8 +88,4 @@ int grpc_get_cq_poll_num(grpc_completion_queue* cc);
95
88
  grpc_completion_queue* grpc_completion_queue_create_internal(
96
89
  grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type);
97
90
 
98
- #ifdef __cplusplus
99
- }
100
- #endif
101
-
102
91
  #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */
@@ -22,10 +22,6 @@
22
22
  #include <grpc/grpc.h>
23
23
  #include "src/core/lib/surface/completion_queue.h"
24
24
 
25
- #ifdef __cplusplus
26
- extern "C" {
27
- #endif
28
-
29
25
  typedef struct grpc_completion_queue_factory_vtable {
30
26
  grpc_completion_queue* (*create)(const grpc_completion_queue_factory*,
31
27
  const grpc_completion_queue_attributes*);
@@ -37,8 +33,4 @@ struct grpc_completion_queue_factory {
37
33
  grpc_completion_queue_factory_vtable* vtable;
38
34
  };
39
35
 
40
- #ifdef __cplusplus
41
- }
42
- #endif
43
-
44
36
  #endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_FACTORY_H */
@@ -22,7 +22,7 @@
22
22
 
23
23
  #include <grpc/byte_buffer.h>
24
24
  #include <grpc/support/string_util.h>
25
- #include "src/core/lib/support/string.h"
25
+ #include "src/core/lib/gpr/string.h"
26
26
 
27
27
  static void addhdr(gpr_strvec* buf, grpc_event* ev) {
28
28
  char* tmp;
@@ -21,15 +21,7 @@
21
21
 
22
22
  #include <grpc/grpc.h>
23
23
 
24
- #ifdef __cplusplus
25
- extern "C" {
26
- #endif
27
-
28
24
  /* Returns a string describing an event. Must be later freed with gpr_free() */
29
25
  char* grpc_event_string(grpc_event* ev);
30
26
 
31
- #ifdef __cplusplus
32
- }
33
- #endif
34
-
35
27
  #endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */
@@ -31,6 +31,8 @@
31
31
  #include "src/core/lib/channel/handshaker_registry.h"
32
32
  #include "src/core/lib/debug/stats.h"
33
33
  #include "src/core/lib/debug/trace.h"
34
+ #include "src/core/lib/gpr/fork.h"
35
+ #include "src/core/lib/gpr/thd_internal.h"
34
36
  #include "src/core/lib/http/parser.h"
35
37
  #include "src/core/lib/iomgr/call_combiner.h"
36
38
  #include "src/core/lib/iomgr/combiner.h"
@@ -40,8 +42,6 @@
40
42
  #include "src/core/lib/iomgr/timer_manager.h"
41
43
  #include "src/core/lib/profiling/timers.h"
42
44
  #include "src/core/lib/slice/slice_internal.h"
43
- #include "src/core/lib/support/fork.h"
44
- #include "src/core/lib/support/thd_internal.h"
45
45
  #include "src/core/lib/surface/alarm_internal.h"
46
46
  #include "src/core/lib/surface/api_trace.h"
47
47
  #include "src/core/lib/surface/call.h"
@@ -73,14 +73,12 @@ static void do_basic_init(void) {
73
73
  grpc_fork_handlers_auto_register();
74
74
  }
75
75
 
76
- static bool append_filter(grpc_exec_ctx* exec_ctx,
77
- grpc_channel_stack_builder* builder, void* arg) {
76
+ static bool append_filter(grpc_channel_stack_builder* builder, void* arg) {
78
77
  return grpc_channel_stack_builder_append_filter(
79
78
  builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
80
79
  }
81
80
 
82
- static bool prepend_filter(grpc_exec_ctx* exec_ctx,
83
- grpc_channel_stack_builder* builder, void* arg) {
81
+ static bool prepend_filter(grpc_channel_stack_builder* builder, void* arg) {
84
82
  return grpc_channel_stack_builder_prepend_filter(
85
83
  builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
86
84
  }
@@ -123,7 +121,6 @@ void grpc_init(void) {
123
121
  int i;
124
122
  gpr_once_init(&g_basic_init, do_basic_init);
125
123
 
126
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
127
124
  gpr_mu_lock(&g_init_mu);
128
125
  if (++g_initializations == 1) {
129
126
  gpr_time_init();
@@ -133,7 +130,8 @@ void grpc_init(void) {
133
130
  grpc_mdctx_global_init();
134
131
  grpc_channel_init_init();
135
132
  grpc_security_pre_init();
136
- grpc_iomgr_init(&exec_ctx);
133
+ grpc_core::ExecCtx::GlobalInit();
134
+ grpc_iomgr_init();
137
135
  gpr_timers_global_init();
138
136
  grpc_handshaker_factory_registry_init();
139
137
  grpc_security_init();
@@ -149,37 +147,41 @@ void grpc_init(void) {
149
147
  grpc_tracer_init("GRPC_TRACE");
150
148
  /* no more changes to channel init pipelines */
151
149
  grpc_channel_init_finalize();
152
- grpc_iomgr_start(&exec_ctx);
150
+ grpc_iomgr_start();
153
151
  }
154
152
  gpr_mu_unlock(&g_init_mu);
155
- grpc_exec_ctx_finish(&exec_ctx);
153
+
156
154
  GRPC_API_TRACE("grpc_init(void)", 0, ());
157
155
  }
158
156
 
159
157
  void grpc_shutdown(void) {
160
158
  int i;
161
159
  GRPC_API_TRACE("grpc_shutdown(void)", 0, ());
162
- grpc_exec_ctx exec_ctx =
163
- GRPC_EXEC_CTX_INITIALIZER(0, grpc_never_ready_to_finish, nullptr);
164
160
  gpr_mu_lock(&g_init_mu);
165
161
  if (--g_initializations == 0) {
166
- grpc_executor_shutdown(&exec_ctx);
167
- grpc_timer_manager_set_threading(false); // shutdown timer_manager thread
168
- for (i = g_number_of_plugins; i >= 0; i--) {
169
- if (g_all_of_the_plugins[i].destroy != nullptr) {
170
- g_all_of_the_plugins[i].destroy();
162
+ {
163
+ grpc_core::ExecCtx exec_ctx(0);
164
+ {
165
+ grpc_executor_shutdown();
166
+ grpc_timer_manager_set_threading(
167
+ false); // shutdown timer_manager thread
168
+ for (i = g_number_of_plugins; i >= 0; i--) {
169
+ if (g_all_of_the_plugins[i].destroy != nullptr) {
170
+ g_all_of_the_plugins[i].destroy();
171
+ }
172
+ }
171
173
  }
174
+ grpc_iomgr_shutdown();
175
+ gpr_timers_global_destroy();
176
+ grpc_tracer_shutdown();
177
+ grpc_mdctx_global_shutdown();
178
+ grpc_handshaker_factory_registry_shutdown();
179
+ grpc_slice_intern_shutdown();
180
+ grpc_stats_shutdown();
172
181
  }
173
- grpc_iomgr_shutdown(&exec_ctx);
174
- gpr_timers_global_destroy();
175
- grpc_tracer_shutdown();
176
- grpc_mdctx_global_shutdown(&exec_ctx);
177
- grpc_handshaker_factory_registry_shutdown(&exec_ctx);
178
- grpc_slice_intern_shutdown();
179
- grpc_stats_shutdown();
182
+ grpc_core::ExecCtx::GlobalShutdown();
180
183
  }
181
184
  gpr_mu_unlock(&g_init_mu);
182
- grpc_exec_ctx_finish(&exec_ctx);
183
185
  }
184
186
 
185
187
  int grpc_is_initialized(void) {
@@ -19,17 +19,9 @@
19
19
  #ifndef GRPC_CORE_LIB_SURFACE_INIT_H
20
20
  #define GRPC_CORE_LIB_SURFACE_INIT_H
21
21
 
22
- #ifdef __cplusplus
23
- extern "C" {
24
- #endif
25
-
26
22
  void grpc_register_security_filters(void);
27
23
  void grpc_security_pre_init(void);
28
24
  void grpc_security_init(void);
29
25
  int grpc_is_initialized(void);
30
26
 
31
- #ifdef __cplusplus
32
- }
33
- #endif
34
-
35
27
  #endif /* GRPC_CORE_LIB_SURFACE_INIT_H */
@@ -37,7 +37,7 @@
37
37
  void grpc_security_pre_init(void) {}
38
38
 
39
39
  static bool maybe_prepend_client_auth_filter(
40
- grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
40
+ grpc_channel_stack_builder* builder, void* arg) {
41
41
  const grpc_channel_args* args =
42
42
  grpc_channel_stack_builder_get_channel_arguments(builder);
43
43
  if (args) {
@@ -52,7 +52,7 @@ static bool maybe_prepend_client_auth_filter(
52
52
  }
53
53
 
54
54
  static bool maybe_prepend_server_auth_filter(
55
- grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) {
55
+ grpc_channel_stack_builder* builder, void* arg) {
56
56
  const grpc_channel_args* args =
57
57
  grpc_channel_stack_builder_get_channel_arguments(builder);
58
58
  if (args) {
@@ -23,10 +23,10 @@
23
23
  #include <grpc/support/alloc.h>
24
24
  #include <grpc/support/log.h>
25
25
 
26
- #include "src/core/lib/support/atomic.h"
26
+ #include "src/core/lib/gpr++/atomic.h"
27
27
 
28
28
  #include "src/core/lib/channel/channel_stack.h"
29
- #include "src/core/lib/support/string.h"
29
+ #include "src/core/lib/gpr/string.h"
30
30
  #include "src/core/lib/surface/api_trace.h"
31
31
  #include "src/core/lib/surface/call.h"
32
32
  #include "src/core/lib/surface/channel.h"
@@ -49,8 +49,7 @@ struct ChannelData {
49
49
  const char* error_message;
50
50
  };
51
51
 
52
- static void fill_metadata(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
53
- grpc_metadata_batch* mdb) {
52
+ static void fill_metadata(grpc_call_element* elem, grpc_metadata_batch* mdb) {
54
53
  CallData* calld = reinterpret_cast<CallData*>(elem->call_data);
55
54
  bool expected = false;
56
55
  if (!calld->filled_metadata.compare_exchange_strong(
@@ -62,9 +61,9 @@ static void fill_metadata(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
62
61
  char tmp[GPR_LTOA_MIN_BUFSIZE];
63
62
  gpr_ltoa(chand->error_code, tmp);
64
63
  calld->status.md = grpc_mdelem_from_slices(
65
- exec_ctx, GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(tmp));
64
+ GRPC_MDSTR_GRPC_STATUS, grpc_slice_from_copied_string(tmp));
66
65
  calld->details.md = grpc_mdelem_from_slices(
67
- exec_ctx, GRPC_MDSTR_GRPC_MESSAGE,
66
+ GRPC_MDSTR_GRPC_MESSAGE,
68
67
  grpc_slice_from_copied_string(chand->error_message));
69
68
  calld->status.prev = calld->details.next = nullptr;
70
69
  calld->status.next = &calld->details;
@@ -76,75 +75,73 @@ static void fill_metadata(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
76
75
  }
77
76
 
78
77
  static void lame_start_transport_stream_op_batch(
79
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
80
- grpc_transport_stream_op_batch* op) {
78
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
81
79
  CallData* calld = reinterpret_cast<CallData*>(elem->call_data);
82
80
  if (op->recv_initial_metadata) {
83
- fill_metadata(exec_ctx, elem,
81
+ fill_metadata(elem,
84
82
  op->payload->recv_initial_metadata.recv_initial_metadata);
85
83
  } else if (op->recv_trailing_metadata) {
86
- fill_metadata(exec_ctx, elem,
84
+ fill_metadata(elem,
87
85
  op->payload->recv_trailing_metadata.recv_trailing_metadata);
88
86
  }
89
87
  grpc_transport_stream_op_batch_finish_with_failure(
90
- exec_ctx, op, GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel"),
88
+ op, GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel"),
91
89
  calld->call_combiner);
92
90
  }
93
91
 
94
- static void lame_get_channel_info(grpc_exec_ctx* exec_ctx,
95
- grpc_channel_element* elem,
92
+ static void lame_get_channel_info(grpc_channel_element* elem,
96
93
  const grpc_channel_info* channel_info) {}
97
94
 
98
- static void lame_start_transport_op(grpc_exec_ctx* exec_ctx,
99
- grpc_channel_element* elem,
95
+ static void lame_start_transport_op(grpc_channel_element* elem,
100
96
  grpc_transport_op* op) {
101
97
  if (op->on_connectivity_state_change) {
102
98
  GPR_ASSERT(*op->connectivity_state != GRPC_CHANNEL_SHUTDOWN);
103
99
  *op->connectivity_state = GRPC_CHANNEL_SHUTDOWN;
104
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_connectivity_state_change,
105
- GRPC_ERROR_NONE);
100
+ GRPC_CLOSURE_SCHED(op->on_connectivity_state_change, GRPC_ERROR_NONE);
106
101
  }
107
- if (op->send_ping != nullptr) {
102
+ if (op->send_ping.on_initiate != nullptr) {
108
103
  GRPC_CLOSURE_SCHED(
109
- exec_ctx, op->send_ping,
104
+ op->send_ping.on_initiate,
105
+ GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel"));
106
+ }
107
+ if (op->send_ping.on_ack != nullptr) {
108
+ GRPC_CLOSURE_SCHED(
109
+ op->send_ping.on_ack,
110
110
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("lame client channel"));
111
111
  }
112
112
  GRPC_ERROR_UNREF(op->disconnect_with_error);
113
113
  if (op->on_consumed != nullptr) {
114
- GRPC_CLOSURE_SCHED(exec_ctx, op->on_consumed, GRPC_ERROR_NONE);
114
+ GRPC_CLOSURE_SCHED(op->on_consumed, GRPC_ERROR_NONE);
115
115
  }
116
116
  }
117
117
 
118
- static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
119
- grpc_call_element* elem,
118
+ static grpc_error* init_call_elem(grpc_call_element* elem,
120
119
  const grpc_call_element_args* args) {
121
120
  CallData* calld = reinterpret_cast<CallData*>(elem->call_data);
122
121
  calld->call_combiner = args->call_combiner;
123
122
  return GRPC_ERROR_NONE;
124
123
  }
125
124
 
126
- static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
125
+ static void destroy_call_elem(grpc_call_element* elem,
127
126
  const grpc_call_final_info* final_info,
128
127
  grpc_closure* then_schedule_closure) {
129
- GRPC_CLOSURE_SCHED(exec_ctx, then_schedule_closure, GRPC_ERROR_NONE);
128
+ GRPC_CLOSURE_SCHED(then_schedule_closure, GRPC_ERROR_NONE);
130
129
  }
131
130
 
132
- static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
133
- grpc_channel_element* elem,
131
+ static grpc_error* init_channel_elem(grpc_channel_element* elem,
134
132
  grpc_channel_element_args* args) {
135
133
  GPR_ASSERT(args->is_first);
136
134
  GPR_ASSERT(args->is_last);
137
135
  return GRPC_ERROR_NONE;
138
136
  }
139
137
 
140
- static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
141
- grpc_channel_element* elem) {}
138
+ static void destroy_channel_elem(grpc_channel_element* elem) {}
142
139
 
143
140
  } // namespace
144
141
 
145
142
  } // namespace grpc_core
146
143
 
147
- extern "C" const grpc_channel_filter grpc_lame_filter = {
144
+ const grpc_channel_filter grpc_lame_filter = {
148
145
  grpc_core::lame_start_transport_stream_op_batch,
149
146
  grpc_core::lame_start_transport_op,
150
147
  sizeof(grpc_core::CallData),
@@ -163,10 +160,10 @@ extern "C" const grpc_channel_filter grpc_lame_filter = {
163
160
  grpc_channel* grpc_lame_client_channel_create(const char* target,
164
161
  grpc_status_code error_code,
165
162
  const char* error_message) {
166
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
163
+ grpc_core::ExecCtx exec_ctx;
167
164
  grpc_channel_element* elem;
168
- grpc_channel* channel = grpc_channel_create(
169
- &exec_ctx, target, nullptr, GRPC_CLIENT_LAME_CHANNEL, nullptr);
165
+ grpc_channel* channel =
166
+ grpc_channel_create(target, nullptr, GRPC_CLIENT_LAME_CHANNEL, nullptr);
170
167
  elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
171
168
  GRPC_API_TRACE(
172
169
  "grpc_lame_client_channel_create(target=%s, error_code=%d, "
@@ -176,6 +173,6 @@ grpc_channel* grpc_lame_client_channel_create(const char* target,
176
173
  auto chand = reinterpret_cast<grpc_core::ChannelData*>(elem->channel_data);
177
174
  chand->error_code = error_code;
178
175
  chand->error_message = error_message;
179
- grpc_exec_ctx_finish(&exec_ctx);
176
+
180
177
  return channel;
181
178
  }
@@ -21,14 +21,6 @@
21
21
 
22
22
  #include "src/core/lib/channel/channel_stack.h"
23
23
 
24
- #ifdef __cplusplus
25
- extern "C" {
26
- #endif
27
-
28
24
  extern const grpc_channel_filter grpc_lame_filter;
29
25
 
30
- #ifdef __cplusplus
31
- }
32
- #endif
33
-
34
26
  #endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */
@@ -30,12 +30,12 @@
30
30
  #include "src/core/lib/channel/channel_args.h"
31
31
  #include "src/core/lib/channel/connected_channel.h"
32
32
  #include "src/core/lib/debug/stats.h"
33
+ #include "src/core/lib/gpr/mpscq.h"
34
+ #include "src/core/lib/gpr/spinlock.h"
35
+ #include "src/core/lib/gpr/string.h"
33
36
  #include "src/core/lib/iomgr/executor.h"
34
37
  #include "src/core/lib/iomgr/iomgr.h"
35
38
  #include "src/core/lib/slice/slice_internal.h"
36
- #include "src/core/lib/support/mpscq.h"
37
- #include "src/core/lib/support/spinlock.h"
38
- #include "src/core/lib/support/string.h"
39
39
  #include "src/core/lib/surface/api_trace.h"
40
40
  #include "src/core/lib/surface/call.h"
41
41
  #include "src/core/lib/surface/channel.h"
@@ -44,25 +44,23 @@
44
44
  #include "src/core/lib/transport/metadata.h"
45
45
  #include "src/core/lib/transport/static_metadata.h"
46
46
 
47
- typedef struct listener {
47
+ grpc_core::TraceFlag grpc_server_channel_trace(false, "server_channel");
48
+
49
+ namespace {
50
+ struct listener {
48
51
  void* arg;
49
- void (*start)(grpc_exec_ctx* exec_ctx, grpc_server* server, void* arg,
50
- grpc_pollset** pollsets, size_t pollset_count);
51
- void (*destroy)(grpc_exec_ctx* exec_ctx, grpc_server* server, void* arg,
52
- grpc_closure* closure);
52
+ void (*start)(grpc_server* server, void* arg, grpc_pollset** pollsets,
53
+ size_t pollset_count);
54
+ void (*destroy)(grpc_server* server, void* arg, grpc_closure* closure);
53
55
  struct listener* next;
54
56
  grpc_closure destroy_done;
55
- } listener;
56
-
57
- typedef struct call_data call_data;
58
- typedef struct channel_data channel_data;
59
- typedef struct registered_method registered_method;
57
+ };
60
58
 
61
- typedef enum { BATCH_CALL, REGISTERED_CALL } requested_call_type;
59
+ enum requested_call_type { BATCH_CALL, REGISTERED_CALL };
62
60
 
63
- grpc_core::TraceFlag grpc_server_channel_trace(false, "server_channel");
61
+ struct registered_method;
64
62
 
65
- typedef struct requested_call {
63
+ struct requested_call {
66
64
  gpr_mpscq_node request_link; /* must be first */
67
65
  requested_call_type type;
68
66
  size_t cq_idx;
@@ -82,15 +80,15 @@ typedef struct requested_call {
82
80
  grpc_byte_buffer** optional_payload;
83
81
  } registered;
84
82
  } data;
85
- } requested_call;
83
+ };
86
84
 
87
- typedef struct channel_registered_method {
85
+ struct channel_registered_method {
88
86
  registered_method* server_registered_method;
89
87
  uint32_t flags;
90
88
  bool has_host;
91
89
  grpc_slice method;
92
90
  grpc_slice host;
93
- } channel_registered_method;
91
+ };
94
92
 
95
93
  struct channel_data {
96
94
  grpc_server* server;
@@ -177,6 +175,7 @@ typedef struct {
177
175
  grpc_channel** channels;
178
176
  size_t num_channels;
179
177
  } channel_broadcaster;
178
+ } // namespace
180
179
 
181
180
  struct grpc_server {
182
181
  grpc_channel_args* channel_args;
@@ -224,13 +223,12 @@ struct grpc_server {
224
223
  #define SERVER_FROM_CALL_ELEM(elem) \
225
224
  (((channel_data*)(elem)->channel_data)->server)
226
225
 
227
- static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* calld,
228
- grpc_error* error);
229
- static void fail_call(grpc_exec_ctx* exec_ctx, grpc_server* server,
230
- size_t cq_idx, requested_call* rc, grpc_error* error);
226
+ static void publish_new_rpc(void* calld, grpc_error* error);
227
+ static void fail_call(grpc_server* server, size_t cq_idx, requested_call* rc,
228
+ grpc_error* error);
231
229
  /* Before calling maybe_finish_shutdown, we must hold mu_global and not
232
230
  hold mu_call */
233
- static void maybe_finish_shutdown(grpc_exec_ctx* exec_ctx, grpc_server* server);
231
+ static void maybe_finish_shutdown(grpc_server* server);
234
232
 
235
233
  /*
236
234
  * channel broadcaster
@@ -258,15 +256,14 @@ struct shutdown_cleanup_args {
258
256
  grpc_slice slice;
259
257
  };
260
258
 
261
- static void shutdown_cleanup(grpc_exec_ctx* exec_ctx, void* arg,
262
- grpc_error* error) {
259
+ static void shutdown_cleanup(void* arg, grpc_error* error) {
263
260
  struct shutdown_cleanup_args* a = (struct shutdown_cleanup_args*)arg;
264
- grpc_slice_unref_internal(exec_ctx, a->slice);
261
+ grpc_slice_unref_internal(a->slice);
265
262
  gpr_free(a);
266
263
  }
267
264
 
268
- static void send_shutdown(grpc_exec_ctx* exec_ctx, grpc_channel* channel,
269
- bool send_goaway, grpc_error* send_disconnect) {
265
+ static void send_shutdown(grpc_channel* channel, bool send_goaway,
266
+ grpc_error* send_disconnect) {
270
267
  struct shutdown_cleanup_args* sc =
271
268
  (struct shutdown_cleanup_args*)gpr_malloc(sizeof(*sc));
272
269
  GRPC_CLOSURE_INIT(&sc->closure, shutdown_cleanup, sc,
@@ -284,19 +281,18 @@ static void send_shutdown(grpc_exec_ctx* exec_ctx, grpc_channel* channel,
284
281
  op->disconnect_with_error = send_disconnect;
285
282
 
286
283
  elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0);
287
- elem->filter->start_transport_op(exec_ctx, elem, op);
284
+ elem->filter->start_transport_op(elem, op);
288
285
  }
289
286
 
290
- static void channel_broadcaster_shutdown(grpc_exec_ctx* exec_ctx,
291
- channel_broadcaster* cb,
287
+ static void channel_broadcaster_shutdown(channel_broadcaster* cb,
292
288
  bool send_goaway,
293
289
  grpc_error* force_disconnect) {
294
290
  size_t i;
295
291
 
296
292
  for (i = 0; i < cb->num_channels; i++) {
297
- send_shutdown(exec_ctx, cb->channels[i], send_goaway,
293
+ send_shutdown(cb->channels[i], send_goaway,
298
294
  GRPC_ERROR_REF(force_disconnect));
299
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, cb->channels[i], "broadcast");
295
+ GRPC_CHANNEL_INTERNAL_UNREF(cb->channels[i], "broadcast");
300
296
  }
301
297
  gpr_free(cb->channels);
302
298
  GRPC_ERROR_UNREF(force_disconnect);
@@ -324,13 +320,11 @@ static void request_matcher_destroy(request_matcher* rm) {
324
320
  gpr_free(rm->requests_per_cq);
325
321
  }
326
322
 
327
- static void kill_zombie(grpc_exec_ctx* exec_ctx, void* elem,
328
- grpc_error* error) {
323
+ static void kill_zombie(void* elem, grpc_error* error) {
329
324
  grpc_call_unref(grpc_call_from_top_element((grpc_call_element*)elem));
330
325
  }
331
326
 
332
- static void request_matcher_zombify_all_pending_calls(grpc_exec_ctx* exec_ctx,
333
- request_matcher* rm) {
327
+ static void request_matcher_zombify_all_pending_calls(request_matcher* rm) {
334
328
  while (rm->pending_head) {
335
329
  call_data* calld = rm->pending_head;
336
330
  rm->pending_head = calld->pending_next;
@@ -339,19 +333,18 @@ static void request_matcher_zombify_all_pending_calls(grpc_exec_ctx* exec_ctx,
339
333
  &calld->kill_zombie_closure, kill_zombie,
340
334
  grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0),
341
335
  grpc_schedule_on_exec_ctx);
342
- GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE);
336
+ GRPC_CLOSURE_SCHED(&calld->kill_zombie_closure, GRPC_ERROR_NONE);
343
337
  }
344
338
  }
345
339
 
346
- static void request_matcher_kill_requests(grpc_exec_ctx* exec_ctx,
347
- grpc_server* server,
340
+ static void request_matcher_kill_requests(grpc_server* server,
348
341
  request_matcher* rm,
349
342
  grpc_error* error) {
350
343
  requested_call* rc;
351
344
  for (size_t i = 0; i < server->cq_count; i++) {
352
345
  while ((rc = (requested_call*)gpr_locked_mpscq_pop(
353
346
  &rm->requests_per_cq[i])) != nullptr) {
354
- fail_call(exec_ctx, server, i, rc, GRPC_ERROR_REF(error));
347
+ fail_call(server, i, rc, GRPC_ERROR_REF(error));
355
348
  }
356
349
  }
357
350
  GRPC_ERROR_UNREF(error);
@@ -365,10 +358,10 @@ static void server_ref(grpc_server* server) {
365
358
  gpr_ref(&server->internal_refcount);
366
359
  }
367
360
 
368
- static void server_delete(grpc_exec_ctx* exec_ctx, grpc_server* server) {
361
+ static void server_delete(grpc_server* server) {
369
362
  registered_method* rm;
370
363
  size_t i;
371
- grpc_channel_args_destroy(exec_ctx, server->channel_args);
364
+ grpc_channel_args_destroy(server->channel_args);
372
365
  gpr_mu_destroy(&server->mu_global);
373
366
  gpr_mu_destroy(&server->mu_call);
374
367
  gpr_cv_destroy(&server->starting_cv);
@@ -385,7 +378,7 @@ static void server_delete(grpc_exec_ctx* exec_ctx, grpc_server* server) {
385
378
  request_matcher_destroy(&server->unregistered_request_matcher);
386
379
  }
387
380
  for (i = 0; i < server->cq_count; i++) {
388
- GRPC_CQ_INTERNAL_UNREF(exec_ctx, server->cqs[i], "server");
381
+ GRPC_CQ_INTERNAL_UNREF(server->cqs[i], "server");
389
382
  }
390
383
  gpr_free(server->cqs);
391
384
  gpr_free(server->pollsets);
@@ -393,9 +386,9 @@ static void server_delete(grpc_exec_ctx* exec_ctx, grpc_server* server) {
393
386
  gpr_free(server);
394
387
  }
395
388
 
396
- static void server_unref(grpc_exec_ctx* exec_ctx, grpc_server* server) {
389
+ static void server_unref(grpc_server* server) {
397
390
  if (gpr_unref(&server->internal_refcount)) {
398
- server_delete(exec_ctx, server);
391
+ server_delete(server);
399
392
  }
400
393
  }
401
394
 
@@ -409,21 +402,19 @@ static void orphan_channel(channel_data* chand) {
409
402
  chand->next = chand->prev = chand;
410
403
  }
411
404
 
412
- static void finish_destroy_channel(grpc_exec_ctx* exec_ctx, void* cd,
413
- grpc_error* error) {
405
+ static void finish_destroy_channel(void* cd, grpc_error* error) {
414
406
  channel_data* chand = (channel_data*)cd;
415
407
  grpc_server* server = chand->server;
416
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, chand->channel, "server");
417
- server_unref(exec_ctx, server);
408
+ GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "server");
409
+ server_unref(server);
418
410
  }
419
411
 
420
- static void destroy_channel(grpc_exec_ctx* exec_ctx, channel_data* chand,
421
- grpc_error* error) {
412
+ static void destroy_channel(channel_data* chand, grpc_error* error) {
422
413
  if (is_channel_orphaned(chand)) return;
423
414
  GPR_ASSERT(chand->server != nullptr);
424
415
  orphan_channel(chand);
425
416
  server_ref(chand->server);
426
- maybe_finish_shutdown(exec_ctx, chand->server);
417
+ maybe_finish_shutdown(chand->server);
427
418
  GRPC_CLOSURE_INIT(&chand->finish_destroy_channel_closure,
428
419
  finish_destroy_channel, chand, grpc_schedule_on_exec_ctx);
429
420
 
@@ -436,20 +427,18 @@ static void destroy_channel(grpc_exec_ctx* exec_ctx, channel_data* chand,
436
427
  grpc_transport_op* op =
437
428
  grpc_make_transport_op(&chand->finish_destroy_channel_closure);
438
429
  op->set_accept_stream = true;
439
- grpc_channel_next_op(exec_ctx,
440
- grpc_channel_stack_element(
430
+ grpc_channel_next_op(grpc_channel_stack_element(
441
431
  grpc_channel_get_channel_stack(chand->channel), 0),
442
432
  op);
443
433
  }
444
434
 
445
- static void done_request_event(grpc_exec_ctx* exec_ctx, void* req,
446
- grpc_cq_completion* c) {
435
+ static void done_request_event(void* req, grpc_cq_completion* c) {
447
436
  gpr_free(req);
448
437
  }
449
438
 
450
- static void publish_call(grpc_exec_ctx* exec_ctx, grpc_server* server,
451
- call_data* calld, size_t cq_idx, requested_call* rc) {
452
- grpc_call_set_completion_queue(exec_ctx, calld->call, rc->cq_bound_to_call);
439
+ static void publish_call(grpc_server* server, call_data* calld, size_t cq_idx,
440
+ requested_call* rc) {
441
+ grpc_call_set_completion_queue(calld->call, rc->cq_bound_to_call);
453
442
  grpc_call* call = calld->call;
454
443
  *rc->call = call;
455
444
  calld->cq_new = server->cqs[cq_idx];
@@ -476,12 +465,11 @@ static void publish_call(grpc_exec_ctx* exec_ctx, grpc_server* server,
476
465
  GPR_UNREACHABLE_CODE(return );
477
466
  }
478
467
 
479
- grpc_cq_end_op(exec_ctx, calld->cq_new, rc->tag, GRPC_ERROR_NONE,
480
- done_request_event, rc, &rc->completion);
468
+ grpc_cq_end_op(calld->cq_new, rc->tag, GRPC_ERROR_NONE, done_request_event,
469
+ rc, &rc->completion);
481
470
  }
482
471
 
483
- static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* arg,
484
- grpc_error* error) {
472
+ static void publish_new_rpc(void* arg, grpc_error* error) {
485
473
  grpc_call_element* call_elem = (grpc_call_element*)arg;
486
474
  call_data* calld = (call_data*)call_elem->call_data;
487
475
  channel_data* chand = (channel_data*)call_elem->channel_data;
@@ -494,8 +482,7 @@ static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* arg,
494
482
  &calld->kill_zombie_closure, kill_zombie,
495
483
  grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0),
496
484
  grpc_schedule_on_exec_ctx);
497
- GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure,
498
- GRPC_ERROR_REF(error));
485
+ GRPC_CLOSURE_SCHED(&calld->kill_zombie_closure, GRPC_ERROR_REF(error));
499
486
  return;
500
487
  }
501
488
 
@@ -506,15 +493,15 @@ static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* arg,
506
493
  if (rc == nullptr) {
507
494
  continue;
508
495
  } else {
509
- GRPC_STATS_INC_SERVER_CQS_CHECKED(exec_ctx, i);
496
+ GRPC_STATS_INC_SERVER_CQS_CHECKED(i);
510
497
  gpr_atm_no_barrier_store(&calld->state, ACTIVATED);
511
- publish_call(exec_ctx, server, calld, cq_idx, rc);
498
+ publish_call(server, calld, cq_idx, rc);
512
499
  return; /* early out */
513
500
  }
514
501
  }
515
502
 
516
503
  /* no cq to take the request found: queue it on the slow list */
517
- GRPC_STATS_INC_SERVER_SLOWPATH_REQUESTS_QUEUED(exec_ctx);
504
+ GRPC_STATS_INC_SERVER_SLOWPATH_REQUESTS_QUEUED();
518
505
  gpr_mu_lock(&server->mu_call);
519
506
 
520
507
  // We need to ensure that all the queues are empty. We do this under
@@ -529,9 +516,9 @@ static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* arg,
529
516
  continue;
530
517
  } else {
531
518
  gpr_mu_unlock(&server->mu_call);
532
- GRPC_STATS_INC_SERVER_CQS_CHECKED(exec_ctx, i + server->cq_count);
519
+ GRPC_STATS_INC_SERVER_CQS_CHECKED(i + server->cq_count);
533
520
  gpr_atm_no_barrier_store(&calld->state, ACTIVATED);
534
- publish_call(exec_ctx, server, calld, cq_idx, rc);
521
+ publish_call(server, calld, cq_idx, rc);
535
522
  return; /* early out */
536
523
  }
537
524
  }
@@ -548,8 +535,7 @@ static void publish_new_rpc(grpc_exec_ctx* exec_ctx, void* arg,
548
535
  }
549
536
 
550
537
  static void finish_start_new_rpc(
551
- grpc_exec_ctx* exec_ctx, grpc_server* server, grpc_call_element* elem,
552
- request_matcher* rm,
538
+ grpc_server* server, grpc_call_element* elem, request_matcher* rm,
553
539
  grpc_server_register_method_payload_handling payload_handling) {
554
540
  call_data* calld = (call_data*)elem->call_data;
555
541
 
@@ -557,7 +543,7 @@ static void finish_start_new_rpc(
557
543
  gpr_atm_no_barrier_store(&calld->state, ZOMBIED);
558
544
  GRPC_CLOSURE_INIT(&calld->kill_zombie_closure, kill_zombie, elem,
559
545
  grpc_schedule_on_exec_ctx);
560
- GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure, GRPC_ERROR_NONE);
546
+ GRPC_CLOSURE_SCHED(&calld->kill_zombie_closure, GRPC_ERROR_NONE);
561
547
  return;
562
548
  }
563
549
 
@@ -565,7 +551,7 @@ static void finish_start_new_rpc(
565
551
 
566
552
  switch (payload_handling) {
567
553
  case GRPC_SRM_PAYLOAD_NONE:
568
- publish_new_rpc(exec_ctx, elem, GRPC_ERROR_NONE);
554
+ publish_new_rpc(elem, GRPC_ERROR_NONE);
569
555
  break;
570
556
  case GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER: {
571
557
  grpc_op op;
@@ -574,14 +560,13 @@ static void finish_start_new_rpc(
574
560
  op.data.recv_message.recv_message = &calld->payload;
575
561
  GRPC_CLOSURE_INIT(&calld->publish, publish_new_rpc, elem,
576
562
  grpc_schedule_on_exec_ctx);
577
- grpc_call_start_batch_and_execute(exec_ctx, calld->call, &op, 1,
578
- &calld->publish);
563
+ grpc_call_start_batch_and_execute(calld->call, &op, 1, &calld->publish);
579
564
  break;
580
565
  }
581
566
  }
582
567
  }
583
568
 
584
- static void start_new_rpc(grpc_exec_ctx* exec_ctx, grpc_call_element* elem) {
569
+ static void start_new_rpc(grpc_call_element* elem) {
585
570
  channel_data* chand = (channel_data*)elem->channel_data;
586
571
  call_data* calld = (call_data*)elem->call_data;
587
572
  grpc_server* server = chand->server;
@@ -606,8 +591,7 @@ static void start_new_rpc(grpc_exec_ctx* exec_ctx, grpc_call_element* elem) {
606
591
  GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST)) {
607
592
  continue;
608
593
  }
609
- finish_start_new_rpc(exec_ctx, server, elem,
610
- &rm->server_registered_method->matcher,
594
+ finish_start_new_rpc(server, elem, &rm->server_registered_method->matcher,
611
595
  rm->server_registered_method->payload_handling);
612
596
  return;
613
597
  }
@@ -624,14 +608,12 @@ static void start_new_rpc(grpc_exec_ctx* exec_ctx, grpc_call_element* elem) {
624
608
  GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST)) {
625
609
  continue;
626
610
  }
627
- finish_start_new_rpc(exec_ctx, server, elem,
628
- &rm->server_registered_method->matcher,
611
+ finish_start_new_rpc(server, elem, &rm->server_registered_method->matcher,
629
612
  rm->server_registered_method->payload_handling);
630
613
  return;
631
614
  }
632
615
  }
633
- finish_start_new_rpc(exec_ctx, server, elem,
634
- &server->unregistered_request_matcher,
616
+ finish_start_new_rpc(server, elem, &server->unregistered_request_matcher,
635
617
  GRPC_SRM_PAYLOAD_NONE);
636
618
  }
637
619
 
@@ -644,9 +626,8 @@ static int num_listeners(grpc_server* server) {
644
626
  return n;
645
627
  }
646
628
 
647
- static void done_shutdown_event(grpc_exec_ctx* exec_ctx, void* server,
648
- grpc_cq_completion* completion) {
649
- server_unref(exec_ctx, (grpc_server*)server);
629
+ static void done_shutdown_event(void* server, grpc_cq_completion* completion) {
630
+ server_unref((grpc_server*)server);
650
631
  }
651
632
 
652
633
  static int num_channels(grpc_server* server) {
@@ -659,34 +640,30 @@ static int num_channels(grpc_server* server) {
659
640
  return n;
660
641
  }
661
642
 
662
- static void kill_pending_work_locked(grpc_exec_ctx* exec_ctx,
663
- grpc_server* server, grpc_error* error) {
643
+ static void kill_pending_work_locked(grpc_server* server, grpc_error* error) {
664
644
  if (server->started) {
665
- request_matcher_kill_requests(exec_ctx, server,
666
- &server->unregistered_request_matcher,
645
+ request_matcher_kill_requests(server, &server->unregistered_request_matcher,
667
646
  GRPC_ERROR_REF(error));
668
647
  request_matcher_zombify_all_pending_calls(
669
- exec_ctx, &server->unregistered_request_matcher);
648
+ &server->unregistered_request_matcher);
670
649
  for (registered_method* rm = server->registered_methods; rm;
671
650
  rm = rm->next) {
672
- request_matcher_kill_requests(exec_ctx, server, &rm->matcher,
651
+ request_matcher_kill_requests(server, &rm->matcher,
673
652
  GRPC_ERROR_REF(error));
674
- request_matcher_zombify_all_pending_calls(exec_ctx, &rm->matcher);
653
+ request_matcher_zombify_all_pending_calls(&rm->matcher);
675
654
  }
676
655
  }
677
656
  GRPC_ERROR_UNREF(error);
678
657
  }
679
658
 
680
- static void maybe_finish_shutdown(grpc_exec_ctx* exec_ctx,
681
- grpc_server* server) {
659
+ static void maybe_finish_shutdown(grpc_server* server) {
682
660
  size_t i;
683
661
  if (!gpr_atm_acq_load(&server->shutdown_flag) || server->shutdown_published) {
684
662
  return;
685
663
  }
686
664
 
687
665
  kill_pending_work_locked(
688
- exec_ctx, server,
689
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
666
+ server, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
690
667
 
691
668
  if (server->root_channel_data.next != &server->root_channel_data ||
692
669
  server->listeners_destroyed < num_listeners(server)) {
@@ -706,15 +683,13 @@ static void maybe_finish_shutdown(grpc_exec_ctx* exec_ctx,
706
683
  server->shutdown_published = 1;
707
684
  for (i = 0; i < server->num_shutdown_tags; i++) {
708
685
  server_ref(server);
709
- grpc_cq_end_op(exec_ctx, server->shutdown_tags[i].cq,
710
- server->shutdown_tags[i].tag, GRPC_ERROR_NONE,
711
- done_shutdown_event, server,
686
+ grpc_cq_end_op(server->shutdown_tags[i].cq, server->shutdown_tags[i].tag,
687
+ GRPC_ERROR_NONE, done_shutdown_event, server,
712
688
  &server->shutdown_tags[i].completion);
713
689
  }
714
690
  }
715
691
 
716
- static void server_on_recv_initial_metadata(grpc_exec_ctx* exec_ctx, void* ptr,
717
- grpc_error* error) {
692
+ static void server_on_recv_initial_metadata(void* ptr, grpc_error* error) {
718
693
  grpc_call_element* elem = (grpc_call_element*)ptr;
719
694
  call_data* calld = (call_data*)elem->call_data;
720
695
  grpc_millis op_deadline;
@@ -728,10 +703,10 @@ static void server_on_recv_initial_metadata(grpc_exec_ctx* exec_ctx, void* ptr,
728
703
  GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
729
704
  calld->path_set = true;
730
705
  calld->host_set = true;
731
- grpc_metadata_batch_remove(exec_ctx, calld->recv_initial_metadata,
706
+ grpc_metadata_batch_remove(calld->recv_initial_metadata,
732
707
  calld->recv_initial_metadata->idx.named.path);
733
708
  grpc_metadata_batch_remove(
734
- exec_ctx, calld->recv_initial_metadata,
709
+ calld->recv_initial_metadata,
735
710
  calld->recv_initial_metadata->idx.named.authority);
736
711
  } else {
737
712
  GRPC_ERROR_REF(error);
@@ -749,7 +724,7 @@ static void server_on_recv_initial_metadata(grpc_exec_ctx* exec_ctx, void* ptr,
749
724
  GRPC_ERROR_UNREF(src_error);
750
725
  }
751
726
 
752
- GRPC_CLOSURE_RUN(exec_ctx, calld->on_done_recv_initial_metadata, error);
727
+ GRPC_CLOSURE_RUN(calld->on_done_recv_initial_metadata, error);
753
728
  }
754
729
 
755
730
  static void server_mutate_op(grpc_call_element* elem,
@@ -770,24 +745,21 @@ static void server_mutate_op(grpc_call_element* elem,
770
745
  }
771
746
 
772
747
  static void server_start_transport_stream_op_batch(
773
- grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
774
- grpc_transport_stream_op_batch* op) {
748
+ grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
775
749
  server_mutate_op(elem, op);
776
- grpc_call_next_op(exec_ctx, elem, op);
750
+ grpc_call_next_op(elem, op);
777
751
  }
778
752
 
779
- static void got_initial_metadata(grpc_exec_ctx* exec_ctx, void* ptr,
780
- grpc_error* error) {
753
+ static void got_initial_metadata(void* ptr, grpc_error* error) {
781
754
  grpc_call_element* elem = (grpc_call_element*)ptr;
782
755
  call_data* calld = (call_data*)elem->call_data;
783
756
  if (error == GRPC_ERROR_NONE) {
784
- start_new_rpc(exec_ctx, elem);
757
+ start_new_rpc(elem);
785
758
  } else {
786
759
  if (gpr_atm_full_cas(&calld->state, NOT_STARTED, ZOMBIED)) {
787
760
  GRPC_CLOSURE_INIT(&calld->kill_zombie_closure, kill_zombie, elem,
788
761
  grpc_schedule_on_exec_ctx);
789
- GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure,
790
- GRPC_ERROR_NONE);
762
+ GRPC_CLOSURE_SCHED(&calld->kill_zombie_closure, GRPC_ERROR_NONE);
791
763
  } else if (gpr_atm_full_cas(&calld->state, PENDING, ZOMBIED)) {
792
764
  /* zombied call will be destroyed when it's removed from the pending
793
765
  queue... later */
@@ -795,8 +767,7 @@ static void got_initial_metadata(grpc_exec_ctx* exec_ctx, void* ptr,
795
767
  }
796
768
  }
797
769
 
798
- static void accept_stream(grpc_exec_ctx* exec_ctx, void* cd,
799
- grpc_transport* transport,
770
+ static void accept_stream(void* cd, grpc_transport* transport,
800
771
  const void* transport_server_data) {
801
772
  channel_data* chand = (channel_data*)cd;
802
773
  /* create a call */
@@ -806,11 +777,11 @@ static void accept_stream(grpc_exec_ctx* exec_ctx, void* cd,
806
777
  args.server_transport_data = transport_server_data;
807
778
  args.send_deadline = GRPC_MILLIS_INF_FUTURE;
808
779
  grpc_call* call;
809
- grpc_error* error = grpc_call_create(exec_ctx, &args, &call);
780
+ grpc_error* error = grpc_call_create(&args, &call);
810
781
  grpc_call_element* elem =
811
782
  grpc_call_stack_element(grpc_call_get_call_stack(call), 0);
812
783
  if (error != GRPC_ERROR_NONE) {
813
- got_initial_metadata(exec_ctx, elem, error);
784
+ got_initial_metadata(elem, error);
814
785
  GRPC_ERROR_UNREF(error);
815
786
  return;
816
787
  }
@@ -822,32 +793,28 @@ static void accept_stream(grpc_exec_ctx* exec_ctx, void* cd,
822
793
  &calld->initial_metadata;
823
794
  GRPC_CLOSURE_INIT(&calld->got_initial_metadata, got_initial_metadata, elem,
824
795
  grpc_schedule_on_exec_ctx);
825
- grpc_call_start_batch_and_execute(exec_ctx, call, &op, 1,
826
- &calld->got_initial_metadata);
796
+ grpc_call_start_batch_and_execute(call, &op, 1, &calld->got_initial_metadata);
827
797
  }
828
798
 
829
- static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* cd,
830
- grpc_error* error) {
799
+ static void channel_connectivity_changed(void* cd, grpc_error* error) {
831
800
  channel_data* chand = (channel_data*)cd;
832
801
  grpc_server* server = chand->server;
833
802
  if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
834
803
  grpc_transport_op* op = grpc_make_transport_op(nullptr);
835
804
  op->on_connectivity_state_change = &chand->channel_connectivity_changed;
836
805
  op->connectivity_state = &chand->connectivity_state;
837
- grpc_channel_next_op(exec_ctx,
838
- grpc_channel_stack_element(
806
+ grpc_channel_next_op(grpc_channel_stack_element(
839
807
  grpc_channel_get_channel_stack(chand->channel), 0),
840
808
  op);
841
809
  } else {
842
810
  gpr_mu_lock(&server->mu_global);
843
- destroy_channel(exec_ctx, chand, GRPC_ERROR_REF(error));
811
+ destroy_channel(chand, GRPC_ERROR_REF(error));
844
812
  gpr_mu_unlock(&server->mu_global);
845
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, chand->channel, "connectivity");
813
+ GRPC_CHANNEL_INTERNAL_UNREF(chand->channel, "connectivity");
846
814
  }
847
815
  }
848
816
 
849
- static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
850
- grpc_call_element* elem,
817
+ static grpc_error* init_call_elem(grpc_call_element* elem,
851
818
  const grpc_call_element_args* args) {
852
819
  call_data* calld = (call_data*)elem->call_data;
853
820
  channel_data* chand = (channel_data*)elem->channel_data;
@@ -863,7 +830,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
863
830
  return GRPC_ERROR_NONE;
864
831
  }
865
832
 
866
- static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
833
+ static void destroy_call_elem(grpc_call_element* elem,
867
834
  const grpc_call_final_info* final_info,
868
835
  grpc_closure* ignored) {
869
836
  channel_data* chand = (channel_data*)elem->channel_data;
@@ -872,19 +839,18 @@ static void destroy_call_elem(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
872
839
  GPR_ASSERT(calld->state != PENDING);
873
840
 
874
841
  if (calld->host_set) {
875
- grpc_slice_unref_internal(exec_ctx, calld->host);
842
+ grpc_slice_unref_internal(calld->host);
876
843
  }
877
844
  if (calld->path_set) {
878
- grpc_slice_unref_internal(exec_ctx, calld->path);
845
+ grpc_slice_unref_internal(calld->path);
879
846
  }
880
847
  grpc_metadata_array_destroy(&calld->initial_metadata);
881
848
  grpc_byte_buffer_destroy(calld->payload);
882
849
 
883
- server_unref(exec_ctx, chand->server);
850
+ server_unref(chand->server);
884
851
  }
885
852
 
886
- static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
887
- grpc_channel_element* elem,
853
+ static grpc_error* init_channel_elem(grpc_channel_element* elem,
888
854
  grpc_channel_element_args* args) {
889
855
  channel_data* chand = (channel_data*)elem->channel_data;
890
856
  GPR_ASSERT(args->is_first);
@@ -900,15 +866,14 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
900
866
  return GRPC_ERROR_NONE;
901
867
  }
902
868
 
903
- static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
904
- grpc_channel_element* elem) {
869
+ static void destroy_channel_elem(grpc_channel_element* elem) {
905
870
  size_t i;
906
871
  channel_data* chand = (channel_data*)elem->channel_data;
907
872
  if (chand->registered_methods) {
908
873
  for (i = 0; i < chand->registered_method_slots; i++) {
909
- grpc_slice_unref_internal(exec_ctx, chand->registered_methods[i].method);
874
+ grpc_slice_unref_internal(chand->registered_methods[i].method);
910
875
  if (chand->registered_methods[i].has_host) {
911
- grpc_slice_unref_internal(exec_ctx, chand->registered_methods[i].host);
876
+ grpc_slice_unref_internal(chand->registered_methods[i].host);
912
877
  }
913
878
  }
914
879
  gpr_free(chand->registered_methods);
@@ -918,9 +883,9 @@ static void destroy_channel_elem(grpc_exec_ctx* exec_ctx,
918
883
  chand->next->prev = chand->prev;
919
884
  chand->prev->next = chand->next;
920
885
  chand->next = chand->prev = chand;
921
- maybe_finish_shutdown(exec_ctx, chand->server);
886
+ maybe_finish_shutdown(chand->server);
922
887
  gpr_mu_unlock(&chand->server->mu_global);
923
- server_unref(exec_ctx, chand->server);
888
+ server_unref(chand->server);
924
889
  }
925
890
  }
926
891
 
@@ -1034,11 +999,10 @@ void* grpc_server_register_method(
1034
999
  return m;
1035
1000
  }
1036
1001
 
1037
- static void start_listeners(grpc_exec_ctx* exec_ctx, void* s,
1038
- grpc_error* error) {
1002
+ static void start_listeners(void* s, grpc_error* error) {
1039
1003
  grpc_server* server = (grpc_server*)s;
1040
1004
  for (listener* l = server->listeners; l; l = l->next) {
1041
- l->start(exec_ctx, server, l->arg, server->pollsets, server->pollset_count);
1005
+ l->start(server, l->arg, server->pollsets, server->pollset_count);
1042
1006
  }
1043
1007
 
1044
1008
  gpr_mu_lock(&server->mu_global);
@@ -1046,12 +1010,12 @@ static void start_listeners(grpc_exec_ctx* exec_ctx, void* s,
1046
1010
  gpr_cv_signal(&server->starting_cv);
1047
1011
  gpr_mu_unlock(&server->mu_global);
1048
1012
 
1049
- server_unref(exec_ctx, server);
1013
+ server_unref(server);
1050
1014
  }
1051
1015
 
1052
1016
  void grpc_server_start(grpc_server* server) {
1053
1017
  size_t i;
1054
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1018
+ grpc_core::ExecCtx exec_ctx;
1055
1019
 
1056
1020
  GRPC_API_TRACE("grpc_server_start(server=%p)", 1, (server));
1057
1021
 
@@ -1073,12 +1037,9 @@ void grpc_server_start(grpc_server* server) {
1073
1037
  server_ref(server);
1074
1038
  server->starting = true;
1075
1039
  GRPC_CLOSURE_SCHED(
1076
- &exec_ctx,
1077
1040
  GRPC_CLOSURE_CREATE(start_listeners, server,
1078
1041
  grpc_executor_scheduler(GRPC_EXECUTOR_SHORT)),
1079
1042
  GRPC_ERROR_NONE);
1080
-
1081
- grpc_exec_ctx_finish(&exec_ctx);
1082
1043
  }
1083
1044
 
1084
1045
  void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets,
@@ -1087,8 +1048,7 @@ void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets,
1087
1048
  *pollsets = server->pollsets;
1088
1049
  }
1089
1050
 
1090
- void grpc_server_setup_transport(grpc_exec_ctx* exec_ctx, grpc_server* s,
1091
- grpc_transport* transport,
1051
+ void grpc_server_setup_transport(grpc_server* s, grpc_transport* transport,
1092
1052
  grpc_pollset* accepting_pollset,
1093
1053
  const grpc_channel_args* args) {
1094
1054
  size_t num_registered_methods;
@@ -1103,8 +1063,7 @@ void grpc_server_setup_transport(grpc_exec_ctx* exec_ctx, grpc_server* s,
1103
1063
  uint32_t max_probes = 0;
1104
1064
  grpc_transport_op* op = nullptr;
1105
1065
 
1106
- channel = grpc_channel_create(exec_ctx, nullptr, args, GRPC_SERVER_CHANNEL,
1107
- transport);
1066
+ channel = grpc_channel_create(nullptr, args, GRPC_SERVER_CHANNEL, transport);
1108
1067
  chand = (channel_data*)grpc_channel_stack_element(
1109
1068
  grpc_channel_get_channel_stack(channel), 0)
1110
1069
  ->channel_data;
@@ -1181,21 +1140,19 @@ void grpc_server_setup_transport(grpc_exec_ctx* exec_ctx, grpc_server* s,
1181
1140
  op->disconnect_with_error =
1182
1141
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server shutdown");
1183
1142
  }
1184
- grpc_transport_perform_op(exec_ctx, transport, op);
1143
+ grpc_transport_perform_op(transport, op);
1185
1144
  }
1186
1145
 
1187
- void done_published_shutdown(grpc_exec_ctx* exec_ctx, void* done_arg,
1188
- grpc_cq_completion* storage) {
1146
+ void done_published_shutdown(void* done_arg, grpc_cq_completion* storage) {
1189
1147
  (void)done_arg;
1190
1148
  gpr_free(storage);
1191
1149
  }
1192
1150
 
1193
- static void listener_destroy_done(grpc_exec_ctx* exec_ctx, void* s,
1194
- grpc_error* error) {
1151
+ static void listener_destroy_done(void* s, grpc_error* error) {
1195
1152
  grpc_server* server = (grpc_server*)s;
1196
1153
  gpr_mu_lock(&server->mu_global);
1197
1154
  server->listeners_destroyed++;
1198
- maybe_finish_shutdown(exec_ctx, server);
1155
+ maybe_finish_shutdown(server);
1199
1156
  gpr_mu_unlock(&server->mu_global);
1200
1157
  }
1201
1158
 
@@ -1204,7 +1161,7 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
1204
1161
  listener* l;
1205
1162
  shutdown_tag* sdt;
1206
1163
  channel_broadcaster broadcaster;
1207
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1164
+ grpc_core::ExecCtx exec_ctx;
1208
1165
 
1209
1166
  GRPC_API_TRACE("grpc_server_shutdown_and_notify(server=%p, cq=%p, tag=%p)", 3,
1210
1167
  (server, cq, tag));
@@ -1213,17 +1170,16 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
1213
1170
  gpr_mu_lock(&server->mu_global);
1214
1171
  while (server->starting) {
1215
1172
  gpr_cv_wait(&server->starting_cv, &server->mu_global,
1216
- gpr_inf_future(GPR_CLOCK_REALTIME));
1173
+ gpr_inf_future(GPR_CLOCK_MONOTONIC));
1217
1174
  }
1218
1175
 
1219
1176
  /* stay locked, and gather up some stuff to do */
1220
1177
  GPR_ASSERT(grpc_cq_begin_op(cq, tag));
1221
1178
  if (server->shutdown_published) {
1222
- grpc_cq_end_op(&exec_ctx, cq, tag, GRPC_ERROR_NONE, done_published_shutdown,
1223
- nullptr,
1179
+ grpc_cq_end_op(cq, tag, GRPC_ERROR_NONE, done_published_shutdown, nullptr,
1224
1180
  (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion)));
1225
1181
  gpr_mu_unlock(&server->mu_global);
1226
- goto done;
1182
+ return;
1227
1183
  }
1228
1184
  server->shutdown_tags = (shutdown_tag*)gpr_realloc(
1229
1185
  server->shutdown_tags,
@@ -1233,7 +1189,7 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
1233
1189
  sdt->cq = cq;
1234
1190
  if (gpr_atm_acq_load(&server->shutdown_flag)) {
1235
1191
  gpr_mu_unlock(&server->mu_global);
1236
- goto done;
1192
+ return;
1237
1193
  }
1238
1194
 
1239
1195
  server->last_shutdown_message_time = gpr_now(GPR_CLOCK_REALTIME);
@@ -1245,30 +1201,26 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
1245
1201
  /* collect all unregistered then registered calls */
1246
1202
  gpr_mu_lock(&server->mu_call);
1247
1203
  kill_pending_work_locked(
1248
- &exec_ctx, server,
1249
- GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
1204
+ server, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
1250
1205
  gpr_mu_unlock(&server->mu_call);
1251
1206
 
1252
- maybe_finish_shutdown(&exec_ctx, server);
1207
+ maybe_finish_shutdown(server);
1253
1208
  gpr_mu_unlock(&server->mu_global);
1254
1209
 
1255
1210
  /* Shutdown listeners */
1256
1211
  for (l = server->listeners; l; l = l->next) {
1257
1212
  GRPC_CLOSURE_INIT(&l->destroy_done, listener_destroy_done, server,
1258
1213
  grpc_schedule_on_exec_ctx);
1259
- l->destroy(&exec_ctx, server, l->arg, &l->destroy_done);
1214
+ l->destroy(server, l->arg, &l->destroy_done);
1260
1215
  }
1261
1216
 
1262
- channel_broadcaster_shutdown(&exec_ctx, &broadcaster, true /* send_goaway */,
1217
+ channel_broadcaster_shutdown(&broadcaster, true /* send_goaway */,
1263
1218
  GRPC_ERROR_NONE);
1264
-
1265
- done:
1266
- grpc_exec_ctx_finish(&exec_ctx);
1267
1219
  }
1268
1220
 
1269
1221
  void grpc_server_cancel_all_calls(grpc_server* server) {
1270
1222
  channel_broadcaster broadcaster;
1271
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1223
+ grpc_core::ExecCtx exec_ctx;
1272
1224
 
1273
1225
  GRPC_API_TRACE("grpc_server_cancel_all_calls(server=%p)", 1, (server));
1274
1226
 
@@ -1277,14 +1229,13 @@ void grpc_server_cancel_all_calls(grpc_server* server) {
1277
1229
  gpr_mu_unlock(&server->mu_global);
1278
1230
 
1279
1231
  channel_broadcaster_shutdown(
1280
- &exec_ctx, &broadcaster, false /* send_goaway */,
1232
+ &broadcaster, false /* send_goaway */,
1281
1233
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Cancelling all calls"));
1282
- grpc_exec_ctx_finish(&exec_ctx);
1283
1234
  }
1284
1235
 
1285
1236
  void grpc_server_destroy(grpc_server* server) {
1286
1237
  listener* l;
1287
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1238
+ grpc_core::ExecCtx exec_ctx;
1288
1239
 
1289
1240
  GRPC_API_TRACE("grpc_server_destroy(server=%p)", 1, (server));
1290
1241
 
@@ -1300,16 +1251,15 @@ void grpc_server_destroy(grpc_server* server) {
1300
1251
 
1301
1252
  gpr_mu_unlock(&server->mu_global);
1302
1253
 
1303
- server_unref(&exec_ctx, server);
1304
- grpc_exec_ctx_finish(&exec_ctx);
1254
+ server_unref(server);
1305
1255
  }
1306
1256
 
1307
- void grpc_server_add_listener(
1308
- grpc_exec_ctx* exec_ctx, grpc_server* server, void* arg,
1309
- void (*start)(grpc_exec_ctx* exec_ctx, grpc_server* server, void* arg,
1310
- grpc_pollset** pollsets, size_t pollset_count),
1311
- void (*destroy)(grpc_exec_ctx* exec_ctx, grpc_server* server, void* arg,
1312
- grpc_closure* on_done)) {
1257
+ void grpc_server_add_listener(grpc_server* server, void* arg,
1258
+ void (*start)(grpc_server* server, void* arg,
1259
+ grpc_pollset** pollsets,
1260
+ size_t pollset_count),
1261
+ void (*destroy)(grpc_server* server, void* arg,
1262
+ grpc_closure* on_done)) {
1313
1263
  listener* l = (listener*)gpr_malloc(sizeof(listener));
1314
1264
  l->arg = arg;
1315
1265
  l->start = start;
@@ -1318,13 +1268,12 @@ void grpc_server_add_listener(
1318
1268
  server->listeners = l;
1319
1269
  }
1320
1270
 
1321
- static grpc_call_error queue_call_request(grpc_exec_ctx* exec_ctx,
1322
- grpc_server* server, size_t cq_idx,
1271
+ static grpc_call_error queue_call_request(grpc_server* server, size_t cq_idx,
1323
1272
  requested_call* rc) {
1324
1273
  call_data* calld = nullptr;
1325
1274
  request_matcher* rm = nullptr;
1326
1275
  if (gpr_atm_acq_load(&server->shutdown_flag)) {
1327
- fail_call(exec_ctx, server, cq_idx, rc,
1276
+ fail_call(server, cq_idx, rc,
1328
1277
  GRPC_ERROR_CREATE_FROM_STATIC_STRING("Server Shutdown"));
1329
1278
  return GRPC_CALL_OK;
1330
1279
  }
@@ -1351,10 +1300,9 @@ static grpc_call_error queue_call_request(grpc_exec_ctx* exec_ctx,
1351
1300
  &calld->kill_zombie_closure, kill_zombie,
1352
1301
  grpc_call_stack_element(grpc_call_get_call_stack(calld->call), 0),
1353
1302
  grpc_schedule_on_exec_ctx);
1354
- GRPC_CLOSURE_SCHED(exec_ctx, &calld->kill_zombie_closure,
1355
- GRPC_ERROR_NONE);
1303
+ GRPC_CLOSURE_SCHED(&calld->kill_zombie_closure, GRPC_ERROR_NONE);
1356
1304
  } else {
1357
- publish_call(exec_ctx, server, calld, cq_idx, rc);
1305
+ publish_call(server, calld, cq_idx, rc);
1358
1306
  }
1359
1307
  gpr_mu_lock(&server->mu_call);
1360
1308
  }
@@ -1369,9 +1317,9 @@ grpc_call_error grpc_server_request_call(
1369
1317
  grpc_completion_queue* cq_bound_to_call,
1370
1318
  grpc_completion_queue* cq_for_notification, void* tag) {
1371
1319
  grpc_call_error error;
1372
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1320
+ grpc_core::ExecCtx exec_ctx;
1373
1321
  requested_call* rc = (requested_call*)gpr_malloc(sizeof(*rc));
1374
- GRPC_STATS_INC_SERVER_REQUESTED_CALLS(&exec_ctx);
1322
+ GRPC_STATS_INC_SERVER_REQUESTED_CALLS();
1375
1323
  GRPC_API_TRACE(
1376
1324
  "grpc_server_request_call("
1377
1325
  "server=%p, call=%p, details=%p, initial_metadata=%p, "
@@ -1404,9 +1352,9 @@ grpc_call_error grpc_server_request_call(
1404
1352
  rc->call = call;
1405
1353
  rc->data.batch.details = details;
1406
1354
  rc->initial_metadata = initial_metadata;
1407
- error = queue_call_request(&exec_ctx, server, cq_idx, rc);
1355
+ error = queue_call_request(server, cq_idx, rc);
1408
1356
  done:
1409
- grpc_exec_ctx_finish(&exec_ctx);
1357
+
1410
1358
  return error;
1411
1359
  }
1412
1360
 
@@ -1416,10 +1364,10 @@ grpc_call_error grpc_server_request_registered_call(
1416
1364
  grpc_completion_queue* cq_bound_to_call,
1417
1365
  grpc_completion_queue* cq_for_notification, void* tag) {
1418
1366
  grpc_call_error error;
1419
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
1367
+ grpc_core::ExecCtx exec_ctx;
1420
1368
  requested_call* rc = (requested_call*)gpr_malloc(sizeof(*rc));
1421
1369
  registered_method* rm = (registered_method*)rmp;
1422
- GRPC_STATS_INC_SERVER_REQUESTED_CALLS(&exec_ctx);
1370
+ GRPC_STATS_INC_SERVER_REQUESTED_CALLS();
1423
1371
  GRPC_API_TRACE(
1424
1372
  "grpc_server_request_registered_call("
1425
1373
  "server=%p, rmp=%p, call=%p, deadline=%p, initial_metadata=%p, "
@@ -1461,20 +1409,20 @@ grpc_call_error grpc_server_request_registered_call(
1461
1409
  rc->data.registered.deadline = deadline;
1462
1410
  rc->initial_metadata = initial_metadata;
1463
1411
  rc->data.registered.optional_payload = optional_payload;
1464
- error = queue_call_request(&exec_ctx, server, cq_idx, rc);
1412
+ error = queue_call_request(server, cq_idx, rc);
1465
1413
  done:
1466
- grpc_exec_ctx_finish(&exec_ctx);
1414
+
1467
1415
  return error;
1468
1416
  }
1469
1417
 
1470
- static void fail_call(grpc_exec_ctx* exec_ctx, grpc_server* server,
1471
- size_t cq_idx, requested_call* rc, grpc_error* error) {
1418
+ static void fail_call(grpc_server* server, size_t cq_idx, requested_call* rc,
1419
+ grpc_error* error) {
1472
1420
  *rc->call = nullptr;
1473
1421
  rc->initial_metadata->count = 0;
1474
1422
  GPR_ASSERT(error != GRPC_ERROR_NONE);
1475
1423
 
1476
- grpc_cq_end_op(exec_ctx, server->cqs[cq_idx], rc->tag, error,
1477
- done_request_event, rc, &rc->completion);
1424
+ grpc_cq_end_op(server->cqs[cq_idx], rc->tag, error, done_request_event, rc,
1425
+ &rc->completion);
1478
1426
  }
1479
1427
 
1480
1428
  const grpc_channel_args* grpc_server_get_channel_args(grpc_server* server) {