grpc 1.60.0 → 1.61.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +208 -165
  3. data/include/grpc/event_engine/event_engine.h +59 -12
  4. data/include/grpc/event_engine/internal/memory_allocator_impl.h +6 -0
  5. data/include/grpc/event_engine/internal/slice_cast.h +12 -0
  6. data/include/grpc/event_engine/memory_allocator.h +3 -1
  7. data/include/grpc/event_engine/slice.h +5 -0
  8. data/include/grpc/grpc_security.h +22 -1
  9. data/include/grpc/impl/call.h +29 -0
  10. data/include/grpc/impl/channel_arg_names.h +12 -1
  11. data/include/grpc/impl/slice_type.h +1 -1
  12. data/include/grpc/module.modulemap +1 -0
  13. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +54 -7
  14. data/src/core/ext/filters/backend_metrics/backend_metric_filter.h +20 -6
  15. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +10 -13
  16. data/src/core/ext/filters/channel_idle/channel_idle_filter.h +18 -10
  17. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +326 -0
  18. data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.h +143 -0
  19. data/src/core/ext/filters/client_channel/backend_metric.cc +2 -2
  20. data/src/core/ext/filters/client_channel/client_channel.cc +32 -6
  21. data/src/core/ext/filters/client_channel/client_channel_internal.h +2 -0
  22. data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +54 -21
  24. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +3 -2
  25. data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +2 -1
  26. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.cc +12 -15
  27. data/src/core/ext/filters/client_channel/lb_policy/endpoint_list.h +8 -5
  28. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +139 -92
  29. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +9 -4
  30. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +9 -4
  31. data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +10 -11
  32. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +94 -93
  33. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +5 -3
  34. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +12 -15
  35. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +38 -16
  36. data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +25 -28
  37. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +10 -10
  38. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +37 -35
  39. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +11 -9
  40. data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +504 -461
  41. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +232 -122
  42. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +8 -6
  43. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.cc +642 -251
  44. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_override_host.h +2 -6
  45. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_wrr_locality.cc +7 -8
  46. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +2 -1
  47. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +3 -1
  48. data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
  49. data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +2 -2
  50. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +6 -8
  51. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.cc +1031 -0
  52. data/src/core/ext/filters/client_channel/resolver/xds/xds_dependency_manager.h +277 -0
  53. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +128 -270
  54. data/src/core/ext/filters/client_channel/resolver/xds/{xds_resolver.h → xds_resolver_attributes.h} +5 -4
  55. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.cc +25 -0
  56. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver_trace.h +30 -0
  57. data/src/core/ext/filters/client_channel/retry_filter.cc +1 -0
  58. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +35 -17
  59. data/src/core/ext/filters/deadline/deadline_filter.cc +12 -0
  60. data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +17 -13
  61. data/src/core/ext/filters/fault_injection/fault_injection_filter.h +13 -4
  62. data/src/core/ext/filters/http/client/http_client_filter.cc +23 -32
  63. data/src/core/ext/filters/http/client/http_client_filter.h +10 -5
  64. data/src/core/ext/filters/http/client_authority_filter.cc +14 -14
  65. data/src/core/ext/filters/http/client_authority_filter.h +12 -4
  66. data/src/core/ext/filters/http/http_filters_plugin.cc +42 -20
  67. data/src/core/ext/filters/http/message_compress/compression_filter.cc +55 -80
  68. data/src/core/ext/filters/http/message_compress/compression_filter.h +54 -12
  69. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.cc +325 -0
  70. data/src/core/ext/filters/http/message_compress/legacy_compression_filter.h +139 -0
  71. data/src/core/ext/filters/http/server/http_server_filter.cc +41 -41
  72. data/src/core/ext/filters/http/server/http_server_filter.h +11 -4
  73. data/src/core/ext/filters/message_size/message_size_filter.cc +56 -76
  74. data/src/core/ext/filters/message_size/message_size_filter.h +35 -23
  75. data/src/core/ext/filters/rbac/rbac_filter.cc +15 -11
  76. data/src/core/ext/filters/rbac/rbac_filter.h +11 -4
  77. data/src/core/ext/filters/server_config_selector/server_config_selector_filter.cc +25 -13
  78. data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +47 -50
  79. data/src/core/ext/filters/stateful_session/stateful_session_filter.h +21 -4
  80. data/src/core/ext/transport/chttp2/alpn/alpn.cc +1 -1
  81. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
  82. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +11 -2
  83. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +67 -145
  84. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -3
  85. data/src/core/ext/transport/chttp2/transport/flow_control.cc +21 -82
  86. data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -8
  87. data/src/core/ext/transport/chttp2/transport/frame.cc +506 -0
  88. data/src/core/ext/transport/chttp2/transport/frame.h +214 -0
  89. data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +1 -1
  90. data/src/core/ext/transport/chttp2/transport/frame_settings.cc +33 -79
  91. data/src/core/ext/transport/chttp2/transport/frame_settings.h +4 -7
  92. data/src/core/ext/transport/chttp2/transport/http2_settings.cc +122 -32
  93. data/src/core/ext/transport/chttp2/transport/http2_settings.h +142 -37
  94. data/src/core/ext/transport/chttp2/transport/internal.h +1 -22
  95. data/src/core/ext/transport/chttp2/transport/parsing.cc +23 -37
  96. data/src/core/ext/transport/chttp2/transport/writing.cc +26 -58
  97. data/src/core/ext/transport/inproc/inproc_transport.cc +172 -13
  98. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +712 -0
  99. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +151 -0
  100. data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +33 -0
  101. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +133 -0
  102. data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +50 -0
  103. data/src/core/ext/xds/certificate_provider_store.cc +2 -1
  104. data/src/core/ext/xds/certificate_provider_store.h +0 -5
  105. data/src/core/ext/xds/xds_api.cc +31 -18
  106. data/src/core/ext/xds/xds_api.h +2 -2
  107. data/src/core/ext/xds/xds_bootstrap.h +3 -0
  108. data/src/core/ext/xds/xds_certificate_provider.cc +88 -287
  109. data/src/core/ext/xds/xds_certificate_provider.h +44 -111
  110. data/src/core/ext/xds/xds_client.cc +420 -414
  111. data/src/core/ext/xds/xds_client.h +31 -22
  112. data/src/core/ext/xds/xds_client_grpc.cc +3 -1
  113. data/src/core/ext/xds/xds_cluster.cc +104 -11
  114. data/src/core/ext/xds/xds_cluster.h +9 -1
  115. data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +9 -5
  116. data/src/core/ext/xds/xds_common_types.cc +14 -10
  117. data/src/core/ext/xds/xds_endpoint.cc +9 -4
  118. data/src/core/ext/xds/xds_endpoint.h +5 -1
  119. data/src/core/ext/xds/xds_health_status.cc +12 -2
  120. data/src/core/ext/xds/xds_health_status.h +4 -2
  121. data/src/core/ext/xds/xds_http_rbac_filter.cc +5 -3
  122. data/src/core/ext/xds/xds_listener.cc +14 -8
  123. data/src/core/ext/xds/xds_resource_type_impl.h +6 -4
  124. data/src/core/ext/xds/xds_route_config.cc +34 -22
  125. data/src/core/ext/xds/xds_route_config.h +1 -0
  126. data/src/core/ext/xds/xds_server_config_fetcher.cc +61 -57
  127. data/src/core/ext/xds/xds_transport.h +3 -0
  128. data/src/core/ext/xds/xds_transport_grpc.cc +47 -50
  129. data/src/core/ext/xds/xds_transport_grpc.h +4 -0
  130. data/src/core/lib/channel/call_tracer.cc +12 -0
  131. data/src/core/lib/channel/call_tracer.h +17 -3
  132. data/src/core/lib/channel/channel_args.cc +24 -14
  133. data/src/core/lib/channel/channel_args.h +74 -13
  134. data/src/core/lib/channel/channel_stack.cc +27 -0
  135. data/src/core/lib/channel/channel_stack.h +10 -10
  136. data/src/core/lib/channel/connected_channel.cc +64 -18
  137. data/src/core/lib/channel/promise_based_filter.h +1041 -1
  138. data/src/core/lib/channel/server_call_tracer_filter.cc +43 -35
  139. data/src/core/lib/compression/compression_internal.cc +0 -3
  140. data/src/core/lib/event_engine/ares_resolver.cc +35 -14
  141. data/src/core/lib/event_engine/ares_resolver.h +9 -10
  142. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +8 -1
  143. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.cc +132 -0
  144. data/src/core/lib/event_engine/posix_engine/native_posix_dns_resolver.h +61 -0
  145. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +52 -36
  146. data/src/core/lib/event_engine/posix_engine/posix_engine.h +4 -9
  147. data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +11 -3
  148. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +9 -2
  149. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +7 -0
  150. data/src/core/lib/event_engine/posix_engine/timer_manager.cc +17 -27
  151. data/src/core/lib/event_engine/posix_engine/timer_manager.h +0 -3
  152. data/src/core/lib/event_engine/ref_counted_dns_resolver_interface.h +55 -0
  153. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.cc +114 -0
  154. data/src/core/lib/event_engine/windows/native_windows_dns_resolver.h +51 -0
  155. data/src/core/lib/event_engine/windows/windows_engine.cc +7 -7
  156. data/src/core/lib/experiments/config.cc +13 -0
  157. data/src/core/lib/experiments/config.h +3 -0
  158. data/src/core/lib/experiments/experiments.cc +245 -366
  159. data/src/core/lib/experiments/experiments.h +50 -156
  160. data/src/core/lib/gprpp/debug_location.h +13 -0
  161. data/src/core/lib/gprpp/dual_ref_counted.h +36 -7
  162. data/src/core/lib/gprpp/orphanable.h +27 -0
  163. data/src/core/lib/gprpp/ref_counted.h +63 -22
  164. data/src/core/lib/gprpp/ref_counted_ptr.h +70 -27
  165. data/src/core/lib/gprpp/ref_counted_string.h +13 -0
  166. data/src/core/lib/gprpp/status_helper.cc +1 -2
  167. data/src/core/lib/iomgr/combiner.cc +15 -51
  168. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +31 -0
  169. data/src/core/lib/iomgr/event_engine_shims/endpoint.h +16 -0
  170. data/src/core/lib/iomgr/tcp_client_posix.cc +4 -3
  171. data/src/core/lib/load_balancing/lb_policy.h +1 -1
  172. data/src/core/lib/promise/activity.cc +17 -2
  173. data/src/core/lib/promise/activity.h +5 -4
  174. data/src/core/lib/promise/all_ok.h +80 -0
  175. data/src/core/lib/promise/detail/join_state.h +2077 -0
  176. data/src/core/lib/promise/detail/promise_factory.h +1 -0
  177. data/src/core/lib/promise/detail/promise_like.h +8 -1
  178. data/src/core/lib/promise/detail/seq_state.h +3458 -150
  179. data/src/core/lib/promise/detail/status.h +42 -5
  180. data/src/core/lib/promise/for_each.h +13 -1
  181. data/src/core/lib/promise/if.h +4 -0
  182. data/src/core/lib/promise/latch.h +6 -3
  183. data/src/core/lib/promise/party.cc +33 -31
  184. data/src/core/lib/promise/party.h +142 -6
  185. data/src/core/lib/promise/poll.h +39 -13
  186. data/src/core/lib/promise/promise.h +4 -0
  187. data/src/core/lib/promise/seq.h +107 -7
  188. data/src/core/lib/promise/status_flag.h +196 -0
  189. data/src/core/lib/promise/try_join.h +132 -0
  190. data/src/core/lib/promise/try_seq.h +132 -10
  191. data/src/core/lib/resolver/endpoint_addresses.cc +0 -1
  192. data/src/core/lib/resolver/endpoint_addresses.h +48 -0
  193. data/src/core/lib/resource_quota/arena.h +2 -2
  194. data/src/core/lib/resource_quota/memory_quota.cc +57 -8
  195. data/src/core/lib/resource_quota/memory_quota.h +6 -0
  196. data/src/core/lib/security/authorization/grpc_server_authz_filter.cc +14 -11
  197. data/src/core/lib/security/authorization/grpc_server_authz_filter.h +14 -5
  198. data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +4 -0
  199. data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +4 -0
  200. data/src/core/lib/security/credentials/external/external_account_credentials.cc +28 -20
  201. data/src/core/lib/security/credentials/external/external_account_credentials.h +4 -0
  202. data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +4 -0
  203. data/src/core/lib/security/credentials/external/file_external_account_credentials.h +4 -0
  204. data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +4 -0
  205. data/src/core/lib/security/credentials/external/url_external_account_credentials.h +4 -0
  206. data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +2 -1
  207. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +0 -3
  208. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +12 -0
  209. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.cc +22 -5
  210. data/src/core/lib/security/credentials/tls/grpc_tls_crl_provider.h +1 -5
  211. data/src/core/lib/security/credentials/tls/tls_credentials.cc +16 -0
  212. data/src/core/lib/security/credentials/xds/xds_credentials.cc +21 -28
  213. data/src/core/lib/security/credentials/xds/xds_credentials.h +2 -4
  214. data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +4 -3
  215. data/src/core/lib/security/transport/auth_filters.h +71 -4
  216. data/src/core/lib/security/transport/client_auth_filter.cc +2 -4
  217. data/src/core/lib/security/transport/legacy_server_auth_filter.cc +244 -0
  218. data/src/core/lib/security/transport/server_auth_filter.cc +70 -90
  219. data/src/core/lib/slice/slice_buffer.h +3 -0
  220. data/src/core/lib/surface/builtins.cc +1 -1
  221. data/src/core/lib/surface/call.cc +683 -196
  222. data/src/core/lib/surface/call.h +26 -13
  223. data/src/core/lib/surface/call_trace.cc +42 -1
  224. data/src/core/lib/surface/channel.cc +0 -1
  225. data/src/core/lib/surface/channel.h +0 -6
  226. data/src/core/lib/surface/channel_init.h +26 -0
  227. data/src/core/lib/surface/init.cc +14 -8
  228. data/src/core/lib/surface/server.cc +256 -237
  229. data/src/core/lib/surface/server.h +26 -54
  230. data/src/core/lib/surface/version.cc +2 -2
  231. data/src/core/lib/surface/wait_for_cq_end_op.h +94 -0
  232. data/src/core/lib/transport/call_final_info.cc +38 -0
  233. data/src/core/lib/transport/call_final_info.h +54 -0
  234. data/src/core/lib/transport/connectivity_state.cc +3 -2
  235. data/src/core/lib/transport/connectivity_state.h +4 -0
  236. data/src/core/lib/transport/metadata_batch.h +4 -4
  237. data/src/core/lib/transport/transport.cc +70 -19
  238. data/src/core/lib/transport/transport.h +395 -25
  239. data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -0
  240. data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +0 -3
  241. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
  242. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +1 -1
  243. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -1
  244. data/src/core/tsi/ssl_transport_security.cc +65 -43
  245. data/src/ruby/ext/grpc/rb_channel_args.c +3 -1
  246. data/src/ruby/ext/grpc/rb_grpc.c +0 -1
  247. data/src/ruby/ext/grpc/rb_grpc.h +0 -2
  248. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  249. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  250. data/src/ruby/lib/grpc/version.rb +1 -1
  251. data/third_party/upb/upb/reflection/def_pool.h +2 -2
  252. data/third_party/zlib/adler32.c +5 -27
  253. data/third_party/zlib/compress.c +5 -16
  254. data/third_party/zlib/crc32.c +86 -162
  255. data/third_party/zlib/deflate.c +233 -336
  256. data/third_party/zlib/deflate.h +8 -8
  257. data/third_party/zlib/gzguts.h +11 -12
  258. data/third_party/zlib/infback.c +7 -23
  259. data/third_party/zlib/inffast.c +1 -4
  260. data/third_party/zlib/inffast.h +1 -1
  261. data/third_party/zlib/inflate.c +30 -99
  262. data/third_party/zlib/inftrees.c +6 -11
  263. data/third_party/zlib/inftrees.h +3 -3
  264. data/third_party/zlib/trees.c +224 -302
  265. data/third_party/zlib/uncompr.c +4 -12
  266. data/third_party/zlib/zconf.h +6 -2
  267. data/third_party/zlib/zlib.h +191 -188
  268. data/third_party/zlib/zutil.c +16 -44
  269. data/third_party/zlib/zutil.h +10 -10
  270. metadata +35 -13
  271. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +0 -1173
  272. data/src/core/lib/event_engine/memory_allocator.cc +0 -74
  273. data/src/core/lib/transport/pid_controller.cc +0 -51
  274. data/src/core/lib/transport/pid_controller.h +0 -116
  275. data/third_party/upb/upb/collections/array.h +0 -17
  276. data/third_party/upb/upb/collections/map.h +0 -17
  277. data/third_party/upb/upb/upb.hpp +0 -18
@@ -24,10 +24,12 @@
24
24
  #include <utility>
25
25
 
26
26
  #include "absl/base/attributes.h"
27
+ #include "absl/strings/str_cat.h"
27
28
 
28
29
  #include <grpc/support/log.h>
29
30
 
30
31
  #include "src/core/lib/gprpp/construct_destruct.h"
32
+ #include "src/core/lib/gprpp/debug_location.h"
31
33
  #include "src/core/lib/promise/detail/promise_factory.h"
32
34
  #include "src/core/lib/promise/detail/promise_like.h"
33
35
  #include "src/core/lib/promise/poll.h"
@@ -98,8 +100,9 @@ struct SeqState<Traits, P, F0> {
98
100
  };
99
101
  enum class State : uint8_t { kState0, kState1 };
100
102
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
103
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
101
104
 
102
- SeqState(P&& p, F0&& f0) noexcept {
105
+ SeqState(P&& p, F0&& f0, DebugLocation whence) noexcept : whence(whence) {
103
106
  Construct(&prior.current_promise, std::forward<P>(p));
104
107
  Construct(&prior.next_factory, std::forward<F0>(f0));
105
108
  }
@@ -115,13 +118,15 @@ struct SeqState<Traits, P, F0> {
115
118
  tail0:
116
119
  Destruct(&prior.next_factory);
117
120
  }
118
- SeqState(const SeqState& other) noexcept : state(other.state) {
121
+ SeqState(const SeqState& other) noexcept
122
+ : state(other.state), whence(other.whence) {
119
123
  GPR_ASSERT(state == State::kState0);
120
124
  Construct(&prior.current_promise, other.prior.current_promise);
121
125
  Construct(&prior.next_factory, other.prior.next_factory);
122
126
  }
123
127
  SeqState& operator=(const SeqState& other) = delete;
124
- SeqState(SeqState&& other) noexcept : state(other.state) {
128
+ SeqState(SeqState&& other) noexcept
129
+ : state(other.state), whence(other.whence) {
125
130
  switch (state) {
126
131
  case State::kState0:
127
132
  Construct(&prior.current_promise,
@@ -139,15 +144,21 @@ struct SeqState<Traits, P, F0> {
139
144
  switch (state) {
140
145
  case State::kState0: {
141
146
  if (grpc_trace_promise_primitives.enabled()) {
142
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/2", this);
147
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
148
+ "seq[%p]: begin poll step 1/2", this);
143
149
  }
144
150
  auto result = prior.current_promise();
145
151
  PromiseResult0* p = result.value_if_ready();
146
152
  if (grpc_trace_promise_primitives.enabled()) {
147
153
  gpr_log(
148
- GPR_DEBUG, "seq[%p]: poll step 1/2 gets %s", this,
154
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
155
+ "seq[%p]: poll step 1/2 gets %s", this,
149
156
  p != nullptr
150
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
157
+ ? (PromiseResultTraits0::IsOk(*p)
158
+ ? "ready"
159
+ : absl::StrCat("early-error:",
160
+ PromiseResultTraits0::ErrorString(*p))
161
+ .c_str())
151
162
  : "pending");
152
163
  }
153
164
  if (p == nullptr) return Pending{};
@@ -166,11 +177,13 @@ struct SeqState<Traits, P, F0> {
166
177
  default:
167
178
  case State::kState1: {
168
179
  if (grpc_trace_promise_primitives.enabled()) {
169
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/2", this);
180
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
181
+ "seq[%p]: begin poll step 2/2", this);
170
182
  }
171
183
  auto result = current_promise();
172
184
  if (grpc_trace_promise_primitives.enabled()) {
173
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 2/2 gets %s", this,
185
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
186
+ "seq[%p]: poll step 2/2 gets %s", this,
174
187
  result.ready() ? "ready" : "pending");
175
188
  }
176
189
  auto* p = result.value_if_ready();
@@ -215,8 +228,10 @@ struct SeqState<Traits, P, F0, F1> {
215
228
  };
216
229
  enum class State : uint8_t { kState0, kState1, kState2 };
217
230
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
231
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
218
232
 
219
- SeqState(P&& p, F0&& f0, F1&& f1) noexcept {
233
+ SeqState(P&& p, F0&& f0, F1&& f1, DebugLocation whence) noexcept
234
+ : whence(whence) {
220
235
  Construct(&prior.prior.current_promise, std::forward<P>(p));
221
236
  Construct(&prior.prior.next_factory, std::forward<F0>(f0));
222
237
  Construct(&prior.next_factory, std::forward<F1>(f1));
@@ -238,14 +253,16 @@ struct SeqState<Traits, P, F0, F1> {
238
253
  tail1:
239
254
  Destruct(&prior.next_factory);
240
255
  }
241
- SeqState(const SeqState& other) noexcept : state(other.state) {
256
+ SeqState(const SeqState& other) noexcept
257
+ : state(other.state), whence(other.whence) {
242
258
  GPR_ASSERT(state == State::kState0);
243
259
  Construct(&prior.current_promise, other.prior.current_promise);
244
260
  Construct(&prior.prior.next_factory, other.prior.prior.next_factory);
245
261
  Construct(&prior.next_factory, other.prior.next_factory);
246
262
  }
247
263
  SeqState& operator=(const SeqState& other) = delete;
248
- SeqState(SeqState&& other) noexcept : state(other.state) {
264
+ SeqState(SeqState&& other) noexcept
265
+ : state(other.state), whence(other.whence) {
249
266
  switch (state) {
250
267
  case State::kState0:
251
268
  Construct(&prior.prior.current_promise,
@@ -270,15 +287,21 @@ struct SeqState<Traits, P, F0, F1> {
270
287
  switch (state) {
271
288
  case State::kState0: {
272
289
  if (grpc_trace_promise_primitives.enabled()) {
273
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/3", this);
290
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
291
+ "seq[%p]: begin poll step 1/3", this);
274
292
  }
275
293
  auto result = prior.prior.current_promise();
276
294
  PromiseResult0* p = result.value_if_ready();
277
295
  if (grpc_trace_promise_primitives.enabled()) {
278
296
  gpr_log(
279
- GPR_DEBUG, "seq[%p]: poll step 1/3 gets %s", this,
297
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
298
+ "seq[%p]: poll step 1/3 gets %s", this,
280
299
  p != nullptr
281
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
300
+ ? (PromiseResultTraits0::IsOk(*p)
301
+ ? "ready"
302
+ : absl::StrCat("early-error:",
303
+ PromiseResultTraits0::ErrorString(*p))
304
+ .c_str())
282
305
  : "pending");
283
306
  }
284
307
  if (p == nullptr) return Pending{};
@@ -296,15 +319,21 @@ struct SeqState<Traits, P, F0, F1> {
296
319
  ABSL_FALLTHROUGH_INTENDED;
297
320
  case State::kState1: {
298
321
  if (grpc_trace_promise_primitives.enabled()) {
299
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/3", this);
322
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
323
+ "seq[%p]: begin poll step 2/3", this);
300
324
  }
301
325
  auto result = prior.current_promise();
302
326
  PromiseResult1* p = result.value_if_ready();
303
327
  if (grpc_trace_promise_primitives.enabled()) {
304
328
  gpr_log(
305
- GPR_DEBUG, "seq[%p]: poll step 2/3 gets %s", this,
329
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
330
+ "seq[%p]: poll step 2/3 gets %s", this,
306
331
  p != nullptr
307
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
332
+ ? (PromiseResultTraits1::IsOk(*p)
333
+ ? "ready"
334
+ : absl::StrCat("early-error:",
335
+ PromiseResultTraits1::ErrorString(*p))
336
+ .c_str())
308
337
  : "pending");
309
338
  }
310
339
  if (p == nullptr) return Pending{};
@@ -323,11 +352,13 @@ struct SeqState<Traits, P, F0, F1> {
323
352
  default:
324
353
  case State::kState2: {
325
354
  if (grpc_trace_promise_primitives.enabled()) {
326
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/3", this);
355
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
356
+ "seq[%p]: begin poll step 3/3", this);
327
357
  }
328
358
  auto result = current_promise();
329
359
  if (grpc_trace_promise_primitives.enabled()) {
330
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 3/3 gets %s", this,
360
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
361
+ "seq[%p]: poll step 3/3 gets %s", this,
331
362
  result.ready() ? "ready" : "pending");
332
363
  }
333
364
  auto* p = result.value_if_ready();
@@ -384,8 +415,10 @@ struct SeqState<Traits, P, F0, F1, F2> {
384
415
  };
385
416
  enum class State : uint8_t { kState0, kState1, kState2, kState3 };
386
417
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
418
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
387
419
 
388
- SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2) noexcept {
420
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, DebugLocation whence) noexcept
421
+ : whence(whence) {
389
422
  Construct(&prior.prior.prior.current_promise, std::forward<P>(p));
390
423
  Construct(&prior.prior.prior.next_factory, std::forward<F0>(f0));
391
424
  Construct(&prior.prior.next_factory, std::forward<F1>(f1));
@@ -413,7 +446,8 @@ struct SeqState<Traits, P, F0, F1, F2> {
413
446
  tail2:
414
447
  Destruct(&prior.next_factory);
415
448
  }
416
- SeqState(const SeqState& other) noexcept : state(other.state) {
449
+ SeqState(const SeqState& other) noexcept
450
+ : state(other.state), whence(other.whence) {
417
451
  GPR_ASSERT(state == State::kState0);
418
452
  Construct(&prior.current_promise, other.prior.current_promise);
419
453
  Construct(&prior.prior.prior.next_factory,
@@ -422,7 +456,8 @@ struct SeqState<Traits, P, F0, F1, F2> {
422
456
  Construct(&prior.next_factory, other.prior.next_factory);
423
457
  }
424
458
  SeqState& operator=(const SeqState& other) = delete;
425
- SeqState(SeqState&& other) noexcept : state(other.state) {
459
+ SeqState(SeqState&& other) noexcept
460
+ : state(other.state), whence(other.whence) {
426
461
  switch (state) {
427
462
  case State::kState0:
428
463
  Construct(&prior.prior.prior.current_promise,
@@ -454,15 +489,21 @@ struct SeqState<Traits, P, F0, F1, F2> {
454
489
  switch (state) {
455
490
  case State::kState0: {
456
491
  if (grpc_trace_promise_primitives.enabled()) {
457
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/4", this);
492
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
493
+ "seq[%p]: begin poll step 1/4", this);
458
494
  }
459
495
  auto result = prior.prior.prior.current_promise();
460
496
  PromiseResult0* p = result.value_if_ready();
461
497
  if (grpc_trace_promise_primitives.enabled()) {
462
498
  gpr_log(
463
- GPR_DEBUG, "seq[%p]: poll step 1/4 gets %s", this,
499
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
500
+ "seq[%p]: poll step 1/4 gets %s", this,
464
501
  p != nullptr
465
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
502
+ ? (PromiseResultTraits0::IsOk(*p)
503
+ ? "ready"
504
+ : absl::StrCat("early-error:",
505
+ PromiseResultTraits0::ErrorString(*p))
506
+ .c_str())
466
507
  : "pending");
467
508
  }
468
509
  if (p == nullptr) return Pending{};
@@ -480,15 +521,21 @@ struct SeqState<Traits, P, F0, F1, F2> {
480
521
  ABSL_FALLTHROUGH_INTENDED;
481
522
  case State::kState1: {
482
523
  if (grpc_trace_promise_primitives.enabled()) {
483
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/4", this);
524
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
525
+ "seq[%p]: begin poll step 2/4", this);
484
526
  }
485
527
  auto result = prior.prior.current_promise();
486
528
  PromiseResult1* p = result.value_if_ready();
487
529
  if (grpc_trace_promise_primitives.enabled()) {
488
530
  gpr_log(
489
- GPR_DEBUG, "seq[%p]: poll step 2/4 gets %s", this,
531
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
532
+ "seq[%p]: poll step 2/4 gets %s", this,
490
533
  p != nullptr
491
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
534
+ ? (PromiseResultTraits1::IsOk(*p)
535
+ ? "ready"
536
+ : absl::StrCat("early-error:",
537
+ PromiseResultTraits1::ErrorString(*p))
538
+ .c_str())
492
539
  : "pending");
493
540
  }
494
541
  if (p == nullptr) return Pending{};
@@ -506,15 +553,21 @@ struct SeqState<Traits, P, F0, F1, F2> {
506
553
  ABSL_FALLTHROUGH_INTENDED;
507
554
  case State::kState2: {
508
555
  if (grpc_trace_promise_primitives.enabled()) {
509
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/4", this);
556
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
557
+ "seq[%p]: begin poll step 3/4", this);
510
558
  }
511
559
  auto result = prior.current_promise();
512
560
  PromiseResult2* p = result.value_if_ready();
513
561
  if (grpc_trace_promise_primitives.enabled()) {
514
562
  gpr_log(
515
- GPR_DEBUG, "seq[%p]: poll step 3/4 gets %s", this,
563
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
564
+ "seq[%p]: poll step 3/4 gets %s", this,
516
565
  p != nullptr
517
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
566
+ ? (PromiseResultTraits2::IsOk(*p)
567
+ ? "ready"
568
+ : absl::StrCat("early-error:",
569
+ PromiseResultTraits2::ErrorString(*p))
570
+ .c_str())
518
571
  : "pending");
519
572
  }
520
573
  if (p == nullptr) return Pending{};
@@ -533,11 +586,13 @@ struct SeqState<Traits, P, F0, F1, F2> {
533
586
  default:
534
587
  case State::kState3: {
535
588
  if (grpc_trace_promise_primitives.enabled()) {
536
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/4", this);
589
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
590
+ "seq[%p]: begin poll step 4/4", this);
537
591
  }
538
592
  auto result = current_promise();
539
593
  if (grpc_trace_promise_primitives.enabled()) {
540
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 4/4 gets %s", this,
594
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
595
+ "seq[%p]: poll step 4/4 gets %s", this,
541
596
  result.ready() ? "ready" : "pending");
542
597
  }
543
598
  auto* p = result.value_if_ready();
@@ -606,8 +661,11 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
606
661
  };
607
662
  enum class State : uint8_t { kState0, kState1, kState2, kState3, kState4 };
608
663
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
664
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
609
665
 
610
- SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3) noexcept {
666
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3,
667
+ DebugLocation whence) noexcept
668
+ : whence(whence) {
611
669
  Construct(&prior.prior.prior.prior.current_promise, std::forward<P>(p));
612
670
  Construct(&prior.prior.prior.prior.next_factory, std::forward<F0>(f0));
613
671
  Construct(&prior.prior.prior.next_factory, std::forward<F1>(f1));
@@ -641,7 +699,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
641
699
  tail3:
642
700
  Destruct(&prior.next_factory);
643
701
  }
644
- SeqState(const SeqState& other) noexcept : state(other.state) {
702
+ SeqState(const SeqState& other) noexcept
703
+ : state(other.state), whence(other.whence) {
645
704
  GPR_ASSERT(state == State::kState0);
646
705
  Construct(&prior.current_promise, other.prior.current_promise);
647
706
  Construct(&prior.prior.prior.prior.next_factory,
@@ -652,7 +711,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
652
711
  Construct(&prior.next_factory, other.prior.next_factory);
653
712
  }
654
713
  SeqState& operator=(const SeqState& other) = delete;
655
- SeqState(SeqState&& other) noexcept : state(other.state) {
714
+ SeqState(SeqState&& other) noexcept
715
+ : state(other.state), whence(other.whence) {
656
716
  switch (state) {
657
717
  case State::kState0:
658
718
  Construct(&prior.prior.prior.prior.current_promise,
@@ -691,15 +751,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
691
751
  switch (state) {
692
752
  case State::kState0: {
693
753
  if (grpc_trace_promise_primitives.enabled()) {
694
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/5", this);
754
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
755
+ "seq[%p]: begin poll step 1/5", this);
695
756
  }
696
757
  auto result = prior.prior.prior.prior.current_promise();
697
758
  PromiseResult0* p = result.value_if_ready();
698
759
  if (grpc_trace_promise_primitives.enabled()) {
699
760
  gpr_log(
700
- GPR_DEBUG, "seq[%p]: poll step 1/5 gets %s", this,
761
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
762
+ "seq[%p]: poll step 1/5 gets %s", this,
701
763
  p != nullptr
702
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
764
+ ? (PromiseResultTraits0::IsOk(*p)
765
+ ? "ready"
766
+ : absl::StrCat("early-error:",
767
+ PromiseResultTraits0::ErrorString(*p))
768
+ .c_str())
703
769
  : "pending");
704
770
  }
705
771
  if (p == nullptr) return Pending{};
@@ -717,15 +783,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
717
783
  ABSL_FALLTHROUGH_INTENDED;
718
784
  case State::kState1: {
719
785
  if (grpc_trace_promise_primitives.enabled()) {
720
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/5", this);
786
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
787
+ "seq[%p]: begin poll step 2/5", this);
721
788
  }
722
789
  auto result = prior.prior.prior.current_promise();
723
790
  PromiseResult1* p = result.value_if_ready();
724
791
  if (grpc_trace_promise_primitives.enabled()) {
725
792
  gpr_log(
726
- GPR_DEBUG, "seq[%p]: poll step 2/5 gets %s", this,
793
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
794
+ "seq[%p]: poll step 2/5 gets %s", this,
727
795
  p != nullptr
728
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
796
+ ? (PromiseResultTraits1::IsOk(*p)
797
+ ? "ready"
798
+ : absl::StrCat("early-error:",
799
+ PromiseResultTraits1::ErrorString(*p))
800
+ .c_str())
729
801
  : "pending");
730
802
  }
731
803
  if (p == nullptr) return Pending{};
@@ -743,15 +815,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
743
815
  ABSL_FALLTHROUGH_INTENDED;
744
816
  case State::kState2: {
745
817
  if (grpc_trace_promise_primitives.enabled()) {
746
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/5", this);
818
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
819
+ "seq[%p]: begin poll step 3/5", this);
747
820
  }
748
821
  auto result = prior.prior.current_promise();
749
822
  PromiseResult2* p = result.value_if_ready();
750
823
  if (grpc_trace_promise_primitives.enabled()) {
751
824
  gpr_log(
752
- GPR_DEBUG, "seq[%p]: poll step 3/5 gets %s", this,
825
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
826
+ "seq[%p]: poll step 3/5 gets %s", this,
753
827
  p != nullptr
754
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
828
+ ? (PromiseResultTraits2::IsOk(*p)
829
+ ? "ready"
830
+ : absl::StrCat("early-error:",
831
+ PromiseResultTraits2::ErrorString(*p))
832
+ .c_str())
755
833
  : "pending");
756
834
  }
757
835
  if (p == nullptr) return Pending{};
@@ -769,15 +847,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
769
847
  ABSL_FALLTHROUGH_INTENDED;
770
848
  case State::kState3: {
771
849
  if (grpc_trace_promise_primitives.enabled()) {
772
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/5", this);
850
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
851
+ "seq[%p]: begin poll step 4/5", this);
773
852
  }
774
853
  auto result = prior.current_promise();
775
854
  PromiseResult3* p = result.value_if_ready();
776
855
  if (grpc_trace_promise_primitives.enabled()) {
777
856
  gpr_log(
778
- GPR_DEBUG, "seq[%p]: poll step 4/5 gets %s", this,
857
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
858
+ "seq[%p]: poll step 4/5 gets %s", this,
779
859
  p != nullptr
780
- ? (PromiseResultTraits3::IsOk(*p) ? "ready" : "early-error")
860
+ ? (PromiseResultTraits3::IsOk(*p)
861
+ ? "ready"
862
+ : absl::StrCat("early-error:",
863
+ PromiseResultTraits3::ErrorString(*p))
864
+ .c_str())
781
865
  : "pending");
782
866
  }
783
867
  if (p == nullptr) return Pending{};
@@ -796,11 +880,13 @@ struct SeqState<Traits, P, F0, F1, F2, F3> {
796
880
  default:
797
881
  case State::kState4: {
798
882
  if (grpc_trace_promise_primitives.enabled()) {
799
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 5/5", this);
883
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
884
+ "seq[%p]: begin poll step 5/5", this);
800
885
  }
801
886
  auto result = current_promise();
802
887
  if (grpc_trace_promise_primitives.enabled()) {
803
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 5/5 gets %s", this,
888
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
889
+ "seq[%p]: poll step 5/5 gets %s", this,
804
890
  result.ready() ? "ready" : "pending");
805
891
  }
806
892
  auto* p = result.value_if_ready();
@@ -888,8 +974,11 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
888
974
  kState5
889
975
  };
890
976
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
977
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
891
978
 
892
- SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4) noexcept {
979
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4,
980
+ DebugLocation whence) noexcept
981
+ : whence(whence) {
893
982
  Construct(&prior.prior.prior.prior.prior.current_promise,
894
983
  std::forward<P>(p));
895
984
  Construct(&prior.prior.prior.prior.prior.next_factory,
@@ -931,7 +1020,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
931
1020
  tail4:
932
1021
  Destruct(&prior.next_factory);
933
1022
  }
934
- SeqState(const SeqState& other) noexcept : state(other.state) {
1023
+ SeqState(const SeqState& other) noexcept
1024
+ : state(other.state), whence(other.whence) {
935
1025
  GPR_ASSERT(state == State::kState0);
936
1026
  Construct(&prior.current_promise, other.prior.current_promise);
937
1027
  Construct(&prior.prior.prior.prior.prior.next_factory,
@@ -944,7 +1034,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
944
1034
  Construct(&prior.next_factory, other.prior.next_factory);
945
1035
  }
946
1036
  SeqState& operator=(const SeqState& other) = delete;
947
- SeqState(SeqState&& other) noexcept : state(other.state) {
1037
+ SeqState(SeqState&& other) noexcept
1038
+ : state(other.state), whence(other.whence) {
948
1039
  switch (state) {
949
1040
  case State::kState0:
950
1041
  Construct(
@@ -991,15 +1082,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
991
1082
  switch (state) {
992
1083
  case State::kState0: {
993
1084
  if (grpc_trace_promise_primitives.enabled()) {
994
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/6", this);
1085
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1086
+ "seq[%p]: begin poll step 1/6", this);
995
1087
  }
996
1088
  auto result = prior.prior.prior.prior.prior.current_promise();
997
1089
  PromiseResult0* p = result.value_if_ready();
998
1090
  if (grpc_trace_promise_primitives.enabled()) {
999
1091
  gpr_log(
1000
- GPR_DEBUG, "seq[%p]: poll step 1/6 gets %s", this,
1092
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1093
+ "seq[%p]: poll step 1/6 gets %s", this,
1001
1094
  p != nullptr
1002
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
1095
+ ? (PromiseResultTraits0::IsOk(*p)
1096
+ ? "ready"
1097
+ : absl::StrCat("early-error:",
1098
+ PromiseResultTraits0::ErrorString(*p))
1099
+ .c_str())
1003
1100
  : "pending");
1004
1101
  }
1005
1102
  if (p == nullptr) return Pending{};
@@ -1018,15 +1115,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
1018
1115
  ABSL_FALLTHROUGH_INTENDED;
1019
1116
  case State::kState1: {
1020
1117
  if (grpc_trace_promise_primitives.enabled()) {
1021
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/6", this);
1118
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1119
+ "seq[%p]: begin poll step 2/6", this);
1022
1120
  }
1023
1121
  auto result = prior.prior.prior.prior.current_promise();
1024
1122
  PromiseResult1* p = result.value_if_ready();
1025
1123
  if (grpc_trace_promise_primitives.enabled()) {
1026
1124
  gpr_log(
1027
- GPR_DEBUG, "seq[%p]: poll step 2/6 gets %s", this,
1125
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1126
+ "seq[%p]: poll step 2/6 gets %s", this,
1028
1127
  p != nullptr
1029
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
1128
+ ? (PromiseResultTraits1::IsOk(*p)
1129
+ ? "ready"
1130
+ : absl::StrCat("early-error:",
1131
+ PromiseResultTraits1::ErrorString(*p))
1132
+ .c_str())
1030
1133
  : "pending");
1031
1134
  }
1032
1135
  if (p == nullptr) return Pending{};
@@ -1044,15 +1147,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
1044
1147
  ABSL_FALLTHROUGH_INTENDED;
1045
1148
  case State::kState2: {
1046
1149
  if (grpc_trace_promise_primitives.enabled()) {
1047
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/6", this);
1150
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1151
+ "seq[%p]: begin poll step 3/6", this);
1048
1152
  }
1049
1153
  auto result = prior.prior.prior.current_promise();
1050
1154
  PromiseResult2* p = result.value_if_ready();
1051
1155
  if (grpc_trace_promise_primitives.enabled()) {
1052
1156
  gpr_log(
1053
- GPR_DEBUG, "seq[%p]: poll step 3/6 gets %s", this,
1157
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1158
+ "seq[%p]: poll step 3/6 gets %s", this,
1054
1159
  p != nullptr
1055
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
1160
+ ? (PromiseResultTraits2::IsOk(*p)
1161
+ ? "ready"
1162
+ : absl::StrCat("early-error:",
1163
+ PromiseResultTraits2::ErrorString(*p))
1164
+ .c_str())
1056
1165
  : "pending");
1057
1166
  }
1058
1167
  if (p == nullptr) return Pending{};
@@ -1070,15 +1179,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
1070
1179
  ABSL_FALLTHROUGH_INTENDED;
1071
1180
  case State::kState3: {
1072
1181
  if (grpc_trace_promise_primitives.enabled()) {
1073
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/6", this);
1182
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1183
+ "seq[%p]: begin poll step 4/6", this);
1074
1184
  }
1075
1185
  auto result = prior.prior.current_promise();
1076
1186
  PromiseResult3* p = result.value_if_ready();
1077
1187
  if (grpc_trace_promise_primitives.enabled()) {
1078
1188
  gpr_log(
1079
- GPR_DEBUG, "seq[%p]: poll step 4/6 gets %s", this,
1189
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1190
+ "seq[%p]: poll step 4/6 gets %s", this,
1080
1191
  p != nullptr
1081
- ? (PromiseResultTraits3::IsOk(*p) ? "ready" : "early-error")
1192
+ ? (PromiseResultTraits3::IsOk(*p)
1193
+ ? "ready"
1194
+ : absl::StrCat("early-error:",
1195
+ PromiseResultTraits3::ErrorString(*p))
1196
+ .c_str())
1082
1197
  : "pending");
1083
1198
  }
1084
1199
  if (p == nullptr) return Pending{};
@@ -1096,15 +1211,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
1096
1211
  ABSL_FALLTHROUGH_INTENDED;
1097
1212
  case State::kState4: {
1098
1213
  if (grpc_trace_promise_primitives.enabled()) {
1099
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 5/6", this);
1214
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1215
+ "seq[%p]: begin poll step 5/6", this);
1100
1216
  }
1101
1217
  auto result = prior.current_promise();
1102
1218
  PromiseResult4* p = result.value_if_ready();
1103
1219
  if (grpc_trace_promise_primitives.enabled()) {
1104
1220
  gpr_log(
1105
- GPR_DEBUG, "seq[%p]: poll step 5/6 gets %s", this,
1221
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1222
+ "seq[%p]: poll step 5/6 gets %s", this,
1106
1223
  p != nullptr
1107
- ? (PromiseResultTraits4::IsOk(*p) ? "ready" : "early-error")
1224
+ ? (PromiseResultTraits4::IsOk(*p)
1225
+ ? "ready"
1226
+ : absl::StrCat("early-error:",
1227
+ PromiseResultTraits4::ErrorString(*p))
1228
+ .c_str())
1108
1229
  : "pending");
1109
1230
  }
1110
1231
  if (p == nullptr) return Pending{};
@@ -1123,11 +1244,13 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4> {
1123
1244
  default:
1124
1245
  case State::kState5: {
1125
1246
  if (grpc_trace_promise_primitives.enabled()) {
1126
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 6/6", this);
1247
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1248
+ "seq[%p]: begin poll step 6/6", this);
1127
1249
  }
1128
1250
  auto result = current_promise();
1129
1251
  if (grpc_trace_promise_primitives.enabled()) {
1130
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 6/6 gets %s", this,
1252
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1253
+ "seq[%p]: poll step 6/6 gets %s", this,
1131
1254
  result.ready() ? "ready" : "pending");
1132
1255
  }
1133
1256
  auto* p = result.value_if_ready();
@@ -1228,9 +1351,11 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1228
1351
  kState6
1229
1352
  };
1230
1353
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
1354
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
1231
1355
 
1232
- SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4,
1233
- F5&& f5) noexcept {
1356
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5,
1357
+ DebugLocation whence) noexcept
1358
+ : whence(whence) {
1234
1359
  Construct(&prior.prior.prior.prior.prior.prior.current_promise,
1235
1360
  std::forward<P>(p));
1236
1361
  Construct(&prior.prior.prior.prior.prior.prior.next_factory,
@@ -1279,7 +1404,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1279
1404
  tail5:
1280
1405
  Destruct(&prior.next_factory);
1281
1406
  }
1282
- SeqState(const SeqState& other) noexcept : state(other.state) {
1407
+ SeqState(const SeqState& other) noexcept
1408
+ : state(other.state), whence(other.whence) {
1283
1409
  GPR_ASSERT(state == State::kState0);
1284
1410
  Construct(&prior.current_promise, other.prior.current_promise);
1285
1411
  Construct(&prior.prior.prior.prior.prior.prior.next_factory,
@@ -1294,7 +1420,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1294
1420
  Construct(&prior.next_factory, other.prior.next_factory);
1295
1421
  }
1296
1422
  SeqState& operator=(const SeqState& other) = delete;
1297
- SeqState(SeqState&& other) noexcept : state(other.state) {
1423
+ SeqState(SeqState&& other) noexcept
1424
+ : state(other.state), whence(other.whence) {
1298
1425
  switch (state) {
1299
1426
  case State::kState0:
1300
1427
  Construct(
@@ -1351,15 +1478,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1351
1478
  switch (state) {
1352
1479
  case State::kState0: {
1353
1480
  if (grpc_trace_promise_primitives.enabled()) {
1354
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/7", this);
1481
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1482
+ "seq[%p]: begin poll step 1/7", this);
1355
1483
  }
1356
1484
  auto result = prior.prior.prior.prior.prior.prior.current_promise();
1357
1485
  PromiseResult0* p = result.value_if_ready();
1358
1486
  if (grpc_trace_promise_primitives.enabled()) {
1359
1487
  gpr_log(
1360
- GPR_DEBUG, "seq[%p]: poll step 1/7 gets %s", this,
1488
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1489
+ "seq[%p]: poll step 1/7 gets %s", this,
1361
1490
  p != nullptr
1362
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
1491
+ ? (PromiseResultTraits0::IsOk(*p)
1492
+ ? "ready"
1493
+ : absl::StrCat("early-error:",
1494
+ PromiseResultTraits0::ErrorString(*p))
1495
+ .c_str())
1363
1496
  : "pending");
1364
1497
  }
1365
1498
  if (p == nullptr) return Pending{};
@@ -1378,15 +1511,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1378
1511
  ABSL_FALLTHROUGH_INTENDED;
1379
1512
  case State::kState1: {
1380
1513
  if (grpc_trace_promise_primitives.enabled()) {
1381
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/7", this);
1514
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1515
+ "seq[%p]: begin poll step 2/7", this);
1382
1516
  }
1383
1517
  auto result = prior.prior.prior.prior.prior.current_promise();
1384
1518
  PromiseResult1* p = result.value_if_ready();
1385
1519
  if (grpc_trace_promise_primitives.enabled()) {
1386
1520
  gpr_log(
1387
- GPR_DEBUG, "seq[%p]: poll step 2/7 gets %s", this,
1521
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1522
+ "seq[%p]: poll step 2/7 gets %s", this,
1388
1523
  p != nullptr
1389
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
1524
+ ? (PromiseResultTraits1::IsOk(*p)
1525
+ ? "ready"
1526
+ : absl::StrCat("early-error:",
1527
+ PromiseResultTraits1::ErrorString(*p))
1528
+ .c_str())
1390
1529
  : "pending");
1391
1530
  }
1392
1531
  if (p == nullptr) return Pending{};
@@ -1405,15 +1544,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1405
1544
  ABSL_FALLTHROUGH_INTENDED;
1406
1545
  case State::kState2: {
1407
1546
  if (grpc_trace_promise_primitives.enabled()) {
1408
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/7", this);
1547
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1548
+ "seq[%p]: begin poll step 3/7", this);
1409
1549
  }
1410
1550
  auto result = prior.prior.prior.prior.current_promise();
1411
1551
  PromiseResult2* p = result.value_if_ready();
1412
1552
  if (grpc_trace_promise_primitives.enabled()) {
1413
1553
  gpr_log(
1414
- GPR_DEBUG, "seq[%p]: poll step 3/7 gets %s", this,
1554
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1555
+ "seq[%p]: poll step 3/7 gets %s", this,
1415
1556
  p != nullptr
1416
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
1557
+ ? (PromiseResultTraits2::IsOk(*p)
1558
+ ? "ready"
1559
+ : absl::StrCat("early-error:",
1560
+ PromiseResultTraits2::ErrorString(*p))
1561
+ .c_str())
1417
1562
  : "pending");
1418
1563
  }
1419
1564
  if (p == nullptr) return Pending{};
@@ -1431,15 +1576,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1431
1576
  ABSL_FALLTHROUGH_INTENDED;
1432
1577
  case State::kState3: {
1433
1578
  if (grpc_trace_promise_primitives.enabled()) {
1434
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/7", this);
1579
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1580
+ "seq[%p]: begin poll step 4/7", this);
1435
1581
  }
1436
1582
  auto result = prior.prior.prior.current_promise();
1437
1583
  PromiseResult3* p = result.value_if_ready();
1438
1584
  if (grpc_trace_promise_primitives.enabled()) {
1439
1585
  gpr_log(
1440
- GPR_DEBUG, "seq[%p]: poll step 4/7 gets %s", this,
1586
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1587
+ "seq[%p]: poll step 4/7 gets %s", this,
1441
1588
  p != nullptr
1442
- ? (PromiseResultTraits3::IsOk(*p) ? "ready" : "early-error")
1589
+ ? (PromiseResultTraits3::IsOk(*p)
1590
+ ? "ready"
1591
+ : absl::StrCat("early-error:",
1592
+ PromiseResultTraits3::ErrorString(*p))
1593
+ .c_str())
1443
1594
  : "pending");
1444
1595
  }
1445
1596
  if (p == nullptr) return Pending{};
@@ -1457,15 +1608,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1457
1608
  ABSL_FALLTHROUGH_INTENDED;
1458
1609
  case State::kState4: {
1459
1610
  if (grpc_trace_promise_primitives.enabled()) {
1460
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 5/7", this);
1611
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1612
+ "seq[%p]: begin poll step 5/7", this);
1461
1613
  }
1462
1614
  auto result = prior.prior.current_promise();
1463
1615
  PromiseResult4* p = result.value_if_ready();
1464
1616
  if (grpc_trace_promise_primitives.enabled()) {
1465
1617
  gpr_log(
1466
- GPR_DEBUG, "seq[%p]: poll step 5/7 gets %s", this,
1618
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1619
+ "seq[%p]: poll step 5/7 gets %s", this,
1467
1620
  p != nullptr
1468
- ? (PromiseResultTraits4::IsOk(*p) ? "ready" : "early-error")
1621
+ ? (PromiseResultTraits4::IsOk(*p)
1622
+ ? "ready"
1623
+ : absl::StrCat("early-error:",
1624
+ PromiseResultTraits4::ErrorString(*p))
1625
+ .c_str())
1469
1626
  : "pending");
1470
1627
  }
1471
1628
  if (p == nullptr) return Pending{};
@@ -1483,15 +1640,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1483
1640
  ABSL_FALLTHROUGH_INTENDED;
1484
1641
  case State::kState5: {
1485
1642
  if (grpc_trace_promise_primitives.enabled()) {
1486
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 6/7", this);
1643
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1644
+ "seq[%p]: begin poll step 6/7", this);
1487
1645
  }
1488
1646
  auto result = prior.current_promise();
1489
1647
  PromiseResult5* p = result.value_if_ready();
1490
1648
  if (grpc_trace_promise_primitives.enabled()) {
1491
1649
  gpr_log(
1492
- GPR_DEBUG, "seq[%p]: poll step 6/7 gets %s", this,
1650
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1651
+ "seq[%p]: poll step 6/7 gets %s", this,
1493
1652
  p != nullptr
1494
- ? (PromiseResultTraits5::IsOk(*p) ? "ready" : "early-error")
1653
+ ? (PromiseResultTraits5::IsOk(*p)
1654
+ ? "ready"
1655
+ : absl::StrCat("early-error:",
1656
+ PromiseResultTraits5::ErrorString(*p))
1657
+ .c_str())
1495
1658
  : "pending");
1496
1659
  }
1497
1660
  if (p == nullptr) return Pending{};
@@ -1510,11 +1673,13 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5> {
1510
1673
  default:
1511
1674
  case State::kState6: {
1512
1675
  if (grpc_trace_promise_primitives.enabled()) {
1513
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 7/7", this);
1676
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1677
+ "seq[%p]: begin poll step 7/7", this);
1514
1678
  }
1515
1679
  auto result = current_promise();
1516
1680
  if (grpc_trace_promise_primitives.enabled()) {
1517
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 7/7 gets %s", this,
1681
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1682
+ "seq[%p]: poll step 7/7 gets %s", this,
1518
1683
  result.ready() ? "ready" : "pending");
1519
1684
  }
1520
1685
  auto* p = result.value_if_ready();
@@ -1629,9 +1794,11 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1629
1794
  kState7
1630
1795
  };
1631
1796
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
1797
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
1632
1798
 
1633
- SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5,
1634
- F6&& f6) noexcept {
1799
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
1800
+ DebugLocation whence) noexcept
1801
+ : whence(whence) {
1635
1802
  Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
1636
1803
  std::forward<P>(p));
1637
1804
  Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
@@ -1687,7 +1854,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1687
1854
  tail6:
1688
1855
  Destruct(&prior.next_factory);
1689
1856
  }
1690
- SeqState(const SeqState& other) noexcept : state(other.state) {
1857
+ SeqState(const SeqState& other) noexcept
1858
+ : state(other.state), whence(other.whence) {
1691
1859
  GPR_ASSERT(state == State::kState0);
1692
1860
  Construct(&prior.current_promise, other.prior.current_promise);
1693
1861
  Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
@@ -1704,7 +1872,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1704
1872
  Construct(&prior.next_factory, other.prior.next_factory);
1705
1873
  }
1706
1874
  SeqState& operator=(const SeqState& other) = delete;
1707
- SeqState(SeqState&& other) noexcept : state(other.state) {
1875
+ SeqState(SeqState&& other) noexcept
1876
+ : state(other.state), whence(other.whence) {
1708
1877
  switch (state) {
1709
1878
  case State::kState0:
1710
1879
  Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
@@ -1771,16 +1940,22 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1771
1940
  switch (state) {
1772
1941
  case State::kState0: {
1773
1942
  if (grpc_trace_promise_primitives.enabled()) {
1774
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/8", this);
1943
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1944
+ "seq[%p]: begin poll step 1/8", this);
1775
1945
  }
1776
1946
  auto result =
1777
1947
  prior.prior.prior.prior.prior.prior.prior.current_promise();
1778
1948
  PromiseResult0* p = result.value_if_ready();
1779
1949
  if (grpc_trace_promise_primitives.enabled()) {
1780
1950
  gpr_log(
1781
- GPR_DEBUG, "seq[%p]: poll step 1/8 gets %s", this,
1951
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1952
+ "seq[%p]: poll step 1/8 gets %s", this,
1782
1953
  p != nullptr
1783
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
1954
+ ? (PromiseResultTraits0::IsOk(*p)
1955
+ ? "ready"
1956
+ : absl::StrCat("early-error:",
1957
+ PromiseResultTraits0::ErrorString(*p))
1958
+ .c_str())
1784
1959
  : "pending");
1785
1960
  }
1786
1961
  if (p == nullptr) return Pending{};
@@ -1800,15 +1975,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1800
1975
  ABSL_FALLTHROUGH_INTENDED;
1801
1976
  case State::kState1: {
1802
1977
  if (grpc_trace_promise_primitives.enabled()) {
1803
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/8", this);
1978
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1979
+ "seq[%p]: begin poll step 2/8", this);
1804
1980
  }
1805
1981
  auto result = prior.prior.prior.prior.prior.prior.current_promise();
1806
1982
  PromiseResult1* p = result.value_if_ready();
1807
1983
  if (grpc_trace_promise_primitives.enabled()) {
1808
1984
  gpr_log(
1809
- GPR_DEBUG, "seq[%p]: poll step 2/8 gets %s", this,
1985
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
1986
+ "seq[%p]: poll step 2/8 gets %s", this,
1810
1987
  p != nullptr
1811
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
1988
+ ? (PromiseResultTraits1::IsOk(*p)
1989
+ ? "ready"
1990
+ : absl::StrCat("early-error:",
1991
+ PromiseResultTraits1::ErrorString(*p))
1992
+ .c_str())
1812
1993
  : "pending");
1813
1994
  }
1814
1995
  if (p == nullptr) return Pending{};
@@ -1827,15 +2008,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1827
2008
  ABSL_FALLTHROUGH_INTENDED;
1828
2009
  case State::kState2: {
1829
2010
  if (grpc_trace_promise_primitives.enabled()) {
1830
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/8", this);
2011
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2012
+ "seq[%p]: begin poll step 3/8", this);
1831
2013
  }
1832
2014
  auto result = prior.prior.prior.prior.prior.current_promise();
1833
2015
  PromiseResult2* p = result.value_if_ready();
1834
2016
  if (grpc_trace_promise_primitives.enabled()) {
1835
2017
  gpr_log(
1836
- GPR_DEBUG, "seq[%p]: poll step 3/8 gets %s", this,
2018
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2019
+ "seq[%p]: poll step 3/8 gets %s", this,
1837
2020
  p != nullptr
1838
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
2021
+ ? (PromiseResultTraits2::IsOk(*p)
2022
+ ? "ready"
2023
+ : absl::StrCat("early-error:",
2024
+ PromiseResultTraits2::ErrorString(*p))
2025
+ .c_str())
1839
2026
  : "pending");
1840
2027
  }
1841
2028
  if (p == nullptr) return Pending{};
@@ -1854,15 +2041,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1854
2041
  ABSL_FALLTHROUGH_INTENDED;
1855
2042
  case State::kState3: {
1856
2043
  if (grpc_trace_promise_primitives.enabled()) {
1857
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/8", this);
2044
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2045
+ "seq[%p]: begin poll step 4/8", this);
1858
2046
  }
1859
2047
  auto result = prior.prior.prior.prior.current_promise();
1860
2048
  PromiseResult3* p = result.value_if_ready();
1861
2049
  if (grpc_trace_promise_primitives.enabled()) {
1862
2050
  gpr_log(
1863
- GPR_DEBUG, "seq[%p]: poll step 4/8 gets %s", this,
2051
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2052
+ "seq[%p]: poll step 4/8 gets %s", this,
1864
2053
  p != nullptr
1865
- ? (PromiseResultTraits3::IsOk(*p) ? "ready" : "early-error")
2054
+ ? (PromiseResultTraits3::IsOk(*p)
2055
+ ? "ready"
2056
+ : absl::StrCat("early-error:",
2057
+ PromiseResultTraits3::ErrorString(*p))
2058
+ .c_str())
1866
2059
  : "pending");
1867
2060
  }
1868
2061
  if (p == nullptr) return Pending{};
@@ -1880,15 +2073,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1880
2073
  ABSL_FALLTHROUGH_INTENDED;
1881
2074
  case State::kState4: {
1882
2075
  if (grpc_trace_promise_primitives.enabled()) {
1883
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 5/8", this);
2076
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2077
+ "seq[%p]: begin poll step 5/8", this);
1884
2078
  }
1885
2079
  auto result = prior.prior.prior.current_promise();
1886
2080
  PromiseResult4* p = result.value_if_ready();
1887
2081
  if (grpc_trace_promise_primitives.enabled()) {
1888
2082
  gpr_log(
1889
- GPR_DEBUG, "seq[%p]: poll step 5/8 gets %s", this,
2083
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2084
+ "seq[%p]: poll step 5/8 gets %s", this,
1890
2085
  p != nullptr
1891
- ? (PromiseResultTraits4::IsOk(*p) ? "ready" : "early-error")
2086
+ ? (PromiseResultTraits4::IsOk(*p)
2087
+ ? "ready"
2088
+ : absl::StrCat("early-error:",
2089
+ PromiseResultTraits4::ErrorString(*p))
2090
+ .c_str())
1892
2091
  : "pending");
1893
2092
  }
1894
2093
  if (p == nullptr) return Pending{};
@@ -1906,15 +2105,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1906
2105
  ABSL_FALLTHROUGH_INTENDED;
1907
2106
  case State::kState5: {
1908
2107
  if (grpc_trace_promise_primitives.enabled()) {
1909
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 6/8", this);
2108
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2109
+ "seq[%p]: begin poll step 6/8", this);
1910
2110
  }
1911
2111
  auto result = prior.prior.current_promise();
1912
2112
  PromiseResult5* p = result.value_if_ready();
1913
2113
  if (grpc_trace_promise_primitives.enabled()) {
1914
2114
  gpr_log(
1915
- GPR_DEBUG, "seq[%p]: poll step 6/8 gets %s", this,
2115
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2116
+ "seq[%p]: poll step 6/8 gets %s", this,
1916
2117
  p != nullptr
1917
- ? (PromiseResultTraits5::IsOk(*p) ? "ready" : "early-error")
2118
+ ? (PromiseResultTraits5::IsOk(*p)
2119
+ ? "ready"
2120
+ : absl::StrCat("early-error:",
2121
+ PromiseResultTraits5::ErrorString(*p))
2122
+ .c_str())
1918
2123
  : "pending");
1919
2124
  }
1920
2125
  if (p == nullptr) return Pending{};
@@ -1932,15 +2137,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1932
2137
  ABSL_FALLTHROUGH_INTENDED;
1933
2138
  case State::kState6: {
1934
2139
  if (grpc_trace_promise_primitives.enabled()) {
1935
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 7/8", this);
2140
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2141
+ "seq[%p]: begin poll step 7/8", this);
1936
2142
  }
1937
2143
  auto result = prior.current_promise();
1938
2144
  PromiseResult6* p = result.value_if_ready();
1939
2145
  if (grpc_trace_promise_primitives.enabled()) {
1940
2146
  gpr_log(
1941
- GPR_DEBUG, "seq[%p]: poll step 7/8 gets %s", this,
2147
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2148
+ "seq[%p]: poll step 7/8 gets %s", this,
1942
2149
  p != nullptr
1943
- ? (PromiseResultTraits6::IsOk(*p) ? "ready" : "early-error")
2150
+ ? (PromiseResultTraits6::IsOk(*p)
2151
+ ? "ready"
2152
+ : absl::StrCat("early-error:",
2153
+ PromiseResultTraits6::ErrorString(*p))
2154
+ .c_str())
1944
2155
  : "pending");
1945
2156
  }
1946
2157
  if (p == nullptr) return Pending{};
@@ -1959,11 +2170,13 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6> {
1959
2170
  default:
1960
2171
  case State::kState7: {
1961
2172
  if (grpc_trace_promise_primitives.enabled()) {
1962
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 8/8", this);
2173
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2174
+ "seq[%p]: begin poll step 8/8", this);
1963
2175
  }
1964
2176
  auto result = current_promise();
1965
2177
  if (grpc_trace_promise_primitives.enabled()) {
1966
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 8/8 gets %s", this,
2178
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2179
+ "seq[%p]: poll step 8/8 gets %s", this,
1967
2180
  result.ready() ? "ready" : "pending");
1968
2181
  }
1969
2182
  auto* p = result.value_if_ready();
@@ -2091,9 +2304,11 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2091
2304
  kState8
2092
2305
  };
2093
2306
  GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
2307
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
2094
2308
 
2095
2309
  SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
2096
- F7&& f7) noexcept {
2310
+ F7&& f7, DebugLocation whence) noexcept
2311
+ : whence(whence) {
2097
2312
  Construct(&prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
2098
2313
  std::forward<P>(p));
2099
2314
  Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
@@ -2157,7 +2372,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2157
2372
  tail7:
2158
2373
  Destruct(&prior.next_factory);
2159
2374
  }
2160
- SeqState(const SeqState& other) noexcept : state(other.state) {
2375
+ SeqState(const SeqState& other) noexcept
2376
+ : state(other.state), whence(other.whence) {
2161
2377
  GPR_ASSERT(state == State::kState0);
2162
2378
  Construct(&prior.current_promise, other.prior.current_promise);
2163
2379
  Construct(
@@ -2177,7 +2393,8 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2177
2393
  Construct(&prior.next_factory, other.prior.next_factory);
2178
2394
  }
2179
2395
  SeqState& operator=(const SeqState& other) = delete;
2180
- SeqState(SeqState&& other) noexcept : state(other.state) {
2396
+ SeqState(SeqState&& other) noexcept
2397
+ : state(other.state), whence(other.whence) {
2181
2398
  switch (state) {
2182
2399
  case State::kState0:
2183
2400
  Construct(
@@ -2254,16 +2471,22 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2254
2471
  switch (state) {
2255
2472
  case State::kState0: {
2256
2473
  if (grpc_trace_promise_primitives.enabled()) {
2257
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 1/9", this);
2474
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2475
+ "seq[%p]: begin poll step 1/9", this);
2258
2476
  }
2259
2477
  auto result =
2260
2478
  prior.prior.prior.prior.prior.prior.prior.prior.current_promise();
2261
2479
  PromiseResult0* p = result.value_if_ready();
2262
2480
  if (grpc_trace_promise_primitives.enabled()) {
2263
2481
  gpr_log(
2264
- GPR_DEBUG, "seq[%p]: poll step 1/9 gets %s", this,
2482
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2483
+ "seq[%p]: poll step 1/9 gets %s", this,
2265
2484
  p != nullptr
2266
- ? (PromiseResultTraits0::IsOk(*p) ? "ready" : "early-error")
2485
+ ? (PromiseResultTraits0::IsOk(*p)
2486
+ ? "ready"
2487
+ : absl::StrCat("early-error:",
2488
+ PromiseResultTraits0::ErrorString(*p))
2489
+ .c_str())
2267
2490
  : "pending");
2268
2491
  }
2269
2492
  if (p == nullptr) return Pending{};
@@ -2284,16 +2507,22 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2284
2507
  ABSL_FALLTHROUGH_INTENDED;
2285
2508
  case State::kState1: {
2286
2509
  if (grpc_trace_promise_primitives.enabled()) {
2287
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 2/9", this);
2510
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2511
+ "seq[%p]: begin poll step 2/9", this);
2288
2512
  }
2289
2513
  auto result =
2290
2514
  prior.prior.prior.prior.prior.prior.prior.current_promise();
2291
2515
  PromiseResult1* p = result.value_if_ready();
2292
2516
  if (grpc_trace_promise_primitives.enabled()) {
2293
2517
  gpr_log(
2294
- GPR_DEBUG, "seq[%p]: poll step 2/9 gets %s", this,
2518
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2519
+ "seq[%p]: poll step 2/9 gets %s", this,
2295
2520
  p != nullptr
2296
- ? (PromiseResultTraits1::IsOk(*p) ? "ready" : "early-error")
2521
+ ? (PromiseResultTraits1::IsOk(*p)
2522
+ ? "ready"
2523
+ : absl::StrCat("early-error:",
2524
+ PromiseResultTraits1::ErrorString(*p))
2525
+ .c_str())
2297
2526
  : "pending");
2298
2527
  }
2299
2528
  if (p == nullptr) return Pending{};
@@ -2313,15 +2542,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2313
2542
  ABSL_FALLTHROUGH_INTENDED;
2314
2543
  case State::kState2: {
2315
2544
  if (grpc_trace_promise_primitives.enabled()) {
2316
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 3/9", this);
2545
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2546
+ "seq[%p]: begin poll step 3/9", this);
2317
2547
  }
2318
2548
  auto result = prior.prior.prior.prior.prior.prior.current_promise();
2319
2549
  PromiseResult2* p = result.value_if_ready();
2320
2550
  if (grpc_trace_promise_primitives.enabled()) {
2321
2551
  gpr_log(
2322
- GPR_DEBUG, "seq[%p]: poll step 3/9 gets %s", this,
2552
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2553
+ "seq[%p]: poll step 3/9 gets %s", this,
2323
2554
  p != nullptr
2324
- ? (PromiseResultTraits2::IsOk(*p) ? "ready" : "early-error")
2555
+ ? (PromiseResultTraits2::IsOk(*p)
2556
+ ? "ready"
2557
+ : absl::StrCat("early-error:",
2558
+ PromiseResultTraits2::ErrorString(*p))
2559
+ .c_str())
2325
2560
  : "pending");
2326
2561
  }
2327
2562
  if (p == nullptr) return Pending{};
@@ -2340,15 +2575,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2340
2575
  ABSL_FALLTHROUGH_INTENDED;
2341
2576
  case State::kState3: {
2342
2577
  if (grpc_trace_promise_primitives.enabled()) {
2343
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 4/9", this);
2578
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2579
+ "seq[%p]: begin poll step 4/9", this);
2344
2580
  }
2345
2581
  auto result = prior.prior.prior.prior.prior.current_promise();
2346
2582
  PromiseResult3* p = result.value_if_ready();
2347
2583
  if (grpc_trace_promise_primitives.enabled()) {
2348
2584
  gpr_log(
2349
- GPR_DEBUG, "seq[%p]: poll step 4/9 gets %s", this,
2585
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2586
+ "seq[%p]: poll step 4/9 gets %s", this,
2350
2587
  p != nullptr
2351
- ? (PromiseResultTraits3::IsOk(*p) ? "ready" : "early-error")
2588
+ ? (PromiseResultTraits3::IsOk(*p)
2589
+ ? "ready"
2590
+ : absl::StrCat("early-error:",
2591
+ PromiseResultTraits3::ErrorString(*p))
2592
+ .c_str())
2352
2593
  : "pending");
2353
2594
  }
2354
2595
  if (p == nullptr) return Pending{};
@@ -2367,15 +2608,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2367
2608
  ABSL_FALLTHROUGH_INTENDED;
2368
2609
  case State::kState4: {
2369
2610
  if (grpc_trace_promise_primitives.enabled()) {
2370
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 5/9", this);
2611
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2612
+ "seq[%p]: begin poll step 5/9", this);
2371
2613
  }
2372
2614
  auto result = prior.prior.prior.prior.current_promise();
2373
2615
  PromiseResult4* p = result.value_if_ready();
2374
2616
  if (grpc_trace_promise_primitives.enabled()) {
2375
2617
  gpr_log(
2376
- GPR_DEBUG, "seq[%p]: poll step 5/9 gets %s", this,
2618
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2619
+ "seq[%p]: poll step 5/9 gets %s", this,
2377
2620
  p != nullptr
2378
- ? (PromiseResultTraits4::IsOk(*p) ? "ready" : "early-error")
2621
+ ? (PromiseResultTraits4::IsOk(*p)
2622
+ ? "ready"
2623
+ : absl::StrCat("early-error:",
2624
+ PromiseResultTraits4::ErrorString(*p))
2625
+ .c_str())
2379
2626
  : "pending");
2380
2627
  }
2381
2628
  if (p == nullptr) return Pending{};
@@ -2393,15 +2640,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2393
2640
  ABSL_FALLTHROUGH_INTENDED;
2394
2641
  case State::kState5: {
2395
2642
  if (grpc_trace_promise_primitives.enabled()) {
2396
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 6/9", this);
2643
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2644
+ "seq[%p]: begin poll step 6/9", this);
2397
2645
  }
2398
2646
  auto result = prior.prior.prior.current_promise();
2399
2647
  PromiseResult5* p = result.value_if_ready();
2400
2648
  if (grpc_trace_promise_primitives.enabled()) {
2401
2649
  gpr_log(
2402
- GPR_DEBUG, "seq[%p]: poll step 6/9 gets %s", this,
2650
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2651
+ "seq[%p]: poll step 6/9 gets %s", this,
2403
2652
  p != nullptr
2404
- ? (PromiseResultTraits5::IsOk(*p) ? "ready" : "early-error")
2653
+ ? (PromiseResultTraits5::IsOk(*p)
2654
+ ? "ready"
2655
+ : absl::StrCat("early-error:",
2656
+ PromiseResultTraits5::ErrorString(*p))
2657
+ .c_str())
2405
2658
  : "pending");
2406
2659
  }
2407
2660
  if (p == nullptr) return Pending{};
@@ -2419,15 +2672,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2419
2672
  ABSL_FALLTHROUGH_INTENDED;
2420
2673
  case State::kState6: {
2421
2674
  if (grpc_trace_promise_primitives.enabled()) {
2422
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 7/9", this);
2675
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2676
+ "seq[%p]: begin poll step 7/9", this);
2423
2677
  }
2424
2678
  auto result = prior.prior.current_promise();
2425
2679
  PromiseResult6* p = result.value_if_ready();
2426
2680
  if (grpc_trace_promise_primitives.enabled()) {
2427
2681
  gpr_log(
2428
- GPR_DEBUG, "seq[%p]: poll step 7/9 gets %s", this,
2682
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2683
+ "seq[%p]: poll step 7/9 gets %s", this,
2429
2684
  p != nullptr
2430
- ? (PromiseResultTraits6::IsOk(*p) ? "ready" : "early-error")
2685
+ ? (PromiseResultTraits6::IsOk(*p)
2686
+ ? "ready"
2687
+ : absl::StrCat("early-error:",
2688
+ PromiseResultTraits6::ErrorString(*p))
2689
+ .c_str())
2431
2690
  : "pending");
2432
2691
  }
2433
2692
  if (p == nullptr) return Pending{};
@@ -2445,15 +2704,21 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2445
2704
  ABSL_FALLTHROUGH_INTENDED;
2446
2705
  case State::kState7: {
2447
2706
  if (grpc_trace_promise_primitives.enabled()) {
2448
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 8/9", this);
2707
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2708
+ "seq[%p]: begin poll step 8/9", this);
2449
2709
  }
2450
2710
  auto result = prior.current_promise();
2451
2711
  PromiseResult7* p = result.value_if_ready();
2452
2712
  if (grpc_trace_promise_primitives.enabled()) {
2453
2713
  gpr_log(
2454
- GPR_DEBUG, "seq[%p]: poll step 8/9 gets %s", this,
2714
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2715
+ "seq[%p]: poll step 8/9 gets %s", this,
2455
2716
  p != nullptr
2456
- ? (PromiseResultTraits7::IsOk(*p) ? "ready" : "early-error")
2717
+ ? (PromiseResultTraits7::IsOk(*p)
2718
+ ? "ready"
2719
+ : absl::StrCat("early-error:",
2720
+ PromiseResultTraits7::ErrorString(*p))
2721
+ .c_str())
2457
2722
  : "pending");
2458
2723
  }
2459
2724
  if (p == nullptr) return Pending{};
@@ -2472,11 +2737,3054 @@ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7> {
2472
2737
  default:
2473
2738
  case State::kState8: {
2474
2739
  if (grpc_trace_promise_primitives.enabled()) {
2475
- gpr_log(GPR_DEBUG, "seq[%p]: begin poll step 9/9", this);
2740
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2741
+ "seq[%p]: begin poll step 9/9", this);
2742
+ }
2743
+ auto result = current_promise();
2744
+ if (grpc_trace_promise_primitives.enabled()) {
2745
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
2746
+ "seq[%p]: poll step 9/9 gets %s", this,
2747
+ result.ready() ? "ready" : "pending");
2748
+ }
2749
+ auto* p = result.value_if_ready();
2750
+ if (p == nullptr) return Pending{};
2751
+ return Result(std::move(*p));
2752
+ }
2753
+ }
2754
+ }
2755
+ };
2756
+
2757
+ template <template <typename> class Traits, typename P, typename F0,
2758
+ typename F1, typename F2, typename F3, typename F4, typename F5,
2759
+ typename F6, typename F7, typename F8>
2760
+ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7, F8> {
2761
+ using Promise0 = PromiseLike<P>;
2762
+ using PromiseResult0 = typename Promise0::Result;
2763
+ using PromiseResultTraits0 = Traits<PromiseResult0>;
2764
+ using NextFactory0 =
2765
+ OncePromiseFactory<typename PromiseResultTraits0::UnwrappedType, F0>;
2766
+ using Promise1 = typename NextFactory0::Promise;
2767
+ using PromiseResult1 = typename Promise1::Result;
2768
+ using PromiseResultTraits1 = Traits<PromiseResult1>;
2769
+ using NextFactory1 =
2770
+ OncePromiseFactory<typename PromiseResultTraits1::UnwrappedType, F1>;
2771
+ using Promise2 = typename NextFactory1::Promise;
2772
+ using PromiseResult2 = typename Promise2::Result;
2773
+ using PromiseResultTraits2 = Traits<PromiseResult2>;
2774
+ using NextFactory2 =
2775
+ OncePromiseFactory<typename PromiseResultTraits2::UnwrappedType, F2>;
2776
+ using Promise3 = typename NextFactory2::Promise;
2777
+ using PromiseResult3 = typename Promise3::Result;
2778
+ using PromiseResultTraits3 = Traits<PromiseResult3>;
2779
+ using NextFactory3 =
2780
+ OncePromiseFactory<typename PromiseResultTraits3::UnwrappedType, F3>;
2781
+ using Promise4 = typename NextFactory3::Promise;
2782
+ using PromiseResult4 = typename Promise4::Result;
2783
+ using PromiseResultTraits4 = Traits<PromiseResult4>;
2784
+ using NextFactory4 =
2785
+ OncePromiseFactory<typename PromiseResultTraits4::UnwrappedType, F4>;
2786
+ using Promise5 = typename NextFactory4::Promise;
2787
+ using PromiseResult5 = typename Promise5::Result;
2788
+ using PromiseResultTraits5 = Traits<PromiseResult5>;
2789
+ using NextFactory5 =
2790
+ OncePromiseFactory<typename PromiseResultTraits5::UnwrappedType, F5>;
2791
+ using Promise6 = typename NextFactory5::Promise;
2792
+ using PromiseResult6 = typename Promise6::Result;
2793
+ using PromiseResultTraits6 = Traits<PromiseResult6>;
2794
+ using NextFactory6 =
2795
+ OncePromiseFactory<typename PromiseResultTraits6::UnwrappedType, F6>;
2796
+ using Promise7 = typename NextFactory6::Promise;
2797
+ using PromiseResult7 = typename Promise7::Result;
2798
+ using PromiseResultTraits7 = Traits<PromiseResult7>;
2799
+ using NextFactory7 =
2800
+ OncePromiseFactory<typename PromiseResultTraits7::UnwrappedType, F7>;
2801
+ using Promise8 = typename NextFactory7::Promise;
2802
+ using PromiseResult8 = typename Promise8::Result;
2803
+ using PromiseResultTraits8 = Traits<PromiseResult8>;
2804
+ using NextFactory8 =
2805
+ OncePromiseFactory<typename PromiseResultTraits8::UnwrappedType, F8>;
2806
+ using Promise9 = typename NextFactory8::Promise;
2807
+ using PromiseResult9 = typename Promise9::Result;
2808
+ using PromiseResultTraits9 = Traits<PromiseResult9>;
2809
+ using Result = typename PromiseResultTraits9::WrappedType;
2810
+ struct Running0 {
2811
+ GPR_NO_UNIQUE_ADDRESS Promise0 current_promise;
2812
+ GPR_NO_UNIQUE_ADDRESS NextFactory0 next_factory;
2813
+ };
2814
+ struct Running1 {
2815
+ union {
2816
+ GPR_NO_UNIQUE_ADDRESS Running0 prior;
2817
+ GPR_NO_UNIQUE_ADDRESS Promise1 current_promise;
2818
+ };
2819
+ GPR_NO_UNIQUE_ADDRESS NextFactory1 next_factory;
2820
+ };
2821
+ struct Running2 {
2822
+ union {
2823
+ GPR_NO_UNIQUE_ADDRESS Running1 prior;
2824
+ GPR_NO_UNIQUE_ADDRESS Promise2 current_promise;
2825
+ };
2826
+ GPR_NO_UNIQUE_ADDRESS NextFactory2 next_factory;
2827
+ };
2828
+ struct Running3 {
2829
+ union {
2830
+ GPR_NO_UNIQUE_ADDRESS Running2 prior;
2831
+ GPR_NO_UNIQUE_ADDRESS Promise3 current_promise;
2832
+ };
2833
+ GPR_NO_UNIQUE_ADDRESS NextFactory3 next_factory;
2834
+ };
2835
+ struct Running4 {
2836
+ union {
2837
+ GPR_NO_UNIQUE_ADDRESS Running3 prior;
2838
+ GPR_NO_UNIQUE_ADDRESS Promise4 current_promise;
2839
+ };
2840
+ GPR_NO_UNIQUE_ADDRESS NextFactory4 next_factory;
2841
+ };
2842
+ struct Running5 {
2843
+ union {
2844
+ GPR_NO_UNIQUE_ADDRESS Running4 prior;
2845
+ GPR_NO_UNIQUE_ADDRESS Promise5 current_promise;
2846
+ };
2847
+ GPR_NO_UNIQUE_ADDRESS NextFactory5 next_factory;
2848
+ };
2849
+ struct Running6 {
2850
+ union {
2851
+ GPR_NO_UNIQUE_ADDRESS Running5 prior;
2852
+ GPR_NO_UNIQUE_ADDRESS Promise6 current_promise;
2853
+ };
2854
+ GPR_NO_UNIQUE_ADDRESS NextFactory6 next_factory;
2855
+ };
2856
+ struct Running7 {
2857
+ union {
2858
+ GPR_NO_UNIQUE_ADDRESS Running6 prior;
2859
+ GPR_NO_UNIQUE_ADDRESS Promise7 current_promise;
2860
+ };
2861
+ GPR_NO_UNIQUE_ADDRESS NextFactory7 next_factory;
2862
+ };
2863
+ struct Running8 {
2864
+ union {
2865
+ GPR_NO_UNIQUE_ADDRESS Running7 prior;
2866
+ GPR_NO_UNIQUE_ADDRESS Promise8 current_promise;
2867
+ };
2868
+ GPR_NO_UNIQUE_ADDRESS NextFactory8 next_factory;
2869
+ };
2870
+ union {
2871
+ GPR_NO_UNIQUE_ADDRESS Running8 prior;
2872
+ GPR_NO_UNIQUE_ADDRESS Promise9 current_promise;
2873
+ };
2874
+ enum class State : uint8_t {
2875
+ kState0,
2876
+ kState1,
2877
+ kState2,
2878
+ kState3,
2879
+ kState4,
2880
+ kState5,
2881
+ kState6,
2882
+ kState7,
2883
+ kState8,
2884
+ kState9
2885
+ };
2886
+ GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
2887
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
2888
+
2889
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
2890
+ F7&& f7, F8&& f8, DebugLocation whence) noexcept
2891
+ : whence(whence) {
2892
+ Construct(
2893
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
2894
+ std::forward<P>(p));
2895
+ Construct(
2896
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
2897
+ std::forward<F0>(f0));
2898
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
2899
+ std::forward<F1>(f1));
2900
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
2901
+ std::forward<F2>(f2));
2902
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
2903
+ std::forward<F3>(f3));
2904
+ Construct(&prior.prior.prior.prior.prior.next_factory,
2905
+ std::forward<F4>(f4));
2906
+ Construct(&prior.prior.prior.prior.next_factory, std::forward<F5>(f5));
2907
+ Construct(&prior.prior.prior.next_factory, std::forward<F6>(f6));
2908
+ Construct(&prior.prior.next_factory, std::forward<F7>(f7));
2909
+ Construct(&prior.next_factory, std::forward<F8>(f8));
2910
+ }
2911
+ ~SeqState() {
2912
+ switch (state) {
2913
+ case State::kState0:
2914
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
2915
+ .current_promise);
2916
+ goto tail0;
2917
+ case State::kState1:
2918
+ Destruct(
2919
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
2920
+ goto tail1;
2921
+ case State::kState2:
2922
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
2923
+ goto tail2;
2924
+ case State::kState3:
2925
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
2926
+ goto tail3;
2927
+ case State::kState4:
2928
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
2929
+ goto tail4;
2930
+ case State::kState5:
2931
+ Destruct(&prior.prior.prior.prior.current_promise);
2932
+ goto tail5;
2933
+ case State::kState6:
2934
+ Destruct(&prior.prior.prior.current_promise);
2935
+ goto tail6;
2936
+ case State::kState7:
2937
+ Destruct(&prior.prior.current_promise);
2938
+ goto tail7;
2939
+ case State::kState8:
2940
+ Destruct(&prior.current_promise);
2941
+ goto tail8;
2942
+ case State::kState9:
2943
+ Destruct(&current_promise);
2944
+ return;
2945
+ }
2946
+ tail0:
2947
+ Destruct(
2948
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
2949
+ tail1:
2950
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
2951
+ tail2:
2952
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
2953
+ tail3:
2954
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
2955
+ tail4:
2956
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
2957
+ tail5:
2958
+ Destruct(&prior.prior.prior.prior.next_factory);
2959
+ tail6:
2960
+ Destruct(&prior.prior.prior.next_factory);
2961
+ tail7:
2962
+ Destruct(&prior.prior.next_factory);
2963
+ tail8:
2964
+ Destruct(&prior.next_factory);
2965
+ }
2966
+ SeqState(const SeqState& other) noexcept
2967
+ : state(other.state), whence(other.whence) {
2968
+ GPR_ASSERT(state == State::kState0);
2969
+ Construct(&prior.current_promise, other.prior.current_promise);
2970
+ Construct(
2971
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
2972
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior
2973
+ .next_factory);
2974
+ Construct(
2975
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
2976
+ other.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
2977
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
2978
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory);
2979
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
2980
+ other.prior.prior.prior.prior.prior.prior.next_factory);
2981
+ Construct(&prior.prior.prior.prior.prior.next_factory,
2982
+ other.prior.prior.prior.prior.prior.next_factory);
2983
+ Construct(&prior.prior.prior.prior.next_factory,
2984
+ other.prior.prior.prior.prior.next_factory);
2985
+ Construct(&prior.prior.prior.next_factory,
2986
+ other.prior.prior.prior.next_factory);
2987
+ Construct(&prior.prior.next_factory, other.prior.prior.next_factory);
2988
+ Construct(&prior.next_factory, other.prior.next_factory);
2989
+ }
2990
+ SeqState& operator=(const SeqState& other) = delete;
2991
+ SeqState(SeqState&& other) noexcept
2992
+ : state(other.state), whence(other.whence) {
2993
+ switch (state) {
2994
+ case State::kState0:
2995
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
2996
+ .current_promise,
2997
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
2998
+ .prior.prior.current_promise));
2999
+ goto tail0;
3000
+ case State::kState1:
3001
+ Construct(
3002
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
3003
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
3004
+ .current_promise));
3005
+ goto tail1;
3006
+ case State::kState2:
3007
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
3008
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
3009
+ .current_promise));
3010
+ goto tail2;
3011
+ case State::kState3:
3012
+ Construct(
3013
+ &prior.prior.prior.prior.prior.prior.current_promise,
3014
+ std::move(
3015
+ other.prior.prior.prior.prior.prior.prior.current_promise));
3016
+ goto tail3;
3017
+ case State::kState4:
3018
+ Construct(
3019
+ &prior.prior.prior.prior.prior.current_promise,
3020
+ std::move(other.prior.prior.prior.prior.prior.current_promise));
3021
+ goto tail4;
3022
+ case State::kState5:
3023
+ Construct(&prior.prior.prior.prior.current_promise,
3024
+ std::move(other.prior.prior.prior.prior.current_promise));
3025
+ goto tail5;
3026
+ case State::kState6:
3027
+ Construct(&prior.prior.prior.current_promise,
3028
+ std::move(other.prior.prior.prior.current_promise));
3029
+ goto tail6;
3030
+ case State::kState7:
3031
+ Construct(&prior.prior.current_promise,
3032
+ std::move(other.prior.prior.current_promise));
3033
+ goto tail7;
3034
+ case State::kState8:
3035
+ Construct(&prior.current_promise,
3036
+ std::move(other.prior.current_promise));
3037
+ goto tail8;
3038
+ case State::kState9:
3039
+ Construct(&current_promise, std::move(other.current_promise));
3040
+ return;
3041
+ }
3042
+ tail0:
3043
+ Construct(
3044
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3045
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior
3046
+ .next_factory));
3047
+ tail1:
3048
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3049
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
3050
+ .next_factory));
3051
+ tail2:
3052
+ Construct(
3053
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
3054
+ std::move(
3055
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory));
3056
+ tail3:
3057
+ Construct(
3058
+ &prior.prior.prior.prior.prior.prior.next_factory,
3059
+ std::move(other.prior.prior.prior.prior.prior.prior.next_factory));
3060
+ tail4:
3061
+ Construct(&prior.prior.prior.prior.prior.next_factory,
3062
+ std::move(other.prior.prior.prior.prior.prior.next_factory));
3063
+ tail5:
3064
+ Construct(&prior.prior.prior.prior.next_factory,
3065
+ std::move(other.prior.prior.prior.prior.next_factory));
3066
+ tail6:
3067
+ Construct(&prior.prior.prior.next_factory,
3068
+ std::move(other.prior.prior.prior.next_factory));
3069
+ tail7:
3070
+ Construct(&prior.prior.next_factory,
3071
+ std::move(other.prior.prior.next_factory));
3072
+ tail8:
3073
+ Construct(&prior.next_factory, std::move(other.prior.next_factory));
3074
+ }
3075
+ SeqState& operator=(SeqState&& other) = delete;
3076
+ Poll<Result> PollOnce() {
3077
+ switch (state) {
3078
+ case State::kState0: {
3079
+ if (grpc_trace_promise_primitives.enabled()) {
3080
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3081
+ "seq[%p]: begin poll step 1/10", this);
3082
+ }
3083
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
3084
+ .current_promise();
3085
+ PromiseResult0* p = result.value_if_ready();
3086
+ if (grpc_trace_promise_primitives.enabled()) {
3087
+ gpr_log(
3088
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3089
+ "seq[%p]: poll step 1/10 gets %s", this,
3090
+ p != nullptr
3091
+ ? (PromiseResultTraits0::IsOk(*p)
3092
+ ? "ready"
3093
+ : absl::StrCat("early-error:",
3094
+ PromiseResultTraits0::ErrorString(*p))
3095
+ .c_str())
3096
+ : "pending");
3097
+ }
3098
+ if (p == nullptr) return Pending{};
3099
+ if (!PromiseResultTraits0::IsOk(*p)) {
3100
+ return PromiseResultTraits0::template ReturnValue<Result>(
3101
+ std::move(*p));
3102
+ }
3103
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3104
+ .current_promise);
3105
+ auto next_promise = PromiseResultTraits0::CallFactory(
3106
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3107
+ std::move(*p));
3108
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3109
+ .next_factory);
3110
+ Construct(
3111
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
3112
+ std::move(next_promise));
3113
+ state = State::kState1;
3114
+ }
3115
+ ABSL_FALLTHROUGH_INTENDED;
3116
+ case State::kState1: {
3117
+ if (grpc_trace_promise_primitives.enabled()) {
3118
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3119
+ "seq[%p]: begin poll step 2/10", this);
3120
+ }
3121
+ auto result =
3122
+ prior.prior.prior.prior.prior.prior.prior.prior.current_promise();
3123
+ PromiseResult1* p = result.value_if_ready();
3124
+ if (grpc_trace_promise_primitives.enabled()) {
3125
+ gpr_log(
3126
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3127
+ "seq[%p]: poll step 2/10 gets %s", this,
3128
+ p != nullptr
3129
+ ? (PromiseResultTraits1::IsOk(*p)
3130
+ ? "ready"
3131
+ : absl::StrCat("early-error:",
3132
+ PromiseResultTraits1::ErrorString(*p))
3133
+ .c_str())
3134
+ : "pending");
3135
+ }
3136
+ if (p == nullptr) return Pending{};
3137
+ if (!PromiseResultTraits1::IsOk(*p)) {
3138
+ return PromiseResultTraits1::template ReturnValue<Result>(
3139
+ std::move(*p));
3140
+ }
3141
+ Destruct(
3142
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
3143
+ auto next_promise = PromiseResultTraits1::CallFactory(
3144
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3145
+ std::move(*p));
3146
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
3147
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
3148
+ std::move(next_promise));
3149
+ state = State::kState2;
3150
+ }
3151
+ ABSL_FALLTHROUGH_INTENDED;
3152
+ case State::kState2: {
3153
+ if (grpc_trace_promise_primitives.enabled()) {
3154
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3155
+ "seq[%p]: begin poll step 3/10", this);
3156
+ }
3157
+ auto result =
3158
+ prior.prior.prior.prior.prior.prior.prior.current_promise();
3159
+ PromiseResult2* p = result.value_if_ready();
3160
+ if (grpc_trace_promise_primitives.enabled()) {
3161
+ gpr_log(
3162
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3163
+ "seq[%p]: poll step 3/10 gets %s", this,
3164
+ p != nullptr
3165
+ ? (PromiseResultTraits2::IsOk(*p)
3166
+ ? "ready"
3167
+ : absl::StrCat("early-error:",
3168
+ PromiseResultTraits2::ErrorString(*p))
3169
+ .c_str())
3170
+ : "pending");
3171
+ }
3172
+ if (p == nullptr) return Pending{};
3173
+ if (!PromiseResultTraits2::IsOk(*p)) {
3174
+ return PromiseResultTraits2::template ReturnValue<Result>(
3175
+ std::move(*p));
3176
+ }
3177
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
3178
+ auto next_promise = PromiseResultTraits2::CallFactory(
3179
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
3180
+ std::move(*p));
3181
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
3182
+ Construct(&prior.prior.prior.prior.prior.prior.current_promise,
3183
+ std::move(next_promise));
3184
+ state = State::kState3;
3185
+ }
3186
+ ABSL_FALLTHROUGH_INTENDED;
3187
+ case State::kState3: {
3188
+ if (grpc_trace_promise_primitives.enabled()) {
3189
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3190
+ "seq[%p]: begin poll step 4/10", this);
3191
+ }
3192
+ auto result = prior.prior.prior.prior.prior.prior.current_promise();
3193
+ PromiseResult3* p = result.value_if_ready();
3194
+ if (grpc_trace_promise_primitives.enabled()) {
3195
+ gpr_log(
3196
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3197
+ "seq[%p]: poll step 4/10 gets %s", this,
3198
+ p != nullptr
3199
+ ? (PromiseResultTraits3::IsOk(*p)
3200
+ ? "ready"
3201
+ : absl::StrCat("early-error:",
3202
+ PromiseResultTraits3::ErrorString(*p))
3203
+ .c_str())
3204
+ : "pending");
3205
+ }
3206
+ if (p == nullptr) return Pending{};
3207
+ if (!PromiseResultTraits3::IsOk(*p)) {
3208
+ return PromiseResultTraits3::template ReturnValue<Result>(
3209
+ std::move(*p));
3210
+ }
3211
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
3212
+ auto next_promise = PromiseResultTraits3::CallFactory(
3213
+ &prior.prior.prior.prior.prior.prior.next_factory, std::move(*p));
3214
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
3215
+ Construct(&prior.prior.prior.prior.prior.current_promise,
3216
+ std::move(next_promise));
3217
+ state = State::kState4;
3218
+ }
3219
+ ABSL_FALLTHROUGH_INTENDED;
3220
+ case State::kState4: {
3221
+ if (grpc_trace_promise_primitives.enabled()) {
3222
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3223
+ "seq[%p]: begin poll step 5/10", this);
3224
+ }
3225
+ auto result = prior.prior.prior.prior.prior.current_promise();
3226
+ PromiseResult4* p = result.value_if_ready();
3227
+ if (grpc_trace_promise_primitives.enabled()) {
3228
+ gpr_log(
3229
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3230
+ "seq[%p]: poll step 5/10 gets %s", this,
3231
+ p != nullptr
3232
+ ? (PromiseResultTraits4::IsOk(*p)
3233
+ ? "ready"
3234
+ : absl::StrCat("early-error:",
3235
+ PromiseResultTraits4::ErrorString(*p))
3236
+ .c_str())
3237
+ : "pending");
3238
+ }
3239
+ if (p == nullptr) return Pending{};
3240
+ if (!PromiseResultTraits4::IsOk(*p)) {
3241
+ return PromiseResultTraits4::template ReturnValue<Result>(
3242
+ std::move(*p));
3243
+ }
3244
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
3245
+ auto next_promise = PromiseResultTraits4::CallFactory(
3246
+ &prior.prior.prior.prior.prior.next_factory, std::move(*p));
3247
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
3248
+ Construct(&prior.prior.prior.prior.current_promise,
3249
+ std::move(next_promise));
3250
+ state = State::kState5;
3251
+ }
3252
+ ABSL_FALLTHROUGH_INTENDED;
3253
+ case State::kState5: {
3254
+ if (grpc_trace_promise_primitives.enabled()) {
3255
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3256
+ "seq[%p]: begin poll step 6/10", this);
3257
+ }
3258
+ auto result = prior.prior.prior.prior.current_promise();
3259
+ PromiseResult5* p = result.value_if_ready();
3260
+ if (grpc_trace_promise_primitives.enabled()) {
3261
+ gpr_log(
3262
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3263
+ "seq[%p]: poll step 6/10 gets %s", this,
3264
+ p != nullptr
3265
+ ? (PromiseResultTraits5::IsOk(*p)
3266
+ ? "ready"
3267
+ : absl::StrCat("early-error:",
3268
+ PromiseResultTraits5::ErrorString(*p))
3269
+ .c_str())
3270
+ : "pending");
3271
+ }
3272
+ if (p == nullptr) return Pending{};
3273
+ if (!PromiseResultTraits5::IsOk(*p)) {
3274
+ return PromiseResultTraits5::template ReturnValue<Result>(
3275
+ std::move(*p));
3276
+ }
3277
+ Destruct(&prior.prior.prior.prior.current_promise);
3278
+ auto next_promise = PromiseResultTraits5::CallFactory(
3279
+ &prior.prior.prior.prior.next_factory, std::move(*p));
3280
+ Destruct(&prior.prior.prior.prior.next_factory);
3281
+ Construct(&prior.prior.prior.current_promise, std::move(next_promise));
3282
+ state = State::kState6;
3283
+ }
3284
+ ABSL_FALLTHROUGH_INTENDED;
3285
+ case State::kState6: {
3286
+ if (grpc_trace_promise_primitives.enabled()) {
3287
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3288
+ "seq[%p]: begin poll step 7/10", this);
3289
+ }
3290
+ auto result = prior.prior.prior.current_promise();
3291
+ PromiseResult6* p = result.value_if_ready();
3292
+ if (grpc_trace_promise_primitives.enabled()) {
3293
+ gpr_log(
3294
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3295
+ "seq[%p]: poll step 7/10 gets %s", this,
3296
+ p != nullptr
3297
+ ? (PromiseResultTraits6::IsOk(*p)
3298
+ ? "ready"
3299
+ : absl::StrCat("early-error:",
3300
+ PromiseResultTraits6::ErrorString(*p))
3301
+ .c_str())
3302
+ : "pending");
3303
+ }
3304
+ if (p == nullptr) return Pending{};
3305
+ if (!PromiseResultTraits6::IsOk(*p)) {
3306
+ return PromiseResultTraits6::template ReturnValue<Result>(
3307
+ std::move(*p));
3308
+ }
3309
+ Destruct(&prior.prior.prior.current_promise);
3310
+ auto next_promise = PromiseResultTraits6::CallFactory(
3311
+ &prior.prior.prior.next_factory, std::move(*p));
3312
+ Destruct(&prior.prior.prior.next_factory);
3313
+ Construct(&prior.prior.current_promise, std::move(next_promise));
3314
+ state = State::kState7;
3315
+ }
3316
+ ABSL_FALLTHROUGH_INTENDED;
3317
+ case State::kState7: {
3318
+ if (grpc_trace_promise_primitives.enabled()) {
3319
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3320
+ "seq[%p]: begin poll step 8/10", this);
3321
+ }
3322
+ auto result = prior.prior.current_promise();
3323
+ PromiseResult7* p = result.value_if_ready();
3324
+ if (grpc_trace_promise_primitives.enabled()) {
3325
+ gpr_log(
3326
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3327
+ "seq[%p]: poll step 8/10 gets %s", this,
3328
+ p != nullptr
3329
+ ? (PromiseResultTraits7::IsOk(*p)
3330
+ ? "ready"
3331
+ : absl::StrCat("early-error:",
3332
+ PromiseResultTraits7::ErrorString(*p))
3333
+ .c_str())
3334
+ : "pending");
3335
+ }
3336
+ if (p == nullptr) return Pending{};
3337
+ if (!PromiseResultTraits7::IsOk(*p)) {
3338
+ return PromiseResultTraits7::template ReturnValue<Result>(
3339
+ std::move(*p));
3340
+ }
3341
+ Destruct(&prior.prior.current_promise);
3342
+ auto next_promise = PromiseResultTraits7::CallFactory(
3343
+ &prior.prior.next_factory, std::move(*p));
3344
+ Destruct(&prior.prior.next_factory);
3345
+ Construct(&prior.current_promise, std::move(next_promise));
3346
+ state = State::kState8;
3347
+ }
3348
+ ABSL_FALLTHROUGH_INTENDED;
3349
+ case State::kState8: {
3350
+ if (grpc_trace_promise_primitives.enabled()) {
3351
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3352
+ "seq[%p]: begin poll step 9/10", this);
3353
+ }
3354
+ auto result = prior.current_promise();
3355
+ PromiseResult8* p = result.value_if_ready();
3356
+ if (grpc_trace_promise_primitives.enabled()) {
3357
+ gpr_log(
3358
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3359
+ "seq[%p]: poll step 9/10 gets %s", this,
3360
+ p != nullptr
3361
+ ? (PromiseResultTraits8::IsOk(*p)
3362
+ ? "ready"
3363
+ : absl::StrCat("early-error:",
3364
+ PromiseResultTraits8::ErrorString(*p))
3365
+ .c_str())
3366
+ : "pending");
3367
+ }
3368
+ if (p == nullptr) return Pending{};
3369
+ if (!PromiseResultTraits8::IsOk(*p)) {
3370
+ return PromiseResultTraits8::template ReturnValue<Result>(
3371
+ std::move(*p));
3372
+ }
3373
+ Destruct(&prior.current_promise);
3374
+ auto next_promise = PromiseResultTraits8::CallFactory(
3375
+ &prior.next_factory, std::move(*p));
3376
+ Destruct(&prior.next_factory);
3377
+ Construct(&current_promise, std::move(next_promise));
3378
+ state = State::kState9;
3379
+ }
3380
+ ABSL_FALLTHROUGH_INTENDED;
3381
+ default:
3382
+ case State::kState9: {
3383
+ if (grpc_trace_promise_primitives.enabled()) {
3384
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3385
+ "seq[%p]: begin poll step 10/10", this);
3386
+ }
3387
+ auto result = current_promise();
3388
+ if (grpc_trace_promise_primitives.enabled()) {
3389
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3390
+ "seq[%p]: poll step 10/10 gets %s", this,
3391
+ result.ready() ? "ready" : "pending");
3392
+ }
3393
+ auto* p = result.value_if_ready();
3394
+ if (p == nullptr) return Pending{};
3395
+ return Result(std::move(*p));
3396
+ }
3397
+ }
3398
+ }
3399
+ };
3400
+
3401
+ template <template <typename> class Traits, typename P, typename F0,
3402
+ typename F1, typename F2, typename F3, typename F4, typename F5,
3403
+ typename F6, typename F7, typename F8, typename F9>
3404
+ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9> {
3405
+ using Promise0 = PromiseLike<P>;
3406
+ using PromiseResult0 = typename Promise0::Result;
3407
+ using PromiseResultTraits0 = Traits<PromiseResult0>;
3408
+ using NextFactory0 =
3409
+ OncePromiseFactory<typename PromiseResultTraits0::UnwrappedType, F0>;
3410
+ using Promise1 = typename NextFactory0::Promise;
3411
+ using PromiseResult1 = typename Promise1::Result;
3412
+ using PromiseResultTraits1 = Traits<PromiseResult1>;
3413
+ using NextFactory1 =
3414
+ OncePromiseFactory<typename PromiseResultTraits1::UnwrappedType, F1>;
3415
+ using Promise2 = typename NextFactory1::Promise;
3416
+ using PromiseResult2 = typename Promise2::Result;
3417
+ using PromiseResultTraits2 = Traits<PromiseResult2>;
3418
+ using NextFactory2 =
3419
+ OncePromiseFactory<typename PromiseResultTraits2::UnwrappedType, F2>;
3420
+ using Promise3 = typename NextFactory2::Promise;
3421
+ using PromiseResult3 = typename Promise3::Result;
3422
+ using PromiseResultTraits3 = Traits<PromiseResult3>;
3423
+ using NextFactory3 =
3424
+ OncePromiseFactory<typename PromiseResultTraits3::UnwrappedType, F3>;
3425
+ using Promise4 = typename NextFactory3::Promise;
3426
+ using PromiseResult4 = typename Promise4::Result;
3427
+ using PromiseResultTraits4 = Traits<PromiseResult4>;
3428
+ using NextFactory4 =
3429
+ OncePromiseFactory<typename PromiseResultTraits4::UnwrappedType, F4>;
3430
+ using Promise5 = typename NextFactory4::Promise;
3431
+ using PromiseResult5 = typename Promise5::Result;
3432
+ using PromiseResultTraits5 = Traits<PromiseResult5>;
3433
+ using NextFactory5 =
3434
+ OncePromiseFactory<typename PromiseResultTraits5::UnwrappedType, F5>;
3435
+ using Promise6 = typename NextFactory5::Promise;
3436
+ using PromiseResult6 = typename Promise6::Result;
3437
+ using PromiseResultTraits6 = Traits<PromiseResult6>;
3438
+ using NextFactory6 =
3439
+ OncePromiseFactory<typename PromiseResultTraits6::UnwrappedType, F6>;
3440
+ using Promise7 = typename NextFactory6::Promise;
3441
+ using PromiseResult7 = typename Promise7::Result;
3442
+ using PromiseResultTraits7 = Traits<PromiseResult7>;
3443
+ using NextFactory7 =
3444
+ OncePromiseFactory<typename PromiseResultTraits7::UnwrappedType, F7>;
3445
+ using Promise8 = typename NextFactory7::Promise;
3446
+ using PromiseResult8 = typename Promise8::Result;
3447
+ using PromiseResultTraits8 = Traits<PromiseResult8>;
3448
+ using NextFactory8 =
3449
+ OncePromiseFactory<typename PromiseResultTraits8::UnwrappedType, F8>;
3450
+ using Promise9 = typename NextFactory8::Promise;
3451
+ using PromiseResult9 = typename Promise9::Result;
3452
+ using PromiseResultTraits9 = Traits<PromiseResult9>;
3453
+ using NextFactory9 =
3454
+ OncePromiseFactory<typename PromiseResultTraits9::UnwrappedType, F9>;
3455
+ using Promise10 = typename NextFactory9::Promise;
3456
+ using PromiseResult10 = typename Promise10::Result;
3457
+ using PromiseResultTraits10 = Traits<PromiseResult10>;
3458
+ using Result = typename PromiseResultTraits10::WrappedType;
3459
+ struct Running0 {
3460
+ GPR_NO_UNIQUE_ADDRESS Promise0 current_promise;
3461
+ GPR_NO_UNIQUE_ADDRESS NextFactory0 next_factory;
3462
+ };
3463
+ struct Running1 {
3464
+ union {
3465
+ GPR_NO_UNIQUE_ADDRESS Running0 prior;
3466
+ GPR_NO_UNIQUE_ADDRESS Promise1 current_promise;
3467
+ };
3468
+ GPR_NO_UNIQUE_ADDRESS NextFactory1 next_factory;
3469
+ };
3470
+ struct Running2 {
3471
+ union {
3472
+ GPR_NO_UNIQUE_ADDRESS Running1 prior;
3473
+ GPR_NO_UNIQUE_ADDRESS Promise2 current_promise;
3474
+ };
3475
+ GPR_NO_UNIQUE_ADDRESS NextFactory2 next_factory;
3476
+ };
3477
+ struct Running3 {
3478
+ union {
3479
+ GPR_NO_UNIQUE_ADDRESS Running2 prior;
3480
+ GPR_NO_UNIQUE_ADDRESS Promise3 current_promise;
3481
+ };
3482
+ GPR_NO_UNIQUE_ADDRESS NextFactory3 next_factory;
3483
+ };
3484
+ struct Running4 {
3485
+ union {
3486
+ GPR_NO_UNIQUE_ADDRESS Running3 prior;
3487
+ GPR_NO_UNIQUE_ADDRESS Promise4 current_promise;
3488
+ };
3489
+ GPR_NO_UNIQUE_ADDRESS NextFactory4 next_factory;
3490
+ };
3491
+ struct Running5 {
3492
+ union {
3493
+ GPR_NO_UNIQUE_ADDRESS Running4 prior;
3494
+ GPR_NO_UNIQUE_ADDRESS Promise5 current_promise;
3495
+ };
3496
+ GPR_NO_UNIQUE_ADDRESS NextFactory5 next_factory;
3497
+ };
3498
+ struct Running6 {
3499
+ union {
3500
+ GPR_NO_UNIQUE_ADDRESS Running5 prior;
3501
+ GPR_NO_UNIQUE_ADDRESS Promise6 current_promise;
3502
+ };
3503
+ GPR_NO_UNIQUE_ADDRESS NextFactory6 next_factory;
3504
+ };
3505
+ struct Running7 {
3506
+ union {
3507
+ GPR_NO_UNIQUE_ADDRESS Running6 prior;
3508
+ GPR_NO_UNIQUE_ADDRESS Promise7 current_promise;
3509
+ };
3510
+ GPR_NO_UNIQUE_ADDRESS NextFactory7 next_factory;
3511
+ };
3512
+ struct Running8 {
3513
+ union {
3514
+ GPR_NO_UNIQUE_ADDRESS Running7 prior;
3515
+ GPR_NO_UNIQUE_ADDRESS Promise8 current_promise;
3516
+ };
3517
+ GPR_NO_UNIQUE_ADDRESS NextFactory8 next_factory;
3518
+ };
3519
+ struct Running9 {
3520
+ union {
3521
+ GPR_NO_UNIQUE_ADDRESS Running8 prior;
3522
+ GPR_NO_UNIQUE_ADDRESS Promise9 current_promise;
3523
+ };
3524
+ GPR_NO_UNIQUE_ADDRESS NextFactory9 next_factory;
3525
+ };
3526
+ union {
3527
+ GPR_NO_UNIQUE_ADDRESS Running9 prior;
3528
+ GPR_NO_UNIQUE_ADDRESS Promise10 current_promise;
3529
+ };
3530
+ enum class State : uint8_t {
3531
+ kState0,
3532
+ kState1,
3533
+ kState2,
3534
+ kState3,
3535
+ kState4,
3536
+ kState5,
3537
+ kState6,
3538
+ kState7,
3539
+ kState8,
3540
+ kState9,
3541
+ kState10
3542
+ };
3543
+ GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
3544
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
3545
+
3546
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
3547
+ F7&& f7, F8&& f8, F9&& f9, DebugLocation whence) noexcept
3548
+ : whence(whence) {
3549
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3550
+ .current_promise,
3551
+ std::forward<P>(p));
3552
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3553
+ .next_factory,
3554
+ std::forward<F0>(f0));
3555
+ Construct(
3556
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3557
+ std::forward<F1>(f1));
3558
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3559
+ std::forward<F2>(f2));
3560
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
3561
+ std::forward<F3>(f3));
3562
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
3563
+ std::forward<F4>(f4));
3564
+ Construct(&prior.prior.prior.prior.prior.next_factory,
3565
+ std::forward<F5>(f5));
3566
+ Construct(&prior.prior.prior.prior.next_factory, std::forward<F6>(f6));
3567
+ Construct(&prior.prior.prior.next_factory, std::forward<F7>(f7));
3568
+ Construct(&prior.prior.next_factory, std::forward<F8>(f8));
3569
+ Construct(&prior.next_factory, std::forward<F9>(f9));
3570
+ }
3571
+ ~SeqState() {
3572
+ switch (state) {
3573
+ case State::kState0:
3574
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3575
+ .current_promise);
3576
+ goto tail0;
3577
+ case State::kState1:
3578
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3579
+ .current_promise);
3580
+ goto tail1;
3581
+ case State::kState2:
3582
+ Destruct(
3583
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
3584
+ goto tail2;
3585
+ case State::kState3:
3586
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
3587
+ goto tail3;
3588
+ case State::kState4:
3589
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
3590
+ goto tail4;
3591
+ case State::kState5:
3592
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
3593
+ goto tail5;
3594
+ case State::kState6:
3595
+ Destruct(&prior.prior.prior.prior.current_promise);
3596
+ goto tail6;
3597
+ case State::kState7:
3598
+ Destruct(&prior.prior.prior.current_promise);
3599
+ goto tail7;
3600
+ case State::kState8:
3601
+ Destruct(&prior.prior.current_promise);
3602
+ goto tail8;
3603
+ case State::kState9:
3604
+ Destruct(&prior.current_promise);
3605
+ goto tail9;
3606
+ case State::kState10:
3607
+ Destruct(&current_promise);
3608
+ return;
3609
+ }
3610
+ tail0:
3611
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3612
+ .next_factory);
3613
+ tail1:
3614
+ Destruct(
3615
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
3616
+ tail2:
3617
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
3618
+ tail3:
3619
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
3620
+ tail4:
3621
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
3622
+ tail5:
3623
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
3624
+ tail6:
3625
+ Destruct(&prior.prior.prior.prior.next_factory);
3626
+ tail7:
3627
+ Destruct(&prior.prior.prior.next_factory);
3628
+ tail8:
3629
+ Destruct(&prior.prior.next_factory);
3630
+ tail9:
3631
+ Destruct(&prior.next_factory);
3632
+ }
3633
+ SeqState(const SeqState& other) noexcept
3634
+ : state(other.state), whence(other.whence) {
3635
+ GPR_ASSERT(state == State::kState0);
3636
+ Construct(&prior.current_promise, other.prior.current_promise);
3637
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3638
+ .next_factory,
3639
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3640
+ .next_factory);
3641
+ Construct(
3642
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3643
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior
3644
+ .next_factory);
3645
+ Construct(
3646
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3647
+ other.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
3648
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
3649
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory);
3650
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
3651
+ other.prior.prior.prior.prior.prior.prior.next_factory);
3652
+ Construct(&prior.prior.prior.prior.prior.next_factory,
3653
+ other.prior.prior.prior.prior.prior.next_factory);
3654
+ Construct(&prior.prior.prior.prior.next_factory,
3655
+ other.prior.prior.prior.prior.next_factory);
3656
+ Construct(&prior.prior.prior.next_factory,
3657
+ other.prior.prior.prior.next_factory);
3658
+ Construct(&prior.prior.next_factory, other.prior.prior.next_factory);
3659
+ Construct(&prior.next_factory, other.prior.next_factory);
3660
+ }
3661
+ SeqState& operator=(const SeqState& other) = delete;
3662
+ SeqState(SeqState&& other) noexcept
3663
+ : state(other.state), whence(other.whence) {
3664
+ switch (state) {
3665
+ case State::kState0:
3666
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3667
+ .current_promise,
3668
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
3669
+ .prior.prior.prior.current_promise));
3670
+ goto tail0;
3671
+ case State::kState1:
3672
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3673
+ .current_promise,
3674
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
3675
+ .prior.prior.current_promise));
3676
+ goto tail1;
3677
+ case State::kState2:
3678
+ Construct(
3679
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
3680
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
3681
+ .current_promise));
3682
+ goto tail2;
3683
+ case State::kState3:
3684
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
3685
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
3686
+ .current_promise));
3687
+ goto tail3;
3688
+ case State::kState4:
3689
+ Construct(
3690
+ &prior.prior.prior.prior.prior.prior.current_promise,
3691
+ std::move(
3692
+ other.prior.prior.prior.prior.prior.prior.current_promise));
3693
+ goto tail4;
3694
+ case State::kState5:
3695
+ Construct(
3696
+ &prior.prior.prior.prior.prior.current_promise,
3697
+ std::move(other.prior.prior.prior.prior.prior.current_promise));
3698
+ goto tail5;
3699
+ case State::kState6:
3700
+ Construct(&prior.prior.prior.prior.current_promise,
3701
+ std::move(other.prior.prior.prior.prior.current_promise));
3702
+ goto tail6;
3703
+ case State::kState7:
3704
+ Construct(&prior.prior.prior.current_promise,
3705
+ std::move(other.prior.prior.prior.current_promise));
3706
+ goto tail7;
3707
+ case State::kState8:
3708
+ Construct(&prior.prior.current_promise,
3709
+ std::move(other.prior.prior.current_promise));
3710
+ goto tail8;
3711
+ case State::kState9:
3712
+ Construct(&prior.current_promise,
3713
+ std::move(other.prior.current_promise));
3714
+ goto tail9;
3715
+ case State::kState10:
3716
+ Construct(&current_promise, std::move(other.current_promise));
3717
+ return;
3718
+ }
3719
+ tail0:
3720
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3721
+ .next_factory,
3722
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
3723
+ .prior.prior.next_factory));
3724
+ tail1:
3725
+ Construct(
3726
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3727
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior
3728
+ .next_factory));
3729
+ tail2:
3730
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3731
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
3732
+ .next_factory));
3733
+ tail3:
3734
+ Construct(
3735
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
3736
+ std::move(
3737
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory));
3738
+ tail4:
3739
+ Construct(
3740
+ &prior.prior.prior.prior.prior.prior.next_factory,
3741
+ std::move(other.prior.prior.prior.prior.prior.prior.next_factory));
3742
+ tail5:
3743
+ Construct(&prior.prior.prior.prior.prior.next_factory,
3744
+ std::move(other.prior.prior.prior.prior.prior.next_factory));
3745
+ tail6:
3746
+ Construct(&prior.prior.prior.prior.next_factory,
3747
+ std::move(other.prior.prior.prior.prior.next_factory));
3748
+ tail7:
3749
+ Construct(&prior.prior.prior.next_factory,
3750
+ std::move(other.prior.prior.prior.next_factory));
3751
+ tail8:
3752
+ Construct(&prior.prior.next_factory,
3753
+ std::move(other.prior.prior.next_factory));
3754
+ tail9:
3755
+ Construct(&prior.next_factory, std::move(other.prior.next_factory));
3756
+ }
3757
+ SeqState& operator=(SeqState&& other) = delete;
3758
+ Poll<Result> PollOnce() {
3759
+ switch (state) {
3760
+ case State::kState0: {
3761
+ if (grpc_trace_promise_primitives.enabled()) {
3762
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3763
+ "seq[%p]: begin poll step 1/11", this);
3764
+ }
3765
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
3766
+ .prior.current_promise();
3767
+ PromiseResult0* p = result.value_if_ready();
3768
+ if (grpc_trace_promise_primitives.enabled()) {
3769
+ gpr_log(
3770
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3771
+ "seq[%p]: poll step 1/11 gets %s", this,
3772
+ p != nullptr
3773
+ ? (PromiseResultTraits0::IsOk(*p)
3774
+ ? "ready"
3775
+ : absl::StrCat("early-error:",
3776
+ PromiseResultTraits0::ErrorString(*p))
3777
+ .c_str())
3778
+ : "pending");
3779
+ }
3780
+ if (p == nullptr) return Pending{};
3781
+ if (!PromiseResultTraits0::IsOk(*p)) {
3782
+ return PromiseResultTraits0::template ReturnValue<Result>(
3783
+ std::move(*p));
3784
+ }
3785
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3786
+ .current_promise);
3787
+ auto next_promise = PromiseResultTraits0::CallFactory(
3788
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3789
+ .next_factory,
3790
+ std::move(*p));
3791
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
3792
+ .next_factory);
3793
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3794
+ .current_promise,
3795
+ std::move(next_promise));
3796
+ state = State::kState1;
3797
+ }
3798
+ ABSL_FALLTHROUGH_INTENDED;
3799
+ case State::kState1: {
3800
+ if (grpc_trace_promise_primitives.enabled()) {
3801
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3802
+ "seq[%p]: begin poll step 2/11", this);
3803
+ }
3804
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
3805
+ .current_promise();
3806
+ PromiseResult1* p = result.value_if_ready();
3807
+ if (grpc_trace_promise_primitives.enabled()) {
3808
+ gpr_log(
3809
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3810
+ "seq[%p]: poll step 2/11 gets %s", this,
3811
+ p != nullptr
3812
+ ? (PromiseResultTraits1::IsOk(*p)
3813
+ ? "ready"
3814
+ : absl::StrCat("early-error:",
3815
+ PromiseResultTraits1::ErrorString(*p))
3816
+ .c_str())
3817
+ : "pending");
3818
+ }
3819
+ if (p == nullptr) return Pending{};
3820
+ if (!PromiseResultTraits1::IsOk(*p)) {
3821
+ return PromiseResultTraits1::template ReturnValue<Result>(
3822
+ std::move(*p));
3823
+ }
3824
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3825
+ .current_promise);
3826
+ auto next_promise = PromiseResultTraits1::CallFactory(
3827
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3828
+ std::move(*p));
3829
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
3830
+ .next_factory);
3831
+ Construct(
3832
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
3833
+ std::move(next_promise));
3834
+ state = State::kState2;
3835
+ }
3836
+ ABSL_FALLTHROUGH_INTENDED;
3837
+ case State::kState2: {
3838
+ if (grpc_trace_promise_primitives.enabled()) {
3839
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3840
+ "seq[%p]: begin poll step 3/11", this);
3841
+ }
3842
+ auto result =
3843
+ prior.prior.prior.prior.prior.prior.prior.prior.current_promise();
3844
+ PromiseResult2* p = result.value_if_ready();
3845
+ if (grpc_trace_promise_primitives.enabled()) {
3846
+ gpr_log(
3847
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3848
+ "seq[%p]: poll step 3/11 gets %s", this,
3849
+ p != nullptr
3850
+ ? (PromiseResultTraits2::IsOk(*p)
3851
+ ? "ready"
3852
+ : absl::StrCat("early-error:",
3853
+ PromiseResultTraits2::ErrorString(*p))
3854
+ .c_str())
3855
+ : "pending");
3856
+ }
3857
+ if (p == nullptr) return Pending{};
3858
+ if (!PromiseResultTraits2::IsOk(*p)) {
3859
+ return PromiseResultTraits2::template ReturnValue<Result>(
3860
+ std::move(*p));
3861
+ }
3862
+ Destruct(
3863
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
3864
+ auto next_promise = PromiseResultTraits2::CallFactory(
3865
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
3866
+ std::move(*p));
3867
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
3868
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
3869
+ std::move(next_promise));
3870
+ state = State::kState3;
3871
+ }
3872
+ ABSL_FALLTHROUGH_INTENDED;
3873
+ case State::kState3: {
3874
+ if (grpc_trace_promise_primitives.enabled()) {
3875
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3876
+ "seq[%p]: begin poll step 4/11", this);
3877
+ }
3878
+ auto result =
3879
+ prior.prior.prior.prior.prior.prior.prior.current_promise();
3880
+ PromiseResult3* p = result.value_if_ready();
3881
+ if (grpc_trace_promise_primitives.enabled()) {
3882
+ gpr_log(
3883
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3884
+ "seq[%p]: poll step 4/11 gets %s", this,
3885
+ p != nullptr
3886
+ ? (PromiseResultTraits3::IsOk(*p)
3887
+ ? "ready"
3888
+ : absl::StrCat("early-error:",
3889
+ PromiseResultTraits3::ErrorString(*p))
3890
+ .c_str())
3891
+ : "pending");
3892
+ }
3893
+ if (p == nullptr) return Pending{};
3894
+ if (!PromiseResultTraits3::IsOk(*p)) {
3895
+ return PromiseResultTraits3::template ReturnValue<Result>(
3896
+ std::move(*p));
3897
+ }
3898
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
3899
+ auto next_promise = PromiseResultTraits3::CallFactory(
3900
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
3901
+ std::move(*p));
3902
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
3903
+ Construct(&prior.prior.prior.prior.prior.prior.current_promise,
3904
+ std::move(next_promise));
3905
+ state = State::kState4;
3906
+ }
3907
+ ABSL_FALLTHROUGH_INTENDED;
3908
+ case State::kState4: {
3909
+ if (grpc_trace_promise_primitives.enabled()) {
3910
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3911
+ "seq[%p]: begin poll step 5/11", this);
3912
+ }
3913
+ auto result = prior.prior.prior.prior.prior.prior.current_promise();
3914
+ PromiseResult4* p = result.value_if_ready();
3915
+ if (grpc_trace_promise_primitives.enabled()) {
3916
+ gpr_log(
3917
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3918
+ "seq[%p]: poll step 5/11 gets %s", this,
3919
+ p != nullptr
3920
+ ? (PromiseResultTraits4::IsOk(*p)
3921
+ ? "ready"
3922
+ : absl::StrCat("early-error:",
3923
+ PromiseResultTraits4::ErrorString(*p))
3924
+ .c_str())
3925
+ : "pending");
3926
+ }
3927
+ if (p == nullptr) return Pending{};
3928
+ if (!PromiseResultTraits4::IsOk(*p)) {
3929
+ return PromiseResultTraits4::template ReturnValue<Result>(
3930
+ std::move(*p));
3931
+ }
3932
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
3933
+ auto next_promise = PromiseResultTraits4::CallFactory(
3934
+ &prior.prior.prior.prior.prior.prior.next_factory, std::move(*p));
3935
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
3936
+ Construct(&prior.prior.prior.prior.prior.current_promise,
3937
+ std::move(next_promise));
3938
+ state = State::kState5;
3939
+ }
3940
+ ABSL_FALLTHROUGH_INTENDED;
3941
+ case State::kState5: {
3942
+ if (grpc_trace_promise_primitives.enabled()) {
3943
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3944
+ "seq[%p]: begin poll step 6/11", this);
3945
+ }
3946
+ auto result = prior.prior.prior.prior.prior.current_promise();
3947
+ PromiseResult5* p = result.value_if_ready();
3948
+ if (grpc_trace_promise_primitives.enabled()) {
3949
+ gpr_log(
3950
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3951
+ "seq[%p]: poll step 6/11 gets %s", this,
3952
+ p != nullptr
3953
+ ? (PromiseResultTraits5::IsOk(*p)
3954
+ ? "ready"
3955
+ : absl::StrCat("early-error:",
3956
+ PromiseResultTraits5::ErrorString(*p))
3957
+ .c_str())
3958
+ : "pending");
3959
+ }
3960
+ if (p == nullptr) return Pending{};
3961
+ if (!PromiseResultTraits5::IsOk(*p)) {
3962
+ return PromiseResultTraits5::template ReturnValue<Result>(
3963
+ std::move(*p));
3964
+ }
3965
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
3966
+ auto next_promise = PromiseResultTraits5::CallFactory(
3967
+ &prior.prior.prior.prior.prior.next_factory, std::move(*p));
3968
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
3969
+ Construct(&prior.prior.prior.prior.current_promise,
3970
+ std::move(next_promise));
3971
+ state = State::kState6;
3972
+ }
3973
+ ABSL_FALLTHROUGH_INTENDED;
3974
+ case State::kState6: {
3975
+ if (grpc_trace_promise_primitives.enabled()) {
3976
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3977
+ "seq[%p]: begin poll step 7/11", this);
3978
+ }
3979
+ auto result = prior.prior.prior.prior.current_promise();
3980
+ PromiseResult6* p = result.value_if_ready();
3981
+ if (grpc_trace_promise_primitives.enabled()) {
3982
+ gpr_log(
3983
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
3984
+ "seq[%p]: poll step 7/11 gets %s", this,
3985
+ p != nullptr
3986
+ ? (PromiseResultTraits6::IsOk(*p)
3987
+ ? "ready"
3988
+ : absl::StrCat("early-error:",
3989
+ PromiseResultTraits6::ErrorString(*p))
3990
+ .c_str())
3991
+ : "pending");
3992
+ }
3993
+ if (p == nullptr) return Pending{};
3994
+ if (!PromiseResultTraits6::IsOk(*p)) {
3995
+ return PromiseResultTraits6::template ReturnValue<Result>(
3996
+ std::move(*p));
3997
+ }
3998
+ Destruct(&prior.prior.prior.prior.current_promise);
3999
+ auto next_promise = PromiseResultTraits6::CallFactory(
4000
+ &prior.prior.prior.prior.next_factory, std::move(*p));
4001
+ Destruct(&prior.prior.prior.prior.next_factory);
4002
+ Construct(&prior.prior.prior.current_promise, std::move(next_promise));
4003
+ state = State::kState7;
4004
+ }
4005
+ ABSL_FALLTHROUGH_INTENDED;
4006
+ case State::kState7: {
4007
+ if (grpc_trace_promise_primitives.enabled()) {
4008
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4009
+ "seq[%p]: begin poll step 8/11", this);
4010
+ }
4011
+ auto result = prior.prior.prior.current_promise();
4012
+ PromiseResult7* p = result.value_if_ready();
4013
+ if (grpc_trace_promise_primitives.enabled()) {
4014
+ gpr_log(
4015
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4016
+ "seq[%p]: poll step 8/11 gets %s", this,
4017
+ p != nullptr
4018
+ ? (PromiseResultTraits7::IsOk(*p)
4019
+ ? "ready"
4020
+ : absl::StrCat("early-error:",
4021
+ PromiseResultTraits7::ErrorString(*p))
4022
+ .c_str())
4023
+ : "pending");
4024
+ }
4025
+ if (p == nullptr) return Pending{};
4026
+ if (!PromiseResultTraits7::IsOk(*p)) {
4027
+ return PromiseResultTraits7::template ReturnValue<Result>(
4028
+ std::move(*p));
4029
+ }
4030
+ Destruct(&prior.prior.prior.current_promise);
4031
+ auto next_promise = PromiseResultTraits7::CallFactory(
4032
+ &prior.prior.prior.next_factory, std::move(*p));
4033
+ Destruct(&prior.prior.prior.next_factory);
4034
+ Construct(&prior.prior.current_promise, std::move(next_promise));
4035
+ state = State::kState8;
4036
+ }
4037
+ ABSL_FALLTHROUGH_INTENDED;
4038
+ case State::kState8: {
4039
+ if (grpc_trace_promise_primitives.enabled()) {
4040
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4041
+ "seq[%p]: begin poll step 9/11", this);
4042
+ }
4043
+ auto result = prior.prior.current_promise();
4044
+ PromiseResult8* p = result.value_if_ready();
4045
+ if (grpc_trace_promise_primitives.enabled()) {
4046
+ gpr_log(
4047
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4048
+ "seq[%p]: poll step 9/11 gets %s", this,
4049
+ p != nullptr
4050
+ ? (PromiseResultTraits8::IsOk(*p)
4051
+ ? "ready"
4052
+ : absl::StrCat("early-error:",
4053
+ PromiseResultTraits8::ErrorString(*p))
4054
+ .c_str())
4055
+ : "pending");
4056
+ }
4057
+ if (p == nullptr) return Pending{};
4058
+ if (!PromiseResultTraits8::IsOk(*p)) {
4059
+ return PromiseResultTraits8::template ReturnValue<Result>(
4060
+ std::move(*p));
4061
+ }
4062
+ Destruct(&prior.prior.current_promise);
4063
+ auto next_promise = PromiseResultTraits8::CallFactory(
4064
+ &prior.prior.next_factory, std::move(*p));
4065
+ Destruct(&prior.prior.next_factory);
4066
+ Construct(&prior.current_promise, std::move(next_promise));
4067
+ state = State::kState9;
4068
+ }
4069
+ ABSL_FALLTHROUGH_INTENDED;
4070
+ case State::kState9: {
4071
+ if (grpc_trace_promise_primitives.enabled()) {
4072
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4073
+ "seq[%p]: begin poll step 10/11", this);
4074
+ }
4075
+ auto result = prior.current_promise();
4076
+ PromiseResult9* p = result.value_if_ready();
4077
+ if (grpc_trace_promise_primitives.enabled()) {
4078
+ gpr_log(
4079
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4080
+ "seq[%p]: poll step 10/11 gets %s", this,
4081
+ p != nullptr
4082
+ ? (PromiseResultTraits9::IsOk(*p)
4083
+ ? "ready"
4084
+ : absl::StrCat("early-error:",
4085
+ PromiseResultTraits9::ErrorString(*p))
4086
+ .c_str())
4087
+ : "pending");
4088
+ }
4089
+ if (p == nullptr) return Pending{};
4090
+ if (!PromiseResultTraits9::IsOk(*p)) {
4091
+ return PromiseResultTraits9::template ReturnValue<Result>(
4092
+ std::move(*p));
4093
+ }
4094
+ Destruct(&prior.current_promise);
4095
+ auto next_promise = PromiseResultTraits9::CallFactory(
4096
+ &prior.next_factory, std::move(*p));
4097
+ Destruct(&prior.next_factory);
4098
+ Construct(&current_promise, std::move(next_promise));
4099
+ state = State::kState10;
4100
+ }
4101
+ ABSL_FALLTHROUGH_INTENDED;
4102
+ default:
4103
+ case State::kState10: {
4104
+ if (grpc_trace_promise_primitives.enabled()) {
4105
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4106
+ "seq[%p]: begin poll step 11/11", this);
4107
+ }
4108
+ auto result = current_promise();
4109
+ if (grpc_trace_promise_primitives.enabled()) {
4110
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4111
+ "seq[%p]: poll step 11/11 gets %s", this,
4112
+ result.ready() ? "ready" : "pending");
4113
+ }
4114
+ auto* p = result.value_if_ready();
4115
+ if (p == nullptr) return Pending{};
4116
+ return Result(std::move(*p));
4117
+ }
4118
+ }
4119
+ }
4120
+ };
4121
+
4122
+ template <template <typename> class Traits, typename P, typename F0,
4123
+ typename F1, typename F2, typename F3, typename F4, typename F5,
4124
+ typename F6, typename F7, typename F8, typename F9, typename F10>
4125
+ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10> {
4126
+ using Promise0 = PromiseLike<P>;
4127
+ using PromiseResult0 = typename Promise0::Result;
4128
+ using PromiseResultTraits0 = Traits<PromiseResult0>;
4129
+ using NextFactory0 =
4130
+ OncePromiseFactory<typename PromiseResultTraits0::UnwrappedType, F0>;
4131
+ using Promise1 = typename NextFactory0::Promise;
4132
+ using PromiseResult1 = typename Promise1::Result;
4133
+ using PromiseResultTraits1 = Traits<PromiseResult1>;
4134
+ using NextFactory1 =
4135
+ OncePromiseFactory<typename PromiseResultTraits1::UnwrappedType, F1>;
4136
+ using Promise2 = typename NextFactory1::Promise;
4137
+ using PromiseResult2 = typename Promise2::Result;
4138
+ using PromiseResultTraits2 = Traits<PromiseResult2>;
4139
+ using NextFactory2 =
4140
+ OncePromiseFactory<typename PromiseResultTraits2::UnwrappedType, F2>;
4141
+ using Promise3 = typename NextFactory2::Promise;
4142
+ using PromiseResult3 = typename Promise3::Result;
4143
+ using PromiseResultTraits3 = Traits<PromiseResult3>;
4144
+ using NextFactory3 =
4145
+ OncePromiseFactory<typename PromiseResultTraits3::UnwrappedType, F3>;
4146
+ using Promise4 = typename NextFactory3::Promise;
4147
+ using PromiseResult4 = typename Promise4::Result;
4148
+ using PromiseResultTraits4 = Traits<PromiseResult4>;
4149
+ using NextFactory4 =
4150
+ OncePromiseFactory<typename PromiseResultTraits4::UnwrappedType, F4>;
4151
+ using Promise5 = typename NextFactory4::Promise;
4152
+ using PromiseResult5 = typename Promise5::Result;
4153
+ using PromiseResultTraits5 = Traits<PromiseResult5>;
4154
+ using NextFactory5 =
4155
+ OncePromiseFactory<typename PromiseResultTraits5::UnwrappedType, F5>;
4156
+ using Promise6 = typename NextFactory5::Promise;
4157
+ using PromiseResult6 = typename Promise6::Result;
4158
+ using PromiseResultTraits6 = Traits<PromiseResult6>;
4159
+ using NextFactory6 =
4160
+ OncePromiseFactory<typename PromiseResultTraits6::UnwrappedType, F6>;
4161
+ using Promise7 = typename NextFactory6::Promise;
4162
+ using PromiseResult7 = typename Promise7::Result;
4163
+ using PromiseResultTraits7 = Traits<PromiseResult7>;
4164
+ using NextFactory7 =
4165
+ OncePromiseFactory<typename PromiseResultTraits7::UnwrappedType, F7>;
4166
+ using Promise8 = typename NextFactory7::Promise;
4167
+ using PromiseResult8 = typename Promise8::Result;
4168
+ using PromiseResultTraits8 = Traits<PromiseResult8>;
4169
+ using NextFactory8 =
4170
+ OncePromiseFactory<typename PromiseResultTraits8::UnwrappedType, F8>;
4171
+ using Promise9 = typename NextFactory8::Promise;
4172
+ using PromiseResult9 = typename Promise9::Result;
4173
+ using PromiseResultTraits9 = Traits<PromiseResult9>;
4174
+ using NextFactory9 =
4175
+ OncePromiseFactory<typename PromiseResultTraits9::UnwrappedType, F9>;
4176
+ using Promise10 = typename NextFactory9::Promise;
4177
+ using PromiseResult10 = typename Promise10::Result;
4178
+ using PromiseResultTraits10 = Traits<PromiseResult10>;
4179
+ using NextFactory10 =
4180
+ OncePromiseFactory<typename PromiseResultTraits10::UnwrappedType, F10>;
4181
+ using Promise11 = typename NextFactory10::Promise;
4182
+ using PromiseResult11 = typename Promise11::Result;
4183
+ using PromiseResultTraits11 = Traits<PromiseResult11>;
4184
+ using Result = typename PromiseResultTraits11::WrappedType;
4185
+ struct Running0 {
4186
+ GPR_NO_UNIQUE_ADDRESS Promise0 current_promise;
4187
+ GPR_NO_UNIQUE_ADDRESS NextFactory0 next_factory;
4188
+ };
4189
+ struct Running1 {
4190
+ union {
4191
+ GPR_NO_UNIQUE_ADDRESS Running0 prior;
4192
+ GPR_NO_UNIQUE_ADDRESS Promise1 current_promise;
4193
+ };
4194
+ GPR_NO_UNIQUE_ADDRESS NextFactory1 next_factory;
4195
+ };
4196
+ struct Running2 {
4197
+ union {
4198
+ GPR_NO_UNIQUE_ADDRESS Running1 prior;
4199
+ GPR_NO_UNIQUE_ADDRESS Promise2 current_promise;
4200
+ };
4201
+ GPR_NO_UNIQUE_ADDRESS NextFactory2 next_factory;
4202
+ };
4203
+ struct Running3 {
4204
+ union {
4205
+ GPR_NO_UNIQUE_ADDRESS Running2 prior;
4206
+ GPR_NO_UNIQUE_ADDRESS Promise3 current_promise;
4207
+ };
4208
+ GPR_NO_UNIQUE_ADDRESS NextFactory3 next_factory;
4209
+ };
4210
+ struct Running4 {
4211
+ union {
4212
+ GPR_NO_UNIQUE_ADDRESS Running3 prior;
4213
+ GPR_NO_UNIQUE_ADDRESS Promise4 current_promise;
4214
+ };
4215
+ GPR_NO_UNIQUE_ADDRESS NextFactory4 next_factory;
4216
+ };
4217
+ struct Running5 {
4218
+ union {
4219
+ GPR_NO_UNIQUE_ADDRESS Running4 prior;
4220
+ GPR_NO_UNIQUE_ADDRESS Promise5 current_promise;
4221
+ };
4222
+ GPR_NO_UNIQUE_ADDRESS NextFactory5 next_factory;
4223
+ };
4224
+ struct Running6 {
4225
+ union {
4226
+ GPR_NO_UNIQUE_ADDRESS Running5 prior;
4227
+ GPR_NO_UNIQUE_ADDRESS Promise6 current_promise;
4228
+ };
4229
+ GPR_NO_UNIQUE_ADDRESS NextFactory6 next_factory;
4230
+ };
4231
+ struct Running7 {
4232
+ union {
4233
+ GPR_NO_UNIQUE_ADDRESS Running6 prior;
4234
+ GPR_NO_UNIQUE_ADDRESS Promise7 current_promise;
4235
+ };
4236
+ GPR_NO_UNIQUE_ADDRESS NextFactory7 next_factory;
4237
+ };
4238
+ struct Running8 {
4239
+ union {
4240
+ GPR_NO_UNIQUE_ADDRESS Running7 prior;
4241
+ GPR_NO_UNIQUE_ADDRESS Promise8 current_promise;
4242
+ };
4243
+ GPR_NO_UNIQUE_ADDRESS NextFactory8 next_factory;
4244
+ };
4245
+ struct Running9 {
4246
+ union {
4247
+ GPR_NO_UNIQUE_ADDRESS Running8 prior;
4248
+ GPR_NO_UNIQUE_ADDRESS Promise9 current_promise;
4249
+ };
4250
+ GPR_NO_UNIQUE_ADDRESS NextFactory9 next_factory;
4251
+ };
4252
+ struct Running10 {
4253
+ union {
4254
+ GPR_NO_UNIQUE_ADDRESS Running9 prior;
4255
+ GPR_NO_UNIQUE_ADDRESS Promise10 current_promise;
4256
+ };
4257
+ GPR_NO_UNIQUE_ADDRESS NextFactory10 next_factory;
4258
+ };
4259
+ union {
4260
+ GPR_NO_UNIQUE_ADDRESS Running10 prior;
4261
+ GPR_NO_UNIQUE_ADDRESS Promise11 current_promise;
4262
+ };
4263
+ enum class State : uint8_t {
4264
+ kState0,
4265
+ kState1,
4266
+ kState2,
4267
+ kState3,
4268
+ kState4,
4269
+ kState5,
4270
+ kState6,
4271
+ kState7,
4272
+ kState8,
4273
+ kState9,
4274
+ kState10,
4275
+ kState11
4276
+ };
4277
+ GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
4278
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
4279
+
4280
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
4281
+ F7&& f7, F8&& f8, F9&& f9, F10&& f10, DebugLocation whence) noexcept
4282
+ : whence(whence) {
4283
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4284
+ .current_promise,
4285
+ std::forward<P>(p));
4286
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4287
+ .next_factory,
4288
+ std::forward<F0>(f0));
4289
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4290
+ .next_factory,
4291
+ std::forward<F1>(f1));
4292
+ Construct(
4293
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4294
+ std::forward<F2>(f2));
4295
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4296
+ std::forward<F3>(f3));
4297
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
4298
+ std::forward<F4>(f4));
4299
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
4300
+ std::forward<F5>(f5));
4301
+ Construct(&prior.prior.prior.prior.prior.next_factory,
4302
+ std::forward<F6>(f6));
4303
+ Construct(&prior.prior.prior.prior.next_factory, std::forward<F7>(f7));
4304
+ Construct(&prior.prior.prior.next_factory, std::forward<F8>(f8));
4305
+ Construct(&prior.prior.next_factory, std::forward<F9>(f9));
4306
+ Construct(&prior.next_factory, std::forward<F10>(f10));
4307
+ }
4308
+ ~SeqState() {
4309
+ switch (state) {
4310
+ case State::kState0:
4311
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4312
+ .prior.current_promise);
4313
+ goto tail0;
4314
+ case State::kState1:
4315
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4316
+ .current_promise);
4317
+ goto tail1;
4318
+ case State::kState2:
4319
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
4320
+ .current_promise);
4321
+ goto tail2;
4322
+ case State::kState3:
4323
+ Destruct(
4324
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
4325
+ goto tail3;
4326
+ case State::kState4:
4327
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
4328
+ goto tail4;
4329
+ case State::kState5:
4330
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
4331
+ goto tail5;
4332
+ case State::kState6:
4333
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
4334
+ goto tail6;
4335
+ case State::kState7:
4336
+ Destruct(&prior.prior.prior.prior.current_promise);
4337
+ goto tail7;
4338
+ case State::kState8:
4339
+ Destruct(&prior.prior.prior.current_promise);
4340
+ goto tail8;
4341
+ case State::kState9:
4342
+ Destruct(&prior.prior.current_promise);
4343
+ goto tail9;
4344
+ case State::kState10:
4345
+ Destruct(&prior.current_promise);
4346
+ goto tail10;
4347
+ case State::kState11:
4348
+ Destruct(&current_promise);
4349
+ return;
4350
+ }
4351
+ tail0:
4352
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4353
+ .next_factory);
4354
+ tail1:
4355
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4356
+ .next_factory);
4357
+ tail2:
4358
+ Destruct(
4359
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
4360
+ tail3:
4361
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
4362
+ tail4:
4363
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
4364
+ tail5:
4365
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
4366
+ tail6:
4367
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
4368
+ tail7:
4369
+ Destruct(&prior.prior.prior.prior.next_factory);
4370
+ tail8:
4371
+ Destruct(&prior.prior.prior.next_factory);
4372
+ tail9:
4373
+ Destruct(&prior.prior.next_factory);
4374
+ tail10:
4375
+ Destruct(&prior.next_factory);
4376
+ }
4377
+ SeqState(const SeqState& other) noexcept
4378
+ : state(other.state), whence(other.whence) {
4379
+ GPR_ASSERT(state == State::kState0);
4380
+ Construct(&prior.current_promise, other.prior.current_promise);
4381
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4382
+ .next_factory,
4383
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4384
+ .prior.next_factory);
4385
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4386
+ .next_factory,
4387
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4388
+ .next_factory);
4389
+ Construct(
4390
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4391
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior
4392
+ .next_factory);
4393
+ Construct(
4394
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4395
+ other.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
4396
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
4397
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory);
4398
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
4399
+ other.prior.prior.prior.prior.prior.prior.next_factory);
4400
+ Construct(&prior.prior.prior.prior.prior.next_factory,
4401
+ other.prior.prior.prior.prior.prior.next_factory);
4402
+ Construct(&prior.prior.prior.prior.next_factory,
4403
+ other.prior.prior.prior.prior.next_factory);
4404
+ Construct(&prior.prior.prior.next_factory,
4405
+ other.prior.prior.prior.next_factory);
4406
+ Construct(&prior.prior.next_factory, other.prior.prior.next_factory);
4407
+ Construct(&prior.next_factory, other.prior.next_factory);
4408
+ }
4409
+ SeqState& operator=(const SeqState& other) = delete;
4410
+ SeqState(SeqState&& other) noexcept
4411
+ : state(other.state), whence(other.whence) {
4412
+ switch (state) {
4413
+ case State::kState0:
4414
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4415
+ .prior.current_promise,
4416
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
4417
+ .prior.prior.prior.prior.current_promise));
4418
+ goto tail0;
4419
+ case State::kState1:
4420
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4421
+ .current_promise,
4422
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
4423
+ .prior.prior.prior.current_promise));
4424
+ goto tail1;
4425
+ case State::kState2:
4426
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
4427
+ .current_promise,
4428
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
4429
+ .prior.prior.current_promise));
4430
+ goto tail2;
4431
+ case State::kState3:
4432
+ Construct(
4433
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
4434
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
4435
+ .current_promise));
4436
+ goto tail3;
4437
+ case State::kState4:
4438
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
4439
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
4440
+ .current_promise));
4441
+ goto tail4;
4442
+ case State::kState5:
4443
+ Construct(
4444
+ &prior.prior.prior.prior.prior.prior.current_promise,
4445
+ std::move(
4446
+ other.prior.prior.prior.prior.prior.prior.current_promise));
4447
+ goto tail5;
4448
+ case State::kState6:
4449
+ Construct(
4450
+ &prior.prior.prior.prior.prior.current_promise,
4451
+ std::move(other.prior.prior.prior.prior.prior.current_promise));
4452
+ goto tail6;
4453
+ case State::kState7:
4454
+ Construct(&prior.prior.prior.prior.current_promise,
4455
+ std::move(other.prior.prior.prior.prior.current_promise));
4456
+ goto tail7;
4457
+ case State::kState8:
4458
+ Construct(&prior.prior.prior.current_promise,
4459
+ std::move(other.prior.prior.prior.current_promise));
4460
+ goto tail8;
4461
+ case State::kState9:
4462
+ Construct(&prior.prior.current_promise,
4463
+ std::move(other.prior.prior.current_promise));
4464
+ goto tail9;
4465
+ case State::kState10:
4466
+ Construct(&prior.current_promise,
4467
+ std::move(other.prior.current_promise));
4468
+ goto tail10;
4469
+ case State::kState11:
4470
+ Construct(&current_promise, std::move(other.current_promise));
4471
+ return;
4472
+ }
4473
+ tail0:
4474
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4475
+ .next_factory,
4476
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
4477
+ .prior.prior.prior.next_factory));
4478
+ tail1:
4479
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4480
+ .next_factory,
4481
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
4482
+ .prior.prior.next_factory));
4483
+ tail2:
4484
+ Construct(
4485
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4486
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior
4487
+ .next_factory));
4488
+ tail3:
4489
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4490
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
4491
+ .next_factory));
4492
+ tail4:
4493
+ Construct(
4494
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
4495
+ std::move(
4496
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory));
4497
+ tail5:
4498
+ Construct(
4499
+ &prior.prior.prior.prior.prior.prior.next_factory,
4500
+ std::move(other.prior.prior.prior.prior.prior.prior.next_factory));
4501
+ tail6:
4502
+ Construct(&prior.prior.prior.prior.prior.next_factory,
4503
+ std::move(other.prior.prior.prior.prior.prior.next_factory));
4504
+ tail7:
4505
+ Construct(&prior.prior.prior.prior.next_factory,
4506
+ std::move(other.prior.prior.prior.prior.next_factory));
4507
+ tail8:
4508
+ Construct(&prior.prior.prior.next_factory,
4509
+ std::move(other.prior.prior.prior.next_factory));
4510
+ tail9:
4511
+ Construct(&prior.prior.next_factory,
4512
+ std::move(other.prior.prior.next_factory));
4513
+ tail10:
4514
+ Construct(&prior.next_factory, std::move(other.prior.next_factory));
4515
+ }
4516
+ SeqState& operator=(SeqState&& other) = delete;
4517
+ Poll<Result> PollOnce() {
4518
+ switch (state) {
4519
+ case State::kState0: {
4520
+ if (grpc_trace_promise_primitives.enabled()) {
4521
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4522
+ "seq[%p]: begin poll step 1/12", this);
4523
+ }
4524
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
4525
+ .prior.prior.current_promise();
4526
+ PromiseResult0* p = result.value_if_ready();
4527
+ if (grpc_trace_promise_primitives.enabled()) {
4528
+ gpr_log(
4529
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4530
+ "seq[%p]: poll step 1/12 gets %s", this,
4531
+ p != nullptr
4532
+ ? (PromiseResultTraits0::IsOk(*p)
4533
+ ? "ready"
4534
+ : absl::StrCat("early-error:",
4535
+ PromiseResultTraits0::ErrorString(*p))
4536
+ .c_str())
4537
+ : "pending");
4538
+ }
4539
+ if (p == nullptr) return Pending{};
4540
+ if (!PromiseResultTraits0::IsOk(*p)) {
4541
+ return PromiseResultTraits0::template ReturnValue<Result>(
4542
+ std::move(*p));
4543
+ }
4544
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4545
+ .prior.current_promise);
4546
+ auto next_promise = PromiseResultTraits0::CallFactory(
4547
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4548
+ .next_factory,
4549
+ std::move(*p));
4550
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4551
+ .prior.next_factory);
4552
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4553
+ .current_promise,
4554
+ std::move(next_promise));
4555
+ state = State::kState1;
4556
+ }
4557
+ ABSL_FALLTHROUGH_INTENDED;
4558
+ case State::kState1: {
4559
+ if (grpc_trace_promise_primitives.enabled()) {
4560
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4561
+ "seq[%p]: begin poll step 2/12", this);
4562
+ }
4563
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
4564
+ .prior.current_promise();
4565
+ PromiseResult1* p = result.value_if_ready();
4566
+ if (grpc_trace_promise_primitives.enabled()) {
4567
+ gpr_log(
4568
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4569
+ "seq[%p]: poll step 2/12 gets %s", this,
4570
+ p != nullptr
4571
+ ? (PromiseResultTraits1::IsOk(*p)
4572
+ ? "ready"
4573
+ : absl::StrCat("early-error:",
4574
+ PromiseResultTraits1::ErrorString(*p))
4575
+ .c_str())
4576
+ : "pending");
4577
+ }
4578
+ if (p == nullptr) return Pending{};
4579
+ if (!PromiseResultTraits1::IsOk(*p)) {
4580
+ return PromiseResultTraits1::template ReturnValue<Result>(
4581
+ std::move(*p));
4582
+ }
4583
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4584
+ .current_promise);
4585
+ auto next_promise = PromiseResultTraits1::CallFactory(
4586
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4587
+ .next_factory,
4588
+ std::move(*p));
4589
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
4590
+ .next_factory);
4591
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
4592
+ .current_promise,
4593
+ std::move(next_promise));
4594
+ state = State::kState2;
4595
+ }
4596
+ ABSL_FALLTHROUGH_INTENDED;
4597
+ case State::kState2: {
4598
+ if (grpc_trace_promise_primitives.enabled()) {
4599
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4600
+ "seq[%p]: begin poll step 3/12", this);
4601
+ }
4602
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
4603
+ .current_promise();
4604
+ PromiseResult2* p = result.value_if_ready();
4605
+ if (grpc_trace_promise_primitives.enabled()) {
4606
+ gpr_log(
4607
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4608
+ "seq[%p]: poll step 3/12 gets %s", this,
4609
+ p != nullptr
4610
+ ? (PromiseResultTraits2::IsOk(*p)
4611
+ ? "ready"
4612
+ : absl::StrCat("early-error:",
4613
+ PromiseResultTraits2::ErrorString(*p))
4614
+ .c_str())
4615
+ : "pending");
4616
+ }
4617
+ if (p == nullptr) return Pending{};
4618
+ if (!PromiseResultTraits2::IsOk(*p)) {
4619
+ return PromiseResultTraits2::template ReturnValue<Result>(
4620
+ std::move(*p));
4621
+ }
4622
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
4623
+ .current_promise);
4624
+ auto next_promise = PromiseResultTraits2::CallFactory(
4625
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4626
+ std::move(*p));
4627
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
4628
+ .next_factory);
4629
+ Construct(
4630
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
4631
+ std::move(next_promise));
4632
+ state = State::kState3;
4633
+ }
4634
+ ABSL_FALLTHROUGH_INTENDED;
4635
+ case State::kState3: {
4636
+ if (grpc_trace_promise_primitives.enabled()) {
4637
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4638
+ "seq[%p]: begin poll step 4/12", this);
4639
+ }
4640
+ auto result =
4641
+ prior.prior.prior.prior.prior.prior.prior.prior.current_promise();
4642
+ PromiseResult3* p = result.value_if_ready();
4643
+ if (grpc_trace_promise_primitives.enabled()) {
4644
+ gpr_log(
4645
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4646
+ "seq[%p]: poll step 4/12 gets %s", this,
4647
+ p != nullptr
4648
+ ? (PromiseResultTraits3::IsOk(*p)
4649
+ ? "ready"
4650
+ : absl::StrCat("early-error:",
4651
+ PromiseResultTraits3::ErrorString(*p))
4652
+ .c_str())
4653
+ : "pending");
4654
+ }
4655
+ if (p == nullptr) return Pending{};
4656
+ if (!PromiseResultTraits3::IsOk(*p)) {
4657
+ return PromiseResultTraits3::template ReturnValue<Result>(
4658
+ std::move(*p));
4659
+ }
4660
+ Destruct(
4661
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
4662
+ auto next_promise = PromiseResultTraits3::CallFactory(
4663
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
4664
+ std::move(*p));
4665
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
4666
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
4667
+ std::move(next_promise));
4668
+ state = State::kState4;
4669
+ }
4670
+ ABSL_FALLTHROUGH_INTENDED;
4671
+ case State::kState4: {
4672
+ if (grpc_trace_promise_primitives.enabled()) {
4673
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4674
+ "seq[%p]: begin poll step 5/12", this);
4675
+ }
4676
+ auto result =
4677
+ prior.prior.prior.prior.prior.prior.prior.current_promise();
4678
+ PromiseResult4* p = result.value_if_ready();
4679
+ if (grpc_trace_promise_primitives.enabled()) {
4680
+ gpr_log(
4681
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4682
+ "seq[%p]: poll step 5/12 gets %s", this,
4683
+ p != nullptr
4684
+ ? (PromiseResultTraits4::IsOk(*p)
4685
+ ? "ready"
4686
+ : absl::StrCat("early-error:",
4687
+ PromiseResultTraits4::ErrorString(*p))
4688
+ .c_str())
4689
+ : "pending");
4690
+ }
4691
+ if (p == nullptr) return Pending{};
4692
+ if (!PromiseResultTraits4::IsOk(*p)) {
4693
+ return PromiseResultTraits4::template ReturnValue<Result>(
4694
+ std::move(*p));
4695
+ }
4696
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
4697
+ auto next_promise = PromiseResultTraits4::CallFactory(
4698
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
4699
+ std::move(*p));
4700
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
4701
+ Construct(&prior.prior.prior.prior.prior.prior.current_promise,
4702
+ std::move(next_promise));
4703
+ state = State::kState5;
4704
+ }
4705
+ ABSL_FALLTHROUGH_INTENDED;
4706
+ case State::kState5: {
4707
+ if (grpc_trace_promise_primitives.enabled()) {
4708
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4709
+ "seq[%p]: begin poll step 6/12", this);
4710
+ }
4711
+ auto result = prior.prior.prior.prior.prior.prior.current_promise();
4712
+ PromiseResult5* p = result.value_if_ready();
4713
+ if (grpc_trace_promise_primitives.enabled()) {
4714
+ gpr_log(
4715
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4716
+ "seq[%p]: poll step 6/12 gets %s", this,
4717
+ p != nullptr
4718
+ ? (PromiseResultTraits5::IsOk(*p)
4719
+ ? "ready"
4720
+ : absl::StrCat("early-error:",
4721
+ PromiseResultTraits5::ErrorString(*p))
4722
+ .c_str())
4723
+ : "pending");
4724
+ }
4725
+ if (p == nullptr) return Pending{};
4726
+ if (!PromiseResultTraits5::IsOk(*p)) {
4727
+ return PromiseResultTraits5::template ReturnValue<Result>(
4728
+ std::move(*p));
4729
+ }
4730
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
4731
+ auto next_promise = PromiseResultTraits5::CallFactory(
4732
+ &prior.prior.prior.prior.prior.prior.next_factory, std::move(*p));
4733
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
4734
+ Construct(&prior.prior.prior.prior.prior.current_promise,
4735
+ std::move(next_promise));
4736
+ state = State::kState6;
4737
+ }
4738
+ ABSL_FALLTHROUGH_INTENDED;
4739
+ case State::kState6: {
4740
+ if (grpc_trace_promise_primitives.enabled()) {
4741
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4742
+ "seq[%p]: begin poll step 7/12", this);
4743
+ }
4744
+ auto result = prior.prior.prior.prior.prior.current_promise();
4745
+ PromiseResult6* p = result.value_if_ready();
4746
+ if (grpc_trace_promise_primitives.enabled()) {
4747
+ gpr_log(
4748
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4749
+ "seq[%p]: poll step 7/12 gets %s", this,
4750
+ p != nullptr
4751
+ ? (PromiseResultTraits6::IsOk(*p)
4752
+ ? "ready"
4753
+ : absl::StrCat("early-error:",
4754
+ PromiseResultTraits6::ErrorString(*p))
4755
+ .c_str())
4756
+ : "pending");
4757
+ }
4758
+ if (p == nullptr) return Pending{};
4759
+ if (!PromiseResultTraits6::IsOk(*p)) {
4760
+ return PromiseResultTraits6::template ReturnValue<Result>(
4761
+ std::move(*p));
4762
+ }
4763
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
4764
+ auto next_promise = PromiseResultTraits6::CallFactory(
4765
+ &prior.prior.prior.prior.prior.next_factory, std::move(*p));
4766
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
4767
+ Construct(&prior.prior.prior.prior.current_promise,
4768
+ std::move(next_promise));
4769
+ state = State::kState7;
4770
+ }
4771
+ ABSL_FALLTHROUGH_INTENDED;
4772
+ case State::kState7: {
4773
+ if (grpc_trace_promise_primitives.enabled()) {
4774
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4775
+ "seq[%p]: begin poll step 8/12", this);
4776
+ }
4777
+ auto result = prior.prior.prior.prior.current_promise();
4778
+ PromiseResult7* p = result.value_if_ready();
4779
+ if (grpc_trace_promise_primitives.enabled()) {
4780
+ gpr_log(
4781
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4782
+ "seq[%p]: poll step 8/12 gets %s", this,
4783
+ p != nullptr
4784
+ ? (PromiseResultTraits7::IsOk(*p)
4785
+ ? "ready"
4786
+ : absl::StrCat("early-error:",
4787
+ PromiseResultTraits7::ErrorString(*p))
4788
+ .c_str())
4789
+ : "pending");
4790
+ }
4791
+ if (p == nullptr) return Pending{};
4792
+ if (!PromiseResultTraits7::IsOk(*p)) {
4793
+ return PromiseResultTraits7::template ReturnValue<Result>(
4794
+ std::move(*p));
4795
+ }
4796
+ Destruct(&prior.prior.prior.prior.current_promise);
4797
+ auto next_promise = PromiseResultTraits7::CallFactory(
4798
+ &prior.prior.prior.prior.next_factory, std::move(*p));
4799
+ Destruct(&prior.prior.prior.prior.next_factory);
4800
+ Construct(&prior.prior.prior.current_promise, std::move(next_promise));
4801
+ state = State::kState8;
4802
+ }
4803
+ ABSL_FALLTHROUGH_INTENDED;
4804
+ case State::kState8: {
4805
+ if (grpc_trace_promise_primitives.enabled()) {
4806
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4807
+ "seq[%p]: begin poll step 9/12", this);
4808
+ }
4809
+ auto result = prior.prior.prior.current_promise();
4810
+ PromiseResult8* p = result.value_if_ready();
4811
+ if (grpc_trace_promise_primitives.enabled()) {
4812
+ gpr_log(
4813
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4814
+ "seq[%p]: poll step 9/12 gets %s", this,
4815
+ p != nullptr
4816
+ ? (PromiseResultTraits8::IsOk(*p)
4817
+ ? "ready"
4818
+ : absl::StrCat("early-error:",
4819
+ PromiseResultTraits8::ErrorString(*p))
4820
+ .c_str())
4821
+ : "pending");
4822
+ }
4823
+ if (p == nullptr) return Pending{};
4824
+ if (!PromiseResultTraits8::IsOk(*p)) {
4825
+ return PromiseResultTraits8::template ReturnValue<Result>(
4826
+ std::move(*p));
4827
+ }
4828
+ Destruct(&prior.prior.prior.current_promise);
4829
+ auto next_promise = PromiseResultTraits8::CallFactory(
4830
+ &prior.prior.prior.next_factory, std::move(*p));
4831
+ Destruct(&prior.prior.prior.next_factory);
4832
+ Construct(&prior.prior.current_promise, std::move(next_promise));
4833
+ state = State::kState9;
4834
+ }
4835
+ ABSL_FALLTHROUGH_INTENDED;
4836
+ case State::kState9: {
4837
+ if (grpc_trace_promise_primitives.enabled()) {
4838
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4839
+ "seq[%p]: begin poll step 10/12", this);
4840
+ }
4841
+ auto result = prior.prior.current_promise();
4842
+ PromiseResult9* p = result.value_if_ready();
4843
+ if (grpc_trace_promise_primitives.enabled()) {
4844
+ gpr_log(
4845
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4846
+ "seq[%p]: poll step 10/12 gets %s", this,
4847
+ p != nullptr
4848
+ ? (PromiseResultTraits9::IsOk(*p)
4849
+ ? "ready"
4850
+ : absl::StrCat("early-error:",
4851
+ PromiseResultTraits9::ErrorString(*p))
4852
+ .c_str())
4853
+ : "pending");
4854
+ }
4855
+ if (p == nullptr) return Pending{};
4856
+ if (!PromiseResultTraits9::IsOk(*p)) {
4857
+ return PromiseResultTraits9::template ReturnValue<Result>(
4858
+ std::move(*p));
4859
+ }
4860
+ Destruct(&prior.prior.current_promise);
4861
+ auto next_promise = PromiseResultTraits9::CallFactory(
4862
+ &prior.prior.next_factory, std::move(*p));
4863
+ Destruct(&prior.prior.next_factory);
4864
+ Construct(&prior.current_promise, std::move(next_promise));
4865
+ state = State::kState10;
4866
+ }
4867
+ ABSL_FALLTHROUGH_INTENDED;
4868
+ case State::kState10: {
4869
+ if (grpc_trace_promise_primitives.enabled()) {
4870
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4871
+ "seq[%p]: begin poll step 11/12", this);
4872
+ }
4873
+ auto result = prior.current_promise();
4874
+ PromiseResult10* p = result.value_if_ready();
4875
+ if (grpc_trace_promise_primitives.enabled()) {
4876
+ gpr_log(
4877
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4878
+ "seq[%p]: poll step 11/12 gets %s", this,
4879
+ p != nullptr
4880
+ ? (PromiseResultTraits10::IsOk(*p)
4881
+ ? "ready"
4882
+ : absl::StrCat("early-error:",
4883
+ PromiseResultTraits10::ErrorString(*p))
4884
+ .c_str())
4885
+ : "pending");
4886
+ }
4887
+ if (p == nullptr) return Pending{};
4888
+ if (!PromiseResultTraits10::IsOk(*p)) {
4889
+ return PromiseResultTraits10::template ReturnValue<Result>(
4890
+ std::move(*p));
4891
+ }
4892
+ Destruct(&prior.current_promise);
4893
+ auto next_promise = PromiseResultTraits10::CallFactory(
4894
+ &prior.next_factory, std::move(*p));
4895
+ Destruct(&prior.next_factory);
4896
+ Construct(&current_promise, std::move(next_promise));
4897
+ state = State::kState11;
4898
+ }
4899
+ ABSL_FALLTHROUGH_INTENDED;
4900
+ default:
4901
+ case State::kState11: {
4902
+ if (grpc_trace_promise_primitives.enabled()) {
4903
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4904
+ "seq[%p]: begin poll step 12/12", this);
4905
+ }
4906
+ auto result = current_promise();
4907
+ if (grpc_trace_promise_primitives.enabled()) {
4908
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
4909
+ "seq[%p]: poll step 12/12 gets %s", this,
4910
+ result.ready() ? "ready" : "pending");
4911
+ }
4912
+ auto* p = result.value_if_ready();
4913
+ if (p == nullptr) return Pending{};
4914
+ return Result(std::move(*p));
4915
+ }
4916
+ }
4917
+ }
4918
+ };
4919
+
4920
+ template <template <typename> class Traits, typename P, typename F0,
4921
+ typename F1, typename F2, typename F3, typename F4, typename F5,
4922
+ typename F6, typename F7, typename F8, typename F9, typename F10,
4923
+ typename F11>
4924
+ struct SeqState<Traits, P, F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11> {
4925
+ using Promise0 = PromiseLike<P>;
4926
+ using PromiseResult0 = typename Promise0::Result;
4927
+ using PromiseResultTraits0 = Traits<PromiseResult0>;
4928
+ using NextFactory0 =
4929
+ OncePromiseFactory<typename PromiseResultTraits0::UnwrappedType, F0>;
4930
+ using Promise1 = typename NextFactory0::Promise;
4931
+ using PromiseResult1 = typename Promise1::Result;
4932
+ using PromiseResultTraits1 = Traits<PromiseResult1>;
4933
+ using NextFactory1 =
4934
+ OncePromiseFactory<typename PromiseResultTraits1::UnwrappedType, F1>;
4935
+ using Promise2 = typename NextFactory1::Promise;
4936
+ using PromiseResult2 = typename Promise2::Result;
4937
+ using PromiseResultTraits2 = Traits<PromiseResult2>;
4938
+ using NextFactory2 =
4939
+ OncePromiseFactory<typename PromiseResultTraits2::UnwrappedType, F2>;
4940
+ using Promise3 = typename NextFactory2::Promise;
4941
+ using PromiseResult3 = typename Promise3::Result;
4942
+ using PromiseResultTraits3 = Traits<PromiseResult3>;
4943
+ using NextFactory3 =
4944
+ OncePromiseFactory<typename PromiseResultTraits3::UnwrappedType, F3>;
4945
+ using Promise4 = typename NextFactory3::Promise;
4946
+ using PromiseResult4 = typename Promise4::Result;
4947
+ using PromiseResultTraits4 = Traits<PromiseResult4>;
4948
+ using NextFactory4 =
4949
+ OncePromiseFactory<typename PromiseResultTraits4::UnwrappedType, F4>;
4950
+ using Promise5 = typename NextFactory4::Promise;
4951
+ using PromiseResult5 = typename Promise5::Result;
4952
+ using PromiseResultTraits5 = Traits<PromiseResult5>;
4953
+ using NextFactory5 =
4954
+ OncePromiseFactory<typename PromiseResultTraits5::UnwrappedType, F5>;
4955
+ using Promise6 = typename NextFactory5::Promise;
4956
+ using PromiseResult6 = typename Promise6::Result;
4957
+ using PromiseResultTraits6 = Traits<PromiseResult6>;
4958
+ using NextFactory6 =
4959
+ OncePromiseFactory<typename PromiseResultTraits6::UnwrappedType, F6>;
4960
+ using Promise7 = typename NextFactory6::Promise;
4961
+ using PromiseResult7 = typename Promise7::Result;
4962
+ using PromiseResultTraits7 = Traits<PromiseResult7>;
4963
+ using NextFactory7 =
4964
+ OncePromiseFactory<typename PromiseResultTraits7::UnwrappedType, F7>;
4965
+ using Promise8 = typename NextFactory7::Promise;
4966
+ using PromiseResult8 = typename Promise8::Result;
4967
+ using PromiseResultTraits8 = Traits<PromiseResult8>;
4968
+ using NextFactory8 =
4969
+ OncePromiseFactory<typename PromiseResultTraits8::UnwrappedType, F8>;
4970
+ using Promise9 = typename NextFactory8::Promise;
4971
+ using PromiseResult9 = typename Promise9::Result;
4972
+ using PromiseResultTraits9 = Traits<PromiseResult9>;
4973
+ using NextFactory9 =
4974
+ OncePromiseFactory<typename PromiseResultTraits9::UnwrappedType, F9>;
4975
+ using Promise10 = typename NextFactory9::Promise;
4976
+ using PromiseResult10 = typename Promise10::Result;
4977
+ using PromiseResultTraits10 = Traits<PromiseResult10>;
4978
+ using NextFactory10 =
4979
+ OncePromiseFactory<typename PromiseResultTraits10::UnwrappedType, F10>;
4980
+ using Promise11 = typename NextFactory10::Promise;
4981
+ using PromiseResult11 = typename Promise11::Result;
4982
+ using PromiseResultTraits11 = Traits<PromiseResult11>;
4983
+ using NextFactory11 =
4984
+ OncePromiseFactory<typename PromiseResultTraits11::UnwrappedType, F11>;
4985
+ using Promise12 = typename NextFactory11::Promise;
4986
+ using PromiseResult12 = typename Promise12::Result;
4987
+ using PromiseResultTraits12 = Traits<PromiseResult12>;
4988
+ using Result = typename PromiseResultTraits12::WrappedType;
4989
+ struct Running0 {
4990
+ GPR_NO_UNIQUE_ADDRESS Promise0 current_promise;
4991
+ GPR_NO_UNIQUE_ADDRESS NextFactory0 next_factory;
4992
+ };
4993
+ struct Running1 {
4994
+ union {
4995
+ GPR_NO_UNIQUE_ADDRESS Running0 prior;
4996
+ GPR_NO_UNIQUE_ADDRESS Promise1 current_promise;
4997
+ };
4998
+ GPR_NO_UNIQUE_ADDRESS NextFactory1 next_factory;
4999
+ };
5000
+ struct Running2 {
5001
+ union {
5002
+ GPR_NO_UNIQUE_ADDRESS Running1 prior;
5003
+ GPR_NO_UNIQUE_ADDRESS Promise2 current_promise;
5004
+ };
5005
+ GPR_NO_UNIQUE_ADDRESS NextFactory2 next_factory;
5006
+ };
5007
+ struct Running3 {
5008
+ union {
5009
+ GPR_NO_UNIQUE_ADDRESS Running2 prior;
5010
+ GPR_NO_UNIQUE_ADDRESS Promise3 current_promise;
5011
+ };
5012
+ GPR_NO_UNIQUE_ADDRESS NextFactory3 next_factory;
5013
+ };
5014
+ struct Running4 {
5015
+ union {
5016
+ GPR_NO_UNIQUE_ADDRESS Running3 prior;
5017
+ GPR_NO_UNIQUE_ADDRESS Promise4 current_promise;
5018
+ };
5019
+ GPR_NO_UNIQUE_ADDRESS NextFactory4 next_factory;
5020
+ };
5021
+ struct Running5 {
5022
+ union {
5023
+ GPR_NO_UNIQUE_ADDRESS Running4 prior;
5024
+ GPR_NO_UNIQUE_ADDRESS Promise5 current_promise;
5025
+ };
5026
+ GPR_NO_UNIQUE_ADDRESS NextFactory5 next_factory;
5027
+ };
5028
+ struct Running6 {
5029
+ union {
5030
+ GPR_NO_UNIQUE_ADDRESS Running5 prior;
5031
+ GPR_NO_UNIQUE_ADDRESS Promise6 current_promise;
5032
+ };
5033
+ GPR_NO_UNIQUE_ADDRESS NextFactory6 next_factory;
5034
+ };
5035
+ struct Running7 {
5036
+ union {
5037
+ GPR_NO_UNIQUE_ADDRESS Running6 prior;
5038
+ GPR_NO_UNIQUE_ADDRESS Promise7 current_promise;
5039
+ };
5040
+ GPR_NO_UNIQUE_ADDRESS NextFactory7 next_factory;
5041
+ };
5042
+ struct Running8 {
5043
+ union {
5044
+ GPR_NO_UNIQUE_ADDRESS Running7 prior;
5045
+ GPR_NO_UNIQUE_ADDRESS Promise8 current_promise;
5046
+ };
5047
+ GPR_NO_UNIQUE_ADDRESS NextFactory8 next_factory;
5048
+ };
5049
+ struct Running9 {
5050
+ union {
5051
+ GPR_NO_UNIQUE_ADDRESS Running8 prior;
5052
+ GPR_NO_UNIQUE_ADDRESS Promise9 current_promise;
5053
+ };
5054
+ GPR_NO_UNIQUE_ADDRESS NextFactory9 next_factory;
5055
+ };
5056
+ struct Running10 {
5057
+ union {
5058
+ GPR_NO_UNIQUE_ADDRESS Running9 prior;
5059
+ GPR_NO_UNIQUE_ADDRESS Promise10 current_promise;
5060
+ };
5061
+ GPR_NO_UNIQUE_ADDRESS NextFactory10 next_factory;
5062
+ };
5063
+ struct Running11 {
5064
+ union {
5065
+ GPR_NO_UNIQUE_ADDRESS Running10 prior;
5066
+ GPR_NO_UNIQUE_ADDRESS Promise11 current_promise;
5067
+ };
5068
+ GPR_NO_UNIQUE_ADDRESS NextFactory11 next_factory;
5069
+ };
5070
+ union {
5071
+ GPR_NO_UNIQUE_ADDRESS Running11 prior;
5072
+ GPR_NO_UNIQUE_ADDRESS Promise12 current_promise;
5073
+ };
5074
+ enum class State : uint8_t {
5075
+ kState0,
5076
+ kState1,
5077
+ kState2,
5078
+ kState3,
5079
+ kState4,
5080
+ kState5,
5081
+ kState6,
5082
+ kState7,
5083
+ kState8,
5084
+ kState9,
5085
+ kState10,
5086
+ kState11,
5087
+ kState12
5088
+ };
5089
+ GPR_NO_UNIQUE_ADDRESS State state = State::kState0;
5090
+ GPR_NO_UNIQUE_ADDRESS DebugLocation whence;
5091
+
5092
+ SeqState(P&& p, F0&& f0, F1&& f1, F2&& f2, F3&& f3, F4&& f4, F5&& f5, F6&& f6,
5093
+ F7&& f7, F8&& f8, F9&& f9, F10&& f10, F11&& f11,
5094
+ DebugLocation whence) noexcept
5095
+ : whence(whence) {
5096
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5097
+ .prior.current_promise,
5098
+ std::forward<P>(p));
5099
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5100
+ .prior.next_factory,
5101
+ std::forward<F0>(f0));
5102
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5103
+ .next_factory,
5104
+ std::forward<F1>(f1));
5105
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5106
+ .next_factory,
5107
+ std::forward<F2>(f2));
5108
+ Construct(
5109
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5110
+ std::forward<F3>(f3));
5111
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5112
+ std::forward<F4>(f4));
5113
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
5114
+ std::forward<F5>(f5));
5115
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
5116
+ std::forward<F6>(f6));
5117
+ Construct(&prior.prior.prior.prior.prior.next_factory,
5118
+ std::forward<F7>(f7));
5119
+ Construct(&prior.prior.prior.prior.next_factory, std::forward<F8>(f8));
5120
+ Construct(&prior.prior.prior.next_factory, std::forward<F9>(f9));
5121
+ Construct(&prior.prior.next_factory, std::forward<F10>(f10));
5122
+ Construct(&prior.next_factory, std::forward<F11>(f11));
5123
+ }
5124
+ ~SeqState() {
5125
+ switch (state) {
5126
+ case State::kState0:
5127
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5128
+ .prior.prior.current_promise);
5129
+ goto tail0;
5130
+ case State::kState1:
5131
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5132
+ .prior.current_promise);
5133
+ goto tail1;
5134
+ case State::kState2:
5135
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5136
+ .current_promise);
5137
+ goto tail2;
5138
+ case State::kState3:
5139
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
5140
+ .current_promise);
5141
+ goto tail3;
5142
+ case State::kState4:
5143
+ Destruct(
5144
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
5145
+ goto tail4;
5146
+ case State::kState5:
5147
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
5148
+ goto tail5;
5149
+ case State::kState6:
5150
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
5151
+ goto tail6;
5152
+ case State::kState7:
5153
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
5154
+ goto tail7;
5155
+ case State::kState8:
5156
+ Destruct(&prior.prior.prior.prior.current_promise);
5157
+ goto tail8;
5158
+ case State::kState9:
5159
+ Destruct(&prior.prior.prior.current_promise);
5160
+ goto tail9;
5161
+ case State::kState10:
5162
+ Destruct(&prior.prior.current_promise);
5163
+ goto tail10;
5164
+ case State::kState11:
5165
+ Destruct(&prior.current_promise);
5166
+ goto tail11;
5167
+ case State::kState12:
5168
+ Destruct(&current_promise);
5169
+ return;
5170
+ }
5171
+ tail0:
5172
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5173
+ .prior.next_factory);
5174
+ tail1:
5175
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5176
+ .next_factory);
5177
+ tail2:
5178
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5179
+ .next_factory);
5180
+ tail3:
5181
+ Destruct(
5182
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
5183
+ tail4:
5184
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
5185
+ tail5:
5186
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
5187
+ tail6:
5188
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
5189
+ tail7:
5190
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
5191
+ tail8:
5192
+ Destruct(&prior.prior.prior.prior.next_factory);
5193
+ tail9:
5194
+ Destruct(&prior.prior.prior.next_factory);
5195
+ tail10:
5196
+ Destruct(&prior.prior.next_factory);
5197
+ tail11:
5198
+ Destruct(&prior.next_factory);
5199
+ }
5200
+ SeqState(const SeqState& other) noexcept
5201
+ : state(other.state), whence(other.whence) {
5202
+ GPR_ASSERT(state == State::kState0);
5203
+ Construct(&prior.current_promise, other.prior.current_promise);
5204
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5205
+ .prior.next_factory,
5206
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5207
+ .prior.prior.next_factory);
5208
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5209
+ .next_factory,
5210
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5211
+ .prior.next_factory);
5212
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5213
+ .next_factory,
5214
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5215
+ .next_factory);
5216
+ Construct(
5217
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5218
+ other.prior.prior.prior.prior.prior.prior.prior.prior.prior
5219
+ .next_factory);
5220
+ Construct(
5221
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5222
+ other.prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
5223
+ Construct(&prior.prior.prior.prior.prior.prior.prior.next_factory,
5224
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory);
5225
+ Construct(&prior.prior.prior.prior.prior.prior.next_factory,
5226
+ other.prior.prior.prior.prior.prior.prior.next_factory);
5227
+ Construct(&prior.prior.prior.prior.prior.next_factory,
5228
+ other.prior.prior.prior.prior.prior.next_factory);
5229
+ Construct(&prior.prior.prior.prior.next_factory,
5230
+ other.prior.prior.prior.prior.next_factory);
5231
+ Construct(&prior.prior.prior.next_factory,
5232
+ other.prior.prior.prior.next_factory);
5233
+ Construct(&prior.prior.next_factory, other.prior.prior.next_factory);
5234
+ Construct(&prior.next_factory, other.prior.next_factory);
5235
+ }
5236
+ SeqState& operator=(const SeqState& other) = delete;
5237
+ SeqState(SeqState&& other) noexcept
5238
+ : state(other.state), whence(other.whence) {
5239
+ switch (state) {
5240
+ case State::kState0:
5241
+ Construct(
5242
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5243
+ .prior.current_promise,
5244
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5245
+ .prior.prior.prior.prior.current_promise));
5246
+ goto tail0;
5247
+ case State::kState1:
5248
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5249
+ .prior.current_promise,
5250
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
5251
+ .prior.prior.prior.prior.current_promise));
5252
+ goto tail1;
5253
+ case State::kState2:
5254
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5255
+ .current_promise,
5256
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
5257
+ .prior.prior.prior.current_promise));
5258
+ goto tail2;
5259
+ case State::kState3:
5260
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
5261
+ .current_promise,
5262
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
5263
+ .prior.prior.current_promise));
5264
+ goto tail3;
5265
+ case State::kState4:
5266
+ Construct(
5267
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
5268
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5269
+ .current_promise));
5270
+ goto tail4;
5271
+ case State::kState5:
5272
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
5273
+ std::move(other.prior.prior.prior.prior.prior.prior.prior
5274
+ .current_promise));
5275
+ goto tail5;
5276
+ case State::kState6:
5277
+ Construct(
5278
+ &prior.prior.prior.prior.prior.prior.current_promise,
5279
+ std::move(
5280
+ other.prior.prior.prior.prior.prior.prior.current_promise));
5281
+ goto tail6;
5282
+ case State::kState7:
5283
+ Construct(
5284
+ &prior.prior.prior.prior.prior.current_promise,
5285
+ std::move(other.prior.prior.prior.prior.prior.current_promise));
5286
+ goto tail7;
5287
+ case State::kState8:
5288
+ Construct(&prior.prior.prior.prior.current_promise,
5289
+ std::move(other.prior.prior.prior.prior.current_promise));
5290
+ goto tail8;
5291
+ case State::kState9:
5292
+ Construct(&prior.prior.prior.current_promise,
5293
+ std::move(other.prior.prior.prior.current_promise));
5294
+ goto tail9;
5295
+ case State::kState10:
5296
+ Construct(&prior.prior.current_promise,
5297
+ std::move(other.prior.prior.current_promise));
5298
+ goto tail10;
5299
+ case State::kState11:
5300
+ Construct(&prior.current_promise,
5301
+ std::move(other.prior.current_promise));
5302
+ goto tail11;
5303
+ case State::kState12:
5304
+ Construct(&current_promise, std::move(other.current_promise));
5305
+ return;
5306
+ }
5307
+ tail0:
5308
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5309
+ .prior.next_factory,
5310
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5311
+ .prior.prior.prior.prior.next_factory));
5312
+ tail1:
5313
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5314
+ .next_factory,
5315
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5316
+ .prior.prior.prior.next_factory));
5317
+ tail2:
5318
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5319
+ .next_factory,
5320
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5321
+ .prior.prior.next_factory));
5322
+ tail3:
5323
+ Construct(
5324
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5325
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior.prior
5326
+ .next_factory));
5327
+ tail4:
5328
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5329
+ std::move(other.prior.prior.prior.prior.prior.prior.prior.prior
5330
+ .next_factory));
5331
+ tail5:
5332
+ Construct(
5333
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
5334
+ std::move(
5335
+ other.prior.prior.prior.prior.prior.prior.prior.next_factory));
5336
+ tail6:
5337
+ Construct(
5338
+ &prior.prior.prior.prior.prior.prior.next_factory,
5339
+ std::move(other.prior.prior.prior.prior.prior.prior.next_factory));
5340
+ tail7:
5341
+ Construct(&prior.prior.prior.prior.prior.next_factory,
5342
+ std::move(other.prior.prior.prior.prior.prior.next_factory));
5343
+ tail8:
5344
+ Construct(&prior.prior.prior.prior.next_factory,
5345
+ std::move(other.prior.prior.prior.prior.next_factory));
5346
+ tail9:
5347
+ Construct(&prior.prior.prior.next_factory,
5348
+ std::move(other.prior.prior.prior.next_factory));
5349
+ tail10:
5350
+ Construct(&prior.prior.next_factory,
5351
+ std::move(other.prior.prior.next_factory));
5352
+ tail11:
5353
+ Construct(&prior.next_factory, std::move(other.prior.next_factory));
5354
+ }
5355
+ SeqState& operator=(SeqState&& other) = delete;
5356
+ Poll<Result> PollOnce() {
5357
+ switch (state) {
5358
+ case State::kState0: {
5359
+ if (grpc_trace_promise_primitives.enabled()) {
5360
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5361
+ "seq[%p]: begin poll step 1/13", this);
5362
+ }
5363
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
5364
+ .prior.prior.prior.current_promise();
5365
+ PromiseResult0* p = result.value_if_ready();
5366
+ if (grpc_trace_promise_primitives.enabled()) {
5367
+ gpr_log(
5368
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5369
+ "seq[%p]: poll step 1/13 gets %s", this,
5370
+ p != nullptr
5371
+ ? (PromiseResultTraits0::IsOk(*p)
5372
+ ? "ready"
5373
+ : absl::StrCat("early-error:",
5374
+ PromiseResultTraits0::ErrorString(*p))
5375
+ .c_str())
5376
+ : "pending");
5377
+ }
5378
+ if (p == nullptr) return Pending{};
5379
+ if (!PromiseResultTraits0::IsOk(*p)) {
5380
+ return PromiseResultTraits0::template ReturnValue<Result>(
5381
+ std::move(*p));
5382
+ }
5383
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5384
+ .prior.prior.current_promise);
5385
+ auto next_promise = PromiseResultTraits0::CallFactory(
5386
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5387
+ .prior.next_factory,
5388
+ std::move(*p));
5389
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5390
+ .prior.prior.next_factory);
5391
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5392
+ .prior.current_promise,
5393
+ std::move(next_promise));
5394
+ state = State::kState1;
5395
+ }
5396
+ ABSL_FALLTHROUGH_INTENDED;
5397
+ case State::kState1: {
5398
+ if (grpc_trace_promise_primitives.enabled()) {
5399
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5400
+ "seq[%p]: begin poll step 2/13", this);
5401
+ }
5402
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
5403
+ .prior.prior.current_promise();
5404
+ PromiseResult1* p = result.value_if_ready();
5405
+ if (grpc_trace_promise_primitives.enabled()) {
5406
+ gpr_log(
5407
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5408
+ "seq[%p]: poll step 2/13 gets %s", this,
5409
+ p != nullptr
5410
+ ? (PromiseResultTraits1::IsOk(*p)
5411
+ ? "ready"
5412
+ : absl::StrCat("early-error:",
5413
+ PromiseResultTraits1::ErrorString(*p))
5414
+ .c_str())
5415
+ : "pending");
5416
+ }
5417
+ if (p == nullptr) return Pending{};
5418
+ if (!PromiseResultTraits1::IsOk(*p)) {
5419
+ return PromiseResultTraits1::template ReturnValue<Result>(
5420
+ std::move(*p));
5421
+ }
5422
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5423
+ .prior.current_promise);
5424
+ auto next_promise = PromiseResultTraits1::CallFactory(
5425
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5426
+ .next_factory,
5427
+ std::move(*p));
5428
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5429
+ .prior.next_factory);
5430
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5431
+ .current_promise,
5432
+ std::move(next_promise));
5433
+ state = State::kState2;
5434
+ }
5435
+ ABSL_FALLTHROUGH_INTENDED;
5436
+ case State::kState2: {
5437
+ if (grpc_trace_promise_primitives.enabled()) {
5438
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5439
+ "seq[%p]: begin poll step 3/13", this);
5440
+ }
5441
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
5442
+ .prior.current_promise();
5443
+ PromiseResult2* p = result.value_if_ready();
5444
+ if (grpc_trace_promise_primitives.enabled()) {
5445
+ gpr_log(
5446
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5447
+ "seq[%p]: poll step 3/13 gets %s", this,
5448
+ p != nullptr
5449
+ ? (PromiseResultTraits2::IsOk(*p)
5450
+ ? "ready"
5451
+ : absl::StrCat("early-error:",
5452
+ PromiseResultTraits2::ErrorString(*p))
5453
+ .c_str())
5454
+ : "pending");
5455
+ }
5456
+ if (p == nullptr) return Pending{};
5457
+ if (!PromiseResultTraits2::IsOk(*p)) {
5458
+ return PromiseResultTraits2::template ReturnValue<Result>(
5459
+ std::move(*p));
5460
+ }
5461
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5462
+ .current_promise);
5463
+ auto next_promise = PromiseResultTraits2::CallFactory(
5464
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5465
+ .next_factory,
5466
+ std::move(*p));
5467
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior.prior
5468
+ .next_factory);
5469
+ Construct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
5470
+ .current_promise,
5471
+ std::move(next_promise));
5472
+ state = State::kState3;
5473
+ }
5474
+ ABSL_FALLTHROUGH_INTENDED;
5475
+ case State::kState3: {
5476
+ if (grpc_trace_promise_primitives.enabled()) {
5477
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5478
+ "seq[%p]: begin poll step 4/13", this);
5479
+ }
5480
+ auto result = prior.prior.prior.prior.prior.prior.prior.prior.prior
5481
+ .current_promise();
5482
+ PromiseResult3* p = result.value_if_ready();
5483
+ if (grpc_trace_promise_primitives.enabled()) {
5484
+ gpr_log(
5485
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5486
+ "seq[%p]: poll step 4/13 gets %s", this,
5487
+ p != nullptr
5488
+ ? (PromiseResultTraits3::IsOk(*p)
5489
+ ? "ready"
5490
+ : absl::StrCat("early-error:",
5491
+ PromiseResultTraits3::ErrorString(*p))
5492
+ .c_str())
5493
+ : "pending");
5494
+ }
5495
+ if (p == nullptr) return Pending{};
5496
+ if (!PromiseResultTraits3::IsOk(*p)) {
5497
+ return PromiseResultTraits3::template ReturnValue<Result>(
5498
+ std::move(*p));
5499
+ }
5500
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
5501
+ .current_promise);
5502
+ auto next_promise = PromiseResultTraits3::CallFactory(
5503
+ &prior.prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5504
+ std::move(*p));
5505
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.prior
5506
+ .next_factory);
5507
+ Construct(
5508
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise,
5509
+ std::move(next_promise));
5510
+ state = State::kState4;
5511
+ }
5512
+ ABSL_FALLTHROUGH_INTENDED;
5513
+ case State::kState4: {
5514
+ if (grpc_trace_promise_primitives.enabled()) {
5515
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5516
+ "seq[%p]: begin poll step 5/13", this);
5517
+ }
5518
+ auto result =
5519
+ prior.prior.prior.prior.prior.prior.prior.prior.current_promise();
5520
+ PromiseResult4* p = result.value_if_ready();
5521
+ if (grpc_trace_promise_primitives.enabled()) {
5522
+ gpr_log(
5523
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5524
+ "seq[%p]: poll step 5/13 gets %s", this,
5525
+ p != nullptr
5526
+ ? (PromiseResultTraits4::IsOk(*p)
5527
+ ? "ready"
5528
+ : absl::StrCat("early-error:",
5529
+ PromiseResultTraits4::ErrorString(*p))
5530
+ .c_str())
5531
+ : "pending");
5532
+ }
5533
+ if (p == nullptr) return Pending{};
5534
+ if (!PromiseResultTraits4::IsOk(*p)) {
5535
+ return PromiseResultTraits4::template ReturnValue<Result>(
5536
+ std::move(*p));
5537
+ }
5538
+ Destruct(
5539
+ &prior.prior.prior.prior.prior.prior.prior.prior.current_promise);
5540
+ auto next_promise = PromiseResultTraits4::CallFactory(
5541
+ &prior.prior.prior.prior.prior.prior.prior.prior.next_factory,
5542
+ std::move(*p));
5543
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.prior.next_factory);
5544
+ Construct(&prior.prior.prior.prior.prior.prior.prior.current_promise,
5545
+ std::move(next_promise));
5546
+ state = State::kState5;
5547
+ }
5548
+ ABSL_FALLTHROUGH_INTENDED;
5549
+ case State::kState5: {
5550
+ if (grpc_trace_promise_primitives.enabled()) {
5551
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5552
+ "seq[%p]: begin poll step 6/13", this);
5553
+ }
5554
+ auto result =
5555
+ prior.prior.prior.prior.prior.prior.prior.current_promise();
5556
+ PromiseResult5* p = result.value_if_ready();
5557
+ if (grpc_trace_promise_primitives.enabled()) {
5558
+ gpr_log(
5559
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5560
+ "seq[%p]: poll step 6/13 gets %s", this,
5561
+ p != nullptr
5562
+ ? (PromiseResultTraits5::IsOk(*p)
5563
+ ? "ready"
5564
+ : absl::StrCat("early-error:",
5565
+ PromiseResultTraits5::ErrorString(*p))
5566
+ .c_str())
5567
+ : "pending");
5568
+ }
5569
+ if (p == nullptr) return Pending{};
5570
+ if (!PromiseResultTraits5::IsOk(*p)) {
5571
+ return PromiseResultTraits5::template ReturnValue<Result>(
5572
+ std::move(*p));
5573
+ }
5574
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.current_promise);
5575
+ auto next_promise = PromiseResultTraits5::CallFactory(
5576
+ &prior.prior.prior.prior.prior.prior.prior.next_factory,
5577
+ std::move(*p));
5578
+ Destruct(&prior.prior.prior.prior.prior.prior.prior.next_factory);
5579
+ Construct(&prior.prior.prior.prior.prior.prior.current_promise,
5580
+ std::move(next_promise));
5581
+ state = State::kState6;
5582
+ }
5583
+ ABSL_FALLTHROUGH_INTENDED;
5584
+ case State::kState6: {
5585
+ if (grpc_trace_promise_primitives.enabled()) {
5586
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5587
+ "seq[%p]: begin poll step 7/13", this);
5588
+ }
5589
+ auto result = prior.prior.prior.prior.prior.prior.current_promise();
5590
+ PromiseResult6* p = result.value_if_ready();
5591
+ if (grpc_trace_promise_primitives.enabled()) {
5592
+ gpr_log(
5593
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5594
+ "seq[%p]: poll step 7/13 gets %s", this,
5595
+ p != nullptr
5596
+ ? (PromiseResultTraits6::IsOk(*p)
5597
+ ? "ready"
5598
+ : absl::StrCat("early-error:",
5599
+ PromiseResultTraits6::ErrorString(*p))
5600
+ .c_str())
5601
+ : "pending");
5602
+ }
5603
+ if (p == nullptr) return Pending{};
5604
+ if (!PromiseResultTraits6::IsOk(*p)) {
5605
+ return PromiseResultTraits6::template ReturnValue<Result>(
5606
+ std::move(*p));
5607
+ }
5608
+ Destruct(&prior.prior.prior.prior.prior.prior.current_promise);
5609
+ auto next_promise = PromiseResultTraits6::CallFactory(
5610
+ &prior.prior.prior.prior.prior.prior.next_factory, std::move(*p));
5611
+ Destruct(&prior.prior.prior.prior.prior.prior.next_factory);
5612
+ Construct(&prior.prior.prior.prior.prior.current_promise,
5613
+ std::move(next_promise));
5614
+ state = State::kState7;
5615
+ }
5616
+ ABSL_FALLTHROUGH_INTENDED;
5617
+ case State::kState7: {
5618
+ if (grpc_trace_promise_primitives.enabled()) {
5619
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5620
+ "seq[%p]: begin poll step 8/13", this);
5621
+ }
5622
+ auto result = prior.prior.prior.prior.prior.current_promise();
5623
+ PromiseResult7* p = result.value_if_ready();
5624
+ if (grpc_trace_promise_primitives.enabled()) {
5625
+ gpr_log(
5626
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5627
+ "seq[%p]: poll step 8/13 gets %s", this,
5628
+ p != nullptr
5629
+ ? (PromiseResultTraits7::IsOk(*p)
5630
+ ? "ready"
5631
+ : absl::StrCat("early-error:",
5632
+ PromiseResultTraits7::ErrorString(*p))
5633
+ .c_str())
5634
+ : "pending");
5635
+ }
5636
+ if (p == nullptr) return Pending{};
5637
+ if (!PromiseResultTraits7::IsOk(*p)) {
5638
+ return PromiseResultTraits7::template ReturnValue<Result>(
5639
+ std::move(*p));
5640
+ }
5641
+ Destruct(&prior.prior.prior.prior.prior.current_promise);
5642
+ auto next_promise = PromiseResultTraits7::CallFactory(
5643
+ &prior.prior.prior.prior.prior.next_factory, std::move(*p));
5644
+ Destruct(&prior.prior.prior.prior.prior.next_factory);
5645
+ Construct(&prior.prior.prior.prior.current_promise,
5646
+ std::move(next_promise));
5647
+ state = State::kState8;
5648
+ }
5649
+ ABSL_FALLTHROUGH_INTENDED;
5650
+ case State::kState8: {
5651
+ if (grpc_trace_promise_primitives.enabled()) {
5652
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5653
+ "seq[%p]: begin poll step 9/13", this);
5654
+ }
5655
+ auto result = prior.prior.prior.prior.current_promise();
5656
+ PromiseResult8* p = result.value_if_ready();
5657
+ if (grpc_trace_promise_primitives.enabled()) {
5658
+ gpr_log(
5659
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5660
+ "seq[%p]: poll step 9/13 gets %s", this,
5661
+ p != nullptr
5662
+ ? (PromiseResultTraits8::IsOk(*p)
5663
+ ? "ready"
5664
+ : absl::StrCat("early-error:",
5665
+ PromiseResultTraits8::ErrorString(*p))
5666
+ .c_str())
5667
+ : "pending");
5668
+ }
5669
+ if (p == nullptr) return Pending{};
5670
+ if (!PromiseResultTraits8::IsOk(*p)) {
5671
+ return PromiseResultTraits8::template ReturnValue<Result>(
5672
+ std::move(*p));
5673
+ }
5674
+ Destruct(&prior.prior.prior.prior.current_promise);
5675
+ auto next_promise = PromiseResultTraits8::CallFactory(
5676
+ &prior.prior.prior.prior.next_factory, std::move(*p));
5677
+ Destruct(&prior.prior.prior.prior.next_factory);
5678
+ Construct(&prior.prior.prior.current_promise, std::move(next_promise));
5679
+ state = State::kState9;
5680
+ }
5681
+ ABSL_FALLTHROUGH_INTENDED;
5682
+ case State::kState9: {
5683
+ if (grpc_trace_promise_primitives.enabled()) {
5684
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5685
+ "seq[%p]: begin poll step 10/13", this);
5686
+ }
5687
+ auto result = prior.prior.prior.current_promise();
5688
+ PromiseResult9* p = result.value_if_ready();
5689
+ if (grpc_trace_promise_primitives.enabled()) {
5690
+ gpr_log(
5691
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5692
+ "seq[%p]: poll step 10/13 gets %s", this,
5693
+ p != nullptr
5694
+ ? (PromiseResultTraits9::IsOk(*p)
5695
+ ? "ready"
5696
+ : absl::StrCat("early-error:",
5697
+ PromiseResultTraits9::ErrorString(*p))
5698
+ .c_str())
5699
+ : "pending");
5700
+ }
5701
+ if (p == nullptr) return Pending{};
5702
+ if (!PromiseResultTraits9::IsOk(*p)) {
5703
+ return PromiseResultTraits9::template ReturnValue<Result>(
5704
+ std::move(*p));
5705
+ }
5706
+ Destruct(&prior.prior.prior.current_promise);
5707
+ auto next_promise = PromiseResultTraits9::CallFactory(
5708
+ &prior.prior.prior.next_factory, std::move(*p));
5709
+ Destruct(&prior.prior.prior.next_factory);
5710
+ Construct(&prior.prior.current_promise, std::move(next_promise));
5711
+ state = State::kState10;
5712
+ }
5713
+ ABSL_FALLTHROUGH_INTENDED;
5714
+ case State::kState10: {
5715
+ if (grpc_trace_promise_primitives.enabled()) {
5716
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5717
+ "seq[%p]: begin poll step 11/13", this);
5718
+ }
5719
+ auto result = prior.prior.current_promise();
5720
+ PromiseResult10* p = result.value_if_ready();
5721
+ if (grpc_trace_promise_primitives.enabled()) {
5722
+ gpr_log(
5723
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5724
+ "seq[%p]: poll step 11/13 gets %s", this,
5725
+ p != nullptr
5726
+ ? (PromiseResultTraits10::IsOk(*p)
5727
+ ? "ready"
5728
+ : absl::StrCat("early-error:",
5729
+ PromiseResultTraits10::ErrorString(*p))
5730
+ .c_str())
5731
+ : "pending");
5732
+ }
5733
+ if (p == nullptr) return Pending{};
5734
+ if (!PromiseResultTraits10::IsOk(*p)) {
5735
+ return PromiseResultTraits10::template ReturnValue<Result>(
5736
+ std::move(*p));
5737
+ }
5738
+ Destruct(&prior.prior.current_promise);
5739
+ auto next_promise = PromiseResultTraits10::CallFactory(
5740
+ &prior.prior.next_factory, std::move(*p));
5741
+ Destruct(&prior.prior.next_factory);
5742
+ Construct(&prior.current_promise, std::move(next_promise));
5743
+ state = State::kState11;
5744
+ }
5745
+ ABSL_FALLTHROUGH_INTENDED;
5746
+ case State::kState11: {
5747
+ if (grpc_trace_promise_primitives.enabled()) {
5748
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5749
+ "seq[%p]: begin poll step 12/13", this);
5750
+ }
5751
+ auto result = prior.current_promise();
5752
+ PromiseResult11* p = result.value_if_ready();
5753
+ if (grpc_trace_promise_primitives.enabled()) {
5754
+ gpr_log(
5755
+ whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5756
+ "seq[%p]: poll step 12/13 gets %s", this,
5757
+ p != nullptr
5758
+ ? (PromiseResultTraits11::IsOk(*p)
5759
+ ? "ready"
5760
+ : absl::StrCat("early-error:",
5761
+ PromiseResultTraits11::ErrorString(*p))
5762
+ .c_str())
5763
+ : "pending");
5764
+ }
5765
+ if (p == nullptr) return Pending{};
5766
+ if (!PromiseResultTraits11::IsOk(*p)) {
5767
+ return PromiseResultTraits11::template ReturnValue<Result>(
5768
+ std::move(*p));
5769
+ }
5770
+ Destruct(&prior.current_promise);
5771
+ auto next_promise = PromiseResultTraits11::CallFactory(
5772
+ &prior.next_factory, std::move(*p));
5773
+ Destruct(&prior.next_factory);
5774
+ Construct(&current_promise, std::move(next_promise));
5775
+ state = State::kState12;
5776
+ }
5777
+ ABSL_FALLTHROUGH_INTENDED;
5778
+ default:
5779
+ case State::kState12: {
5780
+ if (grpc_trace_promise_primitives.enabled()) {
5781
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5782
+ "seq[%p]: begin poll step 13/13", this);
2476
5783
  }
2477
5784
  auto result = current_promise();
2478
5785
  if (grpc_trace_promise_primitives.enabled()) {
2479
- gpr_log(GPR_DEBUG, "seq[%p]: poll step 9/9 gets %s", this,
5786
+ gpr_log(whence.file(), whence.line(), GPR_LOG_SEVERITY_DEBUG,
5787
+ "seq[%p]: poll step 13/13 gets %s", this,
2480
5788
  result.ready() ? "ready" : "pending");
2481
5789
  }
2482
5790
  auto* p = result.value_if_ready();