grpc 1.57.0 → 1.58.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (402) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +534 -284
  3. data/include/grpc/event_engine/event_engine.h +0 -1
  4. data/include/grpc/event_engine/memory_allocator.h +2 -2
  5. data/include/grpc/impl/channel_arg_names.h +371 -0
  6. data/include/grpc/impl/grpc_types.h +1 -353
  7. data/include/grpc/module.modulemap +1 -0
  8. data/src/core/ext/filters/backend_metrics/backend_metric_filter.cc +1 -1
  9. data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +2 -1
  10. data/src/core/ext/filters/client_channel/client_channel.cc +7 -3
  11. data/src/core/ext/filters/client_channel/http_proxy.cc +1 -1
  12. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.cc +10 -5
  13. data/src/core/ext/filters/client_channel/lb_policy/address_filtering.h +7 -5
  14. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +1 -0
  15. data/src/core/ext/filters/client_channel/lb_policy/health_check_client.cc +5 -3
  16. data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +4 -2
  17. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +115 -109
  18. data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.h +0 -5
  19. data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +7 -2
  20. data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +2 -1
  21. data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +1 -0
  22. data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +1 -1
  23. data/src/core/ext/filters/client_channel/lb_policy/weighted_round_robin/weighted_round_robin.cc +11 -3
  24. data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +6 -1
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +8 -5
  26. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +1 -1
  27. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +102 -11
  28. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +9 -4
  29. data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +4 -1
  30. data/src/core/ext/filters/client_channel/resolver/dns/dns_resolver_plugin.cc +6 -0
  31. data/src/core/ext/filters/client_channel/resolver/dns/event_engine/event_engine_client_channel_resolver.cc +41 -14
  32. data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
  33. data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +3 -2
  34. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +1 -1
  35. data/src/core/ext/filters/client_channel/retry_filter.h +1 -0
  36. data/src/core/ext/filters/client_channel/retry_service_config.cc +1 -1
  37. data/src/core/ext/filters/client_channel/service_config_channel_arg_filter.cc +1 -1
  38. data/src/core/ext/filters/client_channel/subchannel.cc +9 -5
  39. data/src/core/ext/filters/client_channel/subchannel.h +8 -2
  40. data/src/core/ext/filters/deadline/deadline_filter.cc +1 -1
  41. data/src/core/ext/filters/http/client/http_client_filter.cc +1 -0
  42. data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
  43. data/src/core/ext/filters/http/message_compress/compression_filter.cc +1 -0
  44. data/src/core/ext/filters/http/server/http_server_filter.cc +1 -1
  45. data/src/core/ext/filters/message_size/message_size_filter.cc +1 -0
  46. data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +4 -7
  47. data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -0
  48. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +8 -12
  49. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +357 -358
  50. data/src/core/ext/transport/chttp2/transport/frame_ping.cc +5 -18
  51. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +63 -4
  52. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +7 -2
  53. data/src/core/ext/transport/chttp2/transport/internal.h +30 -57
  54. data/src/core/ext/transport/chttp2/transport/parsing.cc +16 -7
  55. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.cc +80 -0
  56. data/src/core/ext/transport/chttp2/transport/ping_abuse_policy.h +55 -0
  57. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +98 -0
  58. data/src/core/ext/transport/chttp2/transport/ping_rate_policy.h +73 -0
  59. data/src/core/ext/transport/chttp2/transport/writing.cc +81 -89
  60. data/src/core/ext/transport/inproc/inproc_transport.cc +1 -0
  61. data/src/core/ext/xds/xds_client_grpc.cc +1 -0
  62. data/src/core/ext/xds/xds_http_fault_filter.cc +1 -2
  63. data/src/core/ext/xds/xds_http_fault_filter.h +1 -2
  64. data/src/core/ext/xds/xds_http_filters.h +2 -4
  65. data/src/core/ext/xds/xds_http_rbac_filter.cc +3 -8
  66. data/src/core/ext/xds/xds_http_rbac_filter.h +1 -2
  67. data/src/core/ext/xds/xds_http_stateful_session_filter.cc +1 -2
  68. data/src/core/ext/xds/xds_http_stateful_session_filter.h +1 -2
  69. data/src/core/ext/xds/xds_lb_policy_registry.cc +3 -6
  70. data/src/core/ext/xds/xds_routing.cc +2 -2
  71. data/src/core/ext/xds/xds_transport_grpc.cc +1 -0
  72. data/src/core/lib/avl/avl.h +10 -173
  73. data/src/core/lib/channel/call_tracer.cc +289 -0
  74. data/src/core/lib/channel/call_tracer.h +35 -0
  75. data/src/core/lib/channel/channel_args.cc +84 -79
  76. data/src/core/lib/channel/channel_args.h +29 -17
  77. data/src/core/lib/channel/connected_channel.cc +0 -1
  78. data/src/core/lib/channel/promise_based_filter.cc +4 -1
  79. data/src/core/lib/compression/compression_internal.cc +8 -4
  80. data/src/core/lib/debug/stats_data.cc +93 -21
  81. data/src/core/lib/debug/stats_data.h +41 -0
  82. data/src/core/lib/event_engine/ares_resolver.cc +712 -0
  83. data/src/core/lib/event_engine/ares_resolver.h +150 -0
  84. data/src/core/lib/event_engine/cf_engine/cf_engine.cc +9 -3
  85. data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +2 -2
  86. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.cc +229 -0
  87. data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +117 -0
  88. data/src/core/lib/event_engine/forkable.cc +15 -1
  89. data/src/core/lib/event_engine/forkable.h +15 -0
  90. data/src/core/lib/event_engine/grpc_polled_fd.h +73 -0
  91. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +25 -3
  92. data/src/core/lib/event_engine/posix_engine/ev_poll_posix.h +10 -1
  93. data/src/core/lib/event_engine/posix_engine/grpc_polled_fd_posix.h +197 -0
  94. data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +3 -3
  95. data/src/core/lib/event_engine/posix_engine/posix_engine.cc +47 -1
  96. data/src/core/lib/event_engine/posix_engine/posix_engine.h +12 -1
  97. data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +1 -0
  98. data/src/core/lib/event_engine/posix_engine/traced_buffer_list.cc +2 -0
  99. data/src/core/lib/event_engine/thread_pool/thread_count.cc +58 -0
  100. data/src/core/lib/event_engine/thread_pool/thread_count.h +161 -0
  101. data/src/core/lib/event_engine/thread_pool/thread_pool_factory.cc +7 -0
  102. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.cc +86 -111
  103. data/src/core/lib/event_engine/thread_pool/work_stealing_thread_pool.h +15 -61
  104. data/src/core/lib/event_engine/windows/windows_endpoint.cc +3 -4
  105. data/src/core/lib/experiments/config.cc +14 -0
  106. data/src/core/lib/experiments/experiments.cc +141 -304
  107. data/src/core/lib/experiments/experiments.h +16 -17
  108. data/src/core/lib/gprpp/ref_counted.h +3 -1
  109. data/src/core/lib/gprpp/ref_counted_string.cc +44 -0
  110. data/src/core/lib/gprpp/ref_counted_string.h +146 -0
  111. data/src/core/lib/gprpp/time.h +2 -2
  112. data/src/core/lib/gprpp/work_serializer.cc +36 -0
  113. data/src/core/lib/gprpp/work_serializer.h +5 -0
  114. data/src/core/lib/http/httpcli_security_connector.cc +1 -0
  115. data/src/core/lib/iomgr/buffer_list.cc +2 -0
  116. data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +7 -22
  117. data/src/core/lib/iomgr/tcp_posix.cc +3 -3
  118. data/src/core/lib/promise/detail/basic_seq.h +1 -372
  119. data/src/core/lib/promise/detail/seq_state.h +2076 -0
  120. data/src/core/lib/promise/seq.h +19 -2
  121. data/src/core/lib/promise/sleep.h +5 -10
  122. data/src/core/lib/promise/try_seq.h +34 -2
  123. data/src/core/lib/resource_quota/api.cc +1 -0
  124. data/src/core/lib/resource_quota/arena.cc +2 -0
  125. data/src/core/lib/resource_quota/arena.h +42 -8
  126. data/src/core/lib/resource_quota/memory_quota.cc +0 -1
  127. data/src/core/lib/resource_quota/resource_quota.h +1 -0
  128. data/src/core/lib/security/authorization/authorization_policy_provider.h +1 -1
  129. data/src/core/lib/security/authorization/rbac_policy.h +1 -1
  130. data/src/core/lib/security/credentials/external/aws_request_signer.cc +8 -0
  131. data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +1 -0
  132. data/src/core/lib/security/credentials/jwt/json_token.cc +17 -0
  133. data/src/core/lib/security/credentials/jwt/json_token.h +4 -0
  134. data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +42 -0
  135. data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +1 -0
  136. data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -0
  137. data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -0
  138. data/src/core/lib/security/credentials/xds/xds_credentials.cc +1 -0
  139. data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -0
  140. data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -0
  141. data/src/core/lib/security/security_connector/ssl_utils.cc +1 -0
  142. data/src/core/lib/security/transport/client_auth_filter.cc +8 -5
  143. data/src/core/lib/security/transport/security_handshaker.cc +1 -0
  144. data/src/core/lib/security/transport/server_auth_filter.cc +2 -0
  145. data/src/core/lib/surface/call.cc +32 -8
  146. data/src/core/lib/surface/channel.cc +1 -0
  147. data/src/core/lib/surface/completion_queue.cc +10 -0
  148. data/src/core/lib/surface/init.cc +1 -0
  149. data/src/core/lib/surface/server.cc +67 -64
  150. data/src/core/lib/surface/server.h +1 -15
  151. data/src/core/lib/surface/version.cc +2 -2
  152. data/src/core/tsi/alts/crypt/aes_gcm.cc +27 -2
  153. data/src/core/tsi/ssl_transport_security.cc +11 -0
  154. data/src/ruby/lib/grpc/generic/active_call.rb +9 -14
  155. data/src/ruby/lib/grpc/version.rb +1 -1
  156. data/src/ruby/pb/test/client.rb +16 -0
  157. data/src/ruby/spec/generic/rpc_server_spec.rb +3 -3
  158. data/third_party/abseil-cpp/absl/algorithm/container.h +3 -2
  159. data/third_party/abseil-cpp/absl/base/attributes.h +58 -5
  160. data/third_party/abseil-cpp/absl/base/call_once.h +1 -1
  161. data/third_party/abseil-cpp/absl/base/casts.h +8 -8
  162. data/third_party/abseil-cpp/absl/base/config.h +89 -106
  163. data/third_party/abseil-cpp/absl/base/dynamic_annotations.h +26 -1
  164. data/third_party/abseil-cpp/absl/base/internal/direct_mmap.h +2 -2
  165. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc +50 -39
  166. data/third_party/abseil-cpp/absl/base/internal/low_level_alloc.h +2 -1
  167. data/third_party/abseil-cpp/absl/base/internal/prefetch.h +17 -18
  168. data/third_party/abseil-cpp/absl/base/internal/raw_logging.cc +32 -3
  169. data/third_party/abseil-cpp/absl/base/internal/raw_logging.h +24 -4
  170. data/third_party/abseil-cpp/absl/base/internal/sysinfo.cc +31 -73
  171. data/third_party/abseil-cpp/absl/base/internal/thread_identity.cc +9 -8
  172. data/third_party/abseil-cpp/absl/base/internal/thread_identity.h +11 -11
  173. data/third_party/abseil-cpp/absl/base/internal/throw_delegate.cc +23 -32
  174. data/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc +2 -3
  175. data/third_party/abseil-cpp/absl/base/options.h +1 -1
  176. data/third_party/abseil-cpp/absl/base/policy_checks.h +3 -3
  177. data/third_party/abseil-cpp/absl/base/prefetch.h +198 -0
  178. data/third_party/abseil-cpp/absl/container/fixed_array.h +54 -29
  179. data/third_party/abseil-cpp/absl/container/flat_hash_map.h +5 -1
  180. data/third_party/abseil-cpp/absl/container/flat_hash_set.h +6 -2
  181. data/third_party/abseil-cpp/absl/container/inlined_vector.h +167 -79
  182. data/third_party/abseil-cpp/absl/container/internal/common_policy_traits.h +1 -1
  183. data/third_party/abseil-cpp/absl/container/internal/compressed_tuple.h +3 -21
  184. data/third_party/abseil-cpp/absl/container/internal/container_memory.h +1 -1
  185. data/third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h +46 -0
  186. data/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +2 -0
  187. data/third_party/abseil-cpp/absl/container/internal/inlined_vector.h +85 -26
  188. data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +35 -18
  189. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc +70 -29
  190. data/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +437 -236
  191. data/third_party/abseil-cpp/absl/crc/crc32c.h +8 -1
  192. data/third_party/abseil-cpp/absl/crc/internal/cpu_detect.cc +14 -8
  193. data/third_party/abseil-cpp/absl/crc/internal/crc.cc +4 -35
  194. data/third_party/abseil-cpp/absl/crc/internal/crc.h +2 -10
  195. data/third_party/abseil-cpp/absl/crc/internal/crc32_x86_arm_combined_simd.h +1 -1
  196. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.cc +1 -1
  197. data/third_party/abseil-cpp/absl/crc/internal/crc_cord_state.h +4 -4
  198. data/third_party/abseil-cpp/absl/crc/internal/crc_internal.h +8 -10
  199. data/third_party/abseil-cpp/absl/crc/internal/crc_memcpy_x86_64.cc +17 -19
  200. data/third_party/abseil-cpp/absl/crc/internal/crc_x86_arm_combined.cc +8 -8
  201. data/third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h +2 -1
  202. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_aarch64-inl.inc +59 -23
  203. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_powerpc-inl.inc +1 -1
  204. data/third_party/abseil-cpp/absl/debugging/internal/stacktrace_x86-inl.inc +1 -1
  205. data/third_party/abseil-cpp/absl/debugging/internal/symbolize.h +1 -1
  206. data/third_party/abseil-cpp/absl/debugging/symbolize_elf.inc +43 -19
  207. data/third_party/abseil-cpp/absl/debugging/symbolize_emscripten.inc +3 -0
  208. data/third_party/abseil-cpp/absl/flags/commandlineflag.h +1 -1
  209. data/third_party/abseil-cpp/absl/flags/internal/commandlineflag.cc +1 -1
  210. data/third_party/abseil-cpp/absl/flags/internal/flag.cc +2 -2
  211. data/third_party/abseil-cpp/absl/flags/internal/flag.h +16 -15
  212. data/third_party/abseil-cpp/absl/flags/internal/flag_msvc.inc +1 -1
  213. data/third_party/abseil-cpp/absl/flags/marshalling.cc +43 -2
  214. data/third_party/abseil-cpp/absl/flags/marshalling.h +5 -0
  215. data/third_party/abseil-cpp/absl/functional/any_invocable.h +9 -1
  216. data/third_party/abseil-cpp/absl/functional/bind_front.h +1 -1
  217. data/third_party/abseil-cpp/absl/functional/function_ref.h +3 -3
  218. data/third_party/abseil-cpp/absl/functional/internal/any_invocable.h +37 -24
  219. data/third_party/abseil-cpp/absl/functional/internal/function_ref.h +19 -9
  220. data/third_party/abseil-cpp/absl/hash/hash.h +7 -4
  221. data/third_party/abseil-cpp/absl/hash/internal/hash.h +38 -15
  222. data/third_party/abseil-cpp/absl/hash/internal/low_level_hash.cc +6 -0
  223. data/third_party/abseil-cpp/absl/meta/type_traits.h +48 -373
  224. data/third_party/abseil-cpp/absl/numeric/bits.h +4 -4
  225. data/third_party/abseil-cpp/absl/numeric/int128.cc +20 -8
  226. data/third_party/abseil-cpp/absl/numeric/int128.h +36 -39
  227. data/third_party/abseil-cpp/absl/numeric/int128_have_intrinsic.inc +0 -3
  228. data/third_party/abseil-cpp/absl/numeric/int128_no_intrinsic.inc +47 -30
  229. data/third_party/abseil-cpp/absl/random/internal/fast_uniform_bits.h +4 -3
  230. data/third_party/abseil-cpp/absl/random/internal/generate_real.h +1 -1
  231. data/third_party/abseil-cpp/absl/random/internal/platform.h +1 -1
  232. data/third_party/abseil-cpp/absl/random/internal/randen_detect.cc +4 -0
  233. data/third_party/abseil-cpp/absl/random/internal/randen_engine.h +1 -1
  234. data/third_party/abseil-cpp/absl/random/internal/randen_hwaes.cc +1 -1
  235. data/third_party/abseil-cpp/absl/random/internal/uniform_helper.h +1 -1
  236. data/third_party/abseil-cpp/absl/status/internal/status_internal.h +4 -0
  237. data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +12 -24
  238. data/third_party/abseil-cpp/absl/status/status.cc +11 -7
  239. data/third_party/abseil-cpp/absl/status/status.h +11 -2
  240. data/third_party/abseil-cpp/absl/status/statusor.h +22 -8
  241. data/third_party/abseil-cpp/absl/strings/ascii.cc +54 -6
  242. data/third_party/abseil-cpp/absl/strings/charconv.cc +21 -4
  243. data/third_party/abseil-cpp/absl/strings/charconv.h +2 -2
  244. data/third_party/abseil-cpp/absl/strings/cord.cc +1 -2
  245. data/third_party/abseil-cpp/absl/strings/cord.h +32 -5
  246. data/third_party/abseil-cpp/absl/strings/cord_analysis.cc +23 -1
  247. data/third_party/abseil-cpp/absl/strings/cord_analysis.h +18 -0
  248. data/third_party/abseil-cpp/absl/strings/cord_buffer.h +2 -5
  249. data/third_party/abseil-cpp/absl/strings/escaping.cc +10 -32
  250. data/third_party/abseil-cpp/absl/strings/escaping.h +1 -1
  251. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +2 -4
  252. data/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.h +3 -3
  253. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.cc +0 -1
  254. data/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +15 -13
  255. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +13 -4
  256. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +8 -0
  257. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.cc +5 -3
  258. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_consume.h +4 -7
  259. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_flat.h +8 -0
  260. data/third_party/abseil-cpp/absl/strings/internal/cord_rep_ring.h +2 -2
  261. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.cc +46 -20
  262. data/third_party/abseil-cpp/absl/strings/internal/cordz_handle.h +1 -34
  263. data/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +2 -1
  264. data/third_party/abseil-cpp/absl/strings/internal/escaping.cc +23 -0
  265. data/third_party/abseil-cpp/absl/strings/internal/escaping.h +1 -0
  266. data/third_party/abseil-cpp/absl/strings/internal/memutil.cc +2 -77
  267. data/third_party/abseil-cpp/absl/strings/internal/memutil.h +4 -112
  268. data/third_party/abseil-cpp/absl/strings/internal/stl_type_traits.h +1 -1
  269. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +10 -31
  270. data/third_party/abseil-cpp/absl/strings/internal/str_format/arg.h +8 -8
  271. data/third_party/abseil-cpp/absl/strings/internal/str_format/bind.h +5 -20
  272. data/third_party/abseil-cpp/absl/strings/internal/str_format/constexpr_parser.h +1 -0
  273. data/third_party/abseil-cpp/absl/strings/internal/str_format/extension.h +1 -1
  274. data/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +9 -9
  275. data/third_party/abseil-cpp/absl/strings/internal/str_split_internal.h +56 -6
  276. data/third_party/abseil-cpp/absl/strings/match.cc +87 -0
  277. data/third_party/abseil-cpp/absl/strings/match.h +19 -0
  278. data/third_party/abseil-cpp/absl/strings/numbers.cc +154 -122
  279. data/third_party/abseil-cpp/absl/strings/numbers.h +1 -6
  280. data/third_party/abseil-cpp/absl/strings/str_cat.cc +7 -50
  281. data/third_party/abseil-cpp/absl/strings/str_cat.h +83 -15
  282. data/third_party/abseil-cpp/absl/strings/str_format.h +6 -3
  283. data/third_party/abseil-cpp/absl/strings/str_split.cc +9 -6
  284. data/third_party/abseil-cpp/absl/strings/string_view.cc +26 -4
  285. data/third_party/abseil-cpp/absl/synchronization/internal/create_thread_identity.cc +5 -0
  286. data/third_party/abseil-cpp/absl/synchronization/internal/futex.h +63 -43
  287. data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.cc +111 -0
  288. data/third_party/abseil-cpp/absl/synchronization/internal/futex_waiter.h +63 -0
  289. data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +11 -7
  290. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.cc +225 -0
  291. data/third_party/abseil-cpp/absl/synchronization/internal/kernel_timeout.h +122 -114
  292. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.cc +12 -8
  293. data/third_party/abseil-cpp/absl/synchronization/internal/per_thread_sem.h +10 -1
  294. data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.cc +167 -0
  295. data/third_party/abseil-cpp/absl/synchronization/internal/pthread_waiter.h +60 -0
  296. data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.cc +122 -0
  297. data/third_party/abseil-cpp/absl/synchronization/internal/sem_waiter.h +65 -0
  298. data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.cc +91 -0
  299. data/third_party/abseil-cpp/absl/synchronization/internal/stdcpp_waiter.h +56 -0
  300. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.h +19 -113
  301. data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.cc +42 -0
  302. data/third_party/abseil-cpp/absl/synchronization/internal/waiter_base.h +90 -0
  303. data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.cc +151 -0
  304. data/third_party/abseil-cpp/absl/synchronization/internal/win32_waiter.h +70 -0
  305. data/third_party/abseil-cpp/absl/synchronization/mutex.cc +407 -411
  306. data/third_party/abseil-cpp/absl/synchronization/mutex.h +152 -118
  307. data/third_party/abseil-cpp/absl/time/clock.cc +6 -7
  308. data/third_party/abseil-cpp/absl/time/duration.cc +24 -26
  309. data/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h +1 -0
  310. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_fixed.cc +1 -1
  311. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc +3 -3
  312. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.cc +8 -6
  313. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_if.h +6 -3
  314. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.cc +4 -2
  315. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_impl.h +4 -0
  316. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.cc +322 -295
  317. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_info.h +8 -17
  318. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.cc +51 -33
  319. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.h +7 -2
  320. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_lookup.cc +128 -2
  321. data/third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_posix.h +1 -1
  322. data/third_party/abseil-cpp/absl/time/internal/cctz/src/tzfile.h +5 -1
  323. data/third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc +34 -34
  324. data/third_party/abseil-cpp/absl/time/time.cc +9 -2
  325. data/third_party/abseil-cpp/absl/time/time.h +115 -15
  326. data/third_party/abseil-cpp/absl/types/internal/optional.h +0 -52
  327. data/third_party/abseil-cpp/absl/types/internal/span.h +2 -2
  328. data/third_party/abseil-cpp/absl/types/internal/variant.h +2 -2
  329. data/third_party/abseil-cpp/absl/types/optional.h +15 -13
  330. data/third_party/abseil-cpp/absl/types/span.h +1 -2
  331. data/third_party/boringssl-with-bazel/err_data.c +15 -14
  332. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_gentm.c +7 -3
  333. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_strex.c +7 -7
  334. data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +7 -3
  335. data/third_party/boringssl-with-bazel/src/crypto/bio/connect.c +5 -5
  336. data/third_party/boringssl-with-bazel/src/crypto/bio/errno.c +92 -0
  337. data/third_party/boringssl-with-bazel/src/crypto/bio/fd.c +4 -48
  338. data/third_party/boringssl-with-bazel/src/crypto/bio/file.c +11 -6
  339. data/third_party/boringssl-with-bazel/src/crypto/bio/internal.h +16 -6
  340. data/third_party/boringssl-with-bazel/src/crypto/bio/socket.c +2 -2
  341. data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +9 -0
  342. data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +1 -1
  343. data/third_party/boringssl-with-bazel/src/crypto/conf/conf.c +3 -7
  344. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_apple.c +0 -2
  345. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_fuchsia.c +0 -1
  346. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_linux.c +0 -2
  347. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_openbsd.c +0 -1
  348. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_sysreg.c +93 -0
  349. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_win.c +1 -1
  350. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_freebsd.c +0 -1
  351. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_linux.c +0 -2
  352. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/dh_asn1.c +4 -0
  353. data/third_party/boringssl-with-bazel/src/crypto/dh_extra/params.c +5 -0
  354. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/hash_to_curve.c +9 -14
  355. data/third_party/boringssl-with-bazel/src/crypto/ec_extra/internal.h +4 -6
  356. data/third_party/boringssl-with-bazel/src/crypto/err/err.c +10 -11
  357. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/check.c +37 -8
  358. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/dh.c +38 -19
  359. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/dh/internal.h +7 -0
  360. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +39 -16
  361. data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/service_indicator/service_indicator.c +4 -7
  362. data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +7 -0
  363. data/third_party/boringssl-with-bazel/src/crypto/internal.h +13 -21
  364. data/third_party/boringssl-with-bazel/src/crypto/obj/obj.c +6 -23
  365. data/third_party/boringssl-with-bazel/src/crypto/rand_extra/getentropy.c +4 -0
  366. data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +5 -0
  367. data/third_party/boringssl-with-bazel/src/crypto/x509/by_dir.c +1 -6
  368. data/third_party/boringssl-with-bazel/src/crypto/x509/by_file.c +0 -3
  369. data/third_party/boringssl-with-bazel/src/crypto/x509/x509_d2.c +1 -3
  370. data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +2 -3
  371. data/third_party/boringssl-with-bazel/src/include/openssl/base.h +9 -1
  372. data/third_party/boringssl-with-bazel/src/include/openssl/bio.h +11 -1
  373. data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +4 -1
  374. data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +7 -9
  375. data/third_party/boringssl-with-bazel/src/include/openssl/hpke.h +6 -2
  376. data/third_party/boringssl-with-bazel/src/include/openssl/span.h +22 -20
  377. data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +4 -0
  378. data/third_party/boringssl-with-bazel/src/include/openssl/stack.h +20 -12
  379. data/third_party/boringssl-with-bazel/src/include/openssl/target.h +50 -3
  380. data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -4
  381. data/third_party/boringssl-with-bazel/src/ssl/ssl_cipher.cc +2 -2
  382. data/third_party/boringssl-with-bazel/src/ssl/ssl_file.cc +4 -4
  383. data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +2 -0
  384. metadata +39 -31
  385. data/src/core/lib/promise/detail/basic_join.h +0 -197
  386. data/src/core/lib/promise/detail/switch.h +0 -1455
  387. data/src/core/lib/promise/try_join.h +0 -82
  388. data/third_party/abseil-cpp/absl/synchronization/internal/waiter.cc +0 -403
  389. data/third_party/boringssl-with-bazel/src/crypto/cpu_aarch64_freebsd.c +0 -62
  390. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm.c +0 -38
  391. data/third_party/boringssl-with-bazel/src/crypto/cpu_arm_openbsd.c +0 -31
  392. data/third_party/re2/util/benchmark.h +0 -156
  393. data/third_party/re2/util/flags.h +0 -26
  394. data/third_party/re2/util/malloc_counter.h +0 -19
  395. data/third_party/re2/util/pcre.cc +0 -1025
  396. data/third_party/re2/util/pcre.h +0 -681
  397. data/third_party/re2/util/test.h +0 -50
  398. data/third_party/upb/upb/mini_table.h +0 -36
  399. data/third_party/zlib/gzclose.c +0 -25
  400. data/third_party/zlib/gzlib.c +0 -639
  401. data/third_party/zlib/gzread.c +0 -650
  402. data/third_party/zlib/gzwrite.c +0 -677
@@ -77,8 +77,6 @@ class InlinedVector {
77
77
  template <typename TheA>
78
78
  using MoveIterator = inlined_vector_internal::MoveIterator<TheA>;
79
79
  template <typename TheA>
80
- using IsMemcpyOk = inlined_vector_internal::IsMemcpyOk<TheA>;
81
- template <typename TheA>
82
80
  using IsMoveAssignOk = inlined_vector_internal::IsMoveAssignOk<TheA>;
83
81
 
84
82
  template <typename TheA, typename Iterator>
@@ -182,14 +180,23 @@ class InlinedVector {
182
180
  // provided `allocator`.
183
181
  InlinedVector(const InlinedVector& other, const allocator_type& allocator)
184
182
  : storage_(allocator) {
183
+ // Fast path: if the other vector is empty, there's nothing for us to do.
185
184
  if (other.empty()) {
186
- // Empty; nothing to do.
187
- } else if (IsMemcpyOk<A>::value && !other.storage_.GetIsAllocated()) {
188
- // Memcpy-able and do not need allocation.
185
+ return;
186
+ }
187
+
188
+ // Fast path: if the value type is trivially copy constructible, we know the
189
+ // allocator doesn't do anything fancy, and there is nothing on the heap
190
+ // then we know it is legal for us to simply memcpy the other vector's
191
+ // inlined bytes to form our copy of its elements.
192
+ if (absl::is_trivially_copy_constructible<value_type>::value &&
193
+ std::is_same<A, std::allocator<value_type>>::value &&
194
+ !other.storage_.GetIsAllocated()) {
189
195
  storage_.MemcpyFrom(other.storage_);
190
- } else {
191
- storage_.InitFrom(other.storage_);
196
+ return;
192
197
  }
198
+
199
+ storage_.InitFrom(other.storage_);
193
200
  }
194
201
 
195
202
  // Creates an inlined vector by moving in the contents of `other` without
@@ -210,26 +217,38 @@ class InlinedVector {
210
217
  absl::allocator_is_nothrow<allocator_type>::value ||
211
218
  std::is_nothrow_move_constructible<value_type>::value)
212
219
  : storage_(other.storage_.GetAllocator()) {
213
- if (IsMemcpyOk<A>::value) {
220
+ // Fast path: if the value type can be trivially relocated (i.e. moved from
221
+ // and destroyed), and we know the allocator doesn't do anything fancy, then
222
+ // it's safe for us to simply adopt the contents of the storage for `other`
223
+ // and remove its own reference to them. It's as if we had individually
224
+ // move-constructed each value and then destroyed the original.
225
+ if (absl::is_trivially_relocatable<value_type>::value &&
226
+ std::is_same<A, std::allocator<value_type>>::value) {
214
227
  storage_.MemcpyFrom(other.storage_);
215
-
216
228
  other.storage_.SetInlinedSize(0);
217
- } else if (other.storage_.GetIsAllocated()) {
229
+ return;
230
+ }
231
+
232
+ // Fast path: if the other vector is on the heap, we can simply take over
233
+ // its allocation.
234
+ if (other.storage_.GetIsAllocated()) {
218
235
  storage_.SetAllocation({other.storage_.GetAllocatedData(),
219
236
  other.storage_.GetAllocatedCapacity()});
220
237
  storage_.SetAllocatedSize(other.storage_.GetSize());
221
238
 
222
239
  other.storage_.SetInlinedSize(0);
223
- } else {
224
- IteratorValueAdapter<A, MoveIterator<A>> other_values(
225
- MoveIterator<A>(other.storage_.GetInlinedData()));
240
+ return;
241
+ }
226
242
 
227
- inlined_vector_internal::ConstructElements<A>(
228
- storage_.GetAllocator(), storage_.GetInlinedData(), other_values,
229
- other.storage_.GetSize());
243
+ // Otherwise we must move each element individually.
244
+ IteratorValueAdapter<A, MoveIterator<A>> other_values(
245
+ MoveIterator<A>(other.storage_.GetInlinedData()));
230
246
 
231
- storage_.SetInlinedSize(other.storage_.GetSize());
232
- }
247
+ inlined_vector_internal::ConstructElements<A>(
248
+ storage_.GetAllocator(), storage_.GetInlinedData(), other_values,
249
+ other.storage_.GetSize());
250
+
251
+ storage_.SetInlinedSize(other.storage_.GetSize());
233
252
  }
234
253
 
235
254
  // Creates an inlined vector by moving in the contents of `other` with a copy
@@ -244,22 +263,34 @@ class InlinedVector {
244
263
  const allocator_type&
245
264
  allocator) noexcept(absl::allocator_is_nothrow<allocator_type>::value)
246
265
  : storage_(allocator) {
247
- if (IsMemcpyOk<A>::value) {
266
+ // Fast path: if the value type can be trivially relocated (i.e. moved from
267
+ // and destroyed), and we know the allocator doesn't do anything fancy, then
268
+ // it's safe for us to simply adopt the contents of the storage for `other`
269
+ // and remove its own reference to them. It's as if we had individually
270
+ // move-constructed each value and then destroyed the original.
271
+ if (absl::is_trivially_relocatable<value_type>::value &&
272
+ std::is_same<A, std::allocator<value_type>>::value) {
248
273
  storage_.MemcpyFrom(other.storage_);
249
-
250
274
  other.storage_.SetInlinedSize(0);
251
- } else if ((storage_.GetAllocator() == other.storage_.GetAllocator()) &&
252
- other.storage_.GetIsAllocated()) {
275
+ return;
276
+ }
277
+
278
+ // Fast path: if the other vector is on the heap and shared the same
279
+ // allocator, we can simply take over its allocation.
280
+ if ((storage_.GetAllocator() == other.storage_.GetAllocator()) &&
281
+ other.storage_.GetIsAllocated()) {
253
282
  storage_.SetAllocation({other.storage_.GetAllocatedData(),
254
283
  other.storage_.GetAllocatedCapacity()});
255
284
  storage_.SetAllocatedSize(other.storage_.GetSize());
256
285
 
257
286
  other.storage_.SetInlinedSize(0);
258
- } else {
259
- storage_.Initialize(IteratorValueAdapter<A, MoveIterator<A>>(
260
- MoveIterator<A>(other.data())),
261
- other.size());
287
+ return;
262
288
  }
289
+
290
+ // Otherwise we must move each element individually.
291
+ storage_.Initialize(
292
+ IteratorValueAdapter<A, MoveIterator<A>>(MoveIterator<A>(other.data())),
293
+ other.size());
263
294
  }
264
295
 
265
296
  ~InlinedVector() {}
@@ -310,7 +341,7 @@ class InlinedVector {
310
341
  // can be used to access and modify the contained elements.
311
342
  //
312
343
  // NOTE: only elements within [`data()`, `data() + size()`) are valid.
313
- pointer data() noexcept {
344
+ pointer data() noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
314
345
  return storage_.GetIsAllocated() ? storage_.GetAllocatedData()
315
346
  : storage_.GetInlinedData();
316
347
  }
@@ -320,7 +351,7 @@ class InlinedVector {
320
351
  // modify the contained elements.
321
352
  //
322
353
  // NOTE: only elements within [`data()`, `data() + size()`) are valid.
323
- const_pointer data() const noexcept {
354
+ const_pointer data() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
324
355
  return storage_.GetIsAllocated() ? storage_.GetAllocatedData()
325
356
  : storage_.GetInlinedData();
326
357
  }
@@ -328,14 +359,14 @@ class InlinedVector {
328
359
  // `InlinedVector::operator[](...)`
329
360
  //
330
361
  // Returns a `reference` to the `i`th element of the inlined vector.
331
- reference operator[](size_type i) {
362
+ reference operator[](size_type i) ABSL_ATTRIBUTE_LIFETIME_BOUND {
332
363
  ABSL_HARDENING_ASSERT(i < size());
333
364
  return data()[i];
334
365
  }
335
366
 
336
367
  // Overload of `InlinedVector::operator[](...)` that returns a
337
368
  // `const_reference` to the `i`th element of the inlined vector.
338
- const_reference operator[](size_type i) const {
369
+ const_reference operator[](size_type i) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
339
370
  ABSL_HARDENING_ASSERT(i < size());
340
371
  return data()[i];
341
372
  }
@@ -346,7 +377,7 @@ class InlinedVector {
346
377
  //
347
378
  // NOTE: if `i` is not within the required range of `InlinedVector::at(...)`,
348
379
  // in both debug and non-debug builds, `std::out_of_range` will be thrown.
349
- reference at(size_type i) {
380
+ reference at(size_type i) ABSL_ATTRIBUTE_LIFETIME_BOUND {
350
381
  if (ABSL_PREDICT_FALSE(i >= size())) {
351
382
  base_internal::ThrowStdOutOfRange(
352
383
  "`InlinedVector::at(size_type)` failed bounds check");
@@ -359,7 +390,7 @@ class InlinedVector {
359
390
  //
360
391
  // NOTE: if `i` is not within the required range of `InlinedVector::at(...)`,
361
392
  // in both debug and non-debug builds, `std::out_of_range` will be thrown.
362
- const_reference at(size_type i) const {
393
+ const_reference at(size_type i) const ABSL_ATTRIBUTE_LIFETIME_BOUND {
363
394
  if (ABSL_PREDICT_FALSE(i >= size())) {
364
395
  base_internal::ThrowStdOutOfRange(
365
396
  "`InlinedVector::at(size_type) const` failed bounds check");
@@ -370,14 +401,14 @@ class InlinedVector {
370
401
  // `InlinedVector::front()`
371
402
  //
372
403
  // Returns a `reference` to the first element of the inlined vector.
373
- reference front() {
404
+ reference front() ABSL_ATTRIBUTE_LIFETIME_BOUND {
374
405
  ABSL_HARDENING_ASSERT(!empty());
375
406
  return data()[0];
376
407
  }
377
408
 
378
409
  // Overload of `InlinedVector::front()` that returns a `const_reference` to
379
410
  // the first element of the inlined vector.
380
- const_reference front() const {
411
+ const_reference front() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
381
412
  ABSL_HARDENING_ASSERT(!empty());
382
413
  return data()[0];
383
414
  }
@@ -385,14 +416,14 @@ class InlinedVector {
385
416
  // `InlinedVector::back()`
386
417
  //
387
418
  // Returns a `reference` to the last element of the inlined vector.
388
- reference back() {
419
+ reference back() ABSL_ATTRIBUTE_LIFETIME_BOUND {
389
420
  ABSL_HARDENING_ASSERT(!empty());
390
421
  return data()[size() - 1];
391
422
  }
392
423
 
393
424
  // Overload of `InlinedVector::back()` that returns a `const_reference` to the
394
425
  // last element of the inlined vector.
395
- const_reference back() const {
426
+ const_reference back() const ABSL_ATTRIBUTE_LIFETIME_BOUND {
396
427
  ABSL_HARDENING_ASSERT(!empty());
397
428
  return data()[size() - 1];
398
429
  }
@@ -400,63 +431,82 @@ class InlinedVector {
400
431
  // `InlinedVector::begin()`
401
432
  //
402
433
  // Returns an `iterator` to the beginning of the inlined vector.
403
- iterator begin() noexcept { return data(); }
434
+ iterator begin() noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND { return data(); }
404
435
 
405
436
  // Overload of `InlinedVector::begin()` that returns a `const_iterator` to
406
437
  // the beginning of the inlined vector.
407
- const_iterator begin() const noexcept { return data(); }
438
+ const_iterator begin() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
439
+ return data();
440
+ }
408
441
 
409
442
  // `InlinedVector::end()`
410
443
  //
411
444
  // Returns an `iterator` to the end of the inlined vector.
412
- iterator end() noexcept { return data() + size(); }
445
+ iterator end() noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
446
+ return data() + size();
447
+ }
413
448
 
414
449
  // Overload of `InlinedVector::end()` that returns a `const_iterator` to the
415
450
  // end of the inlined vector.
416
- const_iterator end() const noexcept { return data() + size(); }
451
+ const_iterator end() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
452
+ return data() + size();
453
+ }
417
454
 
418
455
  // `InlinedVector::cbegin()`
419
456
  //
420
457
  // Returns a `const_iterator` to the beginning of the inlined vector.
421
- const_iterator cbegin() const noexcept { return begin(); }
458
+ const_iterator cbegin() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
459
+ return begin();
460
+ }
422
461
 
423
462
  // `InlinedVector::cend()`
424
463
  //
425
464
  // Returns a `const_iterator` to the end of the inlined vector.
426
- const_iterator cend() const noexcept { return end(); }
465
+ const_iterator cend() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
466
+ return end();
467
+ }
427
468
 
428
469
  // `InlinedVector::rbegin()`
429
470
  //
430
471
  // Returns a `reverse_iterator` from the end of the inlined vector.
431
- reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
472
+ reverse_iterator rbegin() noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
473
+ return reverse_iterator(end());
474
+ }
432
475
 
433
476
  // Overload of `InlinedVector::rbegin()` that returns a
434
477
  // `const_reverse_iterator` from the end of the inlined vector.
435
- const_reverse_iterator rbegin() const noexcept {
478
+ const_reverse_iterator rbegin() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
436
479
  return const_reverse_iterator(end());
437
480
  }
438
481
 
439
482
  // `InlinedVector::rend()`
440
483
  //
441
484
  // Returns a `reverse_iterator` from the beginning of the inlined vector.
442
- reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
485
+ reverse_iterator rend() noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
486
+ return reverse_iterator(begin());
487
+ }
443
488
 
444
489
  // Overload of `InlinedVector::rend()` that returns a `const_reverse_iterator`
445
490
  // from the beginning of the inlined vector.
446
- const_reverse_iterator rend() const noexcept {
491
+ const_reverse_iterator rend() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
447
492
  return const_reverse_iterator(begin());
448
493
  }
449
494
 
450
495
  // `InlinedVector::crbegin()`
451
496
  //
452
497
  // Returns a `const_reverse_iterator` from the end of the inlined vector.
453
- const_reverse_iterator crbegin() const noexcept { return rbegin(); }
498
+ const_reverse_iterator crbegin() const noexcept
499
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
500
+ return rbegin();
501
+ }
454
502
 
455
503
  // `InlinedVector::crend()`
456
504
  //
457
505
  // Returns a `const_reverse_iterator` from the beginning of the inlined
458
506
  // vector.
459
- const_reverse_iterator crend() const noexcept { return rend(); }
507
+ const_reverse_iterator crend() const noexcept ABSL_ATTRIBUTE_LIFETIME_BOUND {
508
+ return rend();
509
+ }
460
510
 
461
511
  // `InlinedVector::get_allocator()`
462
512
  //
@@ -566,20 +616,23 @@ class InlinedVector {
566
616
  //
567
617
  // Inserts a copy of `v` at `pos`, returning an `iterator` to the newly
568
618
  // inserted element.
569
- iterator insert(const_iterator pos, const_reference v) {
619
+ iterator insert(const_iterator pos,
620
+ const_reference v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
570
621
  return emplace(pos, v);
571
622
  }
572
623
 
573
624
  // Overload of `InlinedVector::insert(...)` that inserts `v` at `pos` using
574
625
  // move semantics, returning an `iterator` to the newly inserted element.
575
- iterator insert(const_iterator pos, value_type&& v) {
626
+ iterator insert(const_iterator pos,
627
+ value_type&& v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
576
628
  return emplace(pos, std::move(v));
577
629
  }
578
630
 
579
631
  // Overload of `InlinedVector::insert(...)` that inserts `n` contiguous copies
580
632
  // of `v` starting at `pos`, returning an `iterator` pointing to the first of
581
633
  // the newly inserted elements.
582
- iterator insert(const_iterator pos, size_type n, const_reference v) {
634
+ iterator insert(const_iterator pos, size_type n,
635
+ const_reference v) ABSL_ATTRIBUTE_LIFETIME_BOUND {
583
636
  ABSL_HARDENING_ASSERT(pos >= begin());
584
637
  ABSL_HARDENING_ASSERT(pos <= end());
585
638
 
@@ -607,7 +660,8 @@ class InlinedVector {
607
660
  // Overload of `InlinedVector::insert(...)` that inserts copies of the
608
661
  // elements of `list` starting at `pos`, returning an `iterator` pointing to
609
662
  // the first of the newly inserted elements.
610
- iterator insert(const_iterator pos, std::initializer_list<value_type> list) {
663
+ iterator insert(const_iterator pos, std::initializer_list<value_type> list)
664
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
611
665
  return insert(pos, list.begin(), list.end());
612
666
  }
613
667
 
@@ -619,7 +673,7 @@ class InlinedVector {
619
673
  template <typename ForwardIterator,
620
674
  EnableIfAtLeastForwardIterator<ForwardIterator> = 0>
621
675
  iterator insert(const_iterator pos, ForwardIterator first,
622
- ForwardIterator last) {
676
+ ForwardIterator last) ABSL_ATTRIBUTE_LIFETIME_BOUND {
623
677
  ABSL_HARDENING_ASSERT(pos >= begin());
624
678
  ABSL_HARDENING_ASSERT(pos <= end());
625
679
 
@@ -639,7 +693,8 @@ class InlinedVector {
639
693
  // NOTE: this overload is for iterators that are "input" category.
640
694
  template <typename InputIterator,
641
695
  DisableIfAtLeastForwardIterator<InputIterator> = 0>
642
- iterator insert(const_iterator pos, InputIterator first, InputIterator last) {
696
+ iterator insert(const_iterator pos, InputIterator first,
697
+ InputIterator last) ABSL_ATTRIBUTE_LIFETIME_BOUND {
643
698
  ABSL_HARDENING_ASSERT(pos >= begin());
644
699
  ABSL_HARDENING_ASSERT(pos <= end());
645
700
 
@@ -656,7 +711,8 @@ class InlinedVector {
656
711
  // Constructs and inserts an element using `args...` in the inlined vector at
657
712
  // `pos`, returning an `iterator` pointing to the newly emplaced element.
658
713
  template <typename... Args>
659
- iterator emplace(const_iterator pos, Args&&... args) {
714
+ iterator emplace(const_iterator pos,
715
+ Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND {
660
716
  ABSL_HARDENING_ASSERT(pos >= begin());
661
717
  ABSL_HARDENING_ASSERT(pos <= end());
662
718
 
@@ -684,7 +740,7 @@ class InlinedVector {
684
740
  // Constructs and inserts an element using `args...` in the inlined vector at
685
741
  // `end()`, returning a `reference` to the newly emplaced element.
686
742
  template <typename... Args>
687
- reference emplace_back(Args&&... args) {
743
+ reference emplace_back(Args&&... args) ABSL_ATTRIBUTE_LIFETIME_BOUND {
688
744
  return storage_.EmplaceBack(std::forward<Args>(args)...);
689
745
  }
690
746
 
@@ -714,8 +770,8 @@ class InlinedVector {
714
770
  // Erases the element at `pos`, returning an `iterator` pointing to where the
715
771
  // erased element was located.
716
772
  //
717
- // NOTE: may return `end()`, which is not dereferencable.
718
- iterator erase(const_iterator pos) {
773
+ // NOTE: may return `end()`, which is not dereferenceable.
774
+ iterator erase(const_iterator pos) ABSL_ATTRIBUTE_LIFETIME_BOUND {
719
775
  ABSL_HARDENING_ASSERT(pos >= begin());
720
776
  ABSL_HARDENING_ASSERT(pos < end());
721
777
 
@@ -726,8 +782,9 @@ class InlinedVector {
726
782
  // range [`from`, `to`), returning an `iterator` pointing to where the first
727
783
  // erased element was located.
728
784
  //
729
- // NOTE: may return `end()`, which is not dereferencable.
730
- iterator erase(const_iterator from, const_iterator to) {
785
+ // NOTE: may return `end()`, which is not dereferenceable.
786
+ iterator erase(const_iterator from,
787
+ const_iterator to) ABSL_ATTRIBUTE_LIFETIME_BOUND {
731
788
  ABSL_HARDENING_ASSERT(from >= begin());
732
789
  ABSL_HARDENING_ASSERT(from <= to);
733
790
  ABSL_HARDENING_ASSERT(to <= end());
@@ -784,39 +841,70 @@ class InlinedVector {
784
841
  friend H AbslHashValue(H h, const absl::InlinedVector<TheT, TheN, TheA>& a);
785
842
 
786
843
  void MoveAssignment(MemcpyPolicy, InlinedVector&& other) {
844
+ // Assumption check: we shouldn't be told to use memcpy to implement move
845
+ // assignment unless we have trivially destructible elements and an
846
+ // allocator that does nothing fancy.
847
+ static_assert(absl::is_trivially_destructible<value_type>::value, "");
848
+ static_assert(std::is_same<A, std::allocator<value_type>>::value, "");
849
+
850
+ // Throw away our existing heap allocation, if any. There is no need to
851
+ // destroy the existing elements one by one because we know they are
852
+ // trivially destructible.
853
+ storage_.DeallocateIfAllocated();
854
+
855
+ // Adopt the other vector's inline elements or heap allocation.
856
+ storage_.MemcpyFrom(other.storage_);
857
+ other.storage_.SetInlinedSize(0);
858
+ }
859
+
860
+ // Destroy our existing elements, if any, and adopt the heap-allocated
861
+ // elements of the other vector.
862
+ //
863
+ // REQUIRES: other.storage_.GetIsAllocated()
864
+ void DestroyExistingAndAdopt(InlinedVector&& other) {
865
+ ABSL_HARDENING_ASSERT(other.storage_.GetIsAllocated());
866
+
787
867
  inlined_vector_internal::DestroyAdapter<A>::DestroyElements(
788
868
  storage_.GetAllocator(), data(), size());
789
869
  storage_.DeallocateIfAllocated();
790
- storage_.MemcpyFrom(other.storage_);
791
870
 
871
+ storage_.MemcpyFrom(other.storage_);
792
872
  other.storage_.SetInlinedSize(0);
793
873
  }
794
874
 
795
875
  void MoveAssignment(ElementwiseAssignPolicy, InlinedVector&& other) {
876
+ // Fast path: if the other vector is on the heap then we don't worry about
877
+ // actually move-assigning each element. Instead we only throw away our own
878
+ // existing elements and adopt the heap allocation of the other vector.
796
879
  if (other.storage_.GetIsAllocated()) {
797
- MoveAssignment(MemcpyPolicy{}, std::move(other));
798
- } else {
799
- storage_.Assign(IteratorValueAdapter<A, MoveIterator<A>>(
800
- MoveIterator<A>(other.storage_.GetInlinedData())),
801
- other.size());
880
+ DestroyExistingAndAdopt(std::move(other));
881
+ return;
802
882
  }
883
+
884
+ storage_.Assign(IteratorValueAdapter<A, MoveIterator<A>>(
885
+ MoveIterator<A>(other.storage_.GetInlinedData())),
886
+ other.size());
803
887
  }
804
888
 
805
889
  void MoveAssignment(ElementwiseConstructPolicy, InlinedVector&& other) {
890
+ // Fast path: if the other vector is on the heap then we don't worry about
891
+ // actually move-assigning each element. Instead we only throw away our own
892
+ // existing elements and adopt the heap allocation of the other vector.
806
893
  if (other.storage_.GetIsAllocated()) {
807
- MoveAssignment(MemcpyPolicy{}, std::move(other));
808
- } else {
809
- inlined_vector_internal::DestroyAdapter<A>::DestroyElements(
810
- storage_.GetAllocator(), data(), size());
811
- storage_.DeallocateIfAllocated();
812
-
813
- IteratorValueAdapter<A, MoveIterator<A>> other_values(
814
- MoveIterator<A>(other.storage_.GetInlinedData()));
815
- inlined_vector_internal::ConstructElements<A>(
816
- storage_.GetAllocator(), storage_.GetInlinedData(), other_values,
817
- other.storage_.GetSize());
818
- storage_.SetInlinedSize(other.storage_.GetSize());
894
+ DestroyExistingAndAdopt(std::move(other));
895
+ return;
819
896
  }
897
+
898
+ inlined_vector_internal::DestroyAdapter<A>::DestroyElements(
899
+ storage_.GetAllocator(), data(), size());
900
+ storage_.DeallocateIfAllocated();
901
+
902
+ IteratorValueAdapter<A, MoveIterator<A>> other_values(
903
+ MoveIterator<A>(other.storage_.GetInlinedData()));
904
+ inlined_vector_internal::ConstructElements<A>(
905
+ storage_.GetAllocator(), storage_.GetInlinedData(), other_values,
906
+ other.storage_.GetSize());
907
+ storage_.SetInlinedSize(other.storage_.GetSize());
820
908
  }
821
909
 
822
910
  Storage storage_;
@@ -843,7 +931,7 @@ bool operator==(const absl::InlinedVector<T, N, A>& a,
843
931
  const absl::InlinedVector<T, N, A>& b) {
844
932
  auto a_data = a.data();
845
933
  auto b_data = b.data();
846
- return absl::equal(a_data, a_data + a.size(), b_data, b_data + b.size());
934
+ return std::equal(a_data, a_data + a.size(), b_data, b_data + b.size());
847
935
  }
848
936
 
849
937
  // `operator!=(...)`
@@ -87,7 +87,7 @@ struct common_policy_traits {
87
87
  }
88
88
 
89
89
  private:
90
- // To rank the overloads below for overload resoltion. Rank0 is preferred.
90
+ // To rank the overloads below for overload resolution. Rank0 is preferred.
91
91
  struct Rank2 {};
92
92
  struct Rank1 : Rank2 {};
93
93
  struct Rank0 : Rank1 {};
@@ -64,19 +64,6 @@ struct Elem<CompressedTuple<B...>, I>
64
64
  template <typename D, size_t I>
65
65
  using ElemT = typename Elem<D, I>::type;
66
66
 
67
- // Use the __is_final intrinsic if available. Where it's not available, classes
68
- // declared with the 'final' specifier cannot be used as CompressedTuple
69
- // elements.
70
- // TODO(sbenza): Replace this with std::is_final in C++14.
71
- template <typename T>
72
- constexpr bool IsFinal() {
73
- #if defined(__clang__) || defined(__GNUC__)
74
- return __is_final(T);
75
- #else
76
- return false;
77
- #endif
78
- }
79
-
80
67
  // We can't use EBCO on other CompressedTuples because that would mean that we
81
68
  // derive from multiple Storage<> instantiations with the same I parameter,
82
69
  // and potentially from multiple identical Storage<> instantiations. So anytime
@@ -86,20 +73,15 @@ struct uses_inheritance {};
86
73
 
87
74
  template <typename T>
88
75
  constexpr bool ShouldUseBase() {
89
- return std::is_class<T>::value && std::is_empty<T>::value && !IsFinal<T>() &&
76
+ return std::is_class<T>::value && std::is_empty<T>::value &&
77
+ !std::is_final<T>::value &&
90
78
  !std::is_base_of<uses_inheritance, T>::value;
91
79
  }
92
80
 
93
81
  // The storage class provides two specializations:
94
82
  // - For empty classes, it stores T as a base class.
95
83
  // - For everything else, it stores T as a member.
96
- template <typename T, size_t I,
97
- #if defined(_MSC_VER)
98
- bool UseBase =
99
- ShouldUseBase<typename std::enable_if<true, T>::type>()>
100
- #else
101
- bool UseBase = ShouldUseBase<T>()>
102
- #endif
84
+ template <typename T, size_t I, bool UseBase = ShouldUseBase<T>()>
103
85
  struct Storage {
104
86
  T value;
105
87
  constexpr Storage() = default;
@@ -165,7 +165,7 @@ decltype(std::declval<F>()(std::declval<T>())) WithConstructed(
165
165
  std::forward<F>(f));
166
166
  }
167
167
 
168
- // Given arguments of an std::pair's consructor, PairArgs() returns a pair of
168
+ // Given arguments of an std::pair's constructor, PairArgs() returns a pair of
169
169
  // tuples with references to the passed arguments. The tuples contain
170
170
  // constructor arguments for the first and the second elements of the pair.
171
171
  //
@@ -56,6 +56,10 @@
56
56
  #include "absl/strings/cord.h"
57
57
  #include "absl/strings/string_view.h"
58
58
 
59
+ #ifdef ABSL_HAVE_STD_STRING_VIEW
60
+ #include <string_view>
61
+ #endif
62
+
59
63
  namespace absl {
60
64
  ABSL_NAMESPACE_BEGIN
61
65
  namespace container_internal {
@@ -107,6 +111,48 @@ struct HashEq<absl::string_view> : StringHashEq {};
107
111
  template <>
108
112
  struct HashEq<absl::Cord> : StringHashEq {};
109
113
 
114
+ #ifdef ABSL_HAVE_STD_STRING_VIEW
115
+
116
+ template <typename TChar>
117
+ struct BasicStringHash {
118
+ using is_transparent = void;
119
+
120
+ size_t operator()(std::basic_string_view<TChar> v) const {
121
+ return absl::Hash<std::basic_string_view<TChar>>{}(v);
122
+ }
123
+ };
124
+
125
+ template <typename TChar>
126
+ struct BasicStringEq {
127
+ using is_transparent = void;
128
+ bool operator()(std::basic_string_view<TChar> lhs,
129
+ std::basic_string_view<TChar> rhs) const {
130
+ return lhs == rhs;
131
+ }
132
+ };
133
+
134
+ // Supports heterogeneous lookup for w/u16/u32 string + string_view + char*.
135
+ template <typename TChar>
136
+ struct BasicStringHashEq {
137
+ using Hash = BasicStringHash<TChar>;
138
+ using Eq = BasicStringEq<TChar>;
139
+ };
140
+
141
+ template <>
142
+ struct HashEq<std::wstring> : BasicStringHashEq<wchar_t> {};
143
+ template <>
144
+ struct HashEq<std::wstring_view> : BasicStringHashEq<wchar_t> {};
145
+ template <>
146
+ struct HashEq<std::u16string> : BasicStringHashEq<char16_t> {};
147
+ template <>
148
+ struct HashEq<std::u16string_view> : BasicStringHashEq<char16_t> {};
149
+ template <>
150
+ struct HashEq<std::u32string> : BasicStringHashEq<char32_t> {};
151
+ template <>
152
+ struct HashEq<std::u32string_view> : BasicStringHashEq<char32_t> {};
153
+
154
+ #endif // ABSL_HAVE_STD_STRING_VIEW
155
+
110
156
  // Supports heterogeneous lookup for pointers and smart pointers.
111
157
  template <class T>
112
158
  struct HashEq<T*> {
@@ -23,11 +23,13 @@
23
23
 
24
24
  #include "absl/base/attributes.h"
25
25
  #include "absl/base/config.h"
26
+ #include "absl/base/internal/raw_logging.h"
26
27
  #include "absl/debugging/stacktrace.h"
27
28
  #include "absl/memory/memory.h"
28
29
  #include "absl/profiling/internal/exponential_biased.h"
29
30
  #include "absl/profiling/internal/sample_recorder.h"
30
31
  #include "absl/synchronization/mutex.h"
32
+ #include "absl/time/clock.h"
31
33
  #include "absl/utility/utility.h"
32
34
 
33
35
  namespace absl {