Remove grpc_core::InlinedVector<> and grpc_core::Optional<>.

pull/22696/head
Mark D. Roth 5 years ago
parent 36d4d8c20f
commit 09b42371e7
  1. 36
      BUILD
  2. 2
      BUILD.gn
  3. 39
      CMakeLists.txt
  4. 48
      Makefile
  5. 17
      build_autogenerated.yaml
  6. 4
      gRPC-C++.podspec
  7. 4
      gRPC-Core.podspec
  8. 2
      grpc.gemspec
  9. 2
      package.xml
  10. 8
      src/core/ext/filters/client_channel/client_channel.cc
  11. 8
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  12. 6
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  13. 5
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h
  14. 2
      src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
  15. 7
      src/core/ext/filters/client_channel/lb_policy/subchannel_list.h
  16. 6
      src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc
  17. 6
      src/core/ext/filters/client_channel/lb_policy_registry.cc
  18. 6
      src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
  19. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  20. 4
      src/core/ext/filters/client_channel/resolver_registry.cc
  21. 1
      src/core/ext/filters/client_channel/resolver_registry.h
  22. 8
      src/core/ext/filters/client_channel/resolver_result_parsing.cc
  23. 15
      src/core/ext/filters/client_channel/resolver_result_parsing.h
  24. 1
      src/core/ext/filters/client_channel/resolving_lb_policy.cc
  25. 5
      src/core/ext/filters/client_channel/resolving_lb_policy.h
  26. 5
      src/core/ext/filters/client_channel/server_address.h
  27. 6
      src/core/ext/filters/client_channel/service_config.cc
  28. 10
      src/core/ext/filters/client_channel/service_config.h
  29. 1
      src/core/ext/filters/client_channel/xds/xds_api.cc
  30. 5
      src/core/ext/filters/client_channel/xds/xds_api.h
  31. 16
      src/core/ext/filters/client_channel/xds/xds_bootstrap.cc
  32. 7
      src/core/ext/filters/client_channel/xds/xds_bootstrap.h
  33. 6
      src/core/ext/filters/client_channel/xds/xds_channel_secure.cc
  34. 3
      src/core/ext/filters/client_channel/xds/xds_client.cc
  35. 1
      src/core/ext/filters/client_channel/xds/xds_client_stats.h
  36. 5
      src/core/lib/channel/channelz.h
  37. 8
      src/core/lib/channel/channelz_registry.cc
  38. 6
      src/core/lib/channel/handshaker.h
  39. 5
      src/core/lib/channel/handshaker_registry.cc
  40. 37
      src/core/lib/gprpp/inlined_vector.h
  41. 33
      src/core/lib/gprpp/optional.h
  42. 43
      src/core/lib/iomgr/buffer_list.h
  43. 5
      src/core/lib/iomgr/call_combiner.h
  44. 1
      src/core/lib/iomgr/error.h
  45. 5
      src/core/lib/iomgr/udp_server.cc
  46. 6
      src/core/lib/security/credentials/composite/composite_credentials.h
  47. 5
      src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
  48. 6
      src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h
  49. 5
      src/core/lib/security/security_connector/load_system_roots_linux.cc
  50. 7
      src/cpp/common/tls_credentials_options.cc
  51. 6
      src/cpp/common/tls_credentials_options_util.cc
  52. 2
      test/core/client_channel/resolvers/fake_resolver_test.cc
  53. 5
      test/core/end2end/fixtures/h2_tls.cc
  54. 13
      test/core/gprpp/BUILD
  55. 50
      test/core/gprpp/optional_test.cc
  56. 7
      test/cpp/client/credentials_test.cc
  57. 2
      tools/doxygen/Doxyfile.c++.internal
  58. 2
      tools/doxygen/Doxyfile.core.internal
  59. 24
      tools/run_tests/generated/tests.json

36
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",

@ -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",

@ -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)

@ -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 \

@ -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

@ -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',

@ -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',

@ -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 )

@ -512,13 +512,11 @@
<file baseinstalldir="/" name="src/core/lib/gprpp/global_config_generic.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/host_port.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/inlined_vector.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/manual_constructor.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/map.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/memory.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/mpscq.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/mpscq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/optional.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/orphanable.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/ref_counted.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/gprpp/ref_counted_ptr.h" role="src" />

@ -33,6 +33,9 @@
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#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<ByteStreamCache*, 3> send_messages_;
absl::InlinedVector<ByteStreamCache*, 3> 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<ServerRetryThrottleData> retry_throttle_data;
if (parsed_service_config != nullptr) {
Optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
absl::optional<internal::ClientChannelGlobalParsedConfig::RetryThrottling>
retry_throttle_config = parsed_service_config->retry_throttling();
if (retry_throttle_config.has_value()) {
retry_throttle_data =

@ -64,6 +64,8 @@
#include <limits.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
@ -555,7 +557,7 @@ ServerAddressList GrpcLb::Serverlist::GetServerAddressList(
lb_token[0] = '\0';
}
// Add address.
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<grpc_arg, 2> args_to_add;
args_to_add.emplace_back(grpc_channel_arg_pointer_create(
const_cast<char*>(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<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> 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<grpc_arg, 2> args_to_add;
absl::InlinedVector<grpc_arg, 2> args_to_add;
args_to_add.emplace_back(grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ADDRESS_IS_BACKEND_FROM_GRPCLB_LOAD_BALANCER),
is_backend_from_grpclb_load_balancer));

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -71,8 +73,8 @@ RefCountedPtr<TargetAuthorityTable> CreateTargetAuthorityTable(
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<const char*, 1> args_to_remove;
absl::InlinedVector<grpc_arg, 2> args_to_add;
// Add arg for targets info table.
RefCountedPtr<TargetAuthorityTable> target_authority_table =
CreateTargetAuthorityTable(addresses);

@ -23,7 +23,8 @@
#include <grpc/support/atm.h>
#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<GrpcLbClientStats> {
: token(std::move(token)), count(count) {}
};
typedef InlinedVector<DropTokenCount, 10> DroppedCallCounts;
typedef absl::InlinedVector<DropTokenCount, 10> DroppedCallCounts;
void AddCallStarted();
void AddCallFinished(bool finished_with_client_failed_to_send,

@ -160,7 +160,7 @@ class RoundRobin : public LoadBalancingPolicy {
RoundRobin* parent_;
size_t last_picked_index_;
InlinedVector<RefCountedPtr<SubchannelInterface>, 10> subchannels_;
absl::InlinedVector<RefCountedPtr<SubchannelInterface>, 10> subchannels_;
};
void ShutdownLocked() override;

@ -25,6 +25,8 @@
#include <grpc/support/alloc.h>
#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 <typename SubchannelListType, typename SubchannelDataType>
class SubchannelList : public InternallyRefCounted<SubchannelListType> {
public:
typedef InlinedVector<SubchannelDataType, 10> SubchannelVector;
typedef absl::InlinedVector<SubchannelDataType, 10> SubchannelVector;
// The number of subchannels in the list.
size_t num_subchannels() const { return subchannels_.size(); }
@ -370,7 +371,7 @@ SubchannelList<SubchannelListType, SubchannelDataType>::SubchannelList(
GRPC_ARG_SERVICE_CONFIG};
// Create a subchannel for each address.
for (size_t i = 0; i < addresses.size(); i++) {
InlinedVector<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> args_to_add;
const size_t subchannel_address_arg_index = args_to_add.size();
args_to_add.emplace_back(
Subchannel::CreateSubchannelAddressArg(&addresses[i].address()));

@ -20,6 +20,7 @@
#include <limits.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include "absl/strings/str_cat.h"
#include <grpc/grpc.h>
@ -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<std::pair<uint32_t, RefCountedPtr<ChildPickerWrapper>>,
1>;
using PickerList = absl::InlinedVector<
std::pair<uint32_t, RefCountedPtr<ChildPickerWrapper>>, 1>;
explicit WeightedPicker(PickerList pickers)
: pickers_(std::move(pickers)) {}

@ -22,8 +22,9 @@
#include <string.h>
#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<std::unique_ptr<LoadBalancingPolicyFactory>, 10> factories_;
absl::InlinedVector<std::unique_ptr<LoadBalancingPolicyFactory>, 10>
factories_;
};
RegistryState* g_state = nullptr;

@ -24,6 +24,8 @@
#include <stdio.h>
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -249,7 +251,7 @@ std::string ChooseServiceConfig(char* service_config_choice_json,
return "";
}
const Json* service_config = nullptr;
InlinedVector<grpc_error*, 4> error_list;
absl::InlinedVector<grpc_error*, 4> 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<grpc_arg, 1> new_args;
absl::InlinedVector<grpc_arg, 1> new_args;
if (balancer_addresses_ != nullptr) {
new_args.push_back(
CreateGrpclbBalancerAddressesArg(balancer_addresses_.get()));

@ -26,6 +26,8 @@
#include <string.h>
#include <sys/types.h>
#include "absl/container/inlined_vector.h"
#include <ares.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -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<grpc_arg, 1> args_to_add;
absl::InlinedVector<grpc_arg, 1> args_to_add;
if (hr->is_balancer) {
args_to_add.emplace_back(
grpc_core::CreateGrpclbBalancerNameArg(hr->host));

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -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<std::unique_ptr<ResolverFactory>, 10> factories_;
absl::InlinedVector<std::unique_ptr<ResolverFactory>, 10> factories_;
grpc_core::UniquePtr<char> default_prefix_;
};

@ -22,7 +22,6 @@
#include <grpc/support/port_platform.h>
#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"

@ -24,6 +24,8 @@
#include <stdio.h>
#include <string.h>
#include "absl/types/optional.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -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<grpc_error*> error_list;
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config;
std::string lb_policy_name;
Optional<ClientChannelGlobalParsedConfig::RetryThrottling> retry_throttling;
absl::optional<ClientChannelGlobalParsedConfig::RetryThrottling>
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<grpc_error*> error_list;
Optional<bool> wait_for_ready;
absl::optional<bool> wait_for_ready;
grpc_millis timeout = 0;
std::unique_ptr<ClientChannelMethodParsedConfig::RetryPolicy> retry_policy;
// Parse waitForReady.

@ -21,13 +21,14 @@
#include <grpc/support/port_platform.h>
#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<LoadBalancingPolicy::Config> parsed_lb_config,
std::string parsed_deprecated_lb_policy,
const Optional<RetryThrottling>& retry_throttling,
const absl::optional<RetryThrottling>& 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<RetryThrottling> retry_throttling() const {
absl::optional<RetryThrottling> retry_throttling() const {
return retry_throttling_;
}
@ -73,7 +74,7 @@ class ClientChannelGlobalParsedConfig : public ServiceConfig::ParsedConfig {
private:
RefCountedPtr<LoadBalancingPolicy::Config> parsed_lb_config_;
std::string parsed_deprecated_lb_policy_;
Optional<RetryThrottling> retry_throttling_;
absl::optional<RetryThrottling> retry_throttling_;
const char* health_check_service_name_;
};
@ -88,7 +89,7 @@ class ClientChannelMethodParsedConfig : public ServiceConfig::ParsedConfig {
};
ClientChannelMethodParsedConfig(grpc_millis timeout,
const Optional<bool>& wait_for_ready,
const absl::optional<bool>& wait_for_ready,
std::unique_ptr<RetryPolicy> 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<bool> wait_for_ready() const { return wait_for_ready_; }
absl::optional<bool> wait_for_ready() const { return wait_for_ready_; }
const RetryPolicy* retry_policy() const { return retry_policy_.get(); }
private:
grpc_millis timeout_ = 0;
Optional<bool> wait_for_ready_;
absl::optional<bool> wait_for_ready_;
std::unique_ptr<RetryPolicy> retry_policy_;
};

@ -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"

@ -21,13 +21,14 @@
#include <grpc/support/port_platform.h>
#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<char*, 3>;
using TraceStringVector = absl::InlinedVector<char*, 3>;
class ResolverResultHandler;
class ResolvingControlHelper;

@ -21,8 +21,9 @@
#include <grpc/support/port_platform.h>
#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<ServerAddress, 1> ServerAddressList;
typedef absl::InlinedVector<ServerAddress, 1> ServerAddressList;
} // namespace grpc_core

@ -34,8 +34,8 @@
namespace grpc_core {
namespace {
typedef InlinedVector<std::unique_ptr<ServiceConfig::Parser>,
ServiceConfig::kNumPreallocatedParsers>
typedef absl::InlinedVector<std::unique_ptr<ServiceConfig::Parser>,
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<ParsedConfigVector>();
InlinedVector<grpc_error*, 4> error_list;
std::vector<grpc_error*> error_list;
for (size_t i = 0; i < g_registered_parsers->size(); i++) {
grpc_error* parser_error = GRPC_ERROR_NONE;
auto parsed_obj =

@ -21,10 +21,11 @@
#include <unordered_map>
#include "absl/container/inlined_vector.h"
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/string_util.h>
#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<ServiceConfig> {
};
static constexpr int kNumPreallocatedParsers = 4;
typedef InlinedVector<std::unique_ptr<ParsedConfig>, kNumPreallocatedParsers>
typedef absl::InlinedVector<std::unique_ptr<ParsedConfig>,
kNumPreallocatedParsers>
ParsedConfigVector;
/// When a service config is applied to a call in the client_channel_filter,
@ -175,7 +177,7 @@ class ServiceConfig : public RefCounted<ServiceConfig> {
std::string json_string_;
Json json_;
InlinedVector<std::unique_ptr<ParsedConfig>, kNumPreallocatedParsers>
absl::InlinedVector<std::unique_ptr<ParsedConfig>, 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<ServiceConfig> {
const ParsedConfigVector* default_method_config_vector_ = nullptr;
// Storage for all the vectors that are being used in
// parsed_method_configs_table_.
InlinedVector<std::unique_ptr<ParsedConfigVector>, 32>
absl::InlinedVector<std::unique_ptr<ParsedConfigVector>, 32>
parsed_method_config_vectors_storage_;
};

@ -31,7 +31,6 @@
#include <grpc/support/string_util.h>
#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"

@ -25,6 +25,7 @@
#include <set>
#include "absl/container/inlined_vector.h"
#include "absl/types/optional.h"
#include <grpc/slice_buffer.h>
@ -150,7 +151,7 @@ class XdsApi {
}
private:
InlinedVector<LocalityMap, 2> priorities_;
absl::InlinedVector<LocalityMap, 2> 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<DropCategory, 2>;
using DropCategoryList = absl::InlinedVector<DropCategory, 2>;
void AddCategory(std::string name, uint32_t parts_per_million) {
drop_category_list_.emplace_back(

@ -18,6 +18,8 @@
#include "src/core/ext/filters/client_channel/xds/xds_bootstrap.h"
#include <vector>
#include <errno.h>
#include <stdlib.h>
@ -128,7 +130,7 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
"malformed JSON in bootstrap file");
return;
}
InlinedVector<grpc_error*, 1> error_list;
std::vector<grpc_error*> 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<grpc_error*, 1> error_list;
std::vector<grpc_error*> 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<grpc_error*, 1> error_list;
std::vector<grpc_error*> 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<grpc_error*, 1> error_list;
std::vector<grpc_error*> 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<grpc_error*, 1> error_list;
std::vector<grpc_error*> 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<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
node_ = absl::make_unique<Node>();
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<grpc_error*, 1> error_list;
std::vector<grpc_error*> error_list;
auto it = json->mutable_object()->find("region");
if (it != json->mutable_object()->end()) {
if (it->second.type() != Json::Type::STRING) {

@ -23,9 +23,10 @@
#include <string>
#include <vector>
#include "absl/container/inlined_vector.h"
#include <grpc/impl/codegen/slice.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/iomgr/error.h"
@ -53,7 +54,7 @@ class XdsBootstrap {
struct XdsServer {
std::string server_uri;
InlinedVector<ChannelCreds, 1> channel_creds;
absl::InlinedVector<ChannelCreds, 1> 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<XdsServer, 1> servers_;
absl::InlinedVector<XdsServer, 1> servers_;
std::unique_ptr<Node> node_;
};

@ -22,6 +22,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -39,8 +41,8 @@
namespace grpc_core {
grpc_channel_args* ModifyXdsChannelArgs(grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
absl::InlinedVector<const char*, 1> args_to_remove;
absl::InlinedVector<grpc_arg, 2> 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.

@ -22,6 +22,7 @@
#include <limits.h>
#include <string.h>
#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<grpc_arg, 3> args_to_add;
absl::InlinedVector<grpc_arg, 3> args_to_add;
// Keepalive interval.
args_to_add.emplace_back(grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), 5000));

@ -24,7 +24,6 @@
#include <grpc/support/string_util.h>
#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"

@ -25,10 +25,11 @@
#include <string>
#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<AtomicCounterData, 1> per_cpu_counter_data_storage_;
absl::InlinedVector<AtomicCounterData, 1> per_cpu_counter_data_storage_;
size_t num_cores_ = 0;
};

@ -21,6 +21,8 @@
#include <algorithm>
#include <cstring>
#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<BaseNode> ChannelzRegistry::InternalGet(intptr_t uuid) {
std::string ChannelzRegistry::InternalGetTopChannels(
intptr_t start_channel_id) {
InlinedVector<RefCountedPtr<BaseNode>, 10> top_level_channels;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> top_level_channels;
RefCountedPtr<BaseNode> 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<RefCountedPtr<BaseNode>, 10> servers;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> servers;
RefCountedPtr<BaseNode> node_after_pagination_limit;
{
MutexLock lock(&mu_);
@ -158,7 +160,7 @@ std::string ChannelzRegistry::InternalGetServers(intptr_t start_server_id) {
}
void ChannelzRegistry::InternalLogAllEntities() {
InlinedVector<RefCountedPtr<BaseNode>, 10> nodes;
absl::InlinedVector<RefCountedPtr<BaseNode>, 10> nodes;
{
MutexLock lock(&mu_);
for (auto& p : node_map_) {

@ -21,12 +21,13 @@
#include <grpc/support/port_platform.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/string_util.h>
#include <grpc/impl/codegen/grpc_types.h>
#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<HandshakeManager> {
gpr_mu mu_;
bool is_shutdown_ = false;
// An array of handshakers added via grpc_handshake_manager_add().
InlinedVector<RefCountedPtr<Handshaker>, HANDSHAKERS_INIT_SIZE> handshakers_;
absl::InlinedVector<RefCountedPtr<Handshaker>, 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_;

@ -18,9 +18,10 @@
#include <grpc/support/port_platform.h>
#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 <string.h>
@ -44,7 +45,7 @@ class HandshakerFactoryList {
HandshakeManager* handshake_mgr);
private:
InlinedVector<std::unique_ptr<HandshakerFactory>, 2> factories_;
absl::InlinedVector<std::unique_ptr<HandshakerFactory>, 2> factories_;
};
HandshakerFactoryList* g_handshaker_factory_lists = nullptr;

@ -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 <grpc/support/port_platform.h>
#include <cassert>
#include <cstring>
#include "absl/container/inlined_vector.h"
#include "src/core/lib/gprpp/memory.h"
namespace grpc_core {
template <typename T, size_t N, typename A = std::allocator<T>>
using InlinedVector = absl::InlinedVector<T, N, A>;
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_INLINED_VECTOR_H */

@ -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 <grpc/support/port_platform.h>
#include "absl/types/optional.h"
namespace grpc_core {
template <typename T>
using Optional = absl::optional<T>;
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

@ -21,12 +21,13 @@
#include <grpc/support/port_platform.h>
#include "absl/types/optional.h"
#include "src/core/lib/iomgr/port.h"
#include <grpc/support/time.h>
#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<uint64_t> delivery_rate;
absl::optional<uint64_t> delivery_rate;
/* If the delivery rate is limited by the application, this is set to true. */
Optional<bool> is_delivery_rate_app_limited;
absl::optional<bool> is_delivery_rate_app_limited;
/* Total packets retransmitted. */
Optional<uint32_t> packet_retx;
absl::optional<uint32_t> packet_retx;
/* Total packets retransmitted spuriously. This metric is smaller than or
equal to packet_retx. */
Optional<uint32_t> packet_spurious_retx;
absl::optional<uint32_t> packet_spurious_retx;
/* Total packets sent. */
Optional<uint32_t> packet_sent;
absl::optional<uint32_t> packet_sent;
/* Total packets delivered. */
Optional<uint32_t> packet_delivered;
absl::optional<uint32_t> packet_delivered;
/* Total packets delivered with ECE marked. This metric is smaller than or
equal to packet_delivered. */
Optional<uint32_t> packet_delivered_ce;
absl::optional<uint32_t> packet_delivered_ce;
/* Total bytes lost so far. */
Optional<uint64_t> data_retx;
absl::optional<uint64_t> data_retx;
/* Total bytes sent so far. */
Optional<uint64_t> data_sent;
absl::optional<uint64_t> data_sent;
/* Total bytes in write queue but not sent. */
Optional<uint64_t> data_notsent;
absl::optional<uint64_t> data_notsent;
/* Pacing rate of the connection in Bps */
Optional<uint64_t> pacing_rate;
absl::optional<uint64_t> pacing_rate;
/* Minimum RTT observed in usec. */
Optional<uint32_t> min_rtt;
absl::optional<uint32_t> min_rtt;
/* Smoothed RTT in usec */
Optional<uint32_t> srtt;
absl::optional<uint32_t> srtt;
/* Send congestion window. */
Optional<uint32_t> congestion_window;
absl::optional<uint32_t> congestion_window;
/* Slow start threshold in packets. */
Optional<uint32_t> snd_ssthresh;
absl::optional<uint32_t> snd_ssthresh;
/* Maximum degree of reordering (i.e., maximum number of packets reodered)
on the connection. */
Optional<uint32_t> reordering;
absl::optional<uint32_t> reordering;
/* Represents the number of recurring retransmissions of the first sequence
that is not acknowledged yet. */
Optional<uint8_t> recurring_retrans;
absl::optional<uint8_t> recurring_retrans;
/* The cumulative time (in usec) that the transport protocol was busy
sending data. */
Optional<uint64_t> busy_usec;
absl::optional<uint64_t> busy_usec;
/* The cumulative time (in usec) that the transport protocol was limited by
the receive window size. */
Optional<uint64_t> rwnd_limited_usec;
absl::optional<uint64_t> rwnd_limited_usec;
/* The cumulative time (in usec) that the transport protocol was limited by
the send buffer size. */
Optional<uint64_t> sndbuf_limited_usec;
absl::optional<uint64_t> sndbuf_limited_usec;
};
struct Timestamp {

@ -23,9 +23,10 @@
#include <stddef.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/atm.h>
#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<CallCombinerClosure, 6> closures_;
absl::InlinedVector<CallCombinerClosure, 6> closures_;
};
} // namespace grpc_core

@ -30,7 +30,6 @@
#include <grpc/support/time.h>
#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

@ -44,6 +44,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@ -52,7 +54,6 @@
#include <grpc/support/time.h>
#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<GrpcUdpListener, 16> listeners;
absl::InlinedVector<GrpcUdpListener, 16> listeners;
/* factory for use to create udp listeners */
GrpcUdpHandlerFactory* handler_factory;

@ -23,7 +23,8 @@
#include <string>
#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<grpc_core::RefCountedPtr<grpc_call_credentials>,
2>;
absl::InlinedVector<grpc_core::RefCountedPtr<grpc_call_credentials>, 2>;
grpc_composite_call_credentials(
grpc_core::RefCountedPtr<grpc_call_credentials> creds1,

@ -23,6 +23,8 @@
#include <string.h>
#include "absl/container/inlined_vector.h"
#include <grpc/grpc_security.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
@ -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<grpc_error*, 3> error_list;
absl::InlinedVector<grpc_error*, 3> error_list;
std::unique_ptr<grpc_uri, GrpcUriDeleter> sts_url(
options->token_exchange_service_uri != nullptr
? grpc_uri_parse(options->token_exchange_service_uri, false)

@ -23,7 +23,8 @@
#include <grpc/grpc_security.h>
#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<grpc_tls_key_materials_config> {
public:
typedef grpc_core::InlinedVector<grpc_core::PemKeyCertPair, 1>
PemKeyCertPairList;
typedef absl::InlinedVector<grpc_core::PemKeyCertPair, 1> PemKeyCertPairList;
/** Getters for member fields. **/
const char* pem_root_certs() const { return pem_root_certs_.get(); }

@ -34,6 +34,8 @@
#include <sys/types.h>
#include <unistd.h>
#include "absl/container/inlined_vector.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
@ -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<FileData, 2> roots_filenames;
absl::InlinedVector<FileData, 2> roots_filenames;
size_t total_bundle_size = 0;
struct dirent* directory_entry;
while ((directory_entry = readdir(ca_directory)) != nullptr) {

@ -18,6 +18,9 @@
#include <grpc/support/alloc.h>
#include <grpcpp/security/tls_credentials_options.h>
#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()) {

@ -16,8 +16,10 @@
*
*/
#include "src/cpp/common/tls_credentials_options_util.h"
#include "absl/container/inlined_vector.h"
#include <grpcpp/security/tls_credentials_options.h>
#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 =

@ -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<grpc_arg, 2> args_to_add;
absl::InlinedVector<grpc_arg, 2> args_to_add;
result.addresses.emplace_back(
address.addr, address.len,
grpc_channel_args_copy_and_add(nullptr, nullptr, 0));

@ -23,12 +23,13 @@
#include <stdio.h>
#include <string.h>
#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<grpc_core::Thread, 1> ThreadList;
typedef absl::InlinedVector<grpc_core::Thread, 1> ThreadList;
struct fullstack_secure_fixture_data {
~fullstack_secure_fixture_data() {

@ -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"],

@ -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 <grpc/support/log.h>
#include <gtest/gtest.h>
#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<int> 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();
}

@ -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<int>(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<int>(c_pair_list.size()), 2);
EXPECT_STREQ(c_pair_list[0].private_key(), "private_key");

@ -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 \

@ -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 \

@ -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,

Loading…
Cancel
Save