From 09b42371e7f8ff992bf82d353bf269c8d6411f6f Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 23 Apr 2020 11:24:41 -0700 Subject: [PATCH] Remove grpc_core::InlinedVector<> and grpc_core::Optional<>. --- BUILD | 36 ++----------- BUILD.gn | 2 - CMakeLists.txt | 39 --------------- Makefile | 48 ------------------ build_autogenerated.yaml | 17 ------- gRPC-C++.podspec | 4 -- gRPC-Core.podspec | 4 -- grpc.gemspec | 2 - package.xml | 2 - .../filters/client_channel/client_channel.cc | 8 +-- .../client_channel/lb_policy/grpclb/grpclb.cc | 8 +-- .../lb_policy/grpclb/grpclb_channel_secure.cc | 6 ++- .../lb_policy/grpclb/grpclb_client_stats.h | 5 +- .../lb_policy/round_robin/round_robin.cc | 2 +- .../lb_policy/subchannel_list.h | 7 +-- .../weighted_target/weighted_target.cc | 6 +-- .../client_channel/lb_policy_registry.cc | 6 ++- .../resolver/dns/c_ares/dns_resolver_ares.cc | 6 ++- .../resolver/dns/c_ares/grpc_ares_wrapper.cc | 4 +- .../client_channel/resolver_registry.cc | 4 +- .../client_channel/resolver_registry.h | 1 - .../client_channel/resolver_result_parsing.cc | 8 +-- .../client_channel/resolver_result_parsing.h | 15 +++--- .../client_channel/resolving_lb_policy.cc | 1 - .../client_channel/resolving_lb_policy.h | 5 +- .../filters/client_channel/server_address.h | 5 +- .../filters/client_channel/service_config.cc | 6 +-- .../filters/client_channel/service_config.h | 10 ++-- .../ext/filters/client_channel/xds/xds_api.cc | 1 - .../ext/filters/client_channel/xds/xds_api.h | 5 +- .../client_channel/xds/xds_bootstrap.cc | 16 +++--- .../client_channel/xds/xds_bootstrap.h | 7 +-- .../client_channel/xds/xds_channel_secure.cc | 6 ++- .../filters/client_channel/xds/xds_client.cc | 3 +- .../client_channel/xds/xds_client_stats.h | 1 - src/core/lib/channel/channelz.h | 5 +- src/core/lib/channel/channelz_registry.cc | 8 +-- src/core/lib/channel/handshaker.h | 6 ++- src/core/lib/channel/handshaker_registry.cc | 5 +- src/core/lib/gprpp/inlined_vector.h | 37 -------------- src/core/lib/gprpp/optional.h | 33 ------------ src/core/lib/iomgr/buffer_list.h | 43 ++++++++-------- src/core/lib/iomgr/call_combiner.h | 5 +- src/core/lib/iomgr/error.h | 1 - src/core/lib/iomgr/udp_server.cc | 5 +- .../composite/composite_credentials.h | 6 +-- .../credentials/oauth2/oauth2_credentials.cc | 5 +- .../tls/grpc_tls_credentials_options.h | 6 +-- .../load_system_roots_linux.cc | 5 +- src/cpp/common/tls_credentials_options.cc | 7 ++- .../common/tls_credentials_options_util.cc | 6 ++- .../resolvers/fake_resolver_test.cc | 2 +- test/core/end2end/fixtures/h2_tls.cc | 5 +- test/core/gprpp/BUILD | 13 ----- test/core/gprpp/optional_test.cc | 50 ------------------- test/cpp/client/credentials_test.cc | 7 ++- tools/doxygen/Doxyfile.c++.internal | 2 - tools/doxygen/Doxyfile.core.internal | 2 - tools/run_tests/generated/tests.json | 24 --------- 59 files changed, 165 insertions(+), 429 deletions(-) delete mode 100644 src/core/lib/gprpp/inlined_vector.h delete mode 100644 src/core/lib/gprpp/optional.h delete mode 100644 test/core/gprpp/optional_test.cc diff --git a/BUILD b/BUILD index 7fcd4a55f5d..91cd3488408 100644 --- a/BUILD +++ b/BUILD @@ -618,40 +618,12 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "inlined_vector", - external_deps = [ - "absl/container:inlined_vector", - ], - language = "c++", - public_hdrs = [ - "src/core/lib/gprpp/inlined_vector.h", - ], - deps = [ - "gpr_base", - ], -) - grpc_cc_library( name = "debug_location", language = "c++", public_hdrs = ["src/core/lib/gprpp/debug_location.h"], ) -grpc_cc_library( - name = "optional", - external_deps = [ - "absl/types:optional", - ], - language = "c++", - public_hdrs = [ - "src/core/lib/gprpp/optional.h", - ], - deps = [ - "gpr_base", - ], -) - grpc_cc_library( name = "orphanable", language = "c++", @@ -990,6 +962,8 @@ grpc_cc_library( ], external_deps = [ "madler_zlib", + "absl/container:inlined_vector", + "absl/types:optional", ], language = "c++", public_hdrs = GRPC_PUBLIC_HDRS, @@ -998,8 +972,6 @@ grpc_cc_library( "gpr_base", "grpc_codegen", "grpc_trace", - "inlined_vector", - "optional", "orphanable", "ref_counted", "ref_counted_ptr", @@ -1107,6 +1079,9 @@ grpc_cc_library( "src/core/ext/filters/client_channel/subchannel_interface.h", "src/core/ext/filters/client_channel/subchannel_pool_interface.h", ], + external_deps = [ + "absl/container:inlined_vector", + ], language = "c++", deps = [ "gpr_base", @@ -1114,7 +1089,6 @@ grpc_cc_library( "grpc_client_authority_filter", "grpc_deadline_filter", "grpc_health_upb", - "inlined_vector", "orphanable", "ref_counted", "ref_counted_ptr", diff --git a/BUILD.gn b/BUILD.gn index 6c3db9ac4b7..9ec801e373c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -570,8 +570,6 @@ config("grpc_config") { "src/core/lib/debug/trace.h", "src/core/lib/gprpp/atomic.h", "src/core/lib/gprpp/debug_location.h", - "src/core/lib/gprpp/inlined_vector.h", - "src/core/lib/gprpp/optional.h", "src/core/lib/gprpp/orphanable.h", "src/core/lib/gprpp/ref_counted.h", "src/core/lib/gprpp/ref_counted_ptr.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 17ed31d4910..a82784d07db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -756,7 +756,6 @@ if(gRPC_BUILD_TESTS) add_dependencies(buildtests_cxx mock_test) add_dependencies(buildtests_cxx nonblocking_test) add_dependencies(buildtests_cxx noop-benchmark) - add_dependencies(buildtests_cxx optional_test) add_dependencies(buildtests_cxx orphanable_test) add_dependencies(buildtests_cxx out_of_bounds_bad_client_test) add_dependencies(buildtests_cxx pid_controller_test) @@ -12166,44 +12165,6 @@ target_link_libraries(noop-benchmark ) -endif() -if(gRPC_BUILD_TESTS) - -add_executable(optional_test - test/core/gprpp/optional_test.cc - third_party/googletest/googletest/src/gtest-all.cc - third_party/googletest/googlemock/src/gmock-all.cc -) - -target_include_directories(optional_test - PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR} - ${_gRPC_SSL_INCLUDE_DIR} - ${_gRPC_UPB_GENERATED_DIR} - ${_gRPC_UPB_GRPC_GENERATED_DIR} - ${_gRPC_UPB_INCLUDE_DIR} - ${_gRPC_ZLIB_INCLUDE_DIR} - third_party/googletest/googletest/include - third_party/googletest/googletest - third_party/googletest/googlemock/include - third_party/googletest/googlemock - ${_gRPC_PROTO_GENS_DIR} -) - -target_link_libraries(optional_test - ${_gRPC_PROTOBUF_LIBRARIES} - ${_gRPC_ALLTARGETS_LIBRARIES} - grpc_test_util - grpc - gpr - address_sorting - upb - ${_gRPC_GFLAGS_LIBRARIES} -) - - endif() if(gRPC_BUILD_TESTS) diff --git a/Makefile b/Makefile index 883745259c5..1ccc7e99fd5 100644 --- a/Makefile +++ b/Makefile @@ -1251,7 +1251,6 @@ nanopb_fuzzer_response_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_response_test nanopb_fuzzer_serverlist_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test nonblocking_test: $(BINDIR)/$(CONFIG)/nonblocking_test noop-benchmark: $(BINDIR)/$(CONFIG)/noop-benchmark -optional_test: $(BINDIR)/$(CONFIG)/optional_test orphanable_test: $(BINDIR)/$(CONFIG)/orphanable_test out_of_bounds_bad_client_test: $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer @@ -1616,7 +1615,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/nonblocking_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ - $(BINDIR)/$(CONFIG)/optional_test \ $(BINDIR)/$(CONFIG)/orphanable_test \ $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \ $(BINDIR)/$(CONFIG)/pid_controller_test \ @@ -1774,7 +1772,6 @@ buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/mock_test \ $(BINDIR)/$(CONFIG)/nonblocking_test \ $(BINDIR)/$(CONFIG)/noop-benchmark \ - $(BINDIR)/$(CONFIG)/optional_test \ $(BINDIR)/$(CONFIG)/orphanable_test \ $(BINDIR)/$(CONFIG)/out_of_bounds_bad_client_test \ $(BINDIR)/$(CONFIG)/pid_controller_test \ @@ -2276,8 +2273,6 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/nonblocking_test || ( echo test nonblocking_test failed ; exit 1 ) $(E) "[RUN] Testing noop-benchmark" $(Q) $(BINDIR)/$(CONFIG)/noop-benchmark || ( echo test noop-benchmark failed ; exit 1 ) - $(E) "[RUN] Testing optional_test" - $(Q) $(BINDIR)/$(CONFIG)/optional_test || ( echo test optional_test failed ; exit 1 ) $(E) "[RUN] Testing orphanable_test" $(Q) $(BINDIR)/$(CONFIG)/orphanable_test || ( echo test orphanable_test failed ; exit 1 ) $(E) "[RUN] Testing out_of_bounds_bad_client_test" @@ -16213,49 +16208,6 @@ endif endif -OPTIONAL_TEST_SRC = \ - test/core/gprpp/optional_test.cc \ - -OPTIONAL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(OPTIONAL_TEST_SRC)))) -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL. - -$(BINDIR)/$(CONFIG)/optional_test: openssl_dep_error - -else - - - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+. - -$(BINDIR)/$(CONFIG)/optional_test: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/optional_test: $(PROTOBUF_DEP) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(OPTIONAL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/optional_test - -endif - -endif - -$(OBJDIR)/$(CONFIG)/test/core/gprpp/optional_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libaddress_sorting.a $(LIBDIR)/$(CONFIG)/libupb.a - -deps_optional_test: $(OPTIONAL_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(OPTIONAL_TEST_OBJS:.o=.dep) -endif -endif - - ORPHANABLE_TEST_SRC = \ test/core/gprpp/orphanable_test.cc \ diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index ca226638154..d01ff14cc58 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -548,8 +548,6 @@ libs: - src/core/lib/debug/trace.h - src/core/lib/gprpp/atomic.h - src/core/lib/gprpp/debug_location.h - - src/core/lib/gprpp/inlined_vector.h - - src/core/lib/gprpp/optional.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -1451,8 +1449,6 @@ libs: - src/core/lib/debug/trace.h - src/core/lib/gprpp/atomic.h - src/core/lib/gprpp/debug_location.h - - src/core/lib/gprpp/inlined_vector.h - - src/core/lib/gprpp/optional.h - src/core/lib/gprpp/orphanable.h - src/core/lib/gprpp/ref_counted.h - src/core/lib/gprpp/ref_counted_ptr.h @@ -6538,19 +6534,6 @@ targets: - benchmark benchmark: true defaults: benchmark -- name: optional_test - gtest: true - build: test - language: c++ - headers: [] - src: - - test/core/gprpp/optional_test.cc - deps: - - grpc_test_util - - grpc - - gpr - - address_sorting - - upb - name: orphanable_test gtest: true build: test diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 612090f465c..77e015d1d97 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -418,12 +418,10 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', @@ -870,12 +868,10 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b2595ac1ce4..a9c11d7d933 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -610,13 +610,11 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.cc', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.cc', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', @@ -1226,12 +1224,10 @@ Pod::Spec.new do |s| 'src/core/lib/gprpp/global_config_env.h', 'src/core/lib/gprpp/global_config_generic.h', 'src/core/lib/gprpp/host_port.h', - 'src/core/lib/gprpp/inlined_vector.h', 'src/core/lib/gprpp/manual_constructor.h', 'src/core/lib/gprpp/map.h', 'src/core/lib/gprpp/memory.h', 'src/core/lib/gprpp/mpscq.h', - 'src/core/lib/gprpp/optional.h', 'src/core/lib/gprpp/orphanable.h', 'src/core/lib/gprpp/ref_counted.h', 'src/core/lib/gprpp/ref_counted_ptr.h', diff --git a/grpc.gemspec b/grpc.gemspec index c6faf7095f6..7042206375a 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -532,13 +532,11 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gprpp/global_config_generic.h ) s.files += %w( src/core/lib/gprpp/host_port.cc ) s.files += %w( src/core/lib/gprpp/host_port.h ) - s.files += %w( src/core/lib/gprpp/inlined_vector.h ) s.files += %w( src/core/lib/gprpp/manual_constructor.h ) s.files += %w( src/core/lib/gprpp/map.h ) s.files += %w( src/core/lib/gprpp/memory.h ) s.files += %w( src/core/lib/gprpp/mpscq.cc ) s.files += %w( src/core/lib/gprpp/mpscq.h ) - s.files += %w( src/core/lib/gprpp/optional.h ) s.files += %w( src/core/lib/gprpp/orphanable.h ) s.files += %w( src/core/lib/gprpp/ref_counted.h ) s.files += %w( src/core/lib/gprpp/ref_counted_ptr.h ) diff --git a/package.xml b/package.xml index adc859441ee..862ea4f566c 100644 --- a/package.xml +++ b/package.xml @@ -512,13 +512,11 @@ - - diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index aea8e00a501..a00bdd6fdb6 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -33,6 +33,9 @@ #include #include +#include "absl/container/inlined_vector.h" +#include "absl/types/optional.h" + #include "src/core/ext/filters/client_channel/backend_metric.h" #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/ext/filters/client_channel/global_subchannel_pool.h" @@ -52,7 +55,6 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/sync.h" @@ -827,7 +829,7 @@ class CallData { // Note: We inline the cache for the first 3 send_message ops and use // dynamic allocation after that. This number was essentially picked // at random; it could be changed in the future to tune performance. - InlinedVector send_messages_; + absl::InlinedVector send_messages_; // send_trailing_metadata bool seen_send_trailing_metadata_ = false; grpc_linked_mdelem* send_trailing_metadata_storage_ = nullptr; @@ -1726,7 +1728,7 @@ bool ChannelData::ProcessResolverResultLocked( chand->received_first_resolver_result_ = true; RefCountedPtr retry_throttle_data; if (parsed_service_config != nullptr) { - Optional + absl::optional retry_throttle_config = parsed_service_config->retry_throttling(); if (retry_throttle_config.has_value()) { retry_throttle_data = diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 9f30e76c9a1..5a7a3840fa7 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -64,6 +64,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -555,7 +557,7 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList( lb_token[0] = '\0'; } // Add address. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; args_to_add.emplace_back(grpc_channel_arg_pointer_create( const_cast(GRPC_ARG_GRPCLB_ADDRESS_LB_TOKEN), lb_token, &lb_token_arg_vtable)); @@ -1273,7 +1275,7 @@ grpc_channel_args* BuildBalancerChannelArgs( GRPC_ARG_CHANNELZ_CHANNEL_NODE, }; // Channel args to add. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; // The fake resolver response generator, which we use to inject // address updates into the LB channel. args_to_add.emplace_back( @@ -1595,7 +1597,7 @@ void GrpcLb::OnFallbackTimerLocked(grpc_error* error) { grpc_channel_args* GrpcLb::CreateChildPolicyArgsLocked( bool is_backend_from_grpclb_load_balancer) { - InlinedVector args_to_add; + absl::InlinedVector args_to_add; args_to_add.emplace_back(grpc_channel_arg_integer_create( const_cast(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER), is_backend_from_grpclb_load_balancer)); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc index 414f8274317..92cf17ac751 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -71,8 +73,8 @@ RefCountedPtr CreateTargetAuthorityTable( grpc_channel_args* ModifyGrpclbBalancerChannelArgs( const ServerAddressList& addresses, grpc_channel_args* args) { - InlinedVector args_to_remove; - InlinedVector args_to_add; + absl::InlinedVector args_to_remove; + absl::InlinedVector args_to_add; // Add arg for targets info table. RefCountedPtr target_authority_table = CreateTargetAuthorityTable(addresses); diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h index 4b1c0046bf0..f6e9440d3ee 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" @@ -40,7 +41,7 @@ class GrpcLbClientStats : public RefCounted { : token(std::move(token)), count(count) {} }; - typedef InlinedVector DroppedCallCounts; + typedef absl::InlinedVector DroppedCallCounts; void AddCallStarted(); void AddCallFinished(bool finished_with_client_failed_to_send, diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index a5ab488ec55..56b71b69dfc 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -160,7 +160,7 @@ class RoundRobin : public LoadBalancingPolicy { RoundRobin* parent_; size_t last_picked_index_; - InlinedVector, 10> subchannels_; + absl::InlinedVector, 10> subchannels_; }; void ShutdownLocked() override; diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h index 0fa4871b707..93c5deb7957 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h @@ -25,6 +25,8 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/ext/filters/client_channel/lb_policy_registry.h" #include "src/core/ext/filters/client_channel/server_address.h" // TODO(roth): Should not need the include of subchannel.h here, since @@ -33,7 +35,6 @@ #include "src/core/ext/filters/client_channel/subchannel_interface.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -172,7 +173,7 @@ class SubchannelData { template class SubchannelList : public InternallyRefCounted { public: - typedef InlinedVector SubchannelVector; + typedef absl::InlinedVector SubchannelVector; // The number of subchannels in the list. size_t num_subchannels() const { return subchannels_.size(); } @@ -370,7 +371,7 @@ SubchannelList::SubchannelList( GRPC_ARG_SERVICE_CONFIG}; // Create a subchannel for each address. for (size_t i = 0; i < addresses.size(); i++) { - InlinedVector args_to_add; + absl::InlinedVector args_to_add; const size_t subchannel_address_arg_index = args_to_add.size(); args_to_add.emplace_back( Subchannel::CreateSubchannelAddressArg(&addresses[i].address())); diff --git a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc index 09e72ae72e0..b1dbe3b5694 100644 --- a/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +++ b/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/container/inlined_vector.h" #include "absl/strings/str_cat.h" #include @@ -99,9 +100,8 @@ class WeightedTargetLb : public LoadBalancingPolicy { // ready state. The first element in the pair represents the end of a // range proportional to the child's weight. The start of the range // is the previous value in the vector and is 0 for the first element. - using PickerList = - InlinedVector>, - 1>; + using PickerList = absl::InlinedVector< + std::pair>, 1>; explicit WeightedPicker(PickerList pickers) : pickers_(std::move(pickers)) {} diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc index 498b158900e..806d6b3d8b4 100644 --- a/src/core/ext/filters/client_channel/lb_policy_registry.cc +++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc @@ -22,8 +22,9 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" namespace grpc_core { @@ -54,7 +55,8 @@ class RegistryState { } private: - InlinedVector, 10> factories_; + absl::InlinedVector, 10> + factories_; }; RegistryState* g_state = nullptr; diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index de49ac76f6d..781941bdbb8 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include @@ -249,7 +251,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json, return ""; } const Json* service_config = nullptr; - InlinedVector error_list; + absl::InlinedVector error_list; for (const Json& choice : json.array_value()) { if (choice.type() != Json::Type::OBJECT) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -352,7 +354,7 @@ void AresDnsResolver::OnResolvedLocked(grpc_error* error) { service_config_string, &result.service_config_error); } } - InlinedVector new_args; + absl::InlinedVector new_args; if (balancer_addresses_ != nullptr) { new_args.push_back( CreateGrpclbBalancerAddressesArg(balancer_addresses_.get())); diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc index 54c60072654..32784b0eded 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc @@ -26,6 +26,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -200,7 +202,7 @@ static void on_hostbyname_done_locked(void* arg, int status, int /*timeouts*/, } ServerAddressList& addresses = **address_list_ptr; for (size_t i = 0; hostent->h_addr_list[i] != nullptr; ++i) { - grpc_core::InlinedVector args_to_add; + absl::InlinedVector args_to_add; if (hr->is_balancer) { args_to_add.emplace_back( grpc_core::CreateGrpclbBalancerNameArg(hr->host)); diff --git a/src/core/ext/filters/client_channel/resolver_registry.cc b/src/core/ext/filters/client_channel/resolver_registry.cc index 718556a4c2a..c7f78389ac8 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.cc +++ b/src/core/ext/filters/client_channel/resolver_registry.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -90,7 +92,7 @@ class RegistryState { // more factories are needed and the additional allocations are // hurting performance (which is unlikely, since these allocations // only occur at gRPC initialization time). - InlinedVector, 10> factories_; + absl::InlinedVector, 10> factories_; grpc_core::UniquePtr default_prefix_; }; diff --git a/src/core/ext/filters/client_channel/resolver_registry.h b/src/core/ext/filters/client_channel/resolver_registry.h index 82025065494..bf34216b2cf 100644 --- a/src/core/ext/filters/client_channel/resolver_registry.h +++ b/src/core/ext/filters/client_channel/resolver_registry.h @@ -22,7 +22,6 @@ #include #include "src/core/ext/filters/client_channel/resolver_factory.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/iomgr/pollset_set.h" diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.cc b/src/core/ext/filters/client_channel/resolver_result_parsing.cc index d87890d1c97..77ee5fad3cd 100644 --- a/src/core/ext/filters/client_channel/resolver_result_parsing.cc +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.cc @@ -24,6 +24,8 @@ #include #include +#include "absl/types/optional.h" + #include #include #include @@ -35,7 +37,6 @@ #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/uri/uri_parser.h" // As per the retry design, we do not allow more than 5 retry attempts. @@ -318,7 +319,8 @@ ClientChannelServiceConfigParser::ParseGlobalParams(const Json& json, std::vector error_list; RefCountedPtr parsed_lb_config; std::string lb_policy_name; - Optional retry_throttling; + absl::optional + retry_throttling; const char* health_check_service_name = nullptr; // Parse LB config. auto it = json.object_value().find("loadBalancingConfig"); @@ -396,7 +398,7 @@ ClientChannelServiceConfigParser::ParsePerMethodParams(const Json& json, grpc_error** error) { GPR_DEBUG_ASSERT(error != nullptr && *error == GRPC_ERROR_NONE); std::vector error_list; - Optional wait_for_ready; + absl::optional wait_for_ready; grpc_millis timeout = 0; std::unique_ptr retry_policy; // Parse waitForReady. diff --git a/src/core/ext/filters/client_channel/resolver_result_parsing.h b/src/core/ext/filters/client_channel/resolver_result_parsing.h index 1f928cfd551..b38ae730708 100644 --- a/src/core/ext/filters/client_channel/resolver_result_parsing.h +++ b/src/core/ext/filters/client_channel/resolver_result_parsing.h @@ -21,13 +21,14 @@ #include +#include "absl/types/optional.h" + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/ext/filters/client_channel/retry_throttle.h" #include "src/core/ext/filters/client_channel/service_config.h" #include "src/core/lib/channel/status_util.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/exec_ctx.h" // for grpc_millis @@ -47,14 +48,14 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig { ClientChannelGlobalParsedConfig( RefCountedPtr parsed_lb_config, std::string parsed_deprecated_lb_policy, - const Optional& retry_throttling, + const absl::optional& retry_throttling, const char* health_check_service_name) : parsed_lb_config_(std::move(parsed_lb_config)), parsed_deprecated_lb_policy_(std::move(parsed_deprecated_lb_policy)), retry_throttling_(retry_throttling), health_check_service_name_(health_check_service_name) {} - Optional retry_throttling() const { + absl::optional retry_throttling() const { return retry_throttling_; } @@ -73,7 +74,7 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig { private: RefCountedPtr parsed_lb_config_; std::string parsed_deprecated_lb_policy_; - Optional retry_throttling_; + absl::optional retry_throttling_; const char* health_check_service_name_; }; @@ -88,7 +89,7 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig { }; ClientChannelMethodParsedConfig(grpc_millis timeout, - const Optional& wait_for_ready, + const absl::optional& wait_for_ready, std::unique_ptr retry_policy) : timeout_(timeout), wait_for_ready_(wait_for_ready), @@ -96,13 +97,13 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig { grpc_millis timeout() const { return timeout_; } - Optional wait_for_ready() const { return wait_for_ready_; } + absl::optional wait_for_ready() const { return wait_for_ready_; } const RetryPolicy* retry_policy() const { return retry_policy_.get(); } private: grpc_millis timeout_ = 0; - Optional wait_for_ready_; + absl::optional wait_for_ready_; std::unique_ptr retry_policy_; }; diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.cc b/src/core/ext/filters/client_channel/resolving_lb_policy.cc index 851c2f20e9a..f0c29ec0183 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.cc +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.cc @@ -47,7 +47,6 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/status_util.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/iomgr.h" diff --git a/src/core/ext/filters/client_channel/resolving_lb_policy.h b/src/core/ext/filters/client_channel/resolving_lb_policy.h index ba53368f219..8a04491424f 100644 --- a/src/core/ext/filters/client_channel/resolving_lb_policy.h +++ b/src/core/ext/filters/client_channel/resolving_lb_policy.h @@ -21,13 +21,14 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/ext/filters/client_channel/lb_policy.h" #include "src/core/ext/filters/client_channel/lb_policy_factory.h" #include "src/core/ext/filters/client_channel/resolver.h" #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/orphanable.h" #include "src/core/lib/iomgr/call_combiner.h" #include "src/core/lib/iomgr/closure.h" @@ -80,7 +81,7 @@ class ResolvingLoadBalancingPolicy : public LoadBalancingPolicy { void ResetBackoffLocked() override; private: - using TraceStringVector = InlinedVector; + using TraceStringVector = absl::InlinedVector; class ResolverResultHandler; class ResolvingControlHelper; diff --git a/src/core/ext/filters/client_channel/server_address.h b/src/core/ext/filters/client_channel/server_address.h index 10f49f2f344..f53dd3c7dd5 100644 --- a/src/core/ext/filters/client_channel/server_address.h +++ b/src/core/ext/filters/client_channel/server_address.h @@ -21,8 +21,9 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/resolve_address.h" namespace grpc_core { @@ -82,7 +83,7 @@ class ServerAddress { // ServerAddressList // -typedef InlinedVector ServerAddressList; +typedef absl::InlinedVector ServerAddressList; } // namespace grpc_core diff --git a/src/core/ext/filters/client_channel/service_config.cc b/src/core/ext/filters/client_channel/service_config.cc index f08ebe1a37d..04ef477204b 100644 --- a/src/core/ext/filters/client_channel/service_config.cc +++ b/src/core/ext/filters/client_channel/service_config.cc @@ -34,8 +34,8 @@ namespace grpc_core { namespace { -typedef InlinedVector, - ServiceConfig::kNumPreallocatedParsers> +typedef absl::InlinedVector, + ServiceConfig::kNumPreallocatedParsers> ServiceConfigParserList; ServiceConfigParserList* g_registered_parsers; } // namespace @@ -100,7 +100,7 @@ grpc_error* ServiceConfig::ParseGlobalParams() { grpc_error* ServiceConfig::ParseJsonMethodConfig(const Json& json) { // Parse method config with each registered parser. auto objs_vector = absl::make_unique(); - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < g_registered_parsers->size(); i++) { grpc_error* parser_error = GRPC_ERROR_NONE; auto parsed_obj = diff --git a/src/core/ext/filters/client_channel/service_config.h b/src/core/ext/filters/client_channel/service_config.h index 3bba4ec1010..73157db50d3 100644 --- a/src/core/ext/filters/client_channel/service_config.h +++ b/src/core/ext/filters/client_channel/service_config.h @@ -21,10 +21,11 @@ #include +#include "absl/container/inlined_vector.h" + #include #include -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" @@ -89,7 +90,8 @@ class ServiceConfig : public RefCounted { }; static constexpr int kNumPreallocatedParsers = 4; - typedef InlinedVector, kNumPreallocatedParsers> + typedef absl::InlinedVector, + kNumPreallocatedParsers> ParsedConfigVector; /// When a service config is applied to a call in the client_channel_filter, @@ -175,7 +177,7 @@ class ServiceConfig : public RefCounted { std::string json_string_; Json json_; - InlinedVector, kNumPreallocatedParsers> + absl::InlinedVector, kNumPreallocatedParsers> parsed_global_configs_; // A map from the method name to the parsed config vector. Note that we are // using a raw pointer and not a unique pointer so that we can use the same @@ -186,7 +188,7 @@ class ServiceConfig : public RefCounted { const ParsedConfigVector* default_method_config_vector_ = nullptr; // Storage for all the vectors that are being used in // parsed_method_configs_table_. - InlinedVector, 32> + absl::InlinedVector, 32> parsed_method_config_vectors_storage_; }; diff --git a/src/core/ext/filters/client_channel/xds/xds_api.cc b/src/core/ext/filters/client_channel/xds/xds_api.cc index 4be62a33cd0..08ba9f925a0 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.cc +++ b/src/core/ext/filters/client_channel/xds/xds_api.cc @@ -31,7 +31,6 @@ #include #include "src/core/ext/filters/client_channel/xds/xds_api.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/sockaddr_utils.h" diff --git a/src/core/ext/filters/client_channel/xds/xds_api.h b/src/core/ext/filters/client_channel/xds/xds_api.h index 9bd74c777f7..9117466fe84 100644 --- a/src/core/ext/filters/client_channel/xds/xds_api.h +++ b/src/core/ext/filters/client_channel/xds/xds_api.h @@ -25,6 +25,7 @@ #include +#include "absl/container/inlined_vector.h" #include "absl/types/optional.h" #include @@ -150,7 +151,7 @@ class XdsApi { } private: - InlinedVector priorities_; + absl::InlinedVector priorities_; }; // There are two phases of accessing this class's content: @@ -169,7 +170,7 @@ class XdsApi { const uint32_t parts_per_million; }; - using DropCategoryList = InlinedVector; + using DropCategoryList = absl::InlinedVector; void AddCategory(std::string name, uint32_t parts_per_million) { drop_category_list_.emplace_back( diff --git a/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc b/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc index 6a641714912..9caee17a852 100644 --- a/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc +++ b/src/core/ext/filters/client_channel/xds/xds_bootstrap.cc @@ -18,6 +18,8 @@ #include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h" +#include + #include #include @@ -128,7 +130,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { "malformed JSON in bootstrap file"); return; } - InlinedVector error_list; + std::vector error_list; auto it = json.mutable_object()->find("xds_servers"); if (it == json.mutable_object()->end()) { error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -155,7 +157,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) { } grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) { - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < json->mutable_array()->size(); ++i) { Json& child = json->mutable_array()->at(i); if (child.type() != Json::Type::OBJECT) { @@ -173,7 +175,7 @@ grpc_error* XdsBootstrap::ParseXdsServerList(Json* json) { } grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) { - InlinedVector error_list; + std::vector error_list; servers_.emplace_back(); XdsServer& server = servers_[servers_.size() - 1]; auto it = json->mutable_object()->find("server_uri"); @@ -211,7 +213,7 @@ grpc_error* XdsBootstrap::ParseXdsServer(Json* json, size_t idx) { grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json, XdsServer* server) { - InlinedVector error_list; + std::vector error_list; for (size_t i = 0; i < json->mutable_array()->size(); ++i) { Json& child = json->mutable_array()->at(i); if (child.type() != Json::Type::OBJECT) { @@ -230,7 +232,7 @@ grpc_error* XdsBootstrap::ParseChannelCredsArray(Json* json, grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx, XdsServer* server) { - InlinedVector error_list; + std::vector error_list; ChannelCreds channel_creds; auto it = json->mutable_object()->find("type"); if (it == json->mutable_object()->end()) { @@ -268,7 +270,7 @@ grpc_error* XdsBootstrap::ParseChannelCreds(Json* json, size_t idx, } grpc_error* XdsBootstrap::ParseNode(Json* json) { - InlinedVector error_list; + std::vector error_list; node_ = absl::make_unique(); auto it = json->mutable_object()->find("id"); if (it != json->mutable_object()->end()) { @@ -312,7 +314,7 @@ grpc_error* XdsBootstrap::ParseNode(Json* json) { } grpc_error* XdsBootstrap::ParseLocality(Json* json) { - InlinedVector error_list; + std::vector error_list; auto it = json->mutable_object()->find("region"); if (it != json->mutable_object()->end()) { if (it->second.type() != Json::Type::STRING) { diff --git a/src/core/ext/filters/client_channel/xds/xds_bootstrap.h b/src/core/ext/filters/client_channel/xds/xds_bootstrap.h index d3b04ad922f..13eff49f575 100644 --- a/src/core/ext/filters/client_channel/xds/xds_bootstrap.h +++ b/src/core/ext/filters/client_channel/xds/xds_bootstrap.h @@ -23,9 +23,10 @@ #include #include +#include "absl/container/inlined_vector.h" + #include -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/error.h" @@ -53,7 +54,7 @@ class XdsBootstrap { struct XdsServer { std::string server_uri; - InlinedVector channel_creds; + absl::InlinedVector channel_creds; }; // If *error is not GRPC_ERROR_NONE after returning, then there was an @@ -78,7 +79,7 @@ class XdsBootstrap { grpc_error* ParseNode(Json* json); grpc_error* ParseLocality(Json* json); - InlinedVector servers_; + absl::InlinedVector servers_; std::unique_ptr node_; }; diff --git a/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc b/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc index 52d226ce74b..c218db86a17 100644 --- a/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc +++ b/src/core/ext/filters/client_channel/xds/xds_channel_secure.cc @@ -22,6 +22,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -39,8 +41,8 @@ namespace grpc_core { grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) { - InlinedVector args_to_remove; - InlinedVector args_to_add; + absl::InlinedVector args_to_remove; + absl::InlinedVector args_to_add; // Substitute the channel credentials with a version without call // credentials: the load balancer is not necessarily trusted to handle // bearer token credentials. diff --git a/src/core/ext/filters/client_channel/xds/xds_client.cc b/src/core/ext/filters/client_channel/xds/xds_client.cc index 9a0e566e1e4..9dc7b97773c 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client.cc +++ b/src/core/ext/filters/client_channel/xds/xds_client.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/container/inlined_vector.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" @@ -447,7 +448,7 @@ grpc_channel_args* BuildXdsChannelArgs(const grpc_channel_args& args) { GRPC_ARG_KEEPALIVE_TIME_MS, }; // Channel args to add. - InlinedVector args_to_add; + absl::InlinedVector args_to_add; // Keepalive interval. args_to_add.emplace_back(grpc_channel_arg_integer_create( const_cast(GRPC_ARG_KEEPALIVE_TIME_MS), 5000)); diff --git a/src/core/ext/filters/client_channel/xds/xds_client_stats.h b/src/core/ext/filters/client_channel/xds/xds_client_stats.h index cbeccd2279d..7a358d47b91 100644 --- a/src/core/ext/filters/client_channel/xds/xds_client_stats.h +++ b/src/core/ext/filters/client_channel/xds/xds_client_stats.h @@ -24,7 +24,6 @@ #include #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h index 73a9b57a45c..63502030966 100644 --- a/src/core/lib/channel/channelz.h +++ b/src/core/lib/channel/channelz.h @@ -25,10 +25,11 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/gpr/time_precise.h" #include "src/core/lib/gprpp/atomic.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/gprpp/map.h" #include "src/core/lib/gprpp/ref_counted.h" @@ -167,7 +168,7 @@ class CallCountingHelper { void CollectData(CounterData* out); // Really zero-sized, but 0-sized arrays are illegal on MSVC. - InlinedVector per_cpu_counter_data_storage_; + absl::InlinedVector per_cpu_counter_data_storage_; size_t num_cores_ = 0; }; diff --git a/src/core/lib/channel/channelz_registry.cc b/src/core/lib/channel/channelz_registry.cc index 0964ffca2a1..43439363bf7 100644 --- a/src/core/lib/channel/channelz_registry.cc +++ b/src/core/lib/channel/channelz_registry.cc @@ -21,6 +21,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_trace.h" #include "src/core/lib/channel/channelz.h" #include "src/core/lib/channel/channelz_registry.h" @@ -82,7 +84,7 @@ RefCountedPtr ChannelzRegistry::InternalGet(intptr_t uuid) { std::string ChannelzRegistry::InternalGetTopChannels( intptr_t start_channel_id) { - InlinedVector, 10> top_level_channels; + absl::InlinedVector, 10> top_level_channels; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -120,7 +122,7 @@ std::string ChannelzRegistry::InternalGetTopChannels( } std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { - InlinedVector, 10> servers; + absl::InlinedVector, 10> servers; RefCountedPtr node_after_pagination_limit; { MutexLock lock(&mu_); @@ -158,7 +160,7 @@ std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) { } void ChannelzRegistry::InternalLogAllEntities() { - InlinedVector, 10> nodes; + absl::InlinedVector, 10> nodes; { MutexLock lock(&mu_); for (auto& p : node_map_) { diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h index 4f064d901df..10b0631968f 100644 --- a/src/core/lib/channel/handshaker.h +++ b/src/core/lib/channel/handshaker.h @@ -21,12 +21,13 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include "src/core/lib/channel/channel_args.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/iomgr/closure.h" @@ -146,7 +147,8 @@ class HandshakeManager : public RefCounted { gpr_mu mu_; bool is_shutdown_ = false; // An array of handshakers added via grpc_handshake_manager_add(). - InlinedVector, HANDSHAKERS_INIT_SIZE> handshakers_; + absl::InlinedVector, HANDSHAKERS_INIT_SIZE> + handshakers_; // The index of the handshaker to invoke next and closure to invoke it. size_t index_ = 0; grpc_closure call_next_handshaker_; diff --git a/src/core/lib/channel/handshaker_registry.cc b/src/core/lib/channel/handshaker_registry.cc index 9ec458b210a..0e686af8992 100644 --- a/src/core/lib/channel/handshaker_registry.cc +++ b/src/core/lib/channel/handshaker_registry.cc @@ -18,9 +18,10 @@ #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/handshaker_registry.h" #include "src/core/lib/gpr/alloc.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include @@ -44,7 +45,7 @@ class HandshakerFactoryList { HandshakeManager* handshake_mgr); private: - InlinedVector, 2> factories_; + absl::InlinedVector, 2> factories_; }; HandshakerFactoryList* g_handshaker_factory_lists = nullptr; diff --git a/src/core/lib/gprpp/inlined_vector.h b/src/core/lib/gprpp/inlined_vector.h deleted file mode 100644 index 3cad99d3429..00000000000 --- a/src/core/lib/gprpp/inlined_vector.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H -#define GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H - -#include - -#include -#include - -#include "absl/container/inlined_vector.h" -#include "src/core/lib/gprpp/memory.h" - -namespace grpc_core { - -template > -using InlinedVector = absl::InlinedVector; - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H */ diff --git a/src/core/lib/gprpp/optional.h b/src/core/lib/gprpp/optional.h deleted file mode 100644 index f4535bb03a8..00000000000 --- a/src/core/lib/gprpp/optional.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H -#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H - -#include - -#include "absl/types/optional.h" - -namespace grpc_core { - -template -using Optional = absl::optional; - -} // namespace grpc_core - -#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */ diff --git a/src/core/lib/iomgr/buffer_list.h b/src/core/lib/iomgr/buffer_list.h index c2552ca26bf..f804f021a75 100644 --- a/src/core/lib/iomgr/buffer_list.h +++ b/src/core/lib/iomgr/buffer_list.h @@ -21,12 +21,13 @@ #include +#include "absl/types/optional.h" + #include "src/core/lib/iomgr/port.h" #include #include "src/core/lib/gprpp/memory.h" -#include "src/core/lib/gprpp/optional.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/internal_errqueue.h" @@ -34,52 +35,52 @@ namespace grpc_core { struct ConnectionMetrics { /* Delivery rate in Bytes/s. */ - Optional delivery_rate; + absl::optional delivery_rate; /* If the delivery rate is limited by the application, this is set to true. */ - Optional is_delivery_rate_app_limited; + absl::optional is_delivery_rate_app_limited; /* Total packets retransmitted. */ - Optional packet_retx; + absl::optional packet_retx; /* Total packets retransmitted spuriously. This metric is smaller than or equal to packet_retx. */ - Optional packet_spurious_retx; + absl::optional packet_spurious_retx; /* Total packets sent. */ - Optional packet_sent; + absl::optional packet_sent; /* Total packets delivered. */ - Optional packet_delivered; + absl::optional packet_delivered; /* Total packets delivered with ECE marked. This metric is smaller than or equal to packet_delivered. */ - Optional packet_delivered_ce; + absl::optional packet_delivered_ce; /* Total bytes lost so far. */ - Optional data_retx; + absl::optional data_retx; /* Total bytes sent so far. */ - Optional data_sent; + absl::optional data_sent; /* Total bytes in write queue but not sent. */ - Optional data_notsent; + absl::optional data_notsent; /* Pacing rate of the connection in Bps */ - Optional pacing_rate; + absl::optional pacing_rate; /* Minimum RTT observed in usec. */ - Optional min_rtt; + absl::optional min_rtt; /* Smoothed RTT in usec */ - Optional srtt; + absl::optional srtt; /* Send congestion window. */ - Optional congestion_window; + absl::optional congestion_window; /* Slow start threshold in packets. */ - Optional snd_ssthresh; + absl::optional snd_ssthresh; /* Maximum degree of reordering (i.e., maximum number of packets reodered) on the connection. */ - Optional reordering; + absl::optional reordering; /* Represents the number of recurring retransmissions of the first sequence that is not acknowledged yet. */ - Optional recurring_retrans; + absl::optional recurring_retrans; /* The cumulative time (in usec) that the transport protocol was busy sending data. */ - Optional busy_usec; + absl::optional busy_usec; /* The cumulative time (in usec) that the transport protocol was limited by the receive window size. */ - Optional rwnd_limited_usec; + absl::optional rwnd_limited_usec; /* The cumulative time (in usec) that the transport protocol was limited by the send buffer size. */ - Optional sndbuf_limited_usec; + absl::optional sndbuf_limited_usec; }; struct Timestamp { diff --git a/src/core/lib/iomgr/call_combiner.h b/src/core/lib/iomgr/call_combiner.h index d3f43cf547f..44acd9fe870 100644 --- a/src/core/lib/iomgr/call_combiner.h +++ b/src/core/lib/iomgr/call_combiner.h @@ -23,9 +23,10 @@ #include +#include "absl/container/inlined_vector.h" + #include -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" @@ -208,7 +209,7 @@ class CallCombinerClosureList { // There are generally a maximum of 6 closures to run in the call // combiner, one for each pending op. - InlinedVector closures_; + absl::InlinedVector closures_; }; } // namespace grpc_core diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 5c79aa78ae7..ac3ff876289 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -30,7 +30,6 @@ #include #include "src/core/lib/debug/trace.h" -#include "src/core/lib/gprpp/inlined_vector.h" /// Opaque representation of an error. /// See https://github.com/grpc/grpc/blob/master/doc/core/grpc-error.md for a diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc index 0bfd22fc79c..ce3531f3378 100644 --- a/src/core/lib/iomgr/udp_server.cc +++ b/src/core/lib/iomgr/udp_server.cc @@ -44,6 +44,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -52,7 +54,6 @@ #include #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/ev_posix.h" @@ -177,7 +178,7 @@ struct grpc_udp_server { int shutdown; /* An array of listeners */ - grpc_core::InlinedVector listeners; + absl::InlinedVector listeners; /* factory for use to create udp listeners */ GrpcUdpHandlerFactory* handler_factory; diff --git a/src/core/lib/security/credentials/composite/composite_credentials.h b/src/core/lib/security/credentials/composite/composite_credentials.h index 57967e1b6c9..6b9e9d114d8 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.h +++ b/src/core/lib/security/credentials/composite/composite_credentials.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/security/credentials/credentials.h" @@ -71,8 +72,7 @@ class grpc_composite_channel_credentials : public grpc_channel_credentials { class grpc_composite_call_credentials : public grpc_call_credentials { public: using CallCredentialsList = - grpc_core::InlinedVector, - 2>; + absl::InlinedVector, 2>; grpc_composite_call_credentials( grpc_core::RefCountedPtr creds1, diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc index c922d35b8d8..8191043db21 100644 --- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc @@ -23,6 +23,8 @@ #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -32,7 +34,6 @@ #include "absl/strings/str_format.h" #include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/load_file.h" @@ -669,7 +670,7 @@ grpc_error* ValidateStsCredentialsOptions( void operator()(grpc_uri* uri) { grpc_uri_destroy(uri); } }; *sts_url_out = nullptr; - InlinedVector error_list; + absl::InlinedVector error_list; std::unique_ptr sts_url( options->token_exchange_service_uri != nullptr ? grpc_uri_parse(options->token_exchange_service_uri, false) diff --git a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h index c411fb2b96b..a5f032abec4 100644 --- a/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +++ b/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h @@ -23,7 +23,8 @@ #include -#include "src/core/lib/gprpp/inlined_vector.h" +#include "absl/container/inlined_vector.h" + #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/security/security_connector/ssl_utils.h" @@ -44,8 +45,7 @@ struct grpc_tls_error_details struct grpc_tls_key_materials_config : public grpc_core::RefCounted { public: - typedef grpc_core::InlinedVector - PemKeyCertPairList; + typedef absl::InlinedVector PemKeyCertPairList; /** Getters for member fields. **/ const char* pem_root_certs() const { return pem_root_certs_.get(); } diff --git a/src/core/lib/security/security_connector/load_system_roots_linux.cc b/src/core/lib/security/security_connector/load_system_roots_linux.cc index e97773f38b3..f7c6c2cec35 100644 --- a/src/core/lib/security/security_connector/load_system_roots_linux.cc +++ b/src/core/lib/security/security_connector/load_system_roots_linux.cc @@ -34,6 +34,8 @@ #include #include +#include "absl/container/inlined_vector.h" + #include #include #include @@ -41,7 +43,6 @@ #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/global_config.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/iomgr/load_file.h" GPR_GLOBAL_CONFIG_DEFINE_STRING(grpc_system_ssl_roots_dir, "", @@ -100,7 +101,7 @@ grpc_slice CreateRootCertsBundle(const char* certs_directory) { char path[MAXPATHLEN]; off_t size; }; - InlinedVector roots_filenames; + absl::InlinedVector roots_filenames; size_t total_bundle_size = 0; struct dirent* directory_entry; while ((directory_entry = readdir(ca_directory)) != nullptr) { diff --git a/src/cpp/common/tls_credentials_options.cc b/src/cpp/common/tls_credentials_options.cc index c821e100f93..23d6495dd20 100644 --- a/src/cpp/common/tls_credentials_options.cc +++ b/src/cpp/common/tls_credentials_options.cc @@ -18,6 +18,9 @@ #include #include + +#include "absl/container/inlined_vector.h" + #include "src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h" #include "src/cpp/common/tls_credentials_options_util.h" @@ -111,7 +114,7 @@ void TlsCredentialReloadArg::set_key_materials( c_arg_->key_materials_config = grpc_tls_key_materials_config_create(); } /** Convert |pem_key_cert_pair_list| to an inlined vector of ssl pairs. **/ - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : pem_key_cert_pair_list) { c_pem_key_cert_pair_list.emplace_back( @@ -128,7 +131,7 @@ void TlsCredentialReloadArg::set_key_materials_config( c_arg_->key_materials_config = nullptr; return; } - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : key_materials_config->pem_key_cert_pair_list()) { diff --git a/src/cpp/common/tls_credentials_options_util.cc b/src/cpp/common/tls_credentials_options_util.cc index 59915e42f61..2211460e664 100644 --- a/src/cpp/common/tls_credentials_options_util.cc +++ b/src/cpp/common/tls_credentials_options_util.cc @@ -16,8 +16,10 @@ * */ -#include "src/cpp/common/tls_credentials_options_util.h" +#include "absl/container/inlined_vector.h" + #include +#include "src/cpp/common/tls_credentials_options_util.h" namespace grpc_impl { namespace experimental { @@ -35,7 +37,7 @@ grpc_tls_key_materials_config* ConvertToCKeyMaterialsConfig( } grpc_tls_key_materials_config* c_config = grpc_tls_key_materials_config_create(); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pem_key_cert_pair_list; for (const auto& key_cert_pair : config->pem_key_cert_pair_list()) { grpc_ssl_pem_key_cert_pair* ssl_pair = diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 84ff252deaf..fb1e3e2dc1d 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -94,7 +94,7 @@ static grpc_core::Resolver::Result create_new_resolver_result() { grpc_uri* uri = grpc_uri_parse(uri_string, true); grpc_resolved_address address; GPR_ASSERT(grpc_parse_uri(uri, &address)); - grpc_core::InlinedVector args_to_add; + absl::InlinedVector args_to_add; result.addresses.emplace_back( address.addr, address.len, grpc_channel_args_copy_and_add(nullptr, nullptr, 0)); diff --git a/test/core/end2end/fixtures/h2_tls.cc b/test/core/end2end/fixtures/h2_tls.cc index 95cff3a2b00..1a79bc96014 100644 --- a/test/core/end2end/fixtures/h2_tls.cc +++ b/test/core/end2end/fixtures/h2_tls.cc @@ -23,12 +23,13 @@ #include #include +#include "absl/container/inlined_vector.h" + #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/gpr/tmpfile.h" #include "src/core/lib/gprpp/host_port.h" -#include "src/core/lib/gprpp/inlined_vector.h" #include "src/core/lib/gprpp/thd.h" #include "src/core/lib/iomgr/load_file.h" #include "src/core/lib/security/credentials/credentials.h" @@ -42,7 +43,7 @@ #define SERVER_CERT_PATH "src/core/tsi/test_creds/server1.pem" #define SERVER_KEY_PATH "src/core/tsi/test_creds/server1.key" -typedef grpc_core::InlinedVector ThreadList; +typedef absl::InlinedVector ThreadList; struct fullstack_secure_fixture_data { ~fullstack_secure_fixture_data() { diff --git a/test/core/gprpp/BUILD b/test/core/gprpp/BUILD index a9a8f84ebec..4eb81c3db23 100644 --- a/test/core/gprpp/BUILD +++ b/test/core/gprpp/BUILD @@ -95,19 +95,6 @@ grpc_cc_test( ], ) -grpc_cc_test( - name = "optional_test", - srcs = ["optional_test.cc"], - external_deps = [ - "gtest", - ], - language = "C++", - deps = [ - "//:optional", - "//test/core/util:grpc_test_util", - ], -) - grpc_cc_test( name = "orphanable_test", srcs = ["orphanable_test.cc"], diff --git a/test/core/gprpp/optional_test.cc b/test/core/gprpp/optional_test.cc deleted file mode 100644 index 67c7fad6c32..00000000000 --- a/test/core/gprpp/optional_test.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Copyright 2019 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "src/core/lib/gprpp/optional.h" -#include -#include -#include "src/core/lib/gprpp/memory.h" -#include "test/core/util/test_config.h" - -namespace grpc_core { -namespace testing { - -namespace { -TEST(OptionalTest, BasicTest) { - grpc_core::Optional opt_val; - EXPECT_FALSE(opt_val.has_value()); - const int kTestVal = 123; - - opt_val.emplace(kTestVal); - EXPECT_TRUE(opt_val.has_value()); - EXPECT_EQ(opt_val.value(), kTestVal); - - opt_val.reset(); - EXPECT_EQ(opt_val.has_value(), false); -} -} // namespace - -} // namespace testing -} // namespace grpc_core - -int main(int argc, char** argv) { - grpc::testing::TestEnvironment env(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index a1a0633e1f8..7ca90f7ff68 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -399,8 +399,7 @@ TEST_F(CredentialsTest, TlsCredentialReloadConfigCppToC) { ssl_pair->cert_chain = gpr_strdup(test_cert_chain.c_str()); ::grpc_core::PemKeyCertPair pem_key_cert_pair = ::grpc_core::PemKeyCertPair(ssl_pair); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> - pem_key_cert_pair_list; + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> pem_key_cert_pair_list; pem_key_cert_pair_list.push_back(pem_key_cert_pair); grpc::string test_pem_root_certs = "pem_root_certs"; c_key_materials.set_key_materials(test_pem_root_certs.c_str(), @@ -417,7 +416,7 @@ TEST_F(CredentialsTest, TlsCredentialReloadConfigCppToC) { EXPECT_EQ(c_arg.cb_user_data, nullptr); EXPECT_STREQ(c_arg.key_materials_config->pem_root_certs(), "new_pem_root_certs"); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> pair_list = + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> pair_list = c_arg.key_materials_config->pem_key_cert_pair_list(); EXPECT_EQ(static_cast(pair_list.size()), 2); EXPECT_STREQ(pair_list[0].private_key(), "private_key"); @@ -625,7 +624,7 @@ TEST_F(CredentialsTest, TlsCredentialsOptionsCppToC) { EXPECT_EQ(c_credential_reload_arg.cb_user_data, nullptr); EXPECT_STREQ(c_credential_reload_arg.key_materials_config->pem_root_certs(), "new_pem_root_certs"); - ::grpc_core::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pair_list = + ::absl::InlinedVector<::grpc_core::PemKeyCertPair, 1> c_pair_list = c_credential_reload_arg.key_materials_config->pem_key_cert_pair_list(); EXPECT_EQ(static_cast(c_pair_list.size()), 2); EXPECT_STREQ(c_pair_list[0].private_key(), "private_key"); diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c00bec03dcb..c5d220fabf1 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -1495,13 +1495,11 @@ src/core/lib/gprpp/global_config_env.h \ src/core/lib/gprpp/global_config_generic.h \ src/core/lib/gprpp/host_port.cc \ src/core/lib/gprpp/host_port.h \ -src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/mpscq.h \ -src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index fd50700de67..04f37228424 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -1306,13 +1306,11 @@ src/core/lib/gprpp/global_config_env.h \ src/core/lib/gprpp/global_config_generic.h \ src/core/lib/gprpp/host_port.cc \ src/core/lib/gprpp/host_port.h \ -src/core/lib/gprpp/inlined_vector.h \ src/core/lib/gprpp/manual_constructor.h \ src/core/lib/gprpp/map.h \ src/core/lib/gprpp/memory.h \ src/core/lib/gprpp/mpscq.cc \ src/core/lib/gprpp/mpscq.h \ -src/core/lib/gprpp/optional.h \ src/core/lib/gprpp/orphanable.h \ src/core/lib/gprpp/ref_counted.h \ src/core/lib/gprpp/ref_counted_ptr.h \ diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index b09efd61926..ab8760486a7 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -4931,30 +4931,6 @@ ], "uses_polling": true }, - { - "args": [], - "benchmark": false, - "ci_platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "exclude_iomgrs": [], - "flaky": false, - "gtest": true, - "language": "c++", - "name": "optional_test", - "platforms": [ - "linux", - "mac", - "posix", - "windows" - ], - "uses_polling": true - }, { "args": [], "benchmark": false,