grpc 1.34.0 → 1.35.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +808 -2787
- data/etc/roots.pem +257 -573
- data/include/grpc/compression.h +1 -1
- data/include/grpc/grpc.h +14 -0
- data/include/grpc/grpc_security.h +61 -3
- data/include/grpc/impl/codegen/atm_windows.h +4 -0
- data/include/grpc/impl/codegen/byte_buffer.h +1 -1
- data/include/grpc/impl/codegen/grpc_types.h +1 -1
- data/include/grpc/impl/codegen/log.h +0 -2
- data/include/grpc/impl/codegen/sync_windows.h +4 -0
- data/include/grpc/slice_buffer.h +3 -3
- data/include/grpc/support/sync.h +3 -3
- data/include/grpc/support/time.h +7 -7
- data/src/core/ext/filters/client_channel/backend_metric.cc +2 -4
- data/src/core/ext/filters/client_channel/client_channel.cc +2734 -1498
- data/src/core/ext/filters/client_channel/client_channel.h +0 -4
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +1 -1
- data/src/core/ext/filters/client_channel/config_selector.h +4 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +186 -0
- data/src/core/ext/filters/client_channel/dynamic_filters.h +99 -0
- data/src/core/ext/filters/client_channel/health/health_check_client.cc +6 -6
- data/src/core/ext/filters/client_channel/health/health_check_client.h +2 -2
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +4 -5
- data/src/core/ext/filters/client_channel/http_proxy.cc +21 -20
- data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +2 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +32 -30
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +3 -3
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +162 -20
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds.h +0 -8
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +24 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +5 -2
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +1262 -0
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +7 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h +1 -32
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +454 -16
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +5 -0
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +6 -9
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +18 -31
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +3 -5
- data/src/core/ext/filters/client_channel/resolver_factory.h +6 -6
- data/src/core/ext/filters/client_channel/resolver_registry.cc +40 -39
- data/src/core/ext/filters/client_channel/resolver_registry.h +2 -2
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +11 -13
- data/src/core/ext/filters/client_channel/resolver_result_parsing.h +8 -8
- data/src/core/ext/filters/client_channel/retry_throttle.cc +5 -3
- data/src/core/ext/filters/client_channel/retry_throttle.h +3 -1
- data/src/core/ext/filters/client_channel/service_config_call_data.h +19 -1
- data/src/core/ext/filters/client_channel/subchannel.cc +34 -50
- data/src/core/ext/filters/client_channel/subchannel.h +12 -18
- data/src/core/ext/filters/deadline/deadline_filter.cc +4 -2
- data/src/core/ext/filters/http/client_authority_filter.cc +6 -6
- data/src/core/ext/filters/http/http_filters_plugin.cc +6 -3
- data/src/core/ext/filters/message_size/message_size_filter.cc +1 -1
- data/src/core/ext/filters/workarounds/workaround_utils.cc +1 -1
- data/src/core/ext/transport/chttp2/client/authority.cc +3 -3
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +20 -8
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +21 -10
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +26 -14
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +178 -86
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +12 -5
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +7 -8
- data/src/core/ext/transport/chttp2/transport/flow_control.h +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.h +2 -1
- data/src/core/ext/transport/chttp2/transport/frame_window_update.cc +6 -6
- data/src/core/ext/transport/chttp2/transport/writing.cc +1 -1
- data/src/core/ext/transport/inproc/inproc_transport.cc +42 -8
- data/src/core/ext/upb-generated/envoy/annotations/deprecation.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/annotations/resource.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +27 -27
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.h +139 -40
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.c +13 -13
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/circuit_breaker.upb.h +44 -17
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +111 -111
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +424 -241
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/filter.upb.h +13 -5
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +22 -22
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +47 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.c +21 -21
- data/src/core/ext/upb-generated/envoy/config/core/v3/address.upb.h +88 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/backoff.upb.h +15 -6
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +44 -44
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +200 -78
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +17 -17
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +72 -35
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/event_service_config.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/extension.upb.h +27 -11
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.c +30 -30
- data/src/core/ext/upb-generated/envoy/config/core/v3/grpc_service.upb.h +136 -49
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +39 -39
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +157 -89
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.c +4 -4
- data/src/core/ext/upb-generated/envoy/config/core/v3/http_uri.upb.h +17 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +47 -47
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +163 -78
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/socket_option.upb.h +9 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +13 -13
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.h +59 -36
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.c +16 -16
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint_components.upb.h +61 -29
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.c +26 -26
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/load_report.upb.h +101 -66
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/api_listener.upb.h +11 -3
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +28 -28
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +122 -77
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +23 -23
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +106 -54
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.h +13 -0
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.c +16 -16
- data/src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h +81 -35
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +38 -22
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +203 -203
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +845 -495
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/config/route/v3/scoped_route.upb.h +26 -6
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.h +17 -3
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +87 -87
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +343 -204
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +20 -20
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +85 -46
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +33 -11
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +32 -32
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.h +118 -67
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/cluster/v3/cds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/ads.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +29 -29
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +120 -82
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.h +31 -16
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/srds.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.c +5 -5
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/metadata.upb.h +25 -11
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/number.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/path.upb.h +7 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.c +6 -6
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/regex.upb.h +29 -8
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.h +16 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/value.upb.h +19 -0
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/type/metadata/v3/metadata.upb.h +46 -3
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.c +8 -8
- data/src/core/ext/upb-generated/envoy/type/tracing/v3/custom_tag.upb.h +41 -8
- data/src/core/ext/upb-generated/envoy/type/v3/http.upb.h +1 -0
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/v3/percent.upb.h +15 -2
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.c +3 -3
- data/src/core/ext/upb-generated/envoy/type/v3/range.upb.h +19 -0
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.c +1 -1
- data/src/core/ext/upb-generated/envoy/type/v3/semantic_version.upb.h +7 -0
- data/src/core/ext/upb-generated/google/api/annotations.upb.h +1 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.c +34 -34
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/checked.upb.h +149 -72
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +34 -34
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +142 -59
- data/src/core/ext/upb-generated/google/api/http.upb.c +3 -3
- data/src/core/ext/upb-generated/google/api/http.upb.h +25 -6
- data/src/core/ext/upb-generated/google/protobuf/any.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/any.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +90 -90
- data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +455 -292
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +4 -4
- data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +22 -3
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +1 -1
- data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +7 -0
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +9 -9
- data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +55 -0
- data/src/core/ext/upb-generated/google/rpc/status.upb.c +1 -1
- data/src/core/ext/upb-generated/google/rpc/status.upb.h +10 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +4 -4
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +11 -3
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +41 -41
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +149 -76
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +5 -5
- data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +21 -6
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +2 -2
- data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +13 -0
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +17 -17
- data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +82 -25
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/annotations/migrate.upb.h +19 -0
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/security.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/annotations/sensitive.upb.h +1 -0
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/annotations/status.upb.h +9 -2
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/annotations/versioning.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.c +1 -1
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +5 -5
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +21 -7
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +2 -2
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +7 -0
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.c +4 -4
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +17 -8
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +7 -7
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +31 -18
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +5 -5
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +19 -11
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +3 -3
- data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +7 -0
- data/src/core/ext/upb-generated/validate/validate.upb.c +64 -64
- data/src/core/ext/upb-generated/validate/validate.upb.h +296 -157
- data/src/core/ext/xds/certificate_provider_store.cc +10 -7
- data/src/core/ext/xds/certificate_provider_store.h +12 -7
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +25 -0
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -4
- data/src/core/ext/xds/xds_api.cc +220 -31
- data/src/core/ext/xds/xds_api.h +41 -10
- data/src/core/ext/xds/xds_bootstrap.h +0 -1
- data/src/core/ext/xds/xds_certificate_provider.cc +61 -2
- data/src/core/ext/xds/xds_certificate_provider.h +40 -2
- data/src/core/ext/xds/xds_client.cc +31 -29
- data/src/core/ext/xds/xds_client.h +6 -1
- data/src/core/ext/xds/xds_client_stats.cc +2 -2
- data/src/core/ext/xds/xds_server_config_fetcher.cc +131 -0
- data/src/core/lib/channel/channel_args.cc +8 -8
- data/src/core/lib/channel/channel_trace.h +1 -1
- data/src/core/lib/channel/channelz.cc +13 -14
- data/src/core/lib/channel/channelz.h +0 -1
- data/src/core/lib/channel/channelz_registry.h +0 -1
- data/src/core/lib/channel/handshaker.cc +2 -2
- data/src/core/lib/compression/compression_args.cc +3 -2
- data/src/core/lib/debug/stats.h +2 -2
- data/src/core/lib/debug/stats_data.h +13 -13
- data/src/core/lib/gpr/alloc.cc +3 -2
- data/src/core/lib/gpr/log.cc +53 -16
- data/src/core/lib/gpr/log_linux.cc +3 -1
- data/src/core/lib/gpr/log_posix.cc +3 -1
- data/src/core/lib/gpr/log_windows.cc +3 -1
- data/src/core/lib/gpr/spinlock.h +10 -2
- data/src/core/lib/gpr/string.cc +22 -21
- data/src/core/lib/gpr/string.h +5 -6
- data/src/core/lib/gpr/sync.cc +4 -4
- data/src/core/lib/gpr/time.cc +12 -12
- data/src/core/lib/gprpp/arena.h +3 -2
- data/src/core/lib/gprpp/ref_counted.h +2 -2
- data/src/core/lib/gprpp/ref_counted_ptr.h +9 -1
- data/src/core/lib/gprpp/thd_posix.cc +6 -1
- data/src/core/lib/gprpp/thd_windows.cc +3 -1
- data/src/core/lib/http/httpcli.cc +1 -1
- data/src/core/lib/http/httpcli.h +2 -3
- data/src/core/lib/http/httpcli_security_connector.cc +1 -1
- data/src/core/lib/http/parser.cc +1 -2
- data/src/core/lib/iomgr/call_combiner.cc +8 -5
- data/src/core/lib/iomgr/combiner.cc +2 -1
- data/src/core/lib/iomgr/endpoint.h +1 -1
- data/src/core/lib/iomgr/error.cc +15 -11
- data/src/core/lib/iomgr/error_internal.h +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +20 -13
- data/src/core/lib/iomgr/ev_epollex_linux.cc +17 -13
- data/src/core/lib/iomgr/ev_poll_posix.cc +9 -7
- data/src/core/lib/iomgr/exec_ctx.h +6 -4
- data/src/core/lib/iomgr/executor.cc +2 -1
- data/src/core/lib/iomgr/executor.h +1 -1
- data/src/core/lib/iomgr/executor/threadpool.h +1 -1
- data/src/core/lib/iomgr/iomgr.cc +1 -1
- data/src/core/lib/iomgr/load_file.h +1 -1
- data/src/core/lib/iomgr/lockfree_event.cc +19 -14
- data/src/core/lib/iomgr/lockfree_event.h +2 -2
- data/src/core/lib/iomgr/parse_address.cc +52 -46
- data/src/core/lib/iomgr/parse_address.h +13 -9
- data/src/core/lib/iomgr/poller/eventmanager_libuv.h +1 -1
- data/src/core/lib/iomgr/pollset_set_custom.cc +1 -1
- data/src/core/lib/iomgr/python_util.h +1 -1
- data/src/core/lib/iomgr/resolve_address.cc +4 -4
- data/src/core/lib/iomgr/resource_quota.cc +4 -4
- data/src/core/lib/iomgr/sockaddr_utils.cc +10 -10
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_factory_posix.cc +3 -2
- data/src/core/lib/iomgr/socket_mutator.cc +3 -2
- data/src/core/lib/iomgr/tcp_client.cc +3 -3
- data/src/core/lib/iomgr/tcp_client_custom.cc +7 -6
- data/src/core/lib/iomgr/tcp_custom.cc +22 -17
- data/src/core/lib/iomgr/tcp_posix.cc +9 -6
- data/src/core/lib/iomgr/tcp_server_custom.cc +28 -22
- data/src/core/lib/iomgr/timer_custom.cc +3 -3
- data/src/core/lib/iomgr/timer_generic.cc +3 -3
- data/src/core/lib/iomgr/timer_manager.cc +2 -2
- data/src/core/lib/iomgr/udp_server.cc +1 -2
- data/src/core/lib/iomgr/udp_server.h +1 -2
- data/src/core/lib/iomgr/unix_sockets_posix.cc +17 -18
- data/src/core/lib/json/json.h +10 -0
- data/src/core/lib/security/authorization/evaluate_args.cc +5 -10
- data/src/core/lib/security/authorization/evaluate_args.h +1 -1
- data/src/core/lib/security/context/security_context.cc +4 -3
- data/src/core/lib/security/credentials/alts/check_gcp_environment.cc +1 -1
- data/src/core/lib/security/credentials/credentials.cc +6 -6
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +413 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.h +80 -0
- data/src/core/lib/security/credentials/external/aws_request_signer.cc +15 -10
- data/src/core/lib/security/credentials/external/aws_request_signer.h +1 -2
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +217 -31
- data/src/core/lib/security/credentials/external/external_account_credentials.h +7 -5
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +5 -6
- data/src/core/lib/security/credentials/external/file_external_account_credentials.h +3 -4
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +20 -18
- data/src/core/lib/security/credentials/external/url_external_account_credentials.h +5 -6
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +18 -12
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +18 -5
- data/src/core/lib/security/credentials/jwt/json_token.cc +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -3
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +37 -44
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.h +5 -4
- data/src/core/lib/security/credentials/plugin/plugin_credentials.cc +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +5 -5
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.cc +1 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_distributor.h +1 -6
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +326 -5
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +64 -0
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +1 -1
- data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +0 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +1 -1
- data/src/core/lib/security/credentials/tls/tls_utils.cc +91 -0
- data/src/core/lib/security/credentials/tls/tls_utils.h +38 -0
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +140 -10
- data/src/core/lib/security/credentials/xds/xds_credentials.h +27 -9
- data/src/core/lib/security/security_connector/alts/alts_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/fake/fake_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +46 -13
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.h +23 -6
- data/src/core/lib/security/security_connector/local/local_security_connector.cc +1 -1
- data/src/core/lib/security/security_connector/security_connector.cc +3 -2
- data/src/core/lib/security/security_connector/ssl/ssl_security_connector.cc +4 -4
- data/src/core/lib/security/security_connector/ssl_utils.cc +2 -2
- data/src/core/lib/security/security_connector/ssl_utils.h +12 -19
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +57 -12
- data/src/core/lib/security/security_connector/tls/tls_security_connector.h +2 -3
- data/src/core/lib/security/transport/secure_endpoint.cc +2 -2
- data/src/core/lib/security/transport/security_handshaker.cc +2 -2
- data/src/core/lib/slice/slice_intern.cc +4 -5
- data/src/core/lib/slice/slice_internal.h +2 -2
- data/src/core/lib/surface/call.cc +32 -24
- data/src/core/lib/surface/call_details.cc +8 -8
- data/src/core/lib/surface/channel.cc +16 -10
- data/src/core/lib/surface/channel.h +3 -2
- data/src/core/lib/surface/channel_init.cc +1 -1
- data/src/core/lib/surface/completion_queue.cc +23 -18
- data/src/core/lib/surface/completion_queue.h +16 -16
- data/src/core/lib/surface/init.cc +6 -5
- data/src/core/lib/surface/lame_client.cc +20 -46
- data/src/core/lib/surface/lame_client.h +4 -0
- data/src/core/lib/surface/server.cc +59 -15
- data/src/core/lib/surface/server.h +37 -5
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/authority_override.cc +6 -4
- data/src/core/lib/transport/authority_override.h +5 -2
- data/src/core/lib/transport/connectivity_state.h +6 -4
- data/src/core/lib/transport/error_utils.h +1 -1
- data/src/core/lib/transport/metadata_batch.h +4 -4
- data/src/core/lib/transport/static_metadata.cc +1 -1
- data/src/core/lib/transport/status_metadata.cc +4 -3
- data/src/core/lib/transport/transport.h +7 -7
- data/src/core/lib/uri/uri_parser.cc +131 -249
- data/src/core/lib/uri/uri_parser.h +57 -21
- data/src/core/plugin_registry/grpc_plugin_registry.cc +10 -4
- data/src/core/tsi/alts/crypt/gsec.cc +5 -4
- data/src/core/tsi/alts/frame_protector/frame_handler.cc +8 -6
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +23 -23
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.cc +8 -6
- data/src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.cc +4 -4
- data/src/core/tsi/fake_transport_security.cc +5 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_boringssl.cc +1 -1
- data/src/core/tsi/ssl_transport_security.cc +62 -49
- data/src/core/tsi/ssl_transport_security.h +6 -6
- data/src/core/tsi/transport_security.cc +6 -6
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/ruby/ext/grpc/rb_event_thread.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +31 -13
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +28 -0
- data/src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb +18 -0
- data/src/ruby/spec/pb/codegen/package_option_spec.rb +2 -6
- data/third_party/abseil-cpp/absl/container/flat_hash_map.h +606 -0
- data/third_party/abseil-cpp/absl/container/internal/raw_hash_map.h +197 -0
- data/third_party/abseil-cpp/absl/status/internal/statusor_internal.h +399 -0
- data/third_party/abseil-cpp/absl/status/statusor.cc +71 -0
- data/third_party/abseil-cpp/absl/status/statusor.h +760 -0
- data/third_party/upb/third_party/wyhash/wyhash.h +145 -0
- data/third_party/upb/upb/decode.c +248 -167
- data/third_party/upb/upb/decode.h +20 -1
- data/third_party/upb/upb/decode.int.h +163 -0
- data/third_party/upb/upb/decode_fast.c +1040 -0
- data/third_party/upb/upb/decode_fast.h +126 -0
- data/third_party/upb/upb/def.c +525 -516
- data/third_party/upb/upb/def.h +16 -31
- data/third_party/upb/upb/def.hpp +37 -123
- data/third_party/upb/upb/encode.c +227 -169
- data/third_party/upb/upb/encode.h +27 -2
- data/third_party/upb/upb/json_decode.c +1443 -0
- data/third_party/upb/upb/json_decode.h +23 -0
- data/third_party/upb/upb/json_encode.c +713 -0
- data/third_party/upb/upb/json_encode.h +36 -0
- data/third_party/upb/upb/msg.c +167 -88
- data/third_party/upb/upb/msg.h +174 -34
- data/third_party/upb/upb/port_def.inc +74 -61
- data/third_party/upb/upb/port_undef.inc +3 -7
- data/third_party/upb/upb/reflection.c +36 -19
- data/third_party/upb/upb/table.c +34 -197
- data/third_party/upb/upb/table.int.h +14 -5
- data/third_party/upb/upb/text_encode.c +45 -22
- data/third_party/upb/upb/text_encode.h +4 -1
- data/third_party/upb/upb/upb.c +18 -41
- data/third_party/upb/upb/upb.h +36 -7
- data/third_party/upb/upb/upb.hpp +4 -4
- data/third_party/upb/upb/upb.int.h +29 -0
- metadata +60 -46
- data/src/core/ext/filters/client_channel/lb_policy/xds/eds.cc +0 -909
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.cc +0 -485
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_fallback.cc +0 -68
- data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +0 -355
- data/src/core/ext/filters/client_channel/resolving_lb_policy.h +0 -138
- data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.cc +0 -265
- data/src/core/ext/xds/google_mesh_ca_certificate_provider_factory.h +0 -104
- data/src/core/lib/gprpp/map.h +0 -53
- data/third_party/upb/upb/port.c +0 -26
@@ -13,7 +13,7 @@
|
|
13
13
|
** store pointers or integers of at least 32 bits (upb isn't really useful on
|
14
14
|
** systems where sizeof(void*) < 4).
|
15
15
|
**
|
16
|
-
** The table must be
|
16
|
+
** The table must be homogeneous (all values of the same type). In debug
|
17
17
|
** mode, we check this on insert and lookup.
|
18
18
|
*/
|
19
19
|
|
@@ -147,10 +147,17 @@ UPB_INLINE char *upb_tabstr(upb_tabkey key, uint32_t *len) {
|
|
147
147
|
return mem + sizeof(*len);
|
148
148
|
}
|
149
149
|
|
150
|
+
UPB_INLINE upb_strview upb_tabstrview(upb_tabkey key) {
|
151
|
+
upb_strview ret;
|
152
|
+
uint32_t len;
|
153
|
+
ret.data = upb_tabstr(key, &len);
|
154
|
+
ret.size = len;
|
155
|
+
return ret;
|
156
|
+
}
|
150
157
|
|
151
158
|
/* upb_tabval *****************************************************************/
|
152
159
|
|
153
|
-
typedef struct {
|
160
|
+
typedef struct upb_tabval {
|
154
161
|
uint64_t val;
|
155
162
|
} upb_tabval;
|
156
163
|
|
@@ -171,7 +178,8 @@ typedef struct _upb_tabent {
|
|
171
178
|
|
172
179
|
typedef struct {
|
173
180
|
size_t count; /* Number of entries in the hash part. */
|
174
|
-
|
181
|
+
uint32_t mask; /* Mask to turn hash value -> bucket. */
|
182
|
+
uint32_t max_count; /* Max count before we hit our load limit. */
|
175
183
|
uint8_t size_lg2; /* Size of the hashtable part is 2^size_lg2 entries. */
|
176
184
|
|
177
185
|
/* Hash table entries.
|
@@ -230,7 +238,8 @@ UPB_INLINE bool upb_arrhas(upb_tabval key) {
|
|
230
238
|
/* Initialize and uninitialize a table, respectively. If memory allocation
|
231
239
|
* failed, false is returned that the table is uninitialized. */
|
232
240
|
bool upb_inttable_init2(upb_inttable *table, upb_ctype_t ctype, upb_alloc *a);
|
233
|
-
bool upb_strtable_init2(upb_strtable *table, upb_ctype_t ctype,
|
241
|
+
bool upb_strtable_init2(upb_strtable *table, upb_ctype_t ctype,
|
242
|
+
size_t expected_size, upb_alloc *a);
|
234
243
|
void upb_inttable_uninit2(upb_inttable *table, upb_alloc *a);
|
235
244
|
void upb_strtable_uninit2(upb_strtable *table, upb_alloc *a);
|
236
245
|
|
@@ -239,7 +248,7 @@ UPB_INLINE bool upb_inttable_init(upb_inttable *table, upb_ctype_t ctype) {
|
|
239
248
|
}
|
240
249
|
|
241
250
|
UPB_INLINE bool upb_strtable_init(upb_strtable *table, upb_ctype_t ctype) {
|
242
|
-
return upb_strtable_init2(table, ctype, &upb_alloc_global);
|
251
|
+
return upb_strtable_init2(table, ctype, 4, &upb_alloc_global);
|
243
252
|
}
|
244
253
|
|
245
254
|
UPB_INLINE void upb_inttable_uninit(upb_inttable *table) {
|
@@ -17,6 +17,7 @@ typedef struct {
|
|
17
17
|
int indent_depth;
|
18
18
|
int options;
|
19
19
|
const upb_symtab *ext_pool;
|
20
|
+
_upb_mapsorter sorter;
|
20
21
|
} txtenc;
|
21
22
|
|
22
23
|
static void txtenc_msg(txtenc *e, const upb_msg *msg, const upb_msgdef *m);
|
@@ -43,7 +44,7 @@ static void txtenc_printf(txtenc *e, const char *fmt, ...) {
|
|
43
44
|
va_list args;
|
44
45
|
|
45
46
|
va_start(args, fmt);
|
46
|
-
n =
|
47
|
+
n = vsnprintf(e->ptr, have, fmt, args);
|
47
48
|
va_end(args);
|
48
49
|
|
49
50
|
if (UPB_LIKELY(have > n)) {
|
@@ -187,6 +188,25 @@ static void txtenc_array(txtenc *e, const upb_array *arr,
|
|
187
188
|
}
|
188
189
|
}
|
189
190
|
|
191
|
+
static void txtenc_mapentry(txtenc *e, upb_msgval key, upb_msgval val,
|
192
|
+
const upb_fielddef *f) {
|
193
|
+
const upb_msgdef *entry = upb_fielddef_msgsubdef(f);
|
194
|
+
const upb_fielddef *key_f = upb_msgdef_field(entry, 0);
|
195
|
+
const upb_fielddef *val_f = upb_msgdef_field(entry, 1);
|
196
|
+
txtenc_indent(e);
|
197
|
+
txtenc_printf(e, "%s: {", upb_fielddef_name(f));
|
198
|
+
txtenc_endfield(e);
|
199
|
+
e->indent_depth++;
|
200
|
+
|
201
|
+
txtenc_field(e, key, key_f);
|
202
|
+
txtenc_field(e, val, val_f);
|
203
|
+
|
204
|
+
e->indent_depth--;
|
205
|
+
txtenc_indent(e);
|
206
|
+
txtenc_putstr(e, "}");
|
207
|
+
txtenc_endfield(e);
|
208
|
+
}
|
209
|
+
|
190
210
|
/*
|
191
211
|
* Maps print as messages of key/value, etc.
|
192
212
|
*
|
@@ -200,27 +220,28 @@ static void txtenc_array(txtenc *e, const upb_array *arr,
|
|
200
220
|
* }
|
201
221
|
*/
|
202
222
|
static void txtenc_map(txtenc *e, const upb_map *map, const upb_fielddef *f) {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
223
|
+
if (e->options & UPB_TXTENC_NOSORT) {
|
224
|
+
size_t iter = UPB_MAP_BEGIN;
|
225
|
+
while (upb_mapiter_next(map, &iter)) {
|
226
|
+
upb_msgval key = upb_mapiter_key(map, iter);
|
227
|
+
upb_msgval val = upb_mapiter_value(map, iter);
|
228
|
+
txtenc_mapentry(e, key, val, f);
|
229
|
+
}
|
230
|
+
} else {
|
231
|
+
const upb_msgdef *entry = upb_fielddef_msgsubdef(f);
|
232
|
+
const upb_fielddef *key_f = upb_msgdef_field(entry, 0);
|
233
|
+
_upb_sortedmap sorted;
|
234
|
+
upb_map_entry ent;
|
235
|
+
|
236
|
+
_upb_mapsorter_pushmap(&e->sorter, upb_fielddef_descriptortype(key_f), map,
|
237
|
+
&sorted);
|
238
|
+
while (_upb_sortedmap_next(&e->sorter, map, &sorted, &ent)) {
|
239
|
+
upb_msgval key, val;
|
240
|
+
memcpy(&key, &ent.k, sizeof(key));
|
241
|
+
memcpy(&val, &ent.v, sizeof(val));
|
242
|
+
txtenc_mapentry(e, key, val, f);
|
243
|
+
}
|
244
|
+
_upb_mapsorter_popmap(&e->sorter, &sorted);
|
224
245
|
}
|
225
246
|
}
|
226
247
|
|
@@ -392,7 +413,9 @@ size_t upb_text_encode(const upb_msg *msg, const upb_msgdef *m,
|
|
392
413
|
e.indent_depth = 0;
|
393
414
|
e.options = options;
|
394
415
|
e.ext_pool = ext_pool;
|
416
|
+
_upb_mapsorter_init(&e.sorter);
|
395
417
|
|
396
418
|
txtenc_msg(&e, msg, m);
|
419
|
+
_upb_mapsorter_destroy(&e.sorter);
|
397
420
|
return txtenc_nullz(&e, size);
|
398
421
|
}
|
@@ -13,7 +13,10 @@ enum {
|
|
13
13
|
UPB_TXTENC_SINGLELINE = 1,
|
14
14
|
|
15
15
|
/* When set, unknown fields are not printed. */
|
16
|
-
UPB_TXTENC_SKIPUNKNOWN = 2
|
16
|
+
UPB_TXTENC_SKIPUNKNOWN = 2,
|
17
|
+
|
18
|
+
/* When set, maps are *not* sorted (this avoids allocating tmp mem). */
|
19
|
+
UPB_TXTENC_NOSORT = 4
|
17
20
|
};
|
18
21
|
|
19
22
|
/* Encodes the given |msg| to text format. The message's reflection is given in
|
data/third_party/upb/upb/upb.c
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
#include "upb/upb.h"
|
2
|
+
#include "upb/upb.int.h"
|
3
3
|
|
4
4
|
#include <errno.h>
|
5
5
|
#include <stdarg.h>
|
@@ -40,7 +40,7 @@ void upb_status_seterrf(upb_status *status, const char *fmt, ...) {
|
|
40
40
|
void upb_status_vseterrf(upb_status *status, const char *fmt, va_list args) {
|
41
41
|
if (!status) return;
|
42
42
|
status->ok = false;
|
43
|
-
|
43
|
+
vsnprintf(status->msg, sizeof(status->msg), fmt, args);
|
44
44
|
status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
|
45
45
|
}
|
46
46
|
|
@@ -49,7 +49,7 @@ void upb_status_vappenderrf(upb_status *status, const char *fmt, va_list args) {
|
|
49
49
|
if (!status) return;
|
50
50
|
status->ok = false;
|
51
51
|
len = strlen(status->msg);
|
52
|
-
|
52
|
+
vsnprintf(status->msg + len, sizeof(status->msg) - len, fmt, args);
|
53
53
|
status->msg[UPB_STATUS_MAX_MESSAGE - 1] = '\0';
|
54
54
|
}
|
55
55
|
|
@@ -73,37 +73,18 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc};
|
|
73
73
|
|
74
74
|
/* Be conservative and choose 16 in case anyone is using SSE. */
|
75
75
|
|
76
|
-
|
76
|
+
struct mem_block {
|
77
77
|
struct mem_block *next;
|
78
78
|
uint32_t size;
|
79
79
|
uint32_t cleanups;
|
80
80
|
/* Data follows. */
|
81
|
-
}
|
81
|
+
};
|
82
82
|
|
83
83
|
typedef struct cleanup_ent {
|
84
84
|
upb_cleanup_func *cleanup;
|
85
85
|
void *ud;
|
86
86
|
} cleanup_ent;
|
87
87
|
|
88
|
-
struct upb_arena {
|
89
|
-
_upb_arena_head head;
|
90
|
-
uint32_t *cleanups;
|
91
|
-
|
92
|
-
/* Allocator to allocate arena blocks. We are responsible for freeing these
|
93
|
-
* when we are destroyed. */
|
94
|
-
upb_alloc *block_alloc;
|
95
|
-
uint32_t last_size;
|
96
|
-
|
97
|
-
/* When multiple arenas are fused together, each arena points to a parent
|
98
|
-
* arena (root points to itself). The root tracks how many live arenas
|
99
|
-
* reference it. */
|
100
|
-
uint32_t refcount; /* Only used when a->parent == a */
|
101
|
-
struct upb_arena *parent;
|
102
|
-
|
103
|
-
/* Linked list of blocks to free/cleanup. */
|
104
|
-
mem_block *freelist, *freelist_tail;
|
105
|
-
};
|
106
|
-
|
107
88
|
static const size_t memblock_reserve = UPB_ALIGN_UP(sizeof(mem_block), 16);
|
108
89
|
|
109
90
|
static upb_arena *arena_findroot(upb_arena *a) {
|
@@ -117,9 +98,9 @@ static upb_arena *arena_findroot(upb_arena *a) {
|
|
117
98
|
return a;
|
118
99
|
}
|
119
100
|
|
120
|
-
static void upb_arena_addblock(upb_arena *a, void *ptr,
|
101
|
+
static void upb_arena_addblock(upb_arena *a, upb_arena *root, void *ptr,
|
102
|
+
size_t size) {
|
121
103
|
mem_block *block = ptr;
|
122
|
-
upb_arena *root = arena_findroot(a);
|
123
104
|
|
124
105
|
/* The block is for arena |a|, but should appear in the freelist of |root|. */
|
125
106
|
block->next = root->freelist;
|
@@ -133,26 +114,22 @@ static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size) {
|
|
133
114
|
a->head.end = UPB_PTR_AT(block, size, char);
|
134
115
|
a->cleanups = &block->cleanups;
|
135
116
|
|
136
|
-
|
117
|
+
UPB_POISON_MEMORY_REGION(a->head.ptr, a->head.end - a->head.ptr);
|
137
118
|
}
|
138
119
|
|
139
120
|
static bool upb_arena_allocblock(upb_arena *a, size_t size) {
|
121
|
+
upb_arena *root = arena_findroot(a);
|
140
122
|
size_t block_size = UPB_MAX(size, a->last_size * 2) + memblock_reserve;
|
141
|
-
mem_block *block = upb_malloc(
|
123
|
+
mem_block *block = upb_malloc(root->block_alloc, block_size);
|
142
124
|
|
143
125
|
if (!block) return false;
|
144
|
-
upb_arena_addblock(a, block, block_size);
|
126
|
+
upb_arena_addblock(a, root, block, block_size);
|
145
127
|
return true;
|
146
128
|
}
|
147
129
|
|
148
|
-
static bool arena_has(upb_arena *a, size_t size) {
|
149
|
-
_upb_arena_head *h = (_upb_arena_head*)a;
|
150
|
-
return (size_t)(h->end - h->ptr) >= size;
|
151
|
-
}
|
152
|
-
|
153
130
|
void *_upb_arena_slowmalloc(upb_arena *a, size_t size) {
|
154
131
|
if (!upb_arena_allocblock(a, size)) return NULL; /* Out of memory. */
|
155
|
-
UPB_ASSERT(
|
132
|
+
UPB_ASSERT(_upb_arenahas(a) >= size);
|
156
133
|
return upb_arena_malloc(a, size);
|
157
134
|
}
|
158
135
|
|
@@ -184,7 +161,7 @@ upb_arena *arena_initslow(void *mem, size_t n, upb_alloc *alloc) {
|
|
184
161
|
a->freelist = NULL;
|
185
162
|
a->freelist_tail = NULL;
|
186
163
|
|
187
|
-
upb_arena_addblock(a, mem, n);
|
164
|
+
upb_arena_addblock(a, a, mem, n);
|
188
165
|
|
189
166
|
return a;
|
190
167
|
}
|
@@ -201,15 +178,14 @@ upb_arena *upb_arena_init(void *mem, size_t n, upb_alloc *alloc) {
|
|
201
178
|
}
|
202
179
|
|
203
180
|
a = UPB_PTR_AT(mem, n - sizeof(*a), upb_arena);
|
204
|
-
n -= sizeof(*a);
|
205
181
|
|
206
182
|
a->head.alloc.func = &upb_arena_doalloc;
|
207
183
|
a->block_alloc = alloc;
|
208
184
|
a->parent = a;
|
209
185
|
a->refcount = 1;
|
210
|
-
a->last_size = 128;
|
186
|
+
a->last_size = UPB_MAX(128, n);
|
211
187
|
a->head.ptr = mem;
|
212
|
-
a->head.end = UPB_PTR_AT(mem, n, char);
|
188
|
+
a->head.end = UPB_PTR_AT(mem, n - sizeof(*a), char);
|
213
189
|
a->freelist = NULL;
|
214
190
|
a->cleanups = NULL;
|
215
191
|
|
@@ -247,14 +223,15 @@ void upb_arena_free(upb_arena *a) {
|
|
247
223
|
bool upb_arena_addcleanup(upb_arena *a, void *ud, upb_cleanup_func *func) {
|
248
224
|
cleanup_ent *ent;
|
249
225
|
|
250
|
-
if (!a->cleanups ||
|
226
|
+
if (!a->cleanups || _upb_arenahas(a) < sizeof(cleanup_ent)) {
|
251
227
|
if (!upb_arena_allocblock(a, 128)) return false; /* Out of memory. */
|
252
|
-
UPB_ASSERT(
|
228
|
+
UPB_ASSERT(_upb_arenahas(a) >= sizeof(cleanup_ent));
|
253
229
|
}
|
254
230
|
|
255
231
|
a->head.end -= sizeof(cleanup_ent);
|
256
232
|
ent = (cleanup_ent*)a->head.end;
|
257
233
|
(*a->cleanups)++;
|
234
|
+
UPB_UNPOISON_MEMORY_REGION(ent, sizeof(cleanup_ent));
|
258
235
|
|
259
236
|
ent->cleanup = func;
|
260
237
|
ent->ud = ud;
|
data/third_party/upb/upb/upb.h
CHANGED
@@ -161,17 +161,35 @@ void *_upb_arena_slowmalloc(upb_arena *a, size_t size);
|
|
161
161
|
|
162
162
|
UPB_INLINE upb_alloc *upb_arena_alloc(upb_arena *a) { return (upb_alloc*)a; }
|
163
163
|
|
164
|
+
UPB_INLINE size_t _upb_arenahas(upb_arena *a) {
|
165
|
+
_upb_arena_head *h = (_upb_arena_head*)a;
|
166
|
+
return (size_t)(h->end - h->ptr);
|
167
|
+
}
|
168
|
+
|
164
169
|
UPB_INLINE void *upb_arena_malloc(upb_arena *a, size_t size) {
|
165
170
|
_upb_arena_head *h = (_upb_arena_head*)a;
|
166
171
|
void* ret;
|
167
172
|
size = UPB_ALIGN_MALLOC(size);
|
168
173
|
|
169
|
-
if (UPB_UNLIKELY((
|
174
|
+
if (UPB_UNLIKELY(_upb_arenahas(a) < size)) {
|
170
175
|
return _upb_arena_slowmalloc(a, size);
|
171
176
|
}
|
172
177
|
|
173
178
|
ret = h->ptr;
|
174
179
|
h->ptr += size;
|
180
|
+
UPB_UNPOISON_MEMORY_REGION(ret, size);
|
181
|
+
|
182
|
+
#if UPB_ASAN
|
183
|
+
{
|
184
|
+
size_t guard_size = 32;
|
185
|
+
if (_upb_arenahas(a) >= guard_size) {
|
186
|
+
h->ptr += guard_size;
|
187
|
+
} else {
|
188
|
+
h->ptr = h->end;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
#endif
|
192
|
+
|
175
193
|
return ret;
|
176
194
|
}
|
177
195
|
|
@@ -283,7 +301,7 @@ UPB_INLINE uint32_t _upb_be_swap32(uint32_t val) {
|
|
283
301
|
return val;
|
284
302
|
} else {
|
285
303
|
return ((val & 0xff) << 24) | ((val & 0xff00) << 8) |
|
286
|
-
((val &
|
304
|
+
((val & 0xff0000) >> 8) | ((val & 0xff000000) >> 24);
|
287
305
|
}
|
288
306
|
}
|
289
307
|
|
@@ -291,14 +309,25 @@ UPB_INLINE uint64_t _upb_be_swap64(uint64_t val) {
|
|
291
309
|
if (_upb_isle()) {
|
292
310
|
return val;
|
293
311
|
} else {
|
294
|
-
return ((val
|
295
|
-
((val & 0xff0000) << 24) | ((val & 0xff000000) << 8) |
|
296
|
-
((val & 0xff00000000ULL) >> 8) | ((val & 0xff0000000000ULL) >> 24) |
|
297
|
-
((val & 0xff000000000000ULL) >> 40) |
|
298
|
-
((val & 0xff00000000000000ULL) >> 56);
|
312
|
+
return ((uint64_t)_upb_be_swap32(val) << 32) | _upb_be_swap32(val >> 32);
|
299
313
|
}
|
300
314
|
}
|
301
315
|
|
316
|
+
UPB_INLINE int _upb_lg2ceil(int x) {
|
317
|
+
if (x <= 1) return 0;
|
318
|
+
#ifdef __GNUC__
|
319
|
+
return 32 - __builtin_clz(x - 1);
|
320
|
+
#else
|
321
|
+
int lg2 = 0;
|
322
|
+
while (1 << lg2 < x) lg2++;
|
323
|
+
return lg2;
|
324
|
+
#endif
|
325
|
+
}
|
326
|
+
|
327
|
+
UPB_INLINE int _upb_lg2ceilsize(int x) {
|
328
|
+
return 1 << _upb_lg2ceil(x);
|
329
|
+
}
|
330
|
+
|
302
331
|
#include "upb/port_undef.inc"
|
303
332
|
|
304
333
|
#ifdef __cplusplus
|
data/third_party/upb/upb/upb.hpp
CHANGED
@@ -41,6 +41,9 @@ class Arena {
|
|
41
41
|
public:
|
42
42
|
// A simple arena with no initial memory block and the default allocator.
|
43
43
|
Arena() : ptr_(upb_arena_new(), upb_arena_free) {}
|
44
|
+
Arena(char *initial_block, size_t size)
|
45
|
+
: ptr_(upb_arena_init(initial_block, size, &upb_alloc_global),
|
46
|
+
upb_arena_free) {}
|
44
47
|
|
45
48
|
upb_arena* ptr() { return ptr_.get(); }
|
46
49
|
|
@@ -71,15 +74,12 @@ class Arena {
|
|
71
74
|
template <int N>
|
72
75
|
class InlinedArena : public Arena {
|
73
76
|
public:
|
74
|
-
InlinedArena() :
|
75
|
-
|
76
|
-
upb_arena* ptr() { return ptr_.get(); }
|
77
|
+
InlinedArena() : Arena(initial_block_, N) {}
|
77
78
|
|
78
79
|
private:
|
79
80
|
InlinedArena(const InlinedArena*) = delete;
|
80
81
|
InlinedArena& operator=(const InlinedArena*) = delete;
|
81
82
|
|
82
|
-
std::unique_ptr<upb_arena, decltype(&upb_arena_free)> ptr_;
|
83
83
|
char initial_block_[N];
|
84
84
|
};
|
85
85
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
#ifndef UPB_INT_H_
|
3
|
+
#define UPB_INT_H_
|
4
|
+
|
5
|
+
#include "upb/upb.h"
|
6
|
+
|
7
|
+
struct mem_block;
|
8
|
+
typedef struct mem_block mem_block;
|
9
|
+
|
10
|
+
struct upb_arena {
|
11
|
+
_upb_arena_head head;
|
12
|
+
uint32_t *cleanups;
|
13
|
+
|
14
|
+
/* Allocator to allocate arena blocks. We are responsible for freeing these
|
15
|
+
* when we are destroyed. */
|
16
|
+
upb_alloc *block_alloc;
|
17
|
+
uint32_t last_size;
|
18
|
+
|
19
|
+
/* When multiple arenas are fused together, each arena points to a parent
|
20
|
+
* arena (root points to itself). The root tracks how many live arenas
|
21
|
+
* reference it. */
|
22
|
+
uint32_t refcount; /* Only used when a->parent == a */
|
23
|
+
struct upb_arena *parent;
|
24
|
+
|
25
|
+
/* Linked list of blocks to free/cleanup. */
|
26
|
+
mem_block *freelist, *freelist_tail;
|
27
|
+
};
|
28
|
+
|
29
|
+
#endif /* UPB_INT_H_ */
|