BufferPool --> ResourceQuota

reviewable/pr8239/r2
Craig Tiller 9 years ago
parent 654b242ce7
commit 20afa3d7c9
  1. 24
      BUILD
  2. 14
      CMakeLists.txt
  3. 92
      Makefile
  4. 2
      binding.gyp
  5. 30
      build.yaml
  6. 2
      config.m4
  7. 6
      gRPC-Core.podspec
  8. 10
      grpc.def
  9. 4
      grpc.gemspec
  10. 28
      include/grpc++/resource_quota.h
  11. 8
      include/grpc++/server_builder.h
  12. 4
      include/grpc++/support/channel_arguments.h
  13. 15
      include/grpc/grpc.h
  14. 7
      include/grpc/impl/codegen/grpc_types.h
  15. 4
      package.xml
  16. 8
      src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c
  17. 26
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  18. 20
      src/core/lib/http/httpcli.c
  19. 4
      src/core/lib/http/httpcli.h
  20. 684
      src/core/lib/iomgr/buffer_pool.c
  21. 4
      src/core/lib/iomgr/endpoint.c
  22. 6
      src/core/lib/iomgr/endpoint.h
  23. 2
      src/core/lib/iomgr/endpoint_pair.h
  24. 6
      src/core/lib/iomgr/endpoint_pair_posix.c
  25. 684
      src/core/lib/iomgr/resource_quota.c
  26. 83
      src/core/lib/iomgr/resource_quota.h
  27. 10
      src/core/lib/iomgr/tcp_client_posix.c
  28. 42
      src/core/lib/iomgr/tcp_posix.c
  29. 2
      src/core/lib/iomgr/tcp_posix.h
  30. 18
      src/core/lib/iomgr/tcp_server_posix.c
  31. 8
      src/core/lib/security/credentials/google_default/google_default_credentials.c
  32. 16
      src/core/lib/security/credentials/jwt/jwt_verifier.c
  33. 18
      src/core/lib/security/credentials/oauth2/oauth2_credentials.c
  34. 6
      src/core/lib/security/transport/secure_endpoint.c
  35. 4
      src/core/lib/surface/init.c
  36. 8
      src/cpp/common/channel_arguments.cc
  37. 14
      src/cpp/common/resource_quota_cc.cc
  38. 26
      src/cpp/server/server_builder.cc
  39. 2
      src/proto/grpc/testing/control.proto
  40. 2
      src/python/grpcio/grpc_core_dependencies.py
  41. 20
      src/ruby/ext/grpc/rb_grpc_imports.generated.c
  42. 30
      src/ruby/ext/grpc/rb_grpc_imports.generated.h
  43. 6
      test/core/bad_client/bad_client.c
  44. 16
      test/core/end2end/end2end_nosec_tests.c
  45. 16
      test/core/end2end/end2end_tests.c
  46. 6
      test/core/end2end/fixtures/h2_sockpair+trace.c
  47. 6
      test/core/end2end/fixtures/h2_sockpair.c
  48. 6
      test/core/end2end/fixtures/h2_sockpair_1byte.c
  49. 10
      test/core/end2end/fuzzers/api_fuzzer.c
  50. 6
      test/core/end2end/fuzzers/client_fuzzer.c
  51. 6
      test/core/end2end/fuzzers/server_fuzzer.c
  52. 2
      test/core/end2end/gen_build_yaml.py
  53. 17
      test/core/end2end/tests/buffer_pool_server.c
  54. 352
      test/core/end2end/tests/resource_quota_server.c
  55. 12
      test/core/http/httpcli_test.c
  56. 12
      test/core/http/httpscli_test.c
  57. 2
      test/core/internal_api_canaries/iomgr.c
  58. 6
      test/core/iomgr/endpoint_pair_test.c
  59. 8
      test/core/iomgr/fd_conservation_posix_test.c
  60. 382
      test/core/iomgr/resource_quota_test.c
  61. 37
      test/core/iomgr/tcp_posix_test.c
  62. 8
      test/core/security/secure_endpoint_test.c
  63. 18
      test/core/util/mock_endpoint.c
  64. 2
      test/core/util/mock_endpoint.h
  65. 20
      test/core/util/passthru_endpoint.c
  66. 2
      test/core/util/passthru_endpoint.h
  67. 24
      test/core/util/port_server_client.c
  68. 15
      test/cpp/end2end/end2end_test.cc
  69. 8
      test/cpp/qps/server_async.cc
  70. 8
      test/cpp/qps/server_sync.cc
  71. 2
      tools/doxygen/Doxyfile.c++
  72. 4
      tools/doxygen/Doxyfile.c++.internal
  73. 4
      tools/doxygen/Doxyfile.core.internal
  74. 10
      tools/run_tests/performance/scenario_config.py
  75. 50
      tools/run_tests/sources_and_headers.json
  76. 848
      tools/run_tests/tests.json
  77. 54
      vsprojects/buildtests_c.sln
  78. 6
      vsprojects/vcxproj/grpc++/grpc++.vcxproj
  79. 12
      vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters
  80. 6
      vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj
  81. 12
      vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters
  82. 6
      vsprojects/vcxproj/grpc/grpc.vcxproj
  83. 12
      vsprojects/vcxproj/grpc/grpc.vcxproj.filters
  84. 6
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
  85. 12
      vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
  86. 6
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
  87. 12
      vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
  88. 4
      vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj
  89. 6
      vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters
  90. 4
      vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj
  91. 6
      vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters
  92. 8
      vsprojects/vcxproj/test/resource_quota_test/resource_quota_test.vcxproj
  93. 8
      vsprojects/vcxproj/test/resource_quota_test/resource_quota_test.vcxproj.filters

24
BUILD

@ -179,7 +179,6 @@ cc_library(
"src/core/lib/http/format_request.h", "src/core/lib/http/format_request.h",
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.h", "src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint.h",
@ -203,6 +202,7 @@ cc_library(
"src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_set_windows.h",
"src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/pollset_windows.h",
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.h", "src/core/lib/iomgr/sockaddr_utils.h",
@ -341,7 +341,6 @@ cc_library(
"src/core/lib/http/format_request.c", "src/core/lib/http/format_request.c",
"src/core/lib/http/httpcli.c", "src/core/lib/http/httpcli.c",
"src/core/lib/http/parser.c", "src/core/lib/http/parser.c",
"src/core/lib/iomgr/buffer_pool.c",
"src/core/lib/iomgr/closure.c", "src/core/lib/iomgr/closure.c",
"src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint.c",
@ -365,6 +364,7 @@ cc_library(
"src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.c",
"src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_posix.c",
"src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/resolve_address_windows.c",
"src/core/lib/iomgr/resource_quota.c",
"src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/sockaddr_utils.c",
"src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_linux.c",
@ -583,7 +583,6 @@ cc_library(
"src/core/lib/http/format_request.h", "src/core/lib/http/format_request.h",
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.h", "src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint.h",
@ -607,6 +606,7 @@ cc_library(
"src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_set_windows.h",
"src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/pollset_windows.h",
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.h", "src/core/lib/iomgr/sockaddr_utils.h",
@ -730,7 +730,6 @@ cc_library(
"src/core/lib/http/format_request.c", "src/core/lib/http/format_request.c",
"src/core/lib/http/httpcli.c", "src/core/lib/http/httpcli.c",
"src/core/lib/http/parser.c", "src/core/lib/http/parser.c",
"src/core/lib/iomgr/buffer_pool.c",
"src/core/lib/iomgr/closure.c", "src/core/lib/iomgr/closure.c",
"src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint.c",
@ -754,6 +753,7 @@ cc_library(
"src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.c",
"src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_posix.c",
"src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/resolve_address_windows.c",
"src/core/lib/iomgr/resource_quota.c",
"src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/sockaddr_utils.c",
"src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_linux.c",
@ -942,7 +942,6 @@ cc_library(
"src/core/lib/http/format_request.h", "src/core/lib/http/format_request.h",
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.h", "src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint.h",
@ -966,6 +965,7 @@ cc_library(
"src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_set_windows.h",
"src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/pollset_windows.h",
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.h", "src/core/lib/iomgr/sockaddr_utils.h",
@ -1081,7 +1081,6 @@ cc_library(
"src/core/lib/http/format_request.c", "src/core/lib/http/format_request.c",
"src/core/lib/http/httpcli.c", "src/core/lib/http/httpcli.c",
"src/core/lib/http/parser.c", "src/core/lib/http/parser.c",
"src/core/lib/iomgr/buffer_pool.c",
"src/core/lib/iomgr/closure.c", "src/core/lib/iomgr/closure.c",
"src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint.c",
@ -1105,6 +1104,7 @@ cc_library(
"src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.c",
"src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_posix.c",
"src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/resolve_address_windows.c",
"src/core/lib/iomgr/resource_quota.c",
"src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/sockaddr_utils.c",
"src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_linux.c",
@ -1296,11 +1296,11 @@ cc_library(
"src/cpp/client/create_channel_posix.cc", "src/cpp/client/create_channel_posix.cc",
"src/cpp/client/credentials_cc.cc", "src/cpp/client/credentials_cc.cc",
"src/cpp/client/generic_stub.cc", "src/cpp/client/generic_stub.cc",
"src/cpp/common/buffer_pool_cc.cc",
"src/cpp/common/channel_arguments.cc", "src/cpp/common/channel_arguments.cc",
"src/cpp/common/channel_filter.cc", "src/cpp/common/channel_filter.cc",
"src/cpp/common/completion_queue_cc.cc", "src/cpp/common/completion_queue_cc.cc",
"src/cpp/common/core_codegen.cc", "src/cpp/common/core_codegen.cc",
"src/cpp/common/resource_quota_cc.cc",
"src/cpp/common/rpc_method.cc", "src/cpp/common/rpc_method.cc",
"src/cpp/server/async_generic_service.cc", "src/cpp/server/async_generic_service.cc",
"src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/create_default_thread_pool.cc",
@ -1319,7 +1319,6 @@ cc_library(
], ],
hdrs = [ hdrs = [
"include/grpc++/alarm.h", "include/grpc++/alarm.h",
"include/grpc++/buffer_pool.h",
"include/grpc++/channel.h", "include/grpc++/channel.h",
"include/grpc++/client_context.h", "include/grpc++/client_context.h",
"include/grpc++/completion_queue.h", "include/grpc++/completion_queue.h",
@ -1346,6 +1345,7 @@ cc_library(
"include/grpc++/impl/thd.h", "include/grpc++/impl/thd.h",
"include/grpc++/impl/thd_cxx11.h", "include/grpc++/impl/thd_cxx11.h",
"include/grpc++/impl/thd_no_cxx11.h", "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h", "include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h", "include/grpc++/security/auth_metadata_processor.h",
"include/grpc++/security/credentials.h", "include/grpc++/security/credentials.h",
@ -1520,11 +1520,11 @@ cc_library(
"src/cpp/client/create_channel_posix.cc", "src/cpp/client/create_channel_posix.cc",
"src/cpp/client/credentials_cc.cc", "src/cpp/client/credentials_cc.cc",
"src/cpp/client/generic_stub.cc", "src/cpp/client/generic_stub.cc",
"src/cpp/common/buffer_pool_cc.cc",
"src/cpp/common/channel_arguments.cc", "src/cpp/common/channel_arguments.cc",
"src/cpp/common/channel_filter.cc", "src/cpp/common/channel_filter.cc",
"src/cpp/common/completion_queue_cc.cc", "src/cpp/common/completion_queue_cc.cc",
"src/cpp/common/core_codegen.cc", "src/cpp/common/core_codegen.cc",
"src/cpp/common/resource_quota_cc.cc",
"src/cpp/common/rpc_method.cc", "src/cpp/common/rpc_method.cc",
"src/cpp/server/async_generic_service.cc", "src/cpp/server/async_generic_service.cc",
"src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/create_default_thread_pool.cc",
@ -1543,7 +1543,6 @@ cc_library(
], ],
hdrs = [ hdrs = [
"include/grpc++/alarm.h", "include/grpc++/alarm.h",
"include/grpc++/buffer_pool.h",
"include/grpc++/channel.h", "include/grpc++/channel.h",
"include/grpc++/client_context.h", "include/grpc++/client_context.h",
"include/grpc++/completion_queue.h", "include/grpc++/completion_queue.h",
@ -1570,6 +1569,7 @@ cc_library(
"include/grpc++/impl/thd.h", "include/grpc++/impl/thd.h",
"include/grpc++/impl/thd_cxx11.h", "include/grpc++/impl/thd_cxx11.h",
"include/grpc++/impl/thd_no_cxx11.h", "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h", "include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h", "include/grpc++/security/auth_metadata_processor.h",
"include/grpc++/security/credentials.h", "include/grpc++/security/credentials.h",
@ -1849,7 +1849,6 @@ objc_library(
"src/core/lib/http/format_request.c", "src/core/lib/http/format_request.c",
"src/core/lib/http/httpcli.c", "src/core/lib/http/httpcli.c",
"src/core/lib/http/parser.c", "src/core/lib/http/parser.c",
"src/core/lib/iomgr/buffer_pool.c",
"src/core/lib/iomgr/closure.c", "src/core/lib/iomgr/closure.c",
"src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/combiner.c",
"src/core/lib/iomgr/endpoint.c", "src/core/lib/iomgr/endpoint.c",
@ -1873,6 +1872,7 @@ objc_library(
"src/core/lib/iomgr/pollset_windows.c", "src/core/lib/iomgr/pollset_windows.c",
"src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_posix.c",
"src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/resolve_address_windows.c",
"src/core/lib/iomgr/resource_quota.c",
"src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/sockaddr_utils.c",
"src/core/lib/iomgr/socket_utils_common_posix.c", "src/core/lib/iomgr/socket_utils_common_posix.c",
"src/core/lib/iomgr/socket_utils_linux.c", "src/core/lib/iomgr/socket_utils_linux.c",
@ -2070,7 +2070,6 @@ objc_library(
"src/core/lib/http/format_request.h", "src/core/lib/http/format_request.h",
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.h", "src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint.h",
@ -2094,6 +2093,7 @@ objc_library(
"src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_set_windows.h",
"src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/pollset_windows.h",
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.h", "src/core/lib/iomgr/sockaddr_utils.h",

@ -306,7 +306,6 @@ add_library(grpc
src/core/lib/http/format_request.c src/core/lib/http/format_request.c
src/core/lib/http/httpcli.c src/core/lib/http/httpcli.c
src/core/lib/http/parser.c src/core/lib/http/parser.c
src/core/lib/iomgr/buffer_pool.c
src/core/lib/iomgr/closure.c src/core/lib/iomgr/closure.c
src/core/lib/iomgr/combiner.c src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint.c
@ -330,6 +329,7 @@ add_library(grpc
src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/pollset_windows.c
src/core/lib/iomgr/resolve_address_posix.c src/core/lib/iomgr/resolve_address_posix.c
src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/resolve_address_windows.c
src/core/lib/iomgr/resource_quota.c
src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/sockaddr_utils.c
src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_linux.c
@ -566,7 +566,6 @@ add_library(grpc_cronet
src/core/lib/http/format_request.c src/core/lib/http/format_request.c
src/core/lib/http/httpcli.c src/core/lib/http/httpcli.c
src/core/lib/http/parser.c src/core/lib/http/parser.c
src/core/lib/iomgr/buffer_pool.c
src/core/lib/iomgr/closure.c src/core/lib/iomgr/closure.c
src/core/lib/iomgr/combiner.c src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint.c
@ -590,6 +589,7 @@ add_library(grpc_cronet
src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/pollset_windows.c
src/core/lib/iomgr/resolve_address_posix.c src/core/lib/iomgr/resolve_address_posix.c
src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/resolve_address_windows.c
src/core/lib/iomgr/resource_quota.c
src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/sockaddr_utils.c
src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_linux.c
@ -798,7 +798,6 @@ add_library(grpc_unsecure
src/core/lib/http/format_request.c src/core/lib/http/format_request.c
src/core/lib/http/httpcli.c src/core/lib/http/httpcli.c
src/core/lib/http/parser.c src/core/lib/http/parser.c
src/core/lib/iomgr/buffer_pool.c
src/core/lib/iomgr/closure.c src/core/lib/iomgr/closure.c
src/core/lib/iomgr/combiner.c src/core/lib/iomgr/combiner.c
src/core/lib/iomgr/endpoint.c src/core/lib/iomgr/endpoint.c
@ -822,6 +821,7 @@ add_library(grpc_unsecure
src/core/lib/iomgr/pollset_windows.c src/core/lib/iomgr/pollset_windows.c
src/core/lib/iomgr/resolve_address_posix.c src/core/lib/iomgr/resolve_address_posix.c
src/core/lib/iomgr/resolve_address_windows.c src/core/lib/iomgr/resolve_address_windows.c
src/core/lib/iomgr/resource_quota.c
src/core/lib/iomgr/sockaddr_utils.c src/core/lib/iomgr/sockaddr_utils.c
src/core/lib/iomgr/socket_utils_common_posix.c src/core/lib/iomgr/socket_utils_common_posix.c
src/core/lib/iomgr/socket_utils_linux.c src/core/lib/iomgr/socket_utils_linux.c
@ -1023,11 +1023,11 @@ add_library(grpc++
src/cpp/client/create_channel_posix.cc src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc src/cpp/client/credentials_cc.cc
src/cpp/client/generic_stub.cc src/cpp/client/generic_stub.cc
src/cpp/common/buffer_pool_cc.cc
src/cpp/common/channel_arguments.cc src/cpp/common/channel_arguments.cc
src/cpp/common/channel_filter.cc src/cpp/common/channel_filter.cc
src/cpp/common/completion_queue_cc.cc src/cpp/common/completion_queue_cc.cc
src/cpp/common/core_codegen.cc src/cpp/common/core_codegen.cc
src/cpp/common/resource_quota_cc.cc
src/cpp/common/rpc_method.cc src/cpp/common/rpc_method.cc
src/cpp/server/async_generic_service.cc src/cpp/server/async_generic_service.cc
src/cpp/server/create_default_thread_pool.cc src/cpp/server/create_default_thread_pool.cc
@ -1063,7 +1063,6 @@ target_link_libraries(grpc++
foreach(_hdr foreach(_hdr
include/grpc++/alarm.h include/grpc++/alarm.h
include/grpc++/buffer_pool.h
include/grpc++/channel.h include/grpc++/channel.h
include/grpc++/client_context.h include/grpc++/client_context.h
include/grpc++/completion_queue.h include/grpc++/completion_queue.h
@ -1090,6 +1089,7 @@ foreach(_hdr
include/grpc++/impl/thd.h include/grpc++/impl/thd.h
include/grpc++/impl/thd_cxx11.h include/grpc++/impl/thd_cxx11.h
include/grpc++/impl/thd_no_cxx11.h include/grpc++/impl/thd_no_cxx11.h
include/grpc++/resource_quota.h
include/grpc++/security/auth_context.h include/grpc++/security/auth_context.h
include/grpc++/security/auth_metadata_processor.h include/grpc++/security/auth_metadata_processor.h
include/grpc++/security/credentials.h include/grpc++/security/credentials.h
@ -1279,11 +1279,11 @@ add_library(grpc++_unsecure
src/cpp/client/create_channel_posix.cc src/cpp/client/create_channel_posix.cc
src/cpp/client/credentials_cc.cc src/cpp/client/credentials_cc.cc
src/cpp/client/generic_stub.cc src/cpp/client/generic_stub.cc
src/cpp/common/buffer_pool_cc.cc
src/cpp/common/channel_arguments.cc src/cpp/common/channel_arguments.cc
src/cpp/common/channel_filter.cc src/cpp/common/channel_filter.cc
src/cpp/common/completion_queue_cc.cc src/cpp/common/completion_queue_cc.cc
src/cpp/common/core_codegen.cc src/cpp/common/core_codegen.cc
src/cpp/common/resource_quota_cc.cc
src/cpp/common/rpc_method.cc src/cpp/common/rpc_method.cc
src/cpp/server/async_generic_service.cc src/cpp/server/async_generic_service.cc
src/cpp/server/create_default_thread_pool.cc src/cpp/server/create_default_thread_pool.cc
@ -1319,7 +1319,6 @@ target_link_libraries(grpc++_unsecure
foreach(_hdr foreach(_hdr
include/grpc++/alarm.h include/grpc++/alarm.h
include/grpc++/buffer_pool.h
include/grpc++/channel.h include/grpc++/channel.h
include/grpc++/client_context.h include/grpc++/client_context.h
include/grpc++/completion_queue.h include/grpc++/completion_queue.h
@ -1346,6 +1345,7 @@ foreach(_hdr
include/grpc++/impl/thd.h include/grpc++/impl/thd.h
include/grpc++/impl/thd_cxx11.h include/grpc++/impl/thd_cxx11.h
include/grpc++/impl/thd_no_cxx11.h include/grpc++/impl/thd_no_cxx11.h
include/grpc++/resource_quota.h
include/grpc++/security/auth_context.h include/grpc++/security/auth_context.h
include/grpc++/security/auth_metadata_processor.h include/grpc++/security/auth_metadata_processor.h
include/grpc++/security/credentials.h include/grpc++/security/credentials.h

@ -907,7 +907,6 @@ api_fuzzer: $(BINDIR)/$(CONFIG)/api_fuzzer
bad_server_response_test: $(BINDIR)/$(CONFIG)/bad_server_response_test bad_server_response_test: $(BINDIR)/$(CONFIG)/bad_server_response_test
bin_decoder_test: $(BINDIR)/$(CONFIG)/bin_decoder_test bin_decoder_test: $(BINDIR)/$(CONFIG)/bin_decoder_test
bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test bin_encoder_test: $(BINDIR)/$(CONFIG)/bin_encoder_test
buffer_pool_test: $(BINDIR)/$(CONFIG)/buffer_pool_test
census_context_test: $(BINDIR)/$(CONFIG)/census_context_test census_context_test: $(BINDIR)/$(CONFIG)/census_context_test
census_resource_test: $(BINDIR)/$(CONFIG)/census_resource_test census_resource_test: $(BINDIR)/$(CONFIG)/census_resource_test
census_trace_context_test: $(BINDIR)/$(CONFIG)/census_trace_context_test census_trace_context_test: $(BINDIR)/$(CONFIG)/census_trace_context_test
@ -1003,6 +1002,7 @@ no_server_test: $(BINDIR)/$(CONFIG)/no_server_test
percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer
percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer
resolve_address_test: $(BINDIR)/$(CONFIG)/resolve_address_test resolve_address_test: $(BINDIR)/$(CONFIG)/resolve_address_test
resource_quota_test: $(BINDIR)/$(CONFIG)/resource_quota_test
secure_channel_create_test: $(BINDIR)/$(CONFIG)/secure_channel_create_test secure_channel_create_test: $(BINDIR)/$(CONFIG)/secure_channel_create_test
secure_endpoint_test: $(BINDIR)/$(CONFIG)/secure_endpoint_test secure_endpoint_test: $(BINDIR)/$(CONFIG)/secure_endpoint_test
sequential_connectivity_test: $(BINDIR)/$(CONFIG)/sequential_connectivity_test sequential_connectivity_test: $(BINDIR)/$(CONFIG)/sequential_connectivity_test
@ -1242,7 +1242,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/bad_server_response_test \ $(BINDIR)/$(CONFIG)/bad_server_response_test \
$(BINDIR)/$(CONFIG)/bin_decoder_test \ $(BINDIR)/$(CONFIG)/bin_decoder_test \
$(BINDIR)/$(CONFIG)/bin_encoder_test \ $(BINDIR)/$(CONFIG)/bin_encoder_test \
$(BINDIR)/$(CONFIG)/buffer_pool_test \
$(BINDIR)/$(CONFIG)/census_context_test \ $(BINDIR)/$(CONFIG)/census_context_test \
$(BINDIR)/$(CONFIG)/census_resource_test \ $(BINDIR)/$(CONFIG)/census_resource_test \
$(BINDIR)/$(CONFIG)/census_trace_context_test \ $(BINDIR)/$(CONFIG)/census_trace_context_test \
@ -1322,6 +1321,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/murmur_hash_test \ $(BINDIR)/$(CONFIG)/murmur_hash_test \
$(BINDIR)/$(CONFIG)/no_server_test \ $(BINDIR)/$(CONFIG)/no_server_test \
$(BINDIR)/$(CONFIG)/resolve_address_test \ $(BINDIR)/$(CONFIG)/resolve_address_test \
$(BINDIR)/$(CONFIG)/resource_quota_test \
$(BINDIR)/$(CONFIG)/secure_channel_create_test \ $(BINDIR)/$(CONFIG)/secure_channel_create_test \
$(BINDIR)/$(CONFIG)/secure_endpoint_test \ $(BINDIR)/$(CONFIG)/secure_endpoint_test \
$(BINDIR)/$(CONFIG)/sequential_connectivity_test \ $(BINDIR)/$(CONFIG)/sequential_connectivity_test \
@ -1560,8 +1560,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/bin_decoder_test || ( echo test bin_decoder_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/bin_decoder_test || ( echo test bin_decoder_test failed ; exit 1 )
$(E) "[RUN] Testing bin_encoder_test" $(E) "[RUN] Testing bin_encoder_test"
$(Q) $(BINDIR)/$(CONFIG)/bin_encoder_test || ( echo test bin_encoder_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/bin_encoder_test || ( echo test bin_encoder_test failed ; exit 1 )
$(E) "[RUN] Testing buffer_pool_test"
$(Q) $(BINDIR)/$(CONFIG)/buffer_pool_test || ( echo test buffer_pool_test failed ; exit 1 )
$(E) "[RUN] Testing census_context_test" $(E) "[RUN] Testing census_context_test"
$(Q) $(BINDIR)/$(CONFIG)/census_context_test || ( echo test census_context_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/census_context_test || ( echo test census_context_test failed ; exit 1 )
$(E) "[RUN] Testing census_resource_test" $(E) "[RUN] Testing census_resource_test"
@ -1702,6 +1700,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/no_server_test || ( echo test no_server_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/no_server_test || ( echo test no_server_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_test" $(E) "[RUN] Testing resolve_address_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_test || ( echo test resolve_address_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/resolve_address_test || ( echo test resolve_address_test failed ; exit 1 )
$(E) "[RUN] Testing resource_quota_test"
$(Q) $(BINDIR)/$(CONFIG)/resource_quota_test || ( echo test resource_quota_test failed ; exit 1 )
$(E) "[RUN] Testing secure_channel_create_test" $(E) "[RUN] Testing secure_channel_create_test"
$(Q) $(BINDIR)/$(CONFIG)/secure_channel_create_test || ( echo test secure_channel_create_test failed ; exit 1 ) $(Q) $(BINDIR)/$(CONFIG)/secure_channel_create_test || ( echo test secure_channel_create_test failed ; exit 1 )
$(E) "[RUN] Testing secure_endpoint_test" $(E) "[RUN] Testing secure_endpoint_test"
@ -2558,7 +2558,6 @@ LIBGRPC_SRC = \
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -2582,6 +2581,7 @@ LIBGRPC_SRC = \
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \
@ -2836,7 +2836,6 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -2860,6 +2859,7 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \
@ -3104,7 +3104,6 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -3128,6 +3127,7 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \
@ -3299,7 +3299,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -3323,6 +3322,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \
@ -3607,11 +3607,11 @@ LIBGRPC++_SRC = \
src/cpp/client/create_channel_posix.cc \ src/cpp/client/create_channel_posix.cc \
src/cpp/client/credentials_cc.cc \ src/cpp/client/credentials_cc.cc \
src/cpp/client/generic_stub.cc \ src/cpp/client/generic_stub.cc \
src/cpp/common/buffer_pool_cc.cc \
src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_arguments.cc \
src/cpp/common/channel_filter.cc \ src/cpp/common/channel_filter.cc \
src/cpp/common/completion_queue_cc.cc \ src/cpp/common/completion_queue_cc.cc \
src/cpp/common/core_codegen.cc \ src/cpp/common/core_codegen.cc \
src/cpp/common/resource_quota_cc.cc \
src/cpp/common/rpc_method.cc \ src/cpp/common/rpc_method.cc \
src/cpp/server/async_generic_service.cc \ src/cpp/server/async_generic_service.cc \
src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/create_default_thread_pool.cc \
@ -3630,7 +3630,6 @@ LIBGRPC++_SRC = \
PUBLIC_HEADERS_CXX += \ PUBLIC_HEADERS_CXX += \
include/grpc++/alarm.h \ include/grpc++/alarm.h \
include/grpc++/buffer_pool.h \
include/grpc++/channel.h \ include/grpc++/channel.h \
include/grpc++/client_context.h \ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \ include/grpc++/completion_queue.h \
@ -3657,6 +3656,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/thd.h \ include/grpc++/impl/thd.h \
include/grpc++/impl/thd_cxx11.h \ include/grpc++/impl/thd_cxx11.h \
include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \ include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \ include/grpc++/security/auth_metadata_processor.h \
include/grpc++/security/credentials.h \ include/grpc++/security/credentials.h \
@ -4139,11 +4139,11 @@ LIBGRPC++_UNSECURE_SRC = \
src/cpp/client/create_channel_posix.cc \ src/cpp/client/create_channel_posix.cc \
src/cpp/client/credentials_cc.cc \ src/cpp/client/credentials_cc.cc \
src/cpp/client/generic_stub.cc \ src/cpp/client/generic_stub.cc \
src/cpp/common/buffer_pool_cc.cc \
src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_arguments.cc \
src/cpp/common/channel_filter.cc \ src/cpp/common/channel_filter.cc \
src/cpp/common/completion_queue_cc.cc \ src/cpp/common/completion_queue_cc.cc \
src/cpp/common/core_codegen.cc \ src/cpp/common/core_codegen.cc \
src/cpp/common/resource_quota_cc.cc \
src/cpp/common/rpc_method.cc \ src/cpp/common/rpc_method.cc \
src/cpp/server/async_generic_service.cc \ src/cpp/server/async_generic_service.cc \
src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/create_default_thread_pool.cc \
@ -4162,7 +4162,6 @@ LIBGRPC++_UNSECURE_SRC = \
PUBLIC_HEADERS_CXX += \ PUBLIC_HEADERS_CXX += \
include/grpc++/alarm.h \ include/grpc++/alarm.h \
include/grpc++/buffer_pool.h \
include/grpc++/channel.h \ include/grpc++/channel.h \
include/grpc++/client_context.h \ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \ include/grpc++/completion_queue.h \
@ -4189,6 +4188,7 @@ PUBLIC_HEADERS_CXX += \
include/grpc++/impl/thd.h \ include/grpc++/impl/thd.h \
include/grpc++/impl/thd_cxx11.h \ include/grpc++/impl/thd_cxx11.h \
include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \ include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \ include/grpc++/security/auth_metadata_processor.h \
include/grpc++/security/credentials.h \ include/grpc++/security/credentials.h \
@ -6590,7 +6590,6 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/end2end_tests.c \ test/core/end2end/end2end_tests.c \
test/core/end2end/tests/bad_hostname.c \ test/core/end2end/tests/bad_hostname.c \
test/core/end2end/tests/binary_metadata.c \ test/core/end2end/tests/binary_metadata.c \
test/core/end2end/tests/buffer_pool_server.c \
test/core/end2end/tests/call_creds.c \ test/core/end2end/tests/call_creds.c \
test/core/end2end/tests/cancel_after_accept.c \ test/core/end2end/tests/cancel_after_accept.c \
test/core/end2end/tests/cancel_after_client_done.c \ test/core/end2end/tests/cancel_after_client_done.c \
@ -6624,6 +6623,7 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/tests/registered_call.c \ test/core/end2end/tests/registered_call.c \
test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_flags.c \
test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/request_with_payload.c \
test/core/end2end/tests/resource_quota_server.c \
test/core/end2end/tests/server_finishes_request.c \ test/core/end2end/tests/server_finishes_request.c \
test/core/end2end/tests/shutdown_finishes_calls.c \ test/core/end2end/tests/shutdown_finishes_calls.c \
test/core/end2end/tests/shutdown_finishes_tags.c \ test/core/end2end/tests/shutdown_finishes_tags.c \
@ -6674,7 +6674,6 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/end2end_nosec_tests.c \ test/core/end2end/end2end_nosec_tests.c \
test/core/end2end/tests/bad_hostname.c \ test/core/end2end/tests/bad_hostname.c \
test/core/end2end/tests/binary_metadata.c \ test/core/end2end/tests/binary_metadata.c \
test/core/end2end/tests/buffer_pool_server.c \
test/core/end2end/tests/cancel_after_accept.c \ test/core/end2end/tests/cancel_after_accept.c \
test/core/end2end/tests/cancel_after_client_done.c \ test/core/end2end/tests/cancel_after_client_done.c \
test/core/end2end/tests/cancel_after_invoke.c \ test/core/end2end/tests/cancel_after_invoke.c \
@ -6707,6 +6706,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/tests/registered_call.c \ test/core/end2end/tests/registered_call.c \
test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_flags.c \
test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/request_with_payload.c \
test/core/end2end/tests/resource_quota_server.c \
test/core/end2end/tests/server_finishes_request.c \ test/core/end2end/tests/server_finishes_request.c \
test/core/end2end/tests/shutdown_finishes_calls.c \ test/core/end2end/tests/shutdown_finishes_calls.c \
test/core/end2end/tests/shutdown_finishes_tags.c \ test/core/end2end/tests/shutdown_finishes_tags.c \
@ -6999,38 +6999,6 @@ endif
endif endif
BUFFER_POOL_TEST_SRC = \
test/core/iomgr/buffer_pool_test.c \
BUFFER_POOL_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(BUFFER_POOL_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/buffer_pool_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/buffer_pool_test: $(BUFFER_POOL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(BUFFER_POOL_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/buffer_pool_test
endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/buffer_pool_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_buffer_pool_test: $(BUFFER_POOL_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(BUFFER_POOL_TEST_OBJS:.o=.dep)
endif
endif
CENSUS_CONTEXT_TEST_SRC = \ CENSUS_CONTEXT_TEST_SRC = \
test/core/census/context_test.c \ test/core/census/context_test.c \
@ -10071,6 +10039,38 @@ endif
endif endif
RESOURCE_QUOTA_TEST_SRC = \
test/core/iomgr/resource_quota_test.c \
RESOURCE_QUOTA_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RESOURCE_QUOTA_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/resource_quota_test: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/resource_quota_test: $(RESOURCE_QUOTA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(RESOURCE_QUOTA_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/resource_quota_test
endif
$(OBJDIR)/$(CONFIG)/test/core/iomgr/resource_quota_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_resource_quota_test: $(RESOURCE_QUOTA_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(RESOURCE_QUOTA_TEST_OBJS:.o=.dep)
endif
endif
SECURE_CHANNEL_CREATE_TEST_SRC = \ SECURE_CHANNEL_CREATE_TEST_SRC = \
test/core/surface/secure_channel_create_test.c \ test/core/surface/secure_channel_create_test.c \

@ -581,7 +581,6 @@
'src/core/lib/http/format_request.c', 'src/core/lib/http/format_request.c',
'src/core/lib/http/httpcli.c', 'src/core/lib/http/httpcli.c',
'src/core/lib/http/parser.c', 'src/core/lib/http/parser.c',
'src/core/lib/iomgr/buffer_pool.c',
'src/core/lib/iomgr/closure.c', 'src/core/lib/iomgr/closure.c',
'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint.c',
@ -605,6 +604,7 @@
'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/pollset_windows.c',
'src/core/lib/iomgr/resolve_address_posix.c', 'src/core/lib/iomgr/resolve_address_posix.c',
'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/resolve_address_windows.c',
'src/core/lib/iomgr/resource_quota.c',
'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/sockaddr_utils.c',
'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_linux.c',

@ -183,7 +183,6 @@ filegroups:
- src/core/lib/http/format_request.h - src/core/lib/http/format_request.h
- src/core/lib/http/httpcli.h - src/core/lib/http/httpcli.h
- src/core/lib/http/parser.h - src/core/lib/http/parser.h
- src/core/lib/iomgr/buffer_pool.h
- src/core/lib/iomgr/closure.h - src/core/lib/iomgr/closure.h
- src/core/lib/iomgr/combiner.h - src/core/lib/iomgr/combiner.h
- src/core/lib/iomgr/endpoint.h - src/core/lib/iomgr/endpoint.h
@ -207,6 +206,7 @@ filegroups:
- src/core/lib/iomgr/pollset_set_windows.h - src/core/lib/iomgr/pollset_set_windows.h
- src/core/lib/iomgr/pollset_windows.h - src/core/lib/iomgr/pollset_windows.h
- src/core/lib/iomgr/resolve_address.h - src/core/lib/iomgr/resolve_address.h
- src/core/lib/iomgr/resource_quota.h
- src/core/lib/iomgr/sockaddr.h - src/core/lib/iomgr/sockaddr.h
- src/core/lib/iomgr/sockaddr_posix.h - src/core/lib/iomgr/sockaddr_posix.h
- src/core/lib/iomgr/sockaddr_utils.h - src/core/lib/iomgr/sockaddr_utils.h
@ -268,7 +268,6 @@ filegroups:
- src/core/lib/http/format_request.c - src/core/lib/http/format_request.c
- src/core/lib/http/httpcli.c - src/core/lib/http/httpcli.c
- src/core/lib/http/parser.c - src/core/lib/http/parser.c
- src/core/lib/iomgr/buffer_pool.c
- src/core/lib/iomgr/closure.c - src/core/lib/iomgr/closure.c
- src/core/lib/iomgr/combiner.c - src/core/lib/iomgr/combiner.c
- src/core/lib/iomgr/endpoint.c - src/core/lib/iomgr/endpoint.c
@ -292,6 +291,7 @@ filegroups:
- src/core/lib/iomgr/pollset_windows.c - src/core/lib/iomgr/pollset_windows.c
- src/core/lib/iomgr/resolve_address_posix.c - src/core/lib/iomgr/resolve_address_posix.c
- src/core/lib/iomgr/resolve_address_windows.c - src/core/lib/iomgr/resolve_address_windows.c
- src/core/lib/iomgr/resource_quota.c
- src/core/lib/iomgr/sockaddr_utils.c - src/core/lib/iomgr/sockaddr_utils.c
- src/core/lib/iomgr/socket_utils_common_posix.c - src/core/lib/iomgr/socket_utils_common_posix.c
- src/core/lib/iomgr/socket_utils_linux.c - src/core/lib/iomgr/socket_utils_linux.c
@ -667,7 +667,6 @@ filegroups:
language: c++ language: c++
public_headers: public_headers:
- include/grpc++/alarm.h - include/grpc++/alarm.h
- include/grpc++/buffer_pool.h
- include/grpc++/channel.h - include/grpc++/channel.h
- include/grpc++/client_context.h - include/grpc++/client_context.h
- include/grpc++/completion_queue.h - include/grpc++/completion_queue.h
@ -694,6 +693,7 @@ filegroups:
- include/grpc++/impl/thd.h - include/grpc++/impl/thd.h
- include/grpc++/impl/thd_cxx11.h - include/grpc++/impl/thd_cxx11.h
- include/grpc++/impl/thd_no_cxx11.h - include/grpc++/impl/thd_no_cxx11.h
- include/grpc++/resource_quota.h
- include/grpc++/security/auth_context.h - include/grpc++/security/auth_context.h
- include/grpc++/security/auth_metadata_processor.h - include/grpc++/security/auth_metadata_processor.h
- include/grpc++/security/credentials.h - include/grpc++/security/credentials.h
@ -727,11 +727,11 @@ filegroups:
- src/cpp/client/create_channel_posix.cc - src/cpp/client/create_channel_posix.cc
- src/cpp/client/credentials_cc.cc - src/cpp/client/credentials_cc.cc
- src/cpp/client/generic_stub.cc - src/cpp/client/generic_stub.cc
- src/cpp/common/buffer_pool_cc.cc
- src/cpp/common/channel_arguments.cc - src/cpp/common/channel_arguments.cc
- src/cpp/common/channel_filter.cc - src/cpp/common/channel_filter.cc
- src/cpp/common/completion_queue_cc.cc - src/cpp/common/completion_queue_cc.cc
- src/cpp/common/core_codegen.cc - src/cpp/common/core_codegen.cc
- src/cpp/common/resource_quota_cc.cc
- src/cpp/common/rpc_method.cc - src/cpp/common/rpc_method.cc
- src/cpp/server/async_generic_service.cc - src/cpp/server/async_generic_service.cc
- src/cpp/server/create_default_thread_pool.cc - src/cpp/server/create_default_thread_pool.cc
@ -1345,17 +1345,6 @@ targets:
deps: deps:
- grpc_test_util - grpc_test_util
- grpc - grpc
- name: buffer_pool_test
cpu_cost: 30
build: test
language: c
src:
- test/core/iomgr/buffer_pool_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: census_context_test - name: census_context_test
build: test build: test
language: c language: c
@ -2343,6 +2332,17 @@ targets:
- grpc - grpc
- gpr_test_util - gpr_test_util
- gpr - gpr
- name: resource_quota_test
cpu_cost: 30
build: test
language: c
src:
- test/core/iomgr/resource_quota_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: secure_channel_create_test - name: secure_channel_create_test
build: test build: test
language: c language: c

@ -100,7 +100,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -124,6 +123,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \

@ -266,7 +266,6 @@ Pod::Spec.new do |s|
'src/core/lib/http/format_request.h', 'src/core/lib/http/format_request.h',
'src/core/lib/http/httpcli.h', 'src/core/lib/http/httpcli.h',
'src/core/lib/http/parser.h', 'src/core/lib/http/parser.h',
'src/core/lib/iomgr/buffer_pool.h',
'src/core/lib/iomgr/closure.h', 'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/combiner.h', 'src/core/lib/iomgr/combiner.h',
'src/core/lib/iomgr/endpoint.h', 'src/core/lib/iomgr/endpoint.h',
@ -290,6 +289,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/pollset_set_windows.h', 'src/core/lib/iomgr/pollset_set_windows.h',
'src/core/lib/iomgr/pollset_windows.h', 'src/core/lib/iomgr/pollset_windows.h',
'src/core/lib/iomgr/resolve_address.h', 'src/core/lib/iomgr/resolve_address.h',
'src/core/lib/iomgr/resource_quota.h',
'src/core/lib/iomgr/sockaddr.h', 'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_posix.h', 'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h', 'src/core/lib/iomgr/sockaddr_utils.h',
@ -432,7 +432,6 @@ Pod::Spec.new do |s|
'src/core/lib/http/format_request.c', 'src/core/lib/http/format_request.c',
'src/core/lib/http/httpcli.c', 'src/core/lib/http/httpcli.c',
'src/core/lib/http/parser.c', 'src/core/lib/http/parser.c',
'src/core/lib/iomgr/buffer_pool.c',
'src/core/lib/iomgr/closure.c', 'src/core/lib/iomgr/closure.c',
'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint.c',
@ -456,6 +455,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/pollset_windows.c',
'src/core/lib/iomgr/resolve_address_posix.c', 'src/core/lib/iomgr/resolve_address_posix.c',
'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/resolve_address_windows.c',
'src/core/lib/iomgr/resource_quota.c',
'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/sockaddr_utils.c',
'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_linux.c',
@ -642,7 +642,6 @@ Pod::Spec.new do |s|
'src/core/lib/http/format_request.h', 'src/core/lib/http/format_request.h',
'src/core/lib/http/httpcli.h', 'src/core/lib/http/httpcli.h',
'src/core/lib/http/parser.h', 'src/core/lib/http/parser.h',
'src/core/lib/iomgr/buffer_pool.h',
'src/core/lib/iomgr/closure.h', 'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/combiner.h', 'src/core/lib/iomgr/combiner.h',
'src/core/lib/iomgr/endpoint.h', 'src/core/lib/iomgr/endpoint.h',
@ -666,6 +665,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/pollset_set_windows.h', 'src/core/lib/iomgr/pollset_set_windows.h',
'src/core/lib/iomgr/pollset_windows.h', 'src/core/lib/iomgr/pollset_windows.h',
'src/core/lib/iomgr/resolve_address.h', 'src/core/lib/iomgr/resolve_address.h',
'src/core/lib/iomgr/resource_quota.h',
'src/core/lib/iomgr/sockaddr.h', 'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_posix.h', 'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h', 'src/core/lib/iomgr/sockaddr_utils.h',

@ -94,11 +94,11 @@ EXPORTS
grpc_header_nonbin_value_is_legal grpc_header_nonbin_value_is_legal
grpc_is_binary_header grpc_is_binary_header
grpc_call_error_to_string grpc_call_error_to_string
grpc_buffer_pool_create grpc_resource_quota_create
grpc_buffer_pool_ref grpc_resource_quota_ref
grpc_buffer_pool_unref grpc_resource_quota_unref
grpc_buffer_pool_resize grpc_resource_quota_resize
grpc_buffer_pool_arg_vtable grpc_resource_quota_arg_vtable
grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd
grpc_server_add_insecure_channel_from_fd grpc_server_add_insecure_channel_from_fd
grpc_use_signal grpc_use_signal

@ -186,7 +186,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/http/format_request.h ) s.files += %w( src/core/lib/http/format_request.h )
s.files += %w( src/core/lib/http/httpcli.h ) s.files += %w( src/core/lib/http/httpcli.h )
s.files += %w( src/core/lib/http/parser.h ) s.files += %w( src/core/lib/http/parser.h )
s.files += %w( src/core/lib/iomgr/buffer_pool.h )
s.files += %w( src/core/lib/iomgr/closure.h ) s.files += %w( src/core/lib/iomgr/closure.h )
s.files += %w( src/core/lib/iomgr/combiner.h ) s.files += %w( src/core/lib/iomgr/combiner.h )
s.files += %w( src/core/lib/iomgr/endpoint.h ) s.files += %w( src/core/lib/iomgr/endpoint.h )
@ -210,6 +209,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/pollset_set_windows.h ) s.files += %w( src/core/lib/iomgr/pollset_set_windows.h )
s.files += %w( src/core/lib/iomgr/pollset_windows.h ) s.files += %w( src/core/lib/iomgr/pollset_windows.h )
s.files += %w( src/core/lib/iomgr/resolve_address.h ) s.files += %w( src/core/lib/iomgr/resolve_address.h )
s.files += %w( src/core/lib/iomgr/resource_quota.h )
s.files += %w( src/core/lib/iomgr/sockaddr.h ) s.files += %w( src/core/lib/iomgr/sockaddr.h )
s.files += %w( src/core/lib/iomgr/sockaddr_posix.h ) s.files += %w( src/core/lib/iomgr/sockaddr_posix.h )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.h ) s.files += %w( src/core/lib/iomgr/sockaddr_utils.h )
@ -352,7 +352,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/http/format_request.c ) s.files += %w( src/core/lib/http/format_request.c )
s.files += %w( src/core/lib/http/httpcli.c ) s.files += %w( src/core/lib/http/httpcli.c )
s.files += %w( src/core/lib/http/parser.c ) s.files += %w( src/core/lib/http/parser.c )
s.files += %w( src/core/lib/iomgr/buffer_pool.c )
s.files += %w( src/core/lib/iomgr/closure.c ) s.files += %w( src/core/lib/iomgr/closure.c )
s.files += %w( src/core/lib/iomgr/combiner.c ) s.files += %w( src/core/lib/iomgr/combiner.c )
s.files += %w( src/core/lib/iomgr/endpoint.c ) s.files += %w( src/core/lib/iomgr/endpoint.c )
@ -376,6 +375,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/pollset_windows.c ) s.files += %w( src/core/lib/iomgr/pollset_windows.c )
s.files += %w( src/core/lib/iomgr/resolve_address_posix.c ) s.files += %w( src/core/lib/iomgr/resolve_address_posix.c )
s.files += %w( src/core/lib/iomgr/resolve_address_windows.c ) s.files += %w( src/core/lib/iomgr/resolve_address_windows.c )
s.files += %w( src/core/lib/iomgr/resource_quota.c )
s.files += %w( src/core/lib/iomgr/sockaddr_utils.c ) s.files += %w( src/core/lib/iomgr/sockaddr_utils.c )
s.files += %w( src/core/lib/iomgr/socket_utils_common_posix.c ) s.files += %w( src/core/lib/iomgr/socket_utils_common_posix.c )
s.files += %w( src/core/lib/iomgr/socket_utils_linux.c ) s.files += %w( src/core/lib/iomgr/socket_utils_linux.c )

@ -34,35 +34,35 @@
#ifndef GRPCXX_BUFFER_POOL_H #ifndef GRPCXX_BUFFER_POOL_H
#define GRPCXX_BUFFER_POOL_H #define GRPCXX_BUFFER_POOL_H
struct grpc_buffer_pool; struct grpc_resource_quota;
#include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/config.h>
namespace grpc { namespace grpc {
/// BufferPool represents a bound on memory usage by the gRPC library. /// ResourceQuota represents a bound on memory usage by the gRPC library.
/// A BufferPool can be attached to a server (via ServerBuilder), or a client /// A ResourceQuota can be attached to a server (via ServerBuilder), or a client
/// channel (via ChannelArguments). gRPC will attempt to keep memory used by /// channel (via ChannelArguments). gRPC will attempt to keep memory used by
/// all attached entities below the BufferPool bound. /// all attached entities below the ResourceQuota bound.
class BufferPool GRPC_FINAL { class ResourceQuota GRPC_FINAL {
public: public:
explicit BufferPool(const grpc::string& name); explicit ResourceQuota(const grpc::string& name);
BufferPool(); ResourceQuota();
~BufferPool(); ~ResourceQuota();
/// Resize this BufferPool to a new size. If new_size is smaller than the /// Resize this ResourceQuota to a new size. If new_size is smaller than the
/// current size of the pool, memory usage will be monotonically decreased /// current size of the pool, memory usage will be monotonically decreased
/// until it falls under new_size. No time bound is given for this to occur /// until it falls under new_size. No time bound is given for this to occur
/// however. /// however.
BufferPool& Resize(size_t new_size); ResourceQuota& Resize(size_t new_size);
grpc_buffer_pool* c_buffer_pool() const { return impl_; } grpc_resource_quota* c_resource_quota() const { return impl_; }
private: private:
BufferPool(const BufferPool& rhs); ResourceQuota(const ResourceQuota& rhs);
BufferPool& operator=(const BufferPool& rhs); ResourceQuota& operator=(const ResourceQuota& rhs);
grpc_buffer_pool* const impl_; grpc_resource_quota* const impl_;
}; };
} // namespace grpc } // namespace grpc

@ -43,12 +43,12 @@
#include <grpc++/support/config.h> #include <grpc++/support/config.h>
#include <grpc/compression.h> #include <grpc/compression.h>
struct grpc_buffer_pool; struct grpc_resource_quota;
namespace grpc { namespace grpc {
class AsyncGenericService; class AsyncGenericService;
class BufferPool; class ResourceQuota;
class CompletionQueue; class CompletionQueue;
class RpcService; class RpcService;
class Server; class Server;
@ -118,7 +118,7 @@ class ServerBuilder {
grpc_compression_algorithm algorithm); grpc_compression_algorithm algorithm);
/// Set the attached buffer pool for this server /// Set the attached buffer pool for this server
ServerBuilder& SetBufferPool(const BufferPool& buffer_pool); ServerBuilder& SetResourceQuota(const ResourceQuota& resource_quota);
ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option); ServerBuilder& SetOption(std::unique_ptr<ServerBuilderOption> option);
@ -194,7 +194,7 @@ class ServerBuilder {
std::vector<ServerCompletionQueue*> cqs_; std::vector<ServerCompletionQueue*> cqs_;
std::shared_ptr<ServerCredentials> creds_; std::shared_ptr<ServerCredentials> creds_;
std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_; std::vector<std::unique_ptr<ServerBuilderPlugin>> plugins_;
grpc_buffer_pool* buffer_pool_; grpc_resource_quota* resource_quota_;
AsyncGenericService* generic_service_; AsyncGenericService* generic_service_;
struct { struct {
bool is_set; bool is_set;

@ -46,7 +46,7 @@ namespace testing {
class ChannelArgumentsTest; class ChannelArgumentsTest;
} // namespace testing } // namespace testing
class BufferPool; class ResourceQuota;
/// Options for channel creation. The user can use generic setters to pass /// Options for channel creation. The user can use generic setters to pass
/// key value pairs down to c channel creation code. For grpc related options, /// key value pairs down to c channel creation code. For grpc related options,
@ -83,7 +83,7 @@ class ChannelArguments {
void SetUserAgentPrefix(const grpc::string& user_agent_prefix); void SetUserAgentPrefix(const grpc::string& user_agent_prefix);
/// The given buffer pool will be attached to the constructed channel /// The given buffer pool will be attached to the constructed channel
void SetBufferPool(const BufferPool& buffer_pool); void SetResourceQuota(const ResourceQuota& resource_quota);
// Generic channel argument setters. Only for advanced use cases. // Generic channel argument setters. Only for advanced use cases.
/// Set an integer argument \a value under \a key. /// Set an integer argument \a value under \a key.

@ -402,20 +402,21 @@ GRPCAPI int grpc_is_binary_header(const char *key, size_t length);
GRPCAPI const char *grpc_call_error_to_string(grpc_call_error error); GRPCAPI const char *grpc_call_error_to_string(grpc_call_error error);
/** Create a buffer pool */ /** Create a buffer pool */
GRPCAPI grpc_buffer_pool *grpc_buffer_pool_create(const char *trace_name); GRPCAPI grpc_resource_quota *grpc_resource_quota_create(const char *trace_name);
/** Add a reference to a buffer pool */ /** Add a reference to a buffer pool */
GRPCAPI void grpc_buffer_pool_ref(grpc_buffer_pool *buffer_pool); GRPCAPI void grpc_resource_quota_ref(grpc_resource_quota *resource_quota);
/** Drop a reference to a buffer pool */ /** Drop a reference to a buffer pool */
GRPCAPI void grpc_buffer_pool_unref(grpc_buffer_pool *buffer_pool); GRPCAPI void grpc_resource_quota_unref(grpc_resource_quota *resource_quota);
/** Update the size of a buffer pool */ /** Update the size of a buffer pool */
GRPCAPI void grpc_buffer_pool_resize(grpc_buffer_pool *buffer_pool, GRPCAPI void grpc_resource_quota_resize(grpc_resource_quota *resource_quota,
size_t new_size); size_t new_size);
/** Fetch a vtable for a grpc_channel_arg that points to a grpc_buffer_pool */ /** Fetch a vtable for a grpc_channel_arg that points to a grpc_resource_quota
GRPCAPI const grpc_arg_pointer_vtable *grpc_buffer_pool_arg_vtable(void); */
GRPCAPI const grpc_arg_pointer_vtable *grpc_resource_quota_arg_vtable(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -201,9 +201,10 @@ typedef struct {
#define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size" #define GRPC_ARG_MAX_METADATA_SIZE "grpc.max_metadata_size"
/** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */ /** If non-zero, allow the use of SO_REUSEPORT if it's available (default 1) */
#define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport" #define GRPC_ARG_ALLOW_REUSEPORT "grpc.so_reuseport"
/** If non-zero, a pointer to a buffer pool (use grpc_buffer_pool_arg_vtable to /** If non-zero, a pointer to a buffer pool (use grpc_resource_quota_arg_vtable
to
fetch an appropriate pointer arg vtable */ fetch an appropriate pointer arg vtable */
#define GRPC_ARG_BUFFER_POOL "grpc.buffer_pool" #define GRPC_ARG_BUFFER_POOL "grpc.resource_quota"
/** \} */ /** \} */
/** Result of a grpc call. If the caller satisfies the prerequisites of a /** Result of a grpc call. If the caller satisfies the prerequisites of a
@ -460,7 +461,7 @@ typedef struct grpc_op {
} data; } data;
} grpc_op; } grpc_op;
typedef struct grpc_buffer_pool grpc_buffer_pool; typedef struct grpc_resource_quota grpc_resource_quota;
#ifdef __cplusplus #ifdef __cplusplus
} }

@ -193,7 +193,6 @@
<file baseinstalldir="/" name="src/core/lib/http/format_request.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/format_request.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/http/httpcli.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/httpcli.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/http/parser.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/parser.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/buffer_pool.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/closure.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/closure.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/combiner.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/combiner.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.h" role="src" />
@ -217,6 +216,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_set_windows.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/pollset_set_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_windows.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/pollset_windows.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resource_quota.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_posix.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_posix.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.h" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.h" role="src" />
@ -359,7 +359,6 @@
<file baseinstalldir="/" name="src/core/lib/http/format_request.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/format_request.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/http/httpcli.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/httpcli.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/http/parser.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/http/parser.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/buffer_pool.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/closure.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/closure.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/combiner.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/combiner.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/endpoint.c" role="src" />
@ -383,6 +382,7 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/pollset_windows.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/pollset_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address_posix.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address_windows.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/resolve_address_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/resource_quota.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/sockaddr_utils.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_utils_common_posix.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/socket_utils_common_posix.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/socket_utils_linux.c" role="src" /> <file baseinstalldir="/" name="src/core/lib/iomgr/socket_utils_linux.c" role="src" />

@ -57,12 +57,12 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server *server,
char *name; char *name;
gpr_asprintf(&name, "fd:%d", fd); gpr_asprintf(&name, "fd:%d", fd);
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_from_channel_args(grpc_server_get_channel_args(server)); grpc_resource_quota_from_channel_args(grpc_server_get_channel_args(server));
grpc_endpoint *server_endpoint = grpc_endpoint *server_endpoint =
grpc_tcp_create(grpc_fd_create(fd, name), buffer_pool, grpc_tcp_create(grpc_fd_create(fd, name), resource_quota,
GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name); GRPC_TCP_DEFAULT_READ_SLICE_SIZE, name);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_free(name); gpr_free(name);

@ -2115,9 +2115,9 @@ static void post_benign_reclaimer(grpc_exec_ctx *exec_ctx,
if (!t->benign_reclaimer_registered) { if (!t->benign_reclaimer_registered) {
t->benign_reclaimer_registered = true; t->benign_reclaimer_registered = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer"); GRPC_CHTTP2_REF_TRANSPORT(t, "benign_reclaimer");
grpc_buffer_user_post_reclaimer(exec_ctx, grpc_resource_user_post_reclaimer(exec_ctx,
grpc_endpoint_get_buffer_user(t->ep), false, grpc_endpoint_get_resource_user(t->ep),
&t->benign_reclaimer); false, &t->benign_reclaimer);
} }
} }
@ -2126,9 +2126,9 @@ static void post_destructive_reclaimer(grpc_exec_ctx *exec_ctx,
if (!t->destructive_reclaimer_registered) { if (!t->destructive_reclaimer_registered) {
t->destructive_reclaimer_registered = true; t->destructive_reclaimer_registered = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer"); GRPC_CHTTP2_REF_TRANSPORT(t, "destructive_reclaimer");
grpc_buffer_user_post_reclaimer(exec_ctx, grpc_resource_user_post_reclaimer(exec_ctx,
grpc_endpoint_get_buffer_user(t->ep), true, grpc_endpoint_get_resource_user(t->ep),
&t->destructive_reclaimer); true, &t->destructive_reclaimer);
} }
} }
@ -2151,13 +2151,13 @@ static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
grpc_chttp2_transport *t = arg; grpc_chttp2_transport *t = arg;
if (error == GRPC_ERROR_NONE && if (error == GRPC_ERROR_NONE &&
grpc_chttp2_stream_map_size(&t->stream_map) == 0) { grpc_chttp2_stream_map_size(&t->stream_map) == 0) {
if (grpc_buffer_pool_trace) { if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "HTTP2: %s - send goaway to free memory", gpr_log(GPR_DEBUG, "HTTP2: %s - send goaway to free memory",
t->peer_string); t->peer_string);
} }
send_goaway(exec_ctx, t, GRPC_CHTTP2_ENHANCE_YOUR_CALM, send_goaway(exec_ctx, t, GRPC_CHTTP2_ENHANCE_YOUR_CALM,
gpr_slice_from_static_string("Buffers full")); gpr_slice_from_static_string("Buffers full"));
} else if (error == GRPC_ERROR_NONE && grpc_buffer_pool_trace) { } else if (error == GRPC_ERROR_NONE && grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, gpr_log(GPR_DEBUG,
"HTTP2: %s - skip benign reclaimation, there are still %" PRIdPTR "HTTP2: %s - skip benign reclaimation, there are still %" PRIdPTR
" streams", " streams",
@ -2165,8 +2165,8 @@ static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
} }
t->benign_reclaimer_registered = false; t->benign_reclaimer_registered = false;
if (error != GRPC_ERROR_CANCELLED) { if (error != GRPC_ERROR_CANCELLED) {
grpc_buffer_user_finish_reclaimation(exec_ctx, grpc_resource_user_finish_reclaimation(
grpc_endpoint_get_buffer_user(t->ep)); exec_ctx, grpc_endpoint_get_resource_user(t->ep));
} }
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "benign_reclaimer"); GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "benign_reclaimer");
} }
@ -2178,7 +2178,7 @@ static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
t->destructive_reclaimer_registered = false; t->destructive_reclaimer_registered = false;
if (error == GRPC_ERROR_NONE && n > 0) { if (error == GRPC_ERROR_NONE && n > 0) {
grpc_chttp2_stream *s = grpc_chttp2_stream_map_rand(&t->stream_map); grpc_chttp2_stream *s = grpc_chttp2_stream_map_rand(&t->stream_map);
if (grpc_buffer_pool_trace) { if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "HTTP2: %s - abandon stream id %d", t->peer_string, gpr_log(GPR_DEBUG, "HTTP2: %s - abandon stream id %d", t->peer_string,
s->id); s->id);
} }
@ -2191,8 +2191,8 @@ static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
} }
} }
if (error != GRPC_ERROR_CANCELLED) { if (error != GRPC_ERROR_CANCELLED) {
grpc_buffer_user_finish_reclaimation(exec_ctx, grpc_resource_user_finish_reclaimation(
grpc_endpoint_get_buffer_user(t->ep)); exec_ctx, grpc_endpoint_get_resource_user(t->ep));
} }
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destructive_reclaimer"); GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "destructive_reclaimer");
} }

@ -71,7 +71,7 @@ typedef struct {
grpc_closure done_write; grpc_closure done_write;
grpc_closure connected; grpc_closure connected;
grpc_error *overall_error; grpc_error *overall_error;
grpc_buffer_pool *buffer_pool; grpc_resource_quota *resource_quota;
} internal_request; } internal_request;
static grpc_httpcli_get_override g_get_override = NULL; static grpc_httpcli_get_override g_get_override = NULL;
@ -119,7 +119,7 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
gpr_slice_buffer_destroy(&req->incoming); gpr_slice_buffer_destroy(&req->incoming);
gpr_slice_buffer_destroy(&req->outgoing); gpr_slice_buffer_destroy(&req->outgoing);
GRPC_ERROR_UNREF(req->overall_error); GRPC_ERROR_UNREF(req->overall_error);
grpc_buffer_pool_internal_unref(exec_ctx, req->buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, req->resource_quota);
gpr_free(req); gpr_free(req);
} }
@ -229,8 +229,8 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req,
grpc_arg arg; grpc_arg arg;
arg.key = GRPC_ARG_BUFFER_POOL; arg.key = GRPC_ARG_BUFFER_POOL;
arg.type = GRPC_ARG_POINTER; arg.type = GRPC_ARG_POINTER;
arg.value.pointer.p = req->buffer_pool; arg.value.pointer.p = req->resource_quota;
arg.value.pointer.vtable = grpc_buffer_pool_arg_vtable(); arg.value.pointer.vtable = grpc_resource_quota_arg_vtable();
grpc_channel_args args = {1, &arg}; grpc_channel_args args = {1, &arg};
grpc_tcp_client_connect( grpc_tcp_client_connect(
exec_ctx, &req->connected, &req->ep, req->context->pollset_set, &args, exec_ctx, &req->connected, &req->ep, req->context->pollset_set, &args,
@ -250,7 +250,7 @@ static void on_resolved(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
static void internal_request_begin(grpc_exec_ctx *exec_ctx, static void internal_request_begin(grpc_exec_ctx *exec_ctx,
grpc_httpcli_context *context, grpc_httpcli_context *context,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_buffer_pool *buffer_pool, grpc_resource_quota *resource_quota,
const grpc_httpcli_request *request, const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_closure *on_done, gpr_timespec deadline, grpc_closure *on_done,
grpc_httpcli_response *response, grpc_httpcli_response *response,
@ -266,7 +266,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
req->context = context; req->context = context;
req->pollent = pollent; req->pollent = pollent;
req->overall_error = GRPC_ERROR_NONE; req->overall_error = GRPC_ERROR_NONE;
req->buffer_pool = grpc_buffer_pool_internal_ref(buffer_pool); req->resource_quota = grpc_resource_quota_internal_ref(resource_quota);
grpc_closure_init(&req->on_read, on_read, req); grpc_closure_init(&req->on_read, on_read, req);
grpc_closure_init(&req->done_write, done_write, req); grpc_closure_init(&req->done_write, done_write, req);
gpr_slice_buffer_init(&req->incoming); gpr_slice_buffer_init(&req->incoming);
@ -284,7 +284,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context, void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_buffer_pool *buffer_pool, grpc_resource_quota *resource_quota,
const grpc_httpcli_request *request, const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_closure *on_done, gpr_timespec deadline, grpc_closure *on_done,
grpc_httpcli_response *response) { grpc_httpcli_response *response) {
@ -294,7 +294,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
return; return;
} }
gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->http.path); gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->http.path);
internal_request_begin(exec_ctx, context, pollent, buffer_pool, request, internal_request_begin(exec_ctx, context, pollent, resource_quota, request,
deadline, on_done, response, name, deadline, on_done, response, name,
grpc_httpcli_format_get_request(request)); grpc_httpcli_format_get_request(request));
gpr_free(name); gpr_free(name);
@ -302,7 +302,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context, void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_buffer_pool *buffer_pool, grpc_resource_quota *resource_quota,
const grpc_httpcli_request *request, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size, const char *body_bytes, size_t body_size,
gpr_timespec deadline, grpc_closure *on_done, gpr_timespec deadline, grpc_closure *on_done,
@ -315,7 +315,7 @@ void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
} }
gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->http.path); gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->http.path);
internal_request_begin( internal_request_begin(
exec_ctx, context, pollent, buffer_pool, request, deadline, on_done, exec_ctx, context, pollent, resource_quota, request, deadline, on_done,
response, name, response, name,
grpc_httpcli_format_post_request(request, body_bytes, body_size)); grpc_httpcli_format_post_request(request, body_bytes, body_size));
gpr_free(name); gpr_free(name);

@ -96,7 +96,7 @@ void grpc_httpcli_context_destroy(grpc_httpcli_context *context);
'on_response' is a callback to report results to */ 'on_response' is a callback to report results to */
void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context, void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_buffer_pool *buffer_pool, grpc_resource_quota *resource_quota,
const grpc_httpcli_request *request, const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_closure *on_complete, gpr_timespec deadline, grpc_closure *on_complete,
grpc_httpcli_response *response); grpc_httpcli_response *response);
@ -117,7 +117,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
Does not support ?var1=val1&var2=val2 in the path. */ Does not support ?var1=val1&var2=val2 in the path. */
void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context, void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
grpc_polling_entity *pollent, grpc_polling_entity *pollent,
grpc_buffer_pool *buffer_pool, grpc_resource_quota *resource_quota,
const grpc_httpcli_request *request, const grpc_httpcli_request *request,
const char *body_bytes, size_t body_size, const char *body_bytes, size_t body_size,
gpr_timespec deadline, grpc_closure *on_complete, gpr_timespec deadline, grpc_closure *on_complete,

@ -1,684 +0,0 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/buffer_pool.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/iomgr/combiner.h"
int grpc_buffer_pool_trace = 0;
typedef bool (*bpstate_func)(grpc_exec_ctx *exec_ctx,
grpc_buffer_pool *buffer_pool);
typedef struct {
grpc_buffer_user *head;
grpc_buffer_user *tail;
} grpc_buffer_user_list;
struct grpc_buffer_pool {
gpr_refcount refs;
grpc_combiner *combiner;
int64_t size;
int64_t free_pool;
bool step_scheduled;
bool reclaiming;
grpc_closure bpstep_closure;
grpc_closure bpreclaimation_done_closure;
grpc_buffer_user *roots[GRPC_BULIST_COUNT];
char *name;
};
/*******************************************************************************
* list management
*/
static void bulist_add_tail(grpc_buffer_user *buffer_user, grpc_bulist list) {
grpc_buffer_pool *buffer_pool = buffer_user->buffer_pool;
grpc_buffer_user **root = &buffer_pool->roots[list];
if (*root == NULL) {
*root = buffer_user;
buffer_user->links[list].next = buffer_user->links[list].prev = buffer_user;
} else {
buffer_user->links[list].next = *root;
buffer_user->links[list].prev = (*root)->links[list].prev;
buffer_user->links[list].next->links[list].prev =
buffer_user->links[list].prev->links[list].next = buffer_user;
}
}
static void bulist_add_head(grpc_buffer_user *buffer_user, grpc_bulist list) {
grpc_buffer_pool *buffer_pool = buffer_user->buffer_pool;
grpc_buffer_user **root = &buffer_pool->roots[list];
if (*root == NULL) {
*root = buffer_user;
buffer_user->links[list].next = buffer_user->links[list].prev = buffer_user;
} else {
buffer_user->links[list].next = (*root)->links[list].next;
buffer_user->links[list].prev = *root;
buffer_user->links[list].next->links[list].prev =
buffer_user->links[list].prev->links[list].next = buffer_user;
*root = buffer_user;
}
}
static bool bulist_empty(grpc_buffer_pool *buffer_pool, grpc_bulist list) {
return buffer_pool->roots[list] == NULL;
}
static grpc_buffer_user *bulist_pop(grpc_buffer_pool *buffer_pool,
grpc_bulist list) {
grpc_buffer_user **root = &buffer_pool->roots[list];
grpc_buffer_user *buffer_user = *root;
if (buffer_user == NULL) {
return NULL;
}
if (buffer_user->links[list].next == buffer_user) {
*root = NULL;
} else {
buffer_user->links[list].next->links[list].prev =
buffer_user->links[list].prev;
buffer_user->links[list].prev->links[list].next =
buffer_user->links[list].next;
*root = buffer_user->links[list].next;
}
buffer_user->links[list].next = buffer_user->links[list].prev = NULL;
return buffer_user;
}
static void bulist_remove(grpc_buffer_user *buffer_user, grpc_bulist list) {
if (buffer_user->links[list].next == NULL) return;
grpc_buffer_pool *buffer_pool = buffer_user->buffer_pool;
if (buffer_pool->roots[list] == buffer_user) {
buffer_pool->roots[list] = buffer_user->links[list].next;
if (buffer_pool->roots[list] == buffer_user) {
buffer_pool->roots[list] = NULL;
}
}
buffer_user->links[list].next->links[list].prev =
buffer_user->links[list].prev;
buffer_user->links[list].prev->links[list].next =
buffer_user->links[list].next;
}
/*******************************************************************************
* buffer pool state machine
*/
static bool bpalloc(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool);
static bool bpscavenge(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool);
static bool bpreclaim(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool,
bool destructive);
static void bpstep(grpc_exec_ctx *exec_ctx, void *bp, grpc_error *error) {
grpc_buffer_pool *buffer_pool = bp;
buffer_pool->step_scheduled = false;
do {
if (bpalloc(exec_ctx, buffer_pool)) goto done;
} while (bpscavenge(exec_ctx, buffer_pool));
bpreclaim(exec_ctx, buffer_pool, false) ||
bpreclaim(exec_ctx, buffer_pool, true);
done:
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
}
static void bpstep_sched(grpc_exec_ctx *exec_ctx,
grpc_buffer_pool *buffer_pool) {
if (buffer_pool->step_scheduled) return;
buffer_pool->step_scheduled = true;
grpc_buffer_pool_internal_ref(buffer_pool);
grpc_combiner_execute_finally(exec_ctx, buffer_pool->combiner,
&buffer_pool->bpstep_closure, GRPC_ERROR_NONE,
false);
}
/* returns true if all allocations are completed */
static bool bpalloc(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool) {
grpc_buffer_user *buffer_user;
while ((buffer_user =
bulist_pop(buffer_pool, GRPC_BULIST_AWAITING_ALLOCATION))) {
gpr_mu_lock(&buffer_user->mu);
if (buffer_user->free_pool < 0 &&
-buffer_user->free_pool <= buffer_pool->free_pool) {
int64_t amt = -buffer_user->free_pool;
buffer_user->free_pool = 0;
buffer_pool->free_pool -= amt;
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: grant alloc %" PRId64
" bytes; bp_free_pool -> %" PRId64,
buffer_pool->name, buffer_user->name, amt,
buffer_pool->free_pool);
}
} else if (grpc_buffer_pool_trace && buffer_user->free_pool >= 0) {
gpr_log(GPR_DEBUG, "BP %s %s: discard already satisfied alloc request",
buffer_pool->name, buffer_user->name);
}
if (buffer_user->free_pool >= 0) {
buffer_user->allocating = false;
grpc_exec_ctx_enqueue_list(exec_ctx, &buffer_user->on_allocated, NULL);
gpr_mu_unlock(&buffer_user->mu);
} else {
bulist_add_head(buffer_user, GRPC_BULIST_AWAITING_ALLOCATION);
gpr_mu_unlock(&buffer_user->mu);
return false;
}
}
return true;
}
/* returns true if any memory could be reclaimed from buffers */
static bool bpscavenge(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool) {
grpc_buffer_user *buffer_user;
while ((buffer_user =
bulist_pop(buffer_pool, GRPC_BULIST_NON_EMPTY_FREE_POOL))) {
gpr_mu_lock(&buffer_user->mu);
if (buffer_user->free_pool > 0) {
int64_t amt = buffer_user->free_pool;
buffer_user->free_pool = 0;
buffer_pool->free_pool += amt;
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: scavenge %" PRId64
" bytes; bp_free_pool -> %" PRId64,
buffer_pool->name, buffer_user->name, amt,
buffer_pool->free_pool);
}
gpr_mu_unlock(&buffer_user->mu);
return true;
} else {
gpr_mu_unlock(&buffer_user->mu);
}
}
return false;
}
/* returns true if reclaimation is proceeding */
static bool bpreclaim(grpc_exec_ctx *exec_ctx, grpc_buffer_pool *buffer_pool,
bool destructive) {
if (buffer_pool->reclaiming) return true;
grpc_bulist list = destructive ? GRPC_BULIST_RECLAIMER_DESTRUCTIVE
: GRPC_BULIST_RECLAIMER_BENIGN;
grpc_buffer_user *buffer_user = bulist_pop(buffer_pool, list);
if (buffer_user == NULL) return false;
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: initiate %s reclaimation", buffer_pool->name,
buffer_user->name, destructive ? "destructive" : "benign");
}
buffer_pool->reclaiming = true;
grpc_buffer_pool_internal_ref(buffer_pool);
grpc_closure *c = buffer_user->reclaimers[destructive];
buffer_user->reclaimers[destructive] = NULL;
grpc_closure_run(exec_ctx, c, GRPC_ERROR_NONE);
return true;
}
/*******************************************************************************
* bu_slice: a slice implementation that is backed by a grpc_buffer_user
*/
typedef struct {
gpr_slice_refcount base;
gpr_refcount refs;
grpc_buffer_user *buffer_user;
size_t size;
} bu_slice_refcount;
static void bu_slice_ref(void *p) {
bu_slice_refcount *rc = p;
gpr_ref(&rc->refs);
}
static void bu_slice_unref(void *p) {
bu_slice_refcount *rc = p;
if (gpr_unref(&rc->refs)) {
/* TODO(ctiller): this is dangerous, but I think safe for now:
we have no guarantee here that we're at a safe point for creating an
execution context, but we have no way of writing this code otherwise.
In the future: consider lifting gpr_slice to grpc, and offering an
internal_{ref,unref} pair that is execution context aware. Alternatively,
make exec_ctx be thread local and 'do the right thing' (whatever that is)
if NULL */
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, rc->buffer_user, rc->size);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(rc);
}
}
static gpr_slice bu_slice_create(grpc_buffer_user *buffer_user, size_t size) {
bu_slice_refcount *rc = gpr_malloc(sizeof(bu_slice_refcount) + size);
rc->base.ref = bu_slice_ref;
rc->base.unref = bu_slice_unref;
gpr_ref_init(&rc->refs, 1);
rc->buffer_user = buffer_user;
rc->size = size;
gpr_slice slice;
slice.refcount = &rc->base;
slice.data.refcounted.bytes = (uint8_t *)(rc + 1);
slice.data.refcounted.length = size;
return slice;
}
/*******************************************************************************
* grpc_buffer_pool internal implementation
*/
static void bu_allocate(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
grpc_buffer_user *buffer_user = bu;
if (bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_AWAITING_ALLOCATION)) {
bpstep_sched(exec_ctx, buffer_user->buffer_pool);
}
bulist_add_tail(buffer_user, GRPC_BULIST_AWAITING_ALLOCATION);
}
static void bu_add_to_free_pool(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_buffer_user *buffer_user = bu;
if (!bulist_empty(buffer_user->buffer_pool,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_NON_EMPTY_FREE_POOL)) {
bpstep_sched(exec_ctx, buffer_user->buffer_pool);
}
bulist_add_tail(buffer_user, GRPC_BULIST_NON_EMPTY_FREE_POOL);
}
static void bu_post_benign_reclaimer(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_buffer_user *buffer_user = bu;
if (!bulist_empty(buffer_user->buffer_pool,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_NON_EMPTY_FREE_POOL) &&
bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_RECLAIMER_BENIGN)) {
bpstep_sched(exec_ctx, buffer_user->buffer_pool);
}
bulist_add_tail(buffer_user, GRPC_BULIST_RECLAIMER_BENIGN);
}
static void bu_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_buffer_user *buffer_user = bu;
if (!bulist_empty(buffer_user->buffer_pool,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_NON_EMPTY_FREE_POOL) &&
bulist_empty(buffer_user->buffer_pool, GRPC_BULIST_RECLAIMER_BENIGN) &&
bulist_empty(buffer_user->buffer_pool,
GRPC_BULIST_RECLAIMER_DESTRUCTIVE)) {
bpstep_sched(exec_ctx, buffer_user->buffer_pool);
}
bulist_add_tail(buffer_user, GRPC_BULIST_RECLAIMER_DESTRUCTIVE);
}
static void bu_destroy(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
grpc_buffer_user *buffer_user = bu;
GPR_ASSERT(buffer_user->allocated == 0);
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
bulist_remove(buffer_user, (grpc_bulist)i);
}
grpc_exec_ctx_sched(exec_ctx, buffer_user->reclaimers[0],
GRPC_ERROR_CANCELLED, NULL);
grpc_exec_ctx_sched(exec_ctx, buffer_user->reclaimers[1],
GRPC_ERROR_CANCELLED, NULL);
grpc_exec_ctx_sched(exec_ctx, (grpc_closure *)gpr_atm_no_barrier_load(
&buffer_user->on_done_destroy_closure),
GRPC_ERROR_NONE, NULL);
if (buffer_user->free_pool != 0) {
buffer_user->buffer_pool->free_pool += buffer_user->free_pool;
bpstep_sched(exec_ctx, buffer_user->buffer_pool);
}
}
static void bu_allocated_slices(grpc_exec_ctx *exec_ctx, void *ts,
grpc_error *error) {
grpc_buffer_user_slice_allocator *slice_allocator = ts;
if (error == GRPC_ERROR_NONE) {
for (size_t i = 0; i < slice_allocator->count; i++) {
gpr_slice_buffer_add_indexed(slice_allocator->dest,
bu_slice_create(slice_allocator->buffer_user,
slice_allocator->length));
}
}
grpc_closure_run(exec_ctx, &slice_allocator->on_done, GRPC_ERROR_REF(error));
}
typedef struct {
int64_t size;
grpc_buffer_pool *buffer_pool;
grpc_closure closure;
} bp_resize_args;
static void bp_resize(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
bp_resize_args *a = args;
int64_t delta = a->size - a->buffer_pool->size;
a->buffer_pool->size += delta;
a->buffer_pool->free_pool += delta;
if (delta < 0 && a->buffer_pool->free_pool < 0) {
bpstep_sched(exec_ctx, a->buffer_pool);
} else if (delta > 0 &&
!bulist_empty(a->buffer_pool, GRPC_BULIST_AWAITING_ALLOCATION)) {
bpstep_sched(exec_ctx, a->buffer_pool);
}
grpc_buffer_pool_internal_unref(exec_ctx, a->buffer_pool);
gpr_free(a);
}
static void bp_reclaimation_done(grpc_exec_ctx *exec_ctx, void *bp,
grpc_error *error) {
grpc_buffer_pool *buffer_pool = bp;
buffer_pool->reclaiming = false;
bpstep_sched(exec_ctx, buffer_pool);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
}
/*******************************************************************************
* grpc_buffer_pool api
*/
grpc_buffer_pool *grpc_buffer_pool_create(const char *name) {
grpc_buffer_pool *buffer_pool = gpr_malloc(sizeof(*buffer_pool));
gpr_ref_init(&buffer_pool->refs, 1);
buffer_pool->combiner = grpc_combiner_create(NULL);
buffer_pool->free_pool = INT64_MAX;
buffer_pool->size = INT64_MAX;
buffer_pool->step_scheduled = false;
buffer_pool->reclaiming = false;
if (name != NULL) {
buffer_pool->name = gpr_strdup(name);
} else {
gpr_asprintf(&buffer_pool->name, "anonymous_pool_%" PRIxPTR,
(intptr_t)buffer_pool);
}
grpc_closure_init(&buffer_pool->bpstep_closure, bpstep, buffer_pool);
grpc_closure_init(&buffer_pool->bpreclaimation_done_closure,
bp_reclaimation_done, buffer_pool);
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
buffer_pool->roots[i] = NULL;
}
return buffer_pool;
}
void grpc_buffer_pool_internal_unref(grpc_exec_ctx *exec_ctx,
grpc_buffer_pool *buffer_pool) {
if (gpr_unref(&buffer_pool->refs)) {
grpc_combiner_destroy(exec_ctx, buffer_pool->combiner);
gpr_free(buffer_pool->name);
gpr_free(buffer_pool);
}
}
void grpc_buffer_pool_unref(grpc_buffer_pool *buffer_pool) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool);
grpc_exec_ctx_finish(&exec_ctx);
}
grpc_buffer_pool *grpc_buffer_pool_internal_ref(grpc_buffer_pool *buffer_pool) {
gpr_ref(&buffer_pool->refs);
return buffer_pool;
}
void grpc_buffer_pool_ref(grpc_buffer_pool *buffer_pool) {
grpc_buffer_pool_internal_ref(buffer_pool);
}
void grpc_buffer_pool_resize(grpc_buffer_pool *buffer_pool, size_t size) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
bp_resize_args *a = gpr_malloc(sizeof(*a));
a->buffer_pool = grpc_buffer_pool_internal_ref(buffer_pool);
a->size = (int64_t)size;
grpc_closure_init(&a->closure, bp_resize, a);
grpc_combiner_execute(&exec_ctx, buffer_pool->combiner, &a->closure,
GRPC_ERROR_NONE, false);
grpc_exec_ctx_finish(&exec_ctx);
}
/*******************************************************************************
* grpc_buffer_user channel args api
*/
grpc_buffer_pool *grpc_buffer_pool_from_channel_args(
const grpc_channel_args *channel_args) {
for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_BUFFER_POOL)) {
if (channel_args->args[i].type == GRPC_ARG_POINTER) {
return grpc_buffer_pool_internal_ref(
channel_args->args[i].value.pointer.p);
} else {
gpr_log(GPR_DEBUG, GRPC_ARG_BUFFER_POOL " should be a pointer");
}
}
}
return grpc_buffer_pool_create(NULL);
}
static void *bp_copy(void *bp) {
grpc_buffer_pool_ref(bp);
return bp;
}
static void bp_destroy(void *bp) { grpc_buffer_pool_unref(bp); }
static int bp_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
const grpc_arg_pointer_vtable *grpc_buffer_pool_arg_vtable(void) {
static const grpc_arg_pointer_vtable vtable = {bp_copy, bp_destroy, bp_cmp};
return &vtable;
}
/*******************************************************************************
* grpc_buffer_user api
*/
void grpc_buffer_user_init(grpc_buffer_user *buffer_user,
grpc_buffer_pool *buffer_pool, const char *name) {
buffer_user->buffer_pool = grpc_buffer_pool_internal_ref(buffer_pool);
grpc_closure_init(&buffer_user->allocate_closure, &bu_allocate, buffer_user);
grpc_closure_init(&buffer_user->add_to_free_pool_closure,
&bu_add_to_free_pool, buffer_user);
grpc_closure_init(&buffer_user->post_reclaimer_closure[0],
&bu_post_benign_reclaimer, buffer_user);
grpc_closure_init(&buffer_user->post_reclaimer_closure[1],
&bu_post_destructive_reclaimer, buffer_user);
grpc_closure_init(&buffer_user->destroy_closure, &bu_destroy, buffer_user);
gpr_mu_init(&buffer_user->mu);
buffer_user->allocated = 0;
buffer_user->free_pool = 0;
grpc_closure_list_init(&buffer_user->on_allocated);
buffer_user->allocating = false;
buffer_user->added_to_free_pool = false;
gpr_atm_no_barrier_store(&buffer_user->on_done_destroy_closure, 0);
buffer_user->reclaimers[0] = NULL;
buffer_user->reclaimers[1] = NULL;
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
buffer_user->links[i].next = buffer_user->links[i].prev = NULL;
}
#ifndef NDEBUG
buffer_user->asan_canary = gpr_malloc(1);
#endif
if (name != NULL) {
buffer_user->name = gpr_strdup(name);
} else {
gpr_asprintf(&buffer_user->name, "anonymous_buffer_user_%" PRIxPTR,
(intptr_t)buffer_user);
}
}
void grpc_buffer_user_shutdown(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user,
grpc_closure *on_done) {
gpr_mu_lock(&buffer_user->mu);
GPR_ASSERT(gpr_atm_no_barrier_load(&buffer_user->on_done_destroy_closure) ==
0);
gpr_atm_no_barrier_store(&buffer_user->on_done_destroy_closure,
(gpr_atm)on_done);
if (buffer_user->allocated == 0) {
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->destroy_closure, GRPC_ERROR_NONE,
false);
}
gpr_mu_unlock(&buffer_user->mu);
}
void grpc_buffer_user_destroy(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user) {
#ifndef NDEBUG
gpr_free(buffer_user->asan_canary);
#endif
grpc_buffer_pool_internal_unref(exec_ctx, buffer_user->buffer_pool);
gpr_mu_destroy(&buffer_user->mu);
gpr_free(buffer_user->name);
}
void grpc_buffer_user_alloc(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user, size_t size,
grpc_closure *optional_on_done) {
gpr_mu_lock(&buffer_user->mu);
grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load(
&buffer_user->on_done_destroy_closure);
if (on_done_destroy != NULL) {
/* already shutdown */
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: alloc %" PRIdPTR " after shutdown",
buffer_user->buffer_pool->name, buffer_user->name, size);
}
grpc_exec_ctx_sched(
exec_ctx, optional_on_done,
GRPC_ERROR_CREATE("Buffer pool user is already shutdown"), NULL);
gpr_mu_unlock(&buffer_user->mu);
return;
}
buffer_user->allocated += (int64_t)size;
buffer_user->free_pool -= (int64_t)size;
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: alloc %" PRIdPTR "; allocated -> %" PRId64
", free_pool -> %" PRId64,
buffer_user->buffer_pool->name, buffer_user->name, size,
buffer_user->allocated, buffer_user->free_pool);
}
if (buffer_user->free_pool < 0) {
grpc_closure_list_append(&buffer_user->on_allocated, optional_on_done,
GRPC_ERROR_NONE);
if (!buffer_user->allocating) {
buffer_user->allocating = true;
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->allocate_closure, GRPC_ERROR_NONE,
false);
}
} else {
grpc_exec_ctx_sched(exec_ctx, optional_on_done, GRPC_ERROR_NONE, NULL);
}
gpr_mu_unlock(&buffer_user->mu);
}
void grpc_buffer_user_free(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user, size_t size) {
gpr_mu_lock(&buffer_user->mu);
GPR_ASSERT(buffer_user->allocated >= (int64_t)size);
bool was_zero_or_negative = buffer_user->free_pool <= 0;
buffer_user->free_pool += (int64_t)size;
buffer_user->allocated -= (int64_t)size;
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: free %" PRIdPTR "; allocated -> %" PRId64
", free_pool -> %" PRId64,
buffer_user->buffer_pool->name, buffer_user->name, size,
buffer_user->allocated, buffer_user->free_pool);
}
bool is_bigger_than_zero = buffer_user->free_pool > 0;
if (is_bigger_than_zero && was_zero_or_negative &&
!buffer_user->added_to_free_pool) {
buffer_user->added_to_free_pool = true;
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->add_to_free_pool_closure,
GRPC_ERROR_NONE, false);
}
grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load(
&buffer_user->on_done_destroy_closure);
if (on_done_destroy != NULL && buffer_user->allocated == 0) {
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->destroy_closure, GRPC_ERROR_NONE,
false);
}
gpr_mu_unlock(&buffer_user->mu);
}
void grpc_buffer_user_post_reclaimer(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user,
bool destructive, grpc_closure *closure) {
if (gpr_atm_acq_load(&buffer_user->on_done_destroy_closure) == 0) {
GPR_ASSERT(buffer_user->reclaimers[destructive] == NULL);
buffer_user->reclaimers[destructive] = closure;
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->post_reclaimer_closure[destructive],
GRPC_ERROR_NONE, false);
} else {
grpc_exec_ctx_sched(exec_ctx, closure, GRPC_ERROR_CANCELLED, NULL);
}
}
void grpc_buffer_user_finish_reclaimation(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user) {
if (grpc_buffer_pool_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: reclaimation complete",
buffer_user->buffer_pool->name, buffer_user->name);
}
grpc_combiner_execute(exec_ctx, buffer_user->buffer_pool->combiner,
&buffer_user->buffer_pool->bpreclaimation_done_closure,
GRPC_ERROR_NONE, false);
}
void grpc_buffer_user_slice_allocator_init(
grpc_buffer_user_slice_allocator *slice_allocator,
grpc_buffer_user *buffer_user, grpc_iomgr_cb_func cb, void *p) {
grpc_closure_init(&slice_allocator->on_allocated, bu_allocated_slices,
slice_allocator);
grpc_closure_init(&slice_allocator->on_done, cb, p);
slice_allocator->buffer_user = buffer_user;
}
void grpc_buffer_user_alloc_slices(
grpc_exec_ctx *exec_ctx, grpc_buffer_user_slice_allocator *slice_allocator,
size_t length, size_t count, gpr_slice_buffer *dest) {
slice_allocator->length = length;
slice_allocator->count = count;
slice_allocator->dest = dest;
grpc_buffer_user_alloc(exec_ctx, slice_allocator->buffer_user, count * length,
&slice_allocator->on_allocated);
}

@ -70,6 +70,6 @@ grpc_workqueue* grpc_endpoint_get_workqueue(grpc_endpoint* ep) {
return ep->vtable->get_workqueue(ep); return ep->vtable->get_workqueue(ep);
} }
grpc_buffer_user* grpc_endpoint_get_buffer_user(grpc_endpoint* ep) { grpc_resource_user* grpc_endpoint_get_resource_user(grpc_endpoint* ep) {
return ep->vtable->get_buffer_user(ep); return ep->vtable->get_resource_user(ep);
} }

@ -37,7 +37,7 @@
#include <grpc/support/slice.h> #include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h> #include <grpc/support/slice_buffer.h>
#include <grpc/support/time.h> #include <grpc/support/time.h>
#include "src/core/lib/iomgr/buffer_pool.h" #include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h" #include "src/core/lib/iomgr/pollset_set.h"
@ -59,7 +59,7 @@ struct grpc_endpoint_vtable {
grpc_pollset_set *pollset); grpc_pollset_set *pollset);
void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep); void (*shutdown)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep);
void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep);
grpc_buffer_user *(*get_buffer_user)(grpc_endpoint *ep); grpc_resource_user *(*get_resource_user)(grpc_endpoint *ep);
char *(*get_peer)(grpc_endpoint *ep); char *(*get_peer)(grpc_endpoint *ep);
}; };
@ -102,7 +102,7 @@ void grpc_endpoint_add_to_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_endpoint *ep, grpc_endpoint *ep,
grpc_pollset_set *pollset_set); grpc_pollset_set *pollset_set);
grpc_buffer_user *grpc_endpoint_get_buffer_user(grpc_endpoint *endpoint); grpc_resource_user *grpc_endpoint_get_resource_user(grpc_endpoint *endpoint);
struct grpc_endpoint { struct grpc_endpoint {
const grpc_endpoint_vtable *vtable; const grpc_endpoint_vtable *vtable;

@ -42,6 +42,6 @@ typedef struct {
} grpc_endpoint_pair; } grpc_endpoint_pair;
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(
const char *name, grpc_buffer_pool *buffer_pool, size_t read_slice_size); const char *name, grpc_resource_quota *resource_quota, size_t read_slice_size);
#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */ #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */

@ -63,18 +63,18 @@ static void create_sockets(int sv[2]) {
} }
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair( grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(
const char *name, grpc_buffer_pool *buffer_pool, size_t read_slice_size) { const char *name, grpc_resource_quota *resource_quota, size_t read_slice_size) {
int sv[2]; int sv[2];
grpc_endpoint_pair p; grpc_endpoint_pair p;
char *final_name; char *final_name;
create_sockets(sv); create_sockets(sv);
gpr_asprintf(&final_name, "%s:client", name); gpr_asprintf(&final_name, "%s:client", name);
p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name), buffer_pool, p.client = grpc_tcp_create(grpc_fd_create(sv[1], final_name), resource_quota,
read_slice_size, "socketpair-server"); read_slice_size, "socketpair-server");
gpr_free(final_name); gpr_free(final_name);
gpr_asprintf(&final_name, "%s:server", name); gpr_asprintf(&final_name, "%s:server", name);
p.server = grpc_tcp_create(grpc_fd_create(sv[0], final_name), buffer_pool, p.server = grpc_tcp_create(grpc_fd_create(sv[0], final_name), resource_quota,
read_slice_size, "socketpair-client"); read_slice_size, "socketpair-client");
gpr_free(final_name); gpr_free(final_name);
return p; return p;

@ -0,0 +1,684 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/lib/iomgr/resource_quota.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/iomgr/combiner.h"
int grpc_resource_quota_trace = 0;
typedef bool (*bpstate_func)(grpc_exec_ctx *exec_ctx,
grpc_resource_quota *resource_quota);
typedef struct {
grpc_resource_user *head;
grpc_resource_user *tail;
} grpc_resource_user_list;
struct grpc_resource_quota {
gpr_refcount refs;
grpc_combiner *combiner;
int64_t size;
int64_t free_pool;
bool step_scheduled;
bool reclaiming;
grpc_closure bpstep_closure;
grpc_closure bpreclaimation_done_closure;
grpc_resource_user *roots[GRPC_BULIST_COUNT];
char *name;
};
/*******************************************************************************
* list management
*/
static void bulist_add_tail(grpc_resource_user *resource_user, grpc_bulist list) {
grpc_resource_quota *resource_quota = resource_user->resource_quota;
grpc_resource_user **root = &resource_quota->roots[list];
if (*root == NULL) {
*root = resource_user;
resource_user->links[list].next = resource_user->links[list].prev = resource_user;
} else {
resource_user->links[list].next = *root;
resource_user->links[list].prev = (*root)->links[list].prev;
resource_user->links[list].next->links[list].prev =
resource_user->links[list].prev->links[list].next = resource_user;
}
}
static void bulist_add_head(grpc_resource_user *resource_user, grpc_bulist list) {
grpc_resource_quota *resource_quota = resource_user->resource_quota;
grpc_resource_user **root = &resource_quota->roots[list];
if (*root == NULL) {
*root = resource_user;
resource_user->links[list].next = resource_user->links[list].prev = resource_user;
} else {
resource_user->links[list].next = (*root)->links[list].next;
resource_user->links[list].prev = *root;
resource_user->links[list].next->links[list].prev =
resource_user->links[list].prev->links[list].next = resource_user;
*root = resource_user;
}
}
static bool bulist_empty(grpc_resource_quota *resource_quota, grpc_bulist list) {
return resource_quota->roots[list] == NULL;
}
static grpc_resource_user *bulist_pop(grpc_resource_quota *resource_quota,
grpc_bulist list) {
grpc_resource_user **root = &resource_quota->roots[list];
grpc_resource_user *resource_user = *root;
if (resource_user == NULL) {
return NULL;
}
if (resource_user->links[list].next == resource_user) {
*root = NULL;
} else {
resource_user->links[list].next->links[list].prev =
resource_user->links[list].prev;
resource_user->links[list].prev->links[list].next =
resource_user->links[list].next;
*root = resource_user->links[list].next;
}
resource_user->links[list].next = resource_user->links[list].prev = NULL;
return resource_user;
}
static void bulist_remove(grpc_resource_user *resource_user, grpc_bulist list) {
if (resource_user->links[list].next == NULL) return;
grpc_resource_quota *resource_quota = resource_user->resource_quota;
if (resource_quota->roots[list] == resource_user) {
resource_quota->roots[list] = resource_user->links[list].next;
if (resource_quota->roots[list] == resource_user) {
resource_quota->roots[list] = NULL;
}
}
resource_user->links[list].next->links[list].prev =
resource_user->links[list].prev;
resource_user->links[list].prev->links[list].next =
resource_user->links[list].next;
}
/*******************************************************************************
* buffer pool state machine
*/
static bool bpalloc(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota);
static bool bpscavenge(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota);
static bool bpreclaim(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota,
bool destructive);
static void bpstep(grpc_exec_ctx *exec_ctx, void *bp, grpc_error *error) {
grpc_resource_quota *resource_quota = bp;
resource_quota->step_scheduled = false;
do {
if (bpalloc(exec_ctx, resource_quota)) goto done;
} while (bpscavenge(exec_ctx, resource_quota));
bpreclaim(exec_ctx, resource_quota, false) ||
bpreclaim(exec_ctx, resource_quota, true);
done:
grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
}
static void bpstep_sched(grpc_exec_ctx *exec_ctx,
grpc_resource_quota *resource_quota) {
if (resource_quota->step_scheduled) return;
resource_quota->step_scheduled = true;
grpc_resource_quota_internal_ref(resource_quota);
grpc_combiner_execute_finally(exec_ctx, resource_quota->combiner,
&resource_quota->bpstep_closure, GRPC_ERROR_NONE,
false);
}
/* returns true if all allocations are completed */
static bool bpalloc(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota) {
grpc_resource_user *resource_user;
while ((resource_user =
bulist_pop(resource_quota, GRPC_BULIST_AWAITING_ALLOCATION))) {
gpr_mu_lock(&resource_user->mu);
if (resource_user->free_pool < 0 &&
-resource_user->free_pool <= resource_quota->free_pool) {
int64_t amt = -resource_user->free_pool;
resource_user->free_pool = 0;
resource_quota->free_pool -= amt;
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: grant alloc %" PRId64
" bytes; bp_free_pool -> %" PRId64,
resource_quota->name, resource_user->name, amt,
resource_quota->free_pool);
}
} else if (grpc_resource_quota_trace && resource_user->free_pool >= 0) {
gpr_log(GPR_DEBUG, "BP %s %s: discard already satisfied alloc request",
resource_quota->name, resource_user->name);
}
if (resource_user->free_pool >= 0) {
resource_user->allocating = false;
grpc_exec_ctx_enqueue_list(exec_ctx, &resource_user->on_allocated, NULL);
gpr_mu_unlock(&resource_user->mu);
} else {
bulist_add_head(resource_user, GRPC_BULIST_AWAITING_ALLOCATION);
gpr_mu_unlock(&resource_user->mu);
return false;
}
}
return true;
}
/* returns true if any memory could be reclaimed from buffers */
static bool bpscavenge(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota) {
grpc_resource_user *resource_user;
while ((resource_user =
bulist_pop(resource_quota, GRPC_BULIST_NON_EMPTY_FREE_POOL))) {
gpr_mu_lock(&resource_user->mu);
if (resource_user->free_pool > 0) {
int64_t amt = resource_user->free_pool;
resource_user->free_pool = 0;
resource_quota->free_pool += amt;
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: scavenge %" PRId64
" bytes; bp_free_pool -> %" PRId64,
resource_quota->name, resource_user->name, amt,
resource_quota->free_pool);
}
gpr_mu_unlock(&resource_user->mu);
return true;
} else {
gpr_mu_unlock(&resource_user->mu);
}
}
return false;
}
/* returns true if reclaimation is proceeding */
static bool bpreclaim(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota,
bool destructive) {
if (resource_quota->reclaiming) return true;
grpc_bulist list = destructive ? GRPC_BULIST_RECLAIMER_DESTRUCTIVE
: GRPC_BULIST_RECLAIMER_BENIGN;
grpc_resource_user *resource_user = bulist_pop(resource_quota, list);
if (resource_user == NULL) return false;
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: initiate %s reclaimation", resource_quota->name,
resource_user->name, destructive ? "destructive" : "benign");
}
resource_quota->reclaiming = true;
grpc_resource_quota_internal_ref(resource_quota);
grpc_closure *c = resource_user->reclaimers[destructive];
resource_user->reclaimers[destructive] = NULL;
grpc_closure_run(exec_ctx, c, GRPC_ERROR_NONE);
return true;
}
/*******************************************************************************
* bu_slice: a slice implementation that is backed by a grpc_resource_user
*/
typedef struct {
gpr_slice_refcount base;
gpr_refcount refs;
grpc_resource_user *resource_user;
size_t size;
} bu_slice_refcount;
static void bu_slice_ref(void *p) {
bu_slice_refcount *rc = p;
gpr_ref(&rc->refs);
}
static void bu_slice_unref(void *p) {
bu_slice_refcount *rc = p;
if (gpr_unref(&rc->refs)) {
/* TODO(ctiller): this is dangerous, but I think safe for now:
we have no guarantee here that we're at a safe point for creating an
execution context, but we have no way of writing this code otherwise.
In the future: consider lifting gpr_slice to grpc, and offering an
internal_{ref,unref} pair that is execution context aware. Alternatively,
make exec_ctx be thread local and 'do the right thing' (whatever that is)
if NULL */
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_user_free(&exec_ctx, rc->resource_user, rc->size);
grpc_exec_ctx_finish(&exec_ctx);
gpr_free(rc);
}
}
static gpr_slice bu_slice_create(grpc_resource_user *resource_user, size_t size) {
bu_slice_refcount *rc = gpr_malloc(sizeof(bu_slice_refcount) + size);
rc->base.ref = bu_slice_ref;
rc->base.unref = bu_slice_unref;
gpr_ref_init(&rc->refs, 1);
rc->resource_user = resource_user;
rc->size = size;
gpr_slice slice;
slice.refcount = &rc->base;
slice.data.refcounted.bytes = (uint8_t *)(rc + 1);
slice.data.refcounted.length = size;
return slice;
}
/*******************************************************************************
* grpc_resource_quota internal implementation
*/
static void bu_allocate(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
grpc_resource_user *resource_user = bu;
if (bulist_empty(resource_user->resource_quota, GRPC_BULIST_AWAITING_ALLOCATION)) {
bpstep_sched(exec_ctx, resource_user->resource_quota);
}
bulist_add_tail(resource_user, GRPC_BULIST_AWAITING_ALLOCATION);
}
static void bu_add_to_free_pool(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_resource_user *resource_user = bu;
if (!bulist_empty(resource_user->resource_quota,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(resource_user->resource_quota, GRPC_BULIST_NON_EMPTY_FREE_POOL)) {
bpstep_sched(exec_ctx, resource_user->resource_quota);
}
bulist_add_tail(resource_user, GRPC_BULIST_NON_EMPTY_FREE_POOL);
}
static void bu_post_benign_reclaimer(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_resource_user *resource_user = bu;
if (!bulist_empty(resource_user->resource_quota,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(resource_user->resource_quota, GRPC_BULIST_NON_EMPTY_FREE_POOL) &&
bulist_empty(resource_user->resource_quota, GRPC_BULIST_RECLAIMER_BENIGN)) {
bpstep_sched(exec_ctx, resource_user->resource_quota);
}
bulist_add_tail(resource_user, GRPC_BULIST_RECLAIMER_BENIGN);
}
static void bu_post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, void *bu,
grpc_error *error) {
grpc_resource_user *resource_user = bu;
if (!bulist_empty(resource_user->resource_quota,
GRPC_BULIST_AWAITING_ALLOCATION) &&
bulist_empty(resource_user->resource_quota, GRPC_BULIST_NON_EMPTY_FREE_POOL) &&
bulist_empty(resource_user->resource_quota, GRPC_BULIST_RECLAIMER_BENIGN) &&
bulist_empty(resource_user->resource_quota,
GRPC_BULIST_RECLAIMER_DESTRUCTIVE)) {
bpstep_sched(exec_ctx, resource_user->resource_quota);
}
bulist_add_tail(resource_user, GRPC_BULIST_RECLAIMER_DESTRUCTIVE);
}
static void bu_destroy(grpc_exec_ctx *exec_ctx, void *bu, grpc_error *error) {
grpc_resource_user *resource_user = bu;
GPR_ASSERT(resource_user->allocated == 0);
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
bulist_remove(resource_user, (grpc_bulist)i);
}
grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[0],
GRPC_ERROR_CANCELLED, NULL);
grpc_exec_ctx_sched(exec_ctx, resource_user->reclaimers[1],
GRPC_ERROR_CANCELLED, NULL);
grpc_exec_ctx_sched(exec_ctx, (grpc_closure *)gpr_atm_no_barrier_load(
&resource_user->on_done_destroy_closure),
GRPC_ERROR_NONE, NULL);
if (resource_user->free_pool != 0) {
resource_user->resource_quota->free_pool += resource_user->free_pool;
bpstep_sched(exec_ctx, resource_user->resource_quota);
}
}
static void bu_allocated_slices(grpc_exec_ctx *exec_ctx, void *ts,
grpc_error *error) {
grpc_resource_user_slice_allocator *slice_allocator = ts;
if (error == GRPC_ERROR_NONE) {
for (size_t i = 0; i < slice_allocator->count; i++) {
gpr_slice_buffer_add_indexed(slice_allocator->dest,
bu_slice_create(slice_allocator->resource_user,
slice_allocator->length));
}
}
grpc_closure_run(exec_ctx, &slice_allocator->on_done, GRPC_ERROR_REF(error));
}
typedef struct {
int64_t size;
grpc_resource_quota *resource_quota;
grpc_closure closure;
} bp_resize_args;
static void bp_resize(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) {
bp_resize_args *a = args;
int64_t delta = a->size - a->resource_quota->size;
a->resource_quota->size += delta;
a->resource_quota->free_pool += delta;
if (delta < 0 && a->resource_quota->free_pool < 0) {
bpstep_sched(exec_ctx, a->resource_quota);
} else if (delta > 0 &&
!bulist_empty(a->resource_quota, GRPC_BULIST_AWAITING_ALLOCATION)) {
bpstep_sched(exec_ctx, a->resource_quota);
}
grpc_resource_quota_internal_unref(exec_ctx, a->resource_quota);
gpr_free(a);
}
static void bp_reclaimation_done(grpc_exec_ctx *exec_ctx, void *bp,
grpc_error *error) {
grpc_resource_quota *resource_quota = bp;
resource_quota->reclaiming = false;
bpstep_sched(exec_ctx, resource_quota);
grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
}
/*******************************************************************************
* grpc_resource_quota api
*/
grpc_resource_quota *grpc_resource_quota_create(const char *name) {
grpc_resource_quota *resource_quota = gpr_malloc(sizeof(*resource_quota));
gpr_ref_init(&resource_quota->refs, 1);
resource_quota->combiner = grpc_combiner_create(NULL);
resource_quota->free_pool = INT64_MAX;
resource_quota->size = INT64_MAX;
resource_quota->step_scheduled = false;
resource_quota->reclaiming = false;
if (name != NULL) {
resource_quota->name = gpr_strdup(name);
} else {
gpr_asprintf(&resource_quota->name, "anonymous_pool_%" PRIxPTR,
(intptr_t)resource_quota);
}
grpc_closure_init(&resource_quota->bpstep_closure, bpstep, resource_quota);
grpc_closure_init(&resource_quota->bpreclaimation_done_closure,
bp_reclaimation_done, resource_quota);
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
resource_quota->roots[i] = NULL;
}
return resource_quota;
}
void grpc_resource_quota_internal_unref(grpc_exec_ctx *exec_ctx,
grpc_resource_quota *resource_quota) {
if (gpr_unref(&resource_quota->refs)) {
grpc_combiner_destroy(exec_ctx, resource_quota->combiner);
gpr_free(resource_quota->name);
gpr_free(resource_quota);
}
}
void grpc_resource_quota_unref(grpc_resource_quota *resource_quota) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_exec_ctx_finish(&exec_ctx);
}
grpc_resource_quota *grpc_resource_quota_internal_ref(grpc_resource_quota *resource_quota) {
gpr_ref(&resource_quota->refs);
return resource_quota;
}
void grpc_resource_quota_ref(grpc_resource_quota *resource_quota) {
grpc_resource_quota_internal_ref(resource_quota);
}
void grpc_resource_quota_resize(grpc_resource_quota *resource_quota, size_t size) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
bp_resize_args *a = gpr_malloc(sizeof(*a));
a->resource_quota = grpc_resource_quota_internal_ref(resource_quota);
a->size = (int64_t)size;
grpc_closure_init(&a->closure, bp_resize, a);
grpc_combiner_execute(&exec_ctx, resource_quota->combiner, &a->closure,
GRPC_ERROR_NONE, false);
grpc_exec_ctx_finish(&exec_ctx);
}
/*******************************************************************************
* grpc_resource_user channel args api
*/
grpc_resource_quota *grpc_resource_quota_from_channel_args(
const grpc_channel_args *channel_args) {
for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_BUFFER_POOL)) {
if (channel_args->args[i].type == GRPC_ARG_POINTER) {
return grpc_resource_quota_internal_ref(
channel_args->args[i].value.pointer.p);
} else {
gpr_log(GPR_DEBUG, GRPC_ARG_BUFFER_POOL " should be a pointer");
}
}
}
return grpc_resource_quota_create(NULL);
}
static void *bp_copy(void *bp) {
grpc_resource_quota_ref(bp);
return bp;
}
static void bp_destroy(void *bp) { grpc_resource_quota_unref(bp); }
static int bp_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
const grpc_arg_pointer_vtable *grpc_resource_quota_arg_vtable(void) {
static const grpc_arg_pointer_vtable vtable = {bp_copy, bp_destroy, bp_cmp};
return &vtable;
}
/*******************************************************************************
* grpc_resource_user api
*/
void grpc_resource_user_init(grpc_resource_user *resource_user,
grpc_resource_quota *resource_quota, const char *name) {
resource_user->resource_quota = grpc_resource_quota_internal_ref(resource_quota);
grpc_closure_init(&resource_user->allocate_closure, &bu_allocate, resource_user);
grpc_closure_init(&resource_user->add_to_free_pool_closure,
&bu_add_to_free_pool, resource_user);
grpc_closure_init(&resource_user->post_reclaimer_closure[0],
&bu_post_benign_reclaimer, resource_user);
grpc_closure_init(&resource_user->post_reclaimer_closure[1],
&bu_post_destructive_reclaimer, resource_user);
grpc_closure_init(&resource_user->destroy_closure, &bu_destroy, resource_user);
gpr_mu_init(&resource_user->mu);
resource_user->allocated = 0;
resource_user->free_pool = 0;
grpc_closure_list_init(&resource_user->on_allocated);
resource_user->allocating = false;
resource_user->added_to_free_pool = false;
gpr_atm_no_barrier_store(&resource_user->on_done_destroy_closure, 0);
resource_user->reclaimers[0] = NULL;
resource_user->reclaimers[1] = NULL;
for (int i = 0; i < GRPC_BULIST_COUNT; i++) {
resource_user->links[i].next = resource_user->links[i].prev = NULL;
}
#ifndef NDEBUG
resource_user->asan_canary = gpr_malloc(1);
#endif
if (name != NULL) {
resource_user->name = gpr_strdup(name);
} else {
gpr_asprintf(&resource_user->name, "anonymous_resource_user_%" PRIxPTR,
(intptr_t)resource_user);
}
}
void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user,
grpc_closure *on_done) {
gpr_mu_lock(&resource_user->mu);
GPR_ASSERT(gpr_atm_no_barrier_load(&resource_user->on_done_destroy_closure) ==
0);
gpr_atm_no_barrier_store(&resource_user->on_done_destroy_closure,
(gpr_atm)on_done);
if (resource_user->allocated == 0) {
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->destroy_closure, GRPC_ERROR_NONE,
false);
}
gpr_mu_unlock(&resource_user->mu);
}
void grpc_resource_user_destroy(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user) {
#ifndef NDEBUG
gpr_free(resource_user->asan_canary);
#endif
grpc_resource_quota_internal_unref(exec_ctx, resource_user->resource_quota);
gpr_mu_destroy(&resource_user->mu);
gpr_free(resource_user->name);
}
void grpc_resource_user_alloc(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user, size_t size,
grpc_closure *optional_on_done) {
gpr_mu_lock(&resource_user->mu);
grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load(
&resource_user->on_done_destroy_closure);
if (on_done_destroy != NULL) {
/* already shutdown */
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: alloc %" PRIdPTR " after shutdown",
resource_user->resource_quota->name, resource_user->name, size);
}
grpc_exec_ctx_sched(
exec_ctx, optional_on_done,
GRPC_ERROR_CREATE("Buffer pool user is already shutdown"), NULL);
gpr_mu_unlock(&resource_user->mu);
return;
}
resource_user->allocated += (int64_t)size;
resource_user->free_pool -= (int64_t)size;
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: alloc %" PRIdPTR "; allocated -> %" PRId64
", free_pool -> %" PRId64,
resource_user->resource_quota->name, resource_user->name, size,
resource_user->allocated, resource_user->free_pool);
}
if (resource_user->free_pool < 0) {
grpc_closure_list_append(&resource_user->on_allocated, optional_on_done,
GRPC_ERROR_NONE);
if (!resource_user->allocating) {
resource_user->allocating = true;
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->allocate_closure, GRPC_ERROR_NONE,
false);
}
} else {
grpc_exec_ctx_sched(exec_ctx, optional_on_done, GRPC_ERROR_NONE, NULL);
}
gpr_mu_unlock(&resource_user->mu);
}
void grpc_resource_user_free(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user, size_t size) {
gpr_mu_lock(&resource_user->mu);
GPR_ASSERT(resource_user->allocated >= (int64_t)size);
bool was_zero_or_negative = resource_user->free_pool <= 0;
resource_user->free_pool += (int64_t)size;
resource_user->allocated -= (int64_t)size;
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: free %" PRIdPTR "; allocated -> %" PRId64
", free_pool -> %" PRId64,
resource_user->resource_quota->name, resource_user->name, size,
resource_user->allocated, resource_user->free_pool);
}
bool is_bigger_than_zero = resource_user->free_pool > 0;
if (is_bigger_than_zero && was_zero_or_negative &&
!resource_user->added_to_free_pool) {
resource_user->added_to_free_pool = true;
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->add_to_free_pool_closure,
GRPC_ERROR_NONE, false);
}
grpc_closure *on_done_destroy = (grpc_closure *)gpr_atm_no_barrier_load(
&resource_user->on_done_destroy_closure);
if (on_done_destroy != NULL && resource_user->allocated == 0) {
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->destroy_closure, GRPC_ERROR_NONE,
false);
}
gpr_mu_unlock(&resource_user->mu);
}
void grpc_resource_user_post_reclaimer(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user,
bool destructive, grpc_closure *closure) {
if (gpr_atm_acq_load(&resource_user->on_done_destroy_closure) == 0) {
GPR_ASSERT(resource_user->reclaimers[destructive] == NULL);
resource_user->reclaimers[destructive] = closure;
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->post_reclaimer_closure[destructive],
GRPC_ERROR_NONE, false);
} else {
grpc_exec_ctx_sched(exec_ctx, closure, GRPC_ERROR_CANCELLED, NULL);
}
}
void grpc_resource_user_finish_reclaimation(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user) {
if (grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG, "BP %s %s: reclaimation complete",
resource_user->resource_quota->name, resource_user->name);
}
grpc_combiner_execute(exec_ctx, resource_user->resource_quota->combiner,
&resource_user->resource_quota->bpreclaimation_done_closure,
GRPC_ERROR_NONE, false);
}
void grpc_resource_user_slice_allocator_init(
grpc_resource_user_slice_allocator *slice_allocator,
grpc_resource_user *resource_user, grpc_iomgr_cb_func cb, void *p) {
grpc_closure_init(&slice_allocator->on_allocated, bu_allocated_slices,
slice_allocator);
grpc_closure_init(&slice_allocator->on_done, cb, p);
slice_allocator->resource_user = resource_user;
}
void grpc_resource_user_alloc_slices(
grpc_exec_ctx *exec_ctx, grpc_resource_user_slice_allocator *slice_allocator,
size_t length, size_t count, gpr_slice_buffer *dest) {
slice_allocator->length = length;
slice_allocator->count = count;
slice_allocator->dest = dest;
grpc_resource_user_alloc(exec_ctx, slice_allocator->resource_user, count * length,
&slice_allocator->on_allocated);
}

@ -38,12 +38,13 @@
#include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/exec_ctx.h"
extern int grpc_buffer_pool_trace; extern int grpc_resource_quota_trace;
grpc_buffer_pool *grpc_buffer_pool_internal_ref(grpc_buffer_pool *buffer_pool); grpc_resource_quota *grpc_resource_quota_internal_ref(
void grpc_buffer_pool_internal_unref(grpc_exec_ctx *exec_ctx, grpc_resource_quota *resource_quota);
grpc_buffer_pool *buffer_pool); void grpc_resource_quota_internal_unref(grpc_exec_ctx *exec_ctx,
grpc_buffer_pool *grpc_buffer_pool_from_channel_args( grpc_resource_quota *resource_quota);
grpc_resource_quota *grpc_resource_quota_from_channel_args(
const grpc_channel_args *channel_args); const grpc_channel_args *channel_args);
typedef enum { typedef enum {
@ -54,15 +55,15 @@ typedef enum {
GRPC_BULIST_COUNT GRPC_BULIST_COUNT
} grpc_bulist; } grpc_bulist;
typedef struct grpc_buffer_user grpc_buffer_user; typedef struct grpc_resource_user grpc_resource_user;
typedef struct { typedef struct {
grpc_buffer_user *next; grpc_resource_user *next;
grpc_buffer_user *prev; grpc_resource_user *prev;
} grpc_buffer_user_link; } grpc_resource_user_link;
struct grpc_buffer_user { struct grpc_resource_user {
grpc_buffer_pool *buffer_pool; grpc_resource_quota *resource_quota;
grpc_closure allocate_closure; grpc_closure allocate_closure;
grpc_closure add_to_free_pool_closure; grpc_closure add_to_free_pool_closure;
@ -84,45 +85,47 @@ struct grpc_buffer_user {
grpc_closure destroy_closure; grpc_closure destroy_closure;
gpr_atm on_done_destroy_closure; gpr_atm on_done_destroy_closure;
grpc_buffer_user_link links[GRPC_BULIST_COUNT]; grpc_resource_user_link links[GRPC_BULIST_COUNT];
char *name; char *name;
}; };
void grpc_buffer_user_init(grpc_buffer_user *buffer_user, void grpc_resource_user_init(grpc_resource_user *resource_user,
grpc_buffer_pool *buffer_pool, const char *name); grpc_resource_quota *resource_quota,
void grpc_buffer_user_shutdown(grpc_exec_ctx *exec_ctx, const char *name);
grpc_buffer_user *buffer_user, void grpc_resource_user_shutdown(grpc_exec_ctx *exec_ctx,
grpc_closure *on_done); grpc_resource_user *resource_user,
void grpc_buffer_user_destroy(grpc_exec_ctx *exec_ctx, grpc_closure *on_done);
grpc_buffer_user *buffer_user); void grpc_resource_user_destroy(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user);
void grpc_buffer_user_alloc(grpc_exec_ctx *exec_ctx,
grpc_buffer_user *buffer_user, size_t size, void grpc_resource_user_alloc(grpc_exec_ctx *exec_ctx,
grpc_closure *optional_on_done); grpc_resource_user *resource_user, size_t size,
void grpc_buffer_user_free(grpc_exec_ctx *exec_ctx, grpc_closure *optional_on_done);
grpc_buffer_user *buffer_user, size_t size); void grpc_resource_user_free(grpc_exec_ctx *exec_ctx,
void grpc_buffer_user_post_reclaimer(grpc_exec_ctx *exec_ctx, grpc_resource_user *resource_user, size_t size);
grpc_buffer_user *buffer_user, void grpc_resource_user_post_reclaimer(grpc_exec_ctx *exec_ctx,
bool destructive, grpc_closure *closure); grpc_resource_user *resource_user,
void grpc_buffer_user_finish_reclaimation(grpc_exec_ctx *exec_ctx, bool destructive, grpc_closure *closure);
grpc_buffer_user *buffer_user); void grpc_resource_user_finish_reclaimation(grpc_exec_ctx *exec_ctx,
grpc_resource_user *resource_user);
typedef struct grpc_buffer_user_slice_allocator {
typedef struct grpc_resource_user_slice_allocator {
grpc_closure on_allocated; grpc_closure on_allocated;
grpc_closure on_done; grpc_closure on_done;
size_t length; size_t length;
size_t count; size_t count;
gpr_slice_buffer *dest; gpr_slice_buffer *dest;
grpc_buffer_user *buffer_user; grpc_resource_user *resource_user;
} grpc_buffer_user_slice_allocator; } grpc_resource_user_slice_allocator;
void grpc_buffer_user_slice_allocator_init( void grpc_resource_user_slice_allocator_init(
grpc_buffer_user_slice_allocator *slice_allocator, grpc_resource_user_slice_allocator *slice_allocator,
grpc_buffer_user *buffer_user, grpc_iomgr_cb_func cb, void *p); grpc_resource_user *resource_user, grpc_iomgr_cb_func cb, void *p);
void grpc_buffer_user_alloc_slices( void grpc_resource_user_alloc_slices(
grpc_exec_ctx *exec_ctx, grpc_buffer_user_slice_allocator *slice_allocator, grpc_exec_ctx *exec_ctx,
size_t length, size_t count, gpr_slice_buffer *dest); grpc_resource_user_slice_allocator *slice_allocator, size_t length,
size_t count, gpr_slice_buffer *dest);
#endif /* GRPC_CORE_LIB_IOMGR_BUFFER_POOL_H */ #endif /* GRPC_CORE_LIB_IOMGR_BUFFER_POOL_H */

@ -125,7 +125,7 @@ grpc_endpoint *grpc_tcp_client_create_from_fd(
grpc_exec_ctx *exec_ctx, grpc_fd *fd, const grpc_channel_args *channel_args, grpc_exec_ctx *exec_ctx, grpc_fd *fd, const grpc_channel_args *channel_args,
const char *addr_str) { const char *addr_str) {
size_t tcp_read_chunk_size = GRPC_TCP_DEFAULT_READ_SLICE_SIZE; size_t tcp_read_chunk_size = GRPC_TCP_DEFAULT_READ_SLICE_SIZE;
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create(NULL); grpc_resource_quota *resource_quota = grpc_resource_quota_create(NULL);
if (channel_args != NULL) { if (channel_args != NULL) {
for (size_t i = 0; i < channel_args->num_args; i++) { for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 == if (0 ==
@ -135,16 +135,16 @@ grpc_endpoint *grpc_tcp_client_create_from_fd(
tcp_read_chunk_size = (size_t)grpc_channel_arg_get_integer( tcp_read_chunk_size = (size_t)grpc_channel_arg_get_integer(
&channel_args->args[i], options); &channel_args->args[i], options);
} else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_BUFFER_POOL)) { } else if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_BUFFER_POOL)) {
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
buffer_pool = grpc_buffer_pool_internal_ref( resource_quota = grpc_resource_quota_internal_ref(
channel_args->args[i].value.pointer.p); channel_args->args[i].value.pointer.p);
} }
} }
} }
grpc_endpoint *ep = grpc_endpoint *ep =
grpc_tcp_create(fd, buffer_pool, tcp_read_chunk_size, addr_str); grpc_tcp_create(fd, resource_quota, tcp_read_chunk_size, addr_str);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
return ep; return ep;
} }

@ -102,8 +102,8 @@ typedef struct {
char *peer_string; char *peer_string;
grpc_buffer_user buffer_user; grpc_resource_user resource_user;
grpc_buffer_user_slice_allocator slice_allocator; grpc_resource_user_slice_allocator slice_allocator;
} grpc_tcp; } grpc_tcp;
static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
@ -113,17 +113,17 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */, static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
grpc_error *error); grpc_error *error);
static void tcp_maybe_shutdown_buffer_user(grpc_exec_ctx *exec_ctx, static void tcp_maybe_shutdown_resource_user(grpc_exec_ctx *exec_ctx,
grpc_tcp *tcp) { grpc_tcp *tcp) {
if (gpr_atm_full_fetch_add(&tcp->shutdown_count, 1) == 0) { if (gpr_atm_full_fetch_add(&tcp->shutdown_count, 1) == 0) {
grpc_buffer_user_shutdown(exec_ctx, &tcp->buffer_user, grpc_resource_user_shutdown(exec_ctx, &tcp->resource_user,
grpc_closure_create(tcp_unref_closure, tcp)); grpc_closure_create(tcp_unref_closure, tcp));
} }
} }
static void tcp_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { static void tcp_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
grpc_tcp *tcp = (grpc_tcp *)ep; grpc_tcp *tcp = (grpc_tcp *)ep;
tcp_maybe_shutdown_buffer_user(exec_ctx, tcp); tcp_maybe_shutdown_resource_user(exec_ctx, tcp);
grpc_fd_shutdown(exec_ctx, tcp->em_fd); grpc_fd_shutdown(exec_ctx, tcp->em_fd);
} }
@ -131,7 +131,7 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
grpc_fd_orphan(exec_ctx, tcp->em_fd, tcp->release_fd_cb, tcp->release_fd, grpc_fd_orphan(exec_ctx, tcp->em_fd, tcp->release_fd_cb, tcp->release_fd,
"tcp_unref_orphan"); "tcp_unref_orphan");
gpr_slice_buffer_destroy(&tcp->last_read_buffer); gpr_slice_buffer_destroy(&tcp->last_read_buffer);
grpc_buffer_user_destroy(exec_ctx, &tcp->buffer_user); grpc_resource_user_destroy(exec_ctx, &tcp->resource_user);
gpr_free(tcp->peer_string); gpr_free(tcp->peer_string);
gpr_free(tcp); gpr_free(tcp);
} }
@ -170,13 +170,13 @@ static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); }
static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg, static void tcp_unref_closure(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) { grpc_error *error) {
TCP_UNREF(exec_ctx, arg, "buffer_user"); TCP_UNREF(exec_ctx, arg, "resource_user");
} }
static void tcp_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { static void tcp_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
grpc_network_status_unregister_endpoint(ep); grpc_network_status_unregister_endpoint(ep);
grpc_tcp *tcp = (grpc_tcp *)ep; grpc_tcp *tcp = (grpc_tcp *)ep;
tcp_maybe_shutdown_buffer_user(exec_ctx, tcp); tcp_maybe_shutdown_resource_user(exec_ctx, tcp);
gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer); gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
TCP_UNREF(exec_ctx, tcp, "destroy"); TCP_UNREF(exec_ctx, tcp, "destroy");
} }
@ -286,7 +286,7 @@ static void tcp_read_allocation_done(grpc_exec_ctx *exec_ctx, void *tcpp,
static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { static void tcp_continue_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
if (tcp->incoming_buffer->count < (size_t)tcp->iov_size) { if (tcp->incoming_buffer->count < (size_t)tcp->iov_size) {
grpc_buffer_user_alloc_slices( grpc_resource_user_alloc_slices(
exec_ctx, &tcp->slice_allocator, tcp->slice_size, exec_ctx, &tcp->slice_allocator, tcp->slice_size,
(size_t)tcp->iov_size - tcp->incoming_buffer->count, (size_t)tcp->iov_size - tcp->incoming_buffer->count,
tcp->incoming_buffer); tcp->incoming_buffer);
@ -513,9 +513,9 @@ static grpc_workqueue *tcp_get_workqueue(grpc_endpoint *ep) {
return grpc_fd_get_workqueue(tcp->em_fd); return grpc_fd_get_workqueue(tcp->em_fd);
} }
static grpc_buffer_user *tcp_get_buffer_user(grpc_endpoint *ep) { static grpc_resource_user *tcp_get_resource_user(grpc_endpoint *ep) {
grpc_tcp *tcp = (grpc_tcp *)ep; grpc_tcp *tcp = (grpc_tcp *)ep;
return &tcp->buffer_user; return &tcp->resource_user;
} }
static const grpc_endpoint_vtable vtable = {tcp_read, static const grpc_endpoint_vtable vtable = {tcp_read,
@ -525,10 +525,11 @@ static const grpc_endpoint_vtable vtable = {tcp_read,
tcp_add_to_pollset_set, tcp_add_to_pollset_set,
tcp_shutdown, tcp_shutdown,
tcp_destroy, tcp_destroy,
tcp_get_buffer_user, tcp_get_resource_user,
tcp_get_peer}; tcp_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, grpc_buffer_pool *buffer_pool, grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd,
grpc_resource_quota *resource_quota,
size_t slice_size, const char *peer_string) { size_t slice_size, const char *peer_string) {
grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));
tcp->base.vtable = &vtable; tcp->base.vtable = &vtable;
@ -543,7 +544,7 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, grpc_buffer_pool *buffer_pool,
tcp->iov_size = 1; tcp->iov_size = 1;
tcp->finished_edge = true; tcp->finished_edge = true;
/* paired with unref in grpc_tcp_destroy, and with the shutdown for our /* paired with unref in grpc_tcp_destroy, and with the shutdown for our
* buffer_user */ * resource_user */
gpr_ref_init(&tcp->refcount, 2); gpr_ref_init(&tcp->refcount, 2);
gpr_atm_no_barrier_store(&tcp->shutdown_count, 0); gpr_atm_no_barrier_store(&tcp->shutdown_count, 0);
tcp->em_fd = em_fd; tcp->em_fd = em_fd;
@ -552,9 +553,10 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, grpc_buffer_pool *buffer_pool,
tcp->write_closure.cb = tcp_handle_write; tcp->write_closure.cb = tcp_handle_write;
tcp->write_closure.cb_arg = tcp; tcp->write_closure.cb_arg = tcp;
gpr_slice_buffer_init(&tcp->last_read_buffer); gpr_slice_buffer_init(&tcp->last_read_buffer);
grpc_buffer_user_init(&tcp->buffer_user, buffer_pool, peer_string); grpc_resource_user_init(&tcp->resource_user, resource_quota, peer_string);
grpc_buffer_user_slice_allocator_init( grpc_resource_user_slice_allocator_init(&tcp->slice_allocator,
&tcp->slice_allocator, &tcp->buffer_user, tcp_read_allocation_done, tcp); &tcp->resource_user,
tcp_read_allocation_done, tcp);
/* Tell network status tracker about new endpoint */ /* Tell network status tracker about new endpoint */
grpc_network_status_register_endpoint(&tcp->base); grpc_network_status_register_endpoint(&tcp->base);
@ -574,7 +576,7 @@ void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
GPR_ASSERT(ep->vtable == &vtable); GPR_ASSERT(ep->vtable == &vtable);
tcp->release_fd = fd; tcp->release_fd = fd;
tcp->release_fd_cb = done; tcp->release_fd_cb = done;
tcp_maybe_shutdown_buffer_user(exec_ctx, tcp); tcp_maybe_shutdown_resource_user(exec_ctx, tcp);
gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer); gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
TCP_UNREF(exec_ctx, tcp, "destroy"); TCP_UNREF(exec_ctx, tcp, "destroy");
} }

@ -53,7 +53,7 @@ extern int grpc_tcp_trace;
/* Create a tcp endpoint given a file desciptor and a read slice size. /* Create a tcp endpoint given a file desciptor and a read slice size.
Takes ownership of fd. */ Takes ownership of fd. */
grpc_endpoint *grpc_tcp_create(grpc_fd *fd, grpc_buffer_pool *buffer_pool, grpc_endpoint *grpc_tcp_create(grpc_fd *fd, grpc_resource_quota *resource_quota,
size_t read_slice_size, const char *peer_string); size_t read_slice_size, const char *peer_string);
/* Return the tcp endpoint's fd, or -1 if this is not available. Does not /* Return the tcp endpoint's fd, or -1 if this is not available. Does not

@ -138,7 +138,7 @@ struct grpc_tcp_server {
/* next pollset to assign a channel to */ /* next pollset to assign a channel to */
gpr_atm next_pollset_to_assign; gpr_atm next_pollset_to_assign;
grpc_buffer_pool *buffer_pool; grpc_resource_quota *resource_quota;
}; };
static gpr_once check_init = GPR_ONCE_INIT; static gpr_once check_init = GPR_ONCE_INIT;
@ -163,25 +163,25 @@ grpc_error *grpc_tcp_server_create(grpc_exec_ctx *exec_ctx,
grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server)); grpc_tcp_server *s = gpr_malloc(sizeof(grpc_tcp_server));
s->so_reuseport = has_so_reuseport; s->so_reuseport = has_so_reuseport;
s->buffer_pool = grpc_buffer_pool_create(NULL); s->resource_quota = grpc_resource_quota_create(NULL);
for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) { for (size_t i = 0; i < (args == NULL ? 0 : args->num_args); i++) {
if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) { if (0 == strcmp(GRPC_ARG_ALLOW_REUSEPORT, args->args[i].key)) {
if (args->args[i].type == GRPC_ARG_INTEGER) { if (args->args[i].type == GRPC_ARG_INTEGER) {
s->so_reuseport = s->so_reuseport =
has_so_reuseport && (args->args[i].value.integer != 0); has_so_reuseport && (args->args[i].value.integer != 0);
} else { } else {
grpc_buffer_pool_internal_unref(exec_ctx, s->buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota);
gpr_free(s); gpr_free(s);
return GRPC_ERROR_CREATE(GRPC_ARG_ALLOW_REUSEPORT return GRPC_ERROR_CREATE(GRPC_ARG_ALLOW_REUSEPORT
" must be an integer"); " must be an integer");
} }
} else if (0 == strcmp(GRPC_ARG_BUFFER_POOL, args->args[i].key)) { } else if (0 == strcmp(GRPC_ARG_BUFFER_POOL, args->args[i].key)) {
if (args->args[i].type == GRPC_ARG_POINTER) { if (args->args[i].type == GRPC_ARG_POINTER) {
grpc_buffer_pool_internal_unref(exec_ctx, s->buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota);
s->buffer_pool = s->resource_quota =
grpc_buffer_pool_internal_ref(args->args[i].value.pointer.p); grpc_resource_quota_internal_ref(args->args[i].value.pointer.p);
} else { } else {
grpc_buffer_pool_internal_unref(exec_ctx, s->buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota);
gpr_free(s); gpr_free(s);
return GRPC_ERROR_CREATE(GRPC_ARG_BUFFER_POOL return GRPC_ERROR_CREATE(GRPC_ARG_BUFFER_POOL
" must be a pointer to a buffer pool"); " must be a pointer to a buffer pool");
@ -222,7 +222,7 @@ static void finish_shutdown(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
gpr_free(sp); gpr_free(sp);
} }
grpc_buffer_pool_internal_unref(exec_ctx, s->buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, s->resource_quota);
gpr_free(s); gpr_free(s);
} }
@ -440,7 +440,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *err) {
sp->server->on_accept_cb( sp->server->on_accept_cb(
exec_ctx, sp->server->on_accept_cb_arg, exec_ctx, sp->server->on_accept_cb_arg,
grpc_tcp_create(fdobj, sp->server->buffer_pool, grpc_tcp_create(fdobj, sp->server->resource_quota,
GRPC_TCP_DEFAULT_READ_SLICE_SIZE, addr_str), GRPC_TCP_DEFAULT_READ_SLICE_SIZE, addr_str),
read_notifier_pollset, &acceptor); read_notifier_pollset, &acceptor);

@ -124,14 +124,14 @@ static int is_stack_running_on_compute_engine(void) {
grpc_httpcli_context_init(&context); grpc_httpcli_context_init(&context);
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("google_default_credentials"); grpc_resource_quota_create("google_default_credentials");
grpc_httpcli_get( grpc_httpcli_get(
&exec_ctx, &context, &detector.pollent, buffer_pool, &request, &exec_ctx, &context, &detector.pollent, resource_quota, &request,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), max_detection_delay), gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), max_detection_delay),
grpc_closure_create(on_compute_engine_detection_http_response, &detector), grpc_closure_create(on_compute_engine_detection_http_response, &detector),
&detector.response); &detector.response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);

@ -657,16 +657,16 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
*(req.host + (req.http.path - jwks_uri)) = '\0'; *(req.host + (req.http.path - jwks_uri)) = '\0';
} }
/* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host /* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */ extreme memory pressure. */
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("jwt_verifier"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("jwt_verifier");
grpc_httpcli_get( grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, buffer_pool, &req, exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay), gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
grpc_closure_create(on_keys_retrieved, ctx), grpc_closure_create(on_keys_retrieved, ctx),
&ctx->responses[HTTP_RESPONSE_KEYS]); &ctx->responses[HTTP_RESPONSE_KEYS]);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
grpc_json_destroy(json); grpc_json_destroy(json);
gpr_free(req.host); gpr_free(req.host);
return; return;
@ -769,15 +769,15 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
rsp_idx = HTTP_RESPONSE_OPENID; rsp_idx = HTTP_RESPONSE_OPENID;
} }
/* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host /* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */ extreme memory pressure. */
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("jwt_verifier"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("jwt_verifier");
grpc_httpcli_get( grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, buffer_pool, &req, exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay), gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
http_cb, &ctx->responses[rsp_idx]); http_cb, &ctx->responses[rsp_idx]);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
gpr_free(req.host); gpr_free(req.host);
gpr_free(req.http.path); gpr_free(req.http.path);
return; return;

@ -307,14 +307,14 @@ static void compute_engine_fetch_oauth2(
request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH; request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.http.hdr_count = 1; request.http.hdr_count = 1;
request.http.hdrs = &header; request.http.hdrs = &header;
/* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host /* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */ extreme memory pressure. */
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("oauth2_credentials"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("oauth2_credentials");
grpc_httpcli_get(exec_ctx, httpcli_context, pollent, buffer_pool, &request, grpc_httpcli_get(exec_ctx, httpcli_context, pollent, resource_quota, &request,
deadline, grpc_closure_create(response_cb, metadata_req), deadline, grpc_closure_create(response_cb, metadata_req),
&metadata_req->response); &metadata_req->response);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
} }
grpc_call_credentials *grpc_google_compute_engine_credentials_create( grpc_call_credentials *grpc_google_compute_engine_credentials_create(
@ -362,16 +362,16 @@ static void refresh_token_fetch_oauth2(
request.http.hdr_count = 1; request.http.hdr_count = 1;
request.http.hdrs = &header; request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl; request.handshaker = &grpc_httpcli_ssl;
/* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host /* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */ extreme memory pressure. */
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("oauth2_credentials_refresh"); grpc_resource_quota_create("oauth2_credentials_refresh");
grpc_httpcli_post(exec_ctx, httpcli_context, pollent, buffer_pool, &request, grpc_httpcli_post(exec_ctx, httpcli_context, pollent, resource_quota, &request,
body, strlen(body), deadline, body, strlen(body), deadline,
grpc_closure_create(response_cb, metadata_req), grpc_closure_create(response_cb, metadata_req),
&metadata_req->response); &metadata_req->response);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
gpr_free(body); gpr_free(body);
} }

@ -370,9 +370,9 @@ static grpc_workqueue *endpoint_get_workqueue(grpc_endpoint *secure_ep) {
return grpc_endpoint_get_workqueue(ep->wrapped_ep); return grpc_endpoint_get_workqueue(ep->wrapped_ep);
} }
static grpc_buffer_user *endpoint_get_buffer_user(grpc_endpoint *secure_ep) { static grpc_resource_user *endpoint_get_resource_user(grpc_endpoint *secure_ep) {
secure_endpoint *ep = (secure_endpoint *)secure_ep; secure_endpoint *ep = (secure_endpoint *)secure_ep;
return grpc_endpoint_get_buffer_user(ep->wrapped_ep); return grpc_endpoint_get_resource_user(ep->wrapped_ep);
} }
static const grpc_endpoint_vtable vtable = {endpoint_read, static const grpc_endpoint_vtable vtable = {endpoint_read,
@ -382,7 +382,7 @@ static const grpc_endpoint_vtable vtable = {endpoint_read,
endpoint_add_to_pollset_set, endpoint_add_to_pollset_set,
endpoint_shutdown, endpoint_shutdown,
endpoint_destroy, endpoint_destroy,
endpoint_get_buffer_user, endpoint_get_resource_user,
endpoint_get_peer}; endpoint_get_peer};
grpc_endpoint *grpc_secure_endpoint_create( grpc_endpoint *grpc_secure_endpoint_create(

@ -49,10 +49,10 @@
#include "src/core/lib/channel/message_size_filter.h" #include "src/core/lib/channel/message_size_filter.h"
#include "src/core/lib/debug/trace.h" #include "src/core/lib/debug/trace.h"
#include "src/core/lib/http/parser.h" #include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/buffer_pool.h"
#include "src/core/lib/iomgr/combiner.h" #include "src/core/lib/iomgr/combiner.h"
#include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h" #include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/profiling/timers.h" #include "src/core/lib/profiling/timers.h"
#include "src/core/lib/surface/api_trace.h" #include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h" #include "src/core/lib/surface/call.h"
@ -192,7 +192,7 @@ void grpc_init(void) {
// Default timeout trace to 1 // Default timeout trace to 1
grpc_cq_event_timeout_trace = 1; grpc_cq_event_timeout_trace = 1;
grpc_register_tracer("op_failure", &grpc_trace_operation_failures); grpc_register_tracer("op_failure", &grpc_trace_operation_failures);
grpc_register_tracer("buffer_pool", &grpc_buffer_pool_trace); grpc_register_tracer("resource_quota", &grpc_resource_quota_trace);
#ifndef NDEBUG #ifndef NDEBUG
grpc_register_tracer("pending_tags", &grpc_trace_pending_tags); grpc_register_tracer("pending_tags", &grpc_trace_pending_tags);
#endif #endif

@ -34,7 +34,7 @@
#include <sstream> #include <sstream>
#include <grpc++/buffer_pool.h> #include <grpc++/resource_quota.h>
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/lib/channel/channel_args.h" #include "src/core/lib/channel/channel_args.h"
@ -114,9 +114,9 @@ void ChannelArguments::SetUserAgentPrefix(
} }
} }
void ChannelArguments::SetBufferPool(const grpc::BufferPool& buffer_pool) { void ChannelArguments::SetResourceQuota(const grpc::ResourceQuota& resource_quota) {
SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, buffer_pool.c_buffer_pool(), SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, resource_quota.c_resource_quota(),
grpc_buffer_pool_arg_vtable()); grpc_resource_quota_arg_vtable());
} }
void ChannelArguments::SetInt(const grpc::string& key, int value) { void ChannelArguments::SetInt(const grpc::string& key, int value) {

@ -31,20 +31,20 @@
* *
*/ */
#include <grpc++/buffer_pool.h> #include <grpc++/resource_quota.h>
#include <grpc/grpc.h> #include <grpc/grpc.h>
namespace grpc { namespace grpc {
BufferPool::BufferPool() : impl_(grpc_buffer_pool_create(nullptr)) {} ResourceQuota::ResourceQuota() : impl_(grpc_resource_quota_create(nullptr)) {}
BufferPool::BufferPool(const grpc::string& name) ResourceQuota::ResourceQuota(const grpc::string& name)
: impl_(grpc_buffer_pool_create(name.c_str())) {} : impl_(grpc_resource_quota_create(name.c_str())) {}
BufferPool::~BufferPool() { grpc_buffer_pool_unref(impl_); } ResourceQuota::~ResourceQuota() { grpc_resource_quota_unref(impl_); }
BufferPool& BufferPool::Resize(size_t new_size) { ResourceQuota& ResourceQuota::Resize(size_t new_size) {
grpc_buffer_pool_resize(impl_, new_size); grpc_resource_quota_resize(impl_, new_size);
return *this; return *this;
} }

@ -33,7 +33,7 @@
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
#include <grpc++/buffer_pool.h> #include <grpc++/resource_quota.h>
#include <grpc++/impl/service_type.h> #include <grpc++/impl/service_type.h>
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
@ -55,7 +55,7 @@ static void do_plugin_list_init(void) {
ServerBuilder::ServerBuilder() ServerBuilder::ServerBuilder()
: max_receive_message_size_(-1), : max_receive_message_size_(-1),
max_send_message_size_(-1), max_send_message_size_(-1),
buffer_pool_(nullptr), resource_quota_(nullptr),
generic_service_(nullptr) { generic_service_(nullptr) {
gpr_once_init(&once_init_plugin_list, do_plugin_list_init); gpr_once_init(&once_init_plugin_list, do_plugin_list_init);
for (auto it = g_plugin_factory_list->begin(); for (auto it = g_plugin_factory_list->begin();
@ -73,8 +73,8 @@ ServerBuilder::ServerBuilder()
} }
ServerBuilder::~ServerBuilder() { ServerBuilder::~ServerBuilder() {
if (buffer_pool_ != nullptr) { if (resource_quota_ != nullptr) {
grpc_buffer_pool_unref(buffer_pool_); grpc_resource_quota_unref(resource_quota_);
} }
} }
@ -138,13 +138,13 @@ ServerBuilder& ServerBuilder::SetDefaultCompressionAlgorithm(
return *this; return *this;
} }
ServerBuilder& ServerBuilder::SetBufferPool( ServerBuilder& ServerBuilder::SetResourceQuota(
const grpc::BufferPool& buffer_pool) { const grpc::ResourceQuota& resource_quota) {
if (buffer_pool_ != nullptr) { if (resource_quota_ != nullptr) {
grpc_buffer_pool_unref(buffer_pool_); grpc_resource_quota_unref(resource_quota_);
} }
buffer_pool_ = buffer_pool.c_buffer_pool(); resource_quota_ = resource_quota.c_resource_quota();
grpc_buffer_pool_ref(buffer_pool_); grpc_resource_quota_ref(resource_quota_);
return *this; return *this;
} }
@ -196,9 +196,9 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM,
maybe_default_compression_algorithm_.algorithm); maybe_default_compression_algorithm_.algorithm);
} }
if (buffer_pool_ != nullptr) { if (resource_quota_ != nullptr) {
args.SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, buffer_pool_, args.SetPointerWithVtable(GRPC_ARG_BUFFER_POOL, resource_quota_,
grpc_buffer_pool_arg_vtable()); grpc_resource_quota_arg_vtable());
} }
std::unique_ptr<Server> server(new Server(thread_pool.release(), true, std::unique_ptr<Server> server(new Server(thread_pool.release(), true,
max_receive_message_size_, &args)); max_receive_message_size_, &args));

@ -141,7 +141,7 @@ message ServerConfig {
// c++-only options (for now) -------------------------------- // c++-only options (for now) --------------------------------
// Buffer pool size (no buffer pool specified if unset) // Buffer pool size (no buffer pool specified if unset)
int32 buffer_pool_size = 1001; int32 resource_quota_size = 1001;
} }
message ServerArgs { message ServerArgs {

@ -94,7 +94,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/http/format_request.c', 'src/core/lib/http/format_request.c',
'src/core/lib/http/httpcli.c', 'src/core/lib/http/httpcli.c',
'src/core/lib/http/parser.c', 'src/core/lib/http/parser.c',
'src/core/lib/iomgr/buffer_pool.c',
'src/core/lib/iomgr/closure.c', 'src/core/lib/iomgr/closure.c',
'src/core/lib/iomgr/combiner.c', 'src/core/lib/iomgr/combiner.c',
'src/core/lib/iomgr/endpoint.c', 'src/core/lib/iomgr/endpoint.c',
@ -118,6 +117,7 @@ CORE_SOURCE_FILES = [
'src/core/lib/iomgr/pollset_windows.c', 'src/core/lib/iomgr/pollset_windows.c',
'src/core/lib/iomgr/resolve_address_posix.c', 'src/core/lib/iomgr/resolve_address_posix.c',
'src/core/lib/iomgr/resolve_address_windows.c', 'src/core/lib/iomgr/resolve_address_windows.c',
'src/core/lib/iomgr/resource_quota.c',
'src/core/lib/iomgr/sockaddr_utils.c', 'src/core/lib/iomgr/sockaddr_utils.c',
'src/core/lib/iomgr/socket_utils_common_posix.c', 'src/core/lib/iomgr/socket_utils_common_posix.c',
'src/core/lib/iomgr/socket_utils_linux.c', 'src/core/lib/iomgr/socket_utils_linux.c',

@ -132,11 +132,11 @@ grpc_header_key_is_legal_type grpc_header_key_is_legal_import;
grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import; grpc_header_nonbin_value_is_legal_type grpc_header_nonbin_value_is_legal_import;
grpc_is_binary_header_type grpc_is_binary_header_import; grpc_is_binary_header_type grpc_is_binary_header_import;
grpc_call_error_to_string_type grpc_call_error_to_string_import; grpc_call_error_to_string_type grpc_call_error_to_string_import;
grpc_buffer_pool_create_type grpc_buffer_pool_create_import; grpc_resource_quota_create_type grpc_resource_quota_create_import;
grpc_buffer_pool_ref_type grpc_buffer_pool_ref_import; grpc_resource_quota_ref_type grpc_resource_quota_ref_import;
grpc_buffer_pool_unref_type grpc_buffer_pool_unref_import; grpc_resource_quota_unref_type grpc_resource_quota_unref_import;
grpc_buffer_pool_resize_type grpc_buffer_pool_resize_import; grpc_resource_quota_resize_type grpc_resource_quota_resize_import;
grpc_buffer_pool_arg_vtable_type grpc_buffer_pool_arg_vtable_import; grpc_resource_quota_arg_vtable_type grpc_resource_quota_arg_vtable_import;
grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import;
grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import; grpc_server_add_insecure_channel_from_fd_type grpc_server_add_insecure_channel_from_fd_import;
grpc_use_signal_type grpc_use_signal_import; grpc_use_signal_type grpc_use_signal_import;
@ -406,11 +406,11 @@ void grpc_rb_load_imports(HMODULE library) {
grpc_header_nonbin_value_is_legal_import = (grpc_header_nonbin_value_is_legal_type) GetProcAddress(library, "grpc_header_nonbin_value_is_legal"); grpc_header_nonbin_value_is_legal_import = (grpc_header_nonbin_value_is_legal_type) GetProcAddress(library, "grpc_header_nonbin_value_is_legal");
grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header"); grpc_is_binary_header_import = (grpc_is_binary_header_type) GetProcAddress(library, "grpc_is_binary_header");
grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string"); grpc_call_error_to_string_import = (grpc_call_error_to_string_type) GetProcAddress(library, "grpc_call_error_to_string");
grpc_buffer_pool_create_import = (grpc_buffer_pool_create_type) GetProcAddress(library, "grpc_buffer_pool_create"); grpc_resource_quota_create_import = (grpc_resource_quota_create_type) GetProcAddress(library, "grpc_resource_quota_create");
grpc_buffer_pool_ref_import = (grpc_buffer_pool_ref_type) GetProcAddress(library, "grpc_buffer_pool_ref"); grpc_resource_quota_ref_import = (grpc_resource_quota_ref_type) GetProcAddress(library, "grpc_resource_quota_ref");
grpc_buffer_pool_unref_import = (grpc_buffer_pool_unref_type) GetProcAddress(library, "grpc_buffer_pool_unref"); grpc_resource_quota_unref_import = (grpc_resource_quota_unref_type) GetProcAddress(library, "grpc_resource_quota_unref");
grpc_buffer_pool_resize_import = (grpc_buffer_pool_resize_type) GetProcAddress(library, "grpc_buffer_pool_resize"); grpc_resource_quota_resize_import = (grpc_resource_quota_resize_type) GetProcAddress(library, "grpc_resource_quota_resize");
grpc_buffer_pool_arg_vtable_import = (grpc_buffer_pool_arg_vtable_type) GetProcAddress(library, "grpc_buffer_pool_arg_vtable"); grpc_resource_quota_arg_vtable_import = (grpc_resource_quota_arg_vtable_type) GetProcAddress(library, "grpc_resource_quota_arg_vtable");
grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd"); grpc_insecure_channel_create_from_fd_import = (grpc_insecure_channel_create_from_fd_type) GetProcAddress(library, "grpc_insecure_channel_create_from_fd");
grpc_server_add_insecure_channel_from_fd_import = (grpc_server_add_insecure_channel_from_fd_type) GetProcAddress(library, "grpc_server_add_insecure_channel_from_fd"); grpc_server_add_insecure_channel_from_fd_import = (grpc_server_add_insecure_channel_from_fd_type) GetProcAddress(library, "grpc_server_add_insecure_channel_from_fd");
grpc_use_signal_import = (grpc_use_signal_type) GetProcAddress(library, "grpc_use_signal"); grpc_use_signal_import = (grpc_use_signal_type) GetProcAddress(library, "grpc_use_signal");

@ -347,21 +347,21 @@ extern grpc_is_binary_header_type grpc_is_binary_header_import;
typedef const char *(*grpc_call_error_to_string_type)(grpc_call_error error); typedef const char *(*grpc_call_error_to_string_type)(grpc_call_error error);
extern grpc_call_error_to_string_type grpc_call_error_to_string_import; extern grpc_call_error_to_string_type grpc_call_error_to_string_import;
#define grpc_call_error_to_string grpc_call_error_to_string_import #define grpc_call_error_to_string grpc_call_error_to_string_import
typedef grpc_buffer_pool *(*grpc_buffer_pool_create_type)(const char *trace_name); typedef grpc_resource_quota *(*grpc_resource_quota_create_type)(const char *trace_name);
extern grpc_buffer_pool_create_type grpc_buffer_pool_create_import; extern grpc_resource_quota_create_type grpc_resource_quota_create_import;
#define grpc_buffer_pool_create grpc_buffer_pool_create_import #define grpc_resource_quota_create grpc_resource_quota_create_import
typedef void(*grpc_buffer_pool_ref_type)(grpc_buffer_pool *buffer_pool); typedef void(*grpc_resource_quota_ref_type)(grpc_resource_quota *resource_quota);
extern grpc_buffer_pool_ref_type grpc_buffer_pool_ref_import; extern grpc_resource_quota_ref_type grpc_resource_quota_ref_import;
#define grpc_buffer_pool_ref grpc_buffer_pool_ref_import #define grpc_resource_quota_ref grpc_resource_quota_ref_import
typedef void(*grpc_buffer_pool_unref_type)(grpc_buffer_pool *buffer_pool); typedef void(*grpc_resource_quota_unref_type)(grpc_resource_quota *resource_quota);
extern grpc_buffer_pool_unref_type grpc_buffer_pool_unref_import; extern grpc_resource_quota_unref_type grpc_resource_quota_unref_import;
#define grpc_buffer_pool_unref grpc_buffer_pool_unref_import #define grpc_resource_quota_unref grpc_resource_quota_unref_import
typedef void(*grpc_buffer_pool_resize_type)(grpc_buffer_pool *buffer_pool, size_t new_size); typedef void(*grpc_resource_quota_resize_type)(grpc_resource_quota *resource_quota, size_t new_size);
extern grpc_buffer_pool_resize_type grpc_buffer_pool_resize_import; extern grpc_resource_quota_resize_type grpc_resource_quota_resize_import;
#define grpc_buffer_pool_resize grpc_buffer_pool_resize_import #define grpc_resource_quota_resize grpc_resource_quota_resize_import
typedef const grpc_arg_pointer_vtable *(*grpc_buffer_pool_arg_vtable_type)(void); typedef const grpc_arg_pointer_vtable *(*grpc_resource_quota_arg_vtable_type)(void);
extern grpc_buffer_pool_arg_vtable_type grpc_buffer_pool_arg_vtable_import; extern grpc_resource_quota_arg_vtable_type grpc_resource_quota_arg_vtable_import;
#define grpc_buffer_pool_arg_vtable grpc_buffer_pool_arg_vtable_import #define grpc_resource_quota_arg_vtable grpc_resource_quota_arg_vtable_import
typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args); typedef grpc_channel *(*grpc_insecure_channel_create_from_fd_type)(const char *target, int fd, const grpc_channel_args *args);
extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import; extern grpc_insecure_channel_create_from_fd_type grpc_insecure_channel_create_from_fd_import;
#define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import #define grpc_insecure_channel_create_from_fd grpc_insecure_channel_create_from_fd_import

@ -114,9 +114,9 @@ void grpc_run_bad_client_test(
grpc_init(); grpc_init();
/* Create endpoints */ /* Create endpoints */
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("bad_client_test"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("bad_client_test");
sfd = grpc_iomgr_create_endpoint_pair("fixture", buffer_pool, 65536); sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
/* Create server, completion events */ /* Create server, completion events */
a.server = grpc_server_create(NULL, NULL); a.server = grpc_server_create(NULL, NULL);

@ -47,8 +47,6 @@ extern void bad_hostname(grpc_end2end_test_config config);
extern void bad_hostname_pre_init(void); extern void bad_hostname_pre_init(void);
extern void binary_metadata(grpc_end2end_test_config config); extern void binary_metadata(grpc_end2end_test_config config);
extern void binary_metadata_pre_init(void); extern void binary_metadata_pre_init(void);
extern void buffer_pool_server(grpc_end2end_test_config config);
extern void buffer_pool_server_pre_init(void);
extern void cancel_after_accept(grpc_end2end_test_config config); extern void cancel_after_accept(grpc_end2end_test_config config);
extern void cancel_after_accept_pre_init(void); extern void cancel_after_accept_pre_init(void);
extern void cancel_after_client_done(grpc_end2end_test_config config); extern void cancel_after_client_done(grpc_end2end_test_config config);
@ -113,6 +111,8 @@ extern void request_with_flags(grpc_end2end_test_config config);
extern void request_with_flags_pre_init(void); extern void request_with_flags_pre_init(void);
extern void request_with_payload(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config);
extern void request_with_payload_pre_init(void); extern void request_with_payload_pre_init(void);
extern void resource_quota_server(grpc_end2end_test_config config);
extern void resource_quota_server_pre_init(void);
extern void server_finishes_request(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config);
extern void server_finishes_request_pre_init(void); extern void server_finishes_request_pre_init(void);
extern void shutdown_finishes_calls(grpc_end2end_test_config config); extern void shutdown_finishes_calls(grpc_end2end_test_config config);
@ -137,7 +137,6 @@ void grpc_end2end_tests_pre_init(void) {
g_pre_init_called = true; g_pre_init_called = true;
bad_hostname_pre_init(); bad_hostname_pre_init();
binary_metadata_pre_init(); binary_metadata_pre_init();
buffer_pool_server_pre_init();
cancel_after_accept_pre_init(); cancel_after_accept_pre_init();
cancel_after_client_done_pre_init(); cancel_after_client_done_pre_init();
cancel_after_invoke_pre_init(); cancel_after_invoke_pre_init();
@ -170,6 +169,7 @@ void grpc_end2end_tests_pre_init(void) {
registered_call_pre_init(); registered_call_pre_init();
request_with_flags_pre_init(); request_with_flags_pre_init();
request_with_payload_pre_init(); request_with_payload_pre_init();
resource_quota_server_pre_init();
server_finishes_request_pre_init(); server_finishes_request_pre_init();
shutdown_finishes_calls_pre_init(); shutdown_finishes_calls_pre_init();
shutdown_finishes_tags_pre_init(); shutdown_finishes_tags_pre_init();
@ -190,7 +190,6 @@ void grpc_end2end_tests(int argc, char **argv,
if (argc <= 1) { if (argc <= 1) {
bad_hostname(config); bad_hostname(config);
binary_metadata(config); binary_metadata(config);
buffer_pool_server(config);
cancel_after_accept(config); cancel_after_accept(config);
cancel_after_client_done(config); cancel_after_client_done(config);
cancel_after_invoke(config); cancel_after_invoke(config);
@ -223,6 +222,7 @@ void grpc_end2end_tests(int argc, char **argv,
registered_call(config); registered_call(config);
request_with_flags(config); request_with_flags(config);
request_with_payload(config); request_with_payload(config);
resource_quota_server(config);
server_finishes_request(config); server_finishes_request(config);
shutdown_finishes_calls(config); shutdown_finishes_calls(config);
shutdown_finishes_tags(config); shutdown_finishes_tags(config);
@ -244,10 +244,6 @@ void grpc_end2end_tests(int argc, char **argv,
binary_metadata(config); binary_metadata(config);
continue; continue;
} }
if (0 == strcmp("buffer_pool_server", argv[i])) {
buffer_pool_server(config);
continue;
}
if (0 == strcmp("cancel_after_accept", argv[i])) { if (0 == strcmp("cancel_after_accept", argv[i])) {
cancel_after_accept(config); cancel_after_accept(config);
continue; continue;
@ -376,6 +372,10 @@ void grpc_end2end_tests(int argc, char **argv,
request_with_payload(config); request_with_payload(config);
continue; continue;
} }
if (0 == strcmp("resource_quota_server", argv[i])) {
resource_quota_server(config);
continue;
}
if (0 == strcmp("server_finishes_request", argv[i])) { if (0 == strcmp("server_finishes_request", argv[i])) {
server_finishes_request(config); server_finishes_request(config);
continue; continue;

@ -47,8 +47,6 @@ extern void bad_hostname(grpc_end2end_test_config config);
extern void bad_hostname_pre_init(void); extern void bad_hostname_pre_init(void);
extern void binary_metadata(grpc_end2end_test_config config); extern void binary_metadata(grpc_end2end_test_config config);
extern void binary_metadata_pre_init(void); extern void binary_metadata_pre_init(void);
extern void buffer_pool_server(grpc_end2end_test_config config);
extern void buffer_pool_server_pre_init(void);
extern void call_creds(grpc_end2end_test_config config); extern void call_creds(grpc_end2end_test_config config);
extern void call_creds_pre_init(void); extern void call_creds_pre_init(void);
extern void cancel_after_accept(grpc_end2end_test_config config); extern void cancel_after_accept(grpc_end2end_test_config config);
@ -115,6 +113,8 @@ extern void request_with_flags(grpc_end2end_test_config config);
extern void request_with_flags_pre_init(void); extern void request_with_flags_pre_init(void);
extern void request_with_payload(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config);
extern void request_with_payload_pre_init(void); extern void request_with_payload_pre_init(void);
extern void resource_quota_server(grpc_end2end_test_config config);
extern void resource_quota_server_pre_init(void);
extern void server_finishes_request(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config);
extern void server_finishes_request_pre_init(void); extern void server_finishes_request_pre_init(void);
extern void shutdown_finishes_calls(grpc_end2end_test_config config); extern void shutdown_finishes_calls(grpc_end2end_test_config config);
@ -139,7 +139,6 @@ void grpc_end2end_tests_pre_init(void) {
g_pre_init_called = true; g_pre_init_called = true;
bad_hostname_pre_init(); bad_hostname_pre_init();
binary_metadata_pre_init(); binary_metadata_pre_init();
buffer_pool_server_pre_init();
call_creds_pre_init(); call_creds_pre_init();
cancel_after_accept_pre_init(); cancel_after_accept_pre_init();
cancel_after_client_done_pre_init(); cancel_after_client_done_pre_init();
@ -173,6 +172,7 @@ void grpc_end2end_tests_pre_init(void) {
registered_call_pre_init(); registered_call_pre_init();
request_with_flags_pre_init(); request_with_flags_pre_init();
request_with_payload_pre_init(); request_with_payload_pre_init();
resource_quota_server_pre_init();
server_finishes_request_pre_init(); server_finishes_request_pre_init();
shutdown_finishes_calls_pre_init(); shutdown_finishes_calls_pre_init();
shutdown_finishes_tags_pre_init(); shutdown_finishes_tags_pre_init();
@ -193,7 +193,6 @@ void grpc_end2end_tests(int argc, char **argv,
if (argc <= 1) { if (argc <= 1) {
bad_hostname(config); bad_hostname(config);
binary_metadata(config); binary_metadata(config);
buffer_pool_server(config);
call_creds(config); call_creds(config);
cancel_after_accept(config); cancel_after_accept(config);
cancel_after_client_done(config); cancel_after_client_done(config);
@ -227,6 +226,7 @@ void grpc_end2end_tests(int argc, char **argv,
registered_call(config); registered_call(config);
request_with_flags(config); request_with_flags(config);
request_with_payload(config); request_with_payload(config);
resource_quota_server(config);
server_finishes_request(config); server_finishes_request(config);
shutdown_finishes_calls(config); shutdown_finishes_calls(config);
shutdown_finishes_tags(config); shutdown_finishes_tags(config);
@ -248,10 +248,6 @@ void grpc_end2end_tests(int argc, char **argv,
binary_metadata(config); binary_metadata(config);
continue; continue;
} }
if (0 == strcmp("buffer_pool_server", argv[i])) {
buffer_pool_server(config);
continue;
}
if (0 == strcmp("call_creds", argv[i])) { if (0 == strcmp("call_creds", argv[i])) {
call_creds(config); call_creds(config);
continue; continue;
@ -384,6 +380,10 @@ void grpc_end2end_tests(int argc, char **argv,
request_with_payload(config); request_with_payload(config);
continue; continue;
} }
if (0 == strcmp("resource_quota_server", argv[i])) {
resource_quota_server(config);
continue;
}
if (0 == strcmp("server_finishes_request", argv[i])) { if (0 == strcmp("server_finishes_request", argv[i])) {
server_finishes_request(config); server_finishes_request(config);
continue; continue;

@ -91,9 +91,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(NULL); f.cq = grpc_completion_queue_create(NULL);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("fixture"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture");
*sfd = grpc_iomgr_create_endpoint_pair("fixture", buffer_pool, 65536); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536);
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
return f; return f;
} }

@ -90,9 +90,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(NULL); f.cq = grpc_completion_queue_create(NULL);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("fixture"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture");
*sfd = grpc_iomgr_create_endpoint_pair("fixture", buffer_pool, 65536); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 65536);
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
return f; return f;
} }

@ -90,9 +90,9 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
f.fixture_data = sfd; f.fixture_data = sfd;
f.cq = grpc_completion_queue_create(NULL); f.cq = grpc_completion_queue_create(NULL);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("fixture"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("fixture");
*sfd = grpc_iomgr_create_endpoint_pair("fixture", buffer_pool, 1); *sfd = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, 1);
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
return f; return f;
} }

@ -173,7 +173,7 @@ static bool is_eof(input_stream *inp) { return inp->cur == inp->end; }
static gpr_timespec g_now; static gpr_timespec g_now;
static grpc_server *g_server; static grpc_server *g_server;
static grpc_channel *g_channel; static grpc_channel *g_channel;
static grpc_buffer_pool *g_buffer_pool; static grpc_resource_quota *g_resource_quota;
extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type); extern gpr_timespec (*gpr_now_impl)(gpr_clock_type clock_type);
@ -253,7 +253,7 @@ static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
} else if (g_server != NULL) { } else if (g_server != NULL) {
grpc_endpoint *client; grpc_endpoint *client;
grpc_endpoint *server; grpc_endpoint *server;
grpc_passthru_endpoint_create(&client, &server, g_buffer_pool); grpc_passthru_endpoint_create(&client, &server, g_resource_quota);
*fc->ep = client; *fc->ep = client;
grpc_transport *transport = grpc_transport *transport =
@ -522,7 +522,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int pending_pings = 0; int pending_pings = 0;
g_active_call = new_call(NULL, ROOT); g_active_call = new_call(NULL, ROOT);
g_buffer_pool = grpc_buffer_pool_create("api_fuzzer"); g_resource_quota = grpc_resource_quota_create("api_fuzzer");
grpc_completion_queue *cq = grpc_completion_queue_create(NULL); grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
@ -944,7 +944,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
} }
// resize the buffer pool // resize the buffer pool
case 21: { case 21: {
grpc_buffer_pool_resize(g_buffer_pool, read_uint22(&inp)); grpc_resource_quota_resize(g_resource_quota, read_uint22(&inp));
break; break;
} }
} }
@ -962,7 +962,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
.type == GRPC_QUEUE_SHUTDOWN); .type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq); grpc_completion_queue_destroy(cq);
grpc_buffer_pool_unref(g_buffer_pool); grpc_resource_quota_unref(g_resource_quota);
grpc_shutdown(); grpc_shutdown();
return 0; return 0;

@ -58,10 +58,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_init(); grpc_init();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("client_fuzzer"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("client_fuzzer");
grpc_endpoint *mock_endpoint = grpc_endpoint *mock_endpoint =
grpc_mock_endpoint_create(discard_write, buffer_pool); grpc_mock_endpoint_create(discard_write, resource_quota);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_completion_queue *cq = grpc_completion_queue_create(NULL); grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
grpc_transport *transport = grpc_transport *transport =

@ -56,10 +56,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_init(); grpc_init();
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("server_fuzzer"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("server_fuzzer");
grpc_endpoint *mock_endpoint = grpc_endpoint *mock_endpoint =
grpc_mock_endpoint_create(discard_write, buffer_pool); grpc_mock_endpoint_create(discard_write, resource_quota);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_mock_endpoint_put_read( grpc_mock_endpoint_put_read(
&exec_ctx, mock_endpoint, &exec_ctx, mock_endpoint,
gpr_slice_from_copied_buffer((const char *)data, size)); gpr_slice_from_copied_buffer((const char *)data, size));

@ -88,7 +88,7 @@ LOWCPU = 0.1
END2END_TESTS = { END2END_TESTS = {
'bad_hostname': default_test_options, 'bad_hostname': default_test_options,
'binary_metadata': default_test_options, 'binary_metadata': default_test_options,
'buffer_pool_server': default_test_options._replace(large_writes=True, 'resource_quota_server': default_test_options._replace(large_writes=True,
proxyable=False), proxyable=False),
'call_creds': default_test_options._replace(secure=True), 'call_creds': default_test_options._replace(secure=True),
'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU), 'cancel_after_accept': default_test_options._replace(cpu_cost=LOWCPU),

@ -107,9 +107,10 @@ static gpr_slice generate_random_slice() {
return gpr_slice_from_copied_string(output); return gpr_slice_from_copied_string(output);
} }
void buffer_pool_server(grpc_end2end_test_config config) { void resource_quota_server(grpc_end2end_test_config config) {
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("test_server"); grpc_resource_quota *resource_quota =
grpc_buffer_pool_resize(buffer_pool, 5 * 1024 * 1024); grpc_resource_quota_create("test_server");
grpc_resource_quota_resize(resource_quota, 5 * 1024 * 1024);
#define NUM_CALLS 100 #define NUM_CALLS 100
#define CLIENT_BASE_TAG 1000 #define CLIENT_BASE_TAG 1000
@ -120,12 +121,12 @@ void buffer_pool_server(grpc_end2end_test_config config) {
grpc_arg arg; grpc_arg arg;
arg.key = GRPC_ARG_BUFFER_POOL; arg.key = GRPC_ARG_BUFFER_POOL;
arg.type = GRPC_ARG_POINTER; arg.type = GRPC_ARG_POINTER;
arg.value.pointer.p = buffer_pool; arg.value.pointer.p = resource_quota;
arg.value.pointer.vtable = grpc_buffer_pool_arg_vtable(); arg.value.pointer.vtable = grpc_resource_quota_arg_vtable();
grpc_channel_args args = {1, &arg}; grpc_channel_args args = {1, &arg};
grpc_end2end_test_fixture f = grpc_end2end_test_fixture f =
begin_test(config, "buffer_pool_server", NULL, &args); begin_test(config, "resource_quota_server", NULL, &args);
/* Create large request and response bodies. These are big enough to require /* Create large request and response bodies. These are big enough to require
* multiple round trips to deliver to the peer, and their exact contents of * multiple round trips to deliver to the peer, and their exact contents of
@ -343,10 +344,10 @@ void buffer_pool_server(grpc_end2end_test_config config) {
grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(request_payload);
gpr_slice_unref(request_payload_slice); gpr_slice_unref(request_payload_slice);
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
end_test(&f); end_test(&f);
config.tear_down_data(&f); config.tear_down_data(&f);
} }
void buffer_pool_server_pre_init(void) {} void resource_quota_server_pre_init(void) {}

@ -0,0 +1,352 @@
/*
*
* Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "test/core/end2end/end2end_tests.h"
#include <stdio.h>
#include <string.h>
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "test/core/end2end/cq_verifier.h"
static void *tag(intptr_t t) { return (void *)t; }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char *test_name,
grpc_channel_args *client_args,
grpc_channel_args *server_args) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "%s/%s", test_name, config.name);
f = config.create_fixture(client_args, server_args);
config.init_server(&f, server_args);
config.init_client(&f, client_args);
return f;
}
static gpr_timespec n_seconds_time(int n) {
return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n);
}
static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue *cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture *f) {
if (!f->server) return;
grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(
f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
}
static void shutdown_client(grpc_end2end_test_fixture *f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
}
static void end_test(grpc_end2end_test_fixture *f) {
shutdown_server(f);
shutdown_client(f);
grpc_completion_queue_shutdown(f->cq);
drain_cq(f->cq);
grpc_completion_queue_destroy(f->cq);
}
/* Creates and returns a gpr_slice containing random alphanumeric characters. */
static gpr_slice generate_random_slice() {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
char output[1024 * 1024];
for (i = 0; i < GPR_ARRAY_SIZE(output) - 1; ++i) {
output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
}
output[GPR_ARRAY_SIZE(output) - 1] = '\0';
return gpr_slice_from_copied_string(output);
}
void resource_quota_server(grpc_end2end_test_config config) {
grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_server");
grpc_resource_quota_resize(resource_quota, 5 * 1024 * 1024);
#define NUM_CALLS 100
#define CLIENT_BASE_TAG 1000
#define SERVER_START_BASE_TAG 2000
#define SERVER_RECV_BASE_TAG 3000
#define SERVER_END_BASE_TAG 4000
grpc_arg arg;
arg.key = GRPC_ARG_BUFFER_POOL;
arg.type = GRPC_ARG_POINTER;
arg.value.pointer.p = resource_quota;
arg.value.pointer.vtable = grpc_resource_quota_arg_vtable();
grpc_channel_args args = {1, &arg};
grpc_end2end_test_fixture f =
begin_test(config, "resource_quota_server", NULL, &args);
/* Create large request and response bodies. These are big enough to require
* multiple round trips to deliver to the peer, and their exact contents of
* will be verified on completion. */
gpr_slice request_payload_slice = generate_random_slice();
grpc_call *client_calls[NUM_CALLS];
grpc_call *server_calls[NUM_CALLS];
grpc_metadata_array initial_metadata_recv[NUM_CALLS];
grpc_metadata_array trailing_metadata_recv[NUM_CALLS];
grpc_metadata_array request_metadata_recv[NUM_CALLS];
grpc_call_details call_details[NUM_CALLS];
grpc_status_code status[NUM_CALLS];
char *details[NUM_CALLS];
size_t details_capacity[NUM_CALLS];
grpc_byte_buffer *request_payload_recv[NUM_CALLS];
int was_cancelled[NUM_CALLS];
grpc_call_error error;
int pending_client_calls = 0;
int pending_server_start_calls = 0;
int pending_server_recv_calls = 0;
int pending_server_end_calls = 0;
int cancelled_calls_on_client = 0;
int cancelled_calls_on_server = 0;
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_op ops[6];
grpc_op *op;
for (int i = 0; i < NUM_CALLS; i++) {
grpc_metadata_array_init(&initial_metadata_recv[i]);
grpc_metadata_array_init(&trailing_metadata_recv[i]);
grpc_metadata_array_init(&request_metadata_recv[i]);
grpc_call_details_init(&call_details[i]);
details[i] = NULL;
details_capacity[i] = 0;
request_payload_recv[i] = NULL;
was_cancelled[i] = 0;
}
for (int i = 0; i < NUM_CALLS; i++) {
error = grpc_server_request_call(
f.server, &server_calls[i], &call_details[i], &request_metadata_recv[i],
f.cq, f.cq, tag(SERVER_START_BASE_TAG + i));
GPR_ASSERT(GRPC_CALL_OK == error);
pending_server_start_calls++;
}
for (int i = 0; i < NUM_CALLS; i++) {
client_calls[i] = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo",
"foo.test.google.fr", n_seconds_time(60), NULL);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata = &initial_metadata_recv[i];
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata =
&trailing_metadata_recv[i];
op->data.recv_status_on_client.status = &status[i];
op->data.recv_status_on_client.status_details = &details[i];
op->data.recv_status_on_client.status_details_capacity =
&details_capacity[i];
op->flags = 0;
op->reserved = NULL;
op++;
error = grpc_call_start_batch(client_calls[i], ops, (size_t)(op - ops),
tag(CLIENT_BASE_TAG + i), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
pending_client_calls++;
}
while (pending_client_calls + pending_server_recv_calls +
pending_server_end_calls >
0) {
grpc_event ev = grpc_completion_queue_next(f.cq, n_seconds_time(10), NULL);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
int ev_tag = (int)(intptr_t)ev.tag;
if (ev_tag < CLIENT_BASE_TAG) {
abort(); /* illegal tag */
} else if (ev_tag < SERVER_START_BASE_TAG) {
/* client call finished */
int call_id = ev_tag - CLIENT_BASE_TAG;
GPR_ASSERT(call_id >= 0);
GPR_ASSERT(call_id < NUM_CALLS);
switch (status[call_id]) {
case GRPC_STATUS_RESOURCE_EXHAUSTED:
cancelled_calls_on_client++;
break;
case GRPC_STATUS_OK:
break;
default:
gpr_log(GPR_ERROR, "Unexpected status code: %d", status[call_id]);
abort();
}
GPR_ASSERT(pending_client_calls > 0);
grpc_metadata_array_destroy(&initial_metadata_recv[call_id]);
grpc_metadata_array_destroy(&trailing_metadata_recv[call_id]);
grpc_call_destroy(client_calls[call_id]);
gpr_free(details[call_id]);
pending_client_calls--;
} else if (ev_tag < SERVER_RECV_BASE_TAG) {
/* new incoming call to the server */
int call_id = ev_tag - SERVER_START_BASE_TAG;
GPR_ASSERT(call_id >= 0);
GPR_ASSERT(call_id < NUM_CALLS);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message = &request_payload_recv[call_id];
op->flags = 0;
op->reserved = NULL;
op++;
error =
grpc_call_start_batch(server_calls[call_id], ops, (size_t)(op - ops),
tag(SERVER_RECV_BASE_TAG + call_id), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(pending_server_start_calls > 0);
pending_server_start_calls--;
pending_server_recv_calls++;
grpc_call_details_destroy(&call_details[call_id]);
grpc_metadata_array_destroy(&request_metadata_recv[call_id]);
} else if (ev_tag < SERVER_END_BASE_TAG) {
/* finished read on the server */
int call_id = ev_tag - SERVER_RECV_BASE_TAG;
GPR_ASSERT(call_id >= 0);
GPR_ASSERT(call_id < NUM_CALLS);
if (ev.success) {
if (request_payload_recv[call_id] != NULL) {
grpc_byte_buffer_destroy(request_payload_recv[call_id]);
request_payload_recv[call_id] = NULL;
}
} else {
GPR_ASSERT(request_payload_recv[call_id] == NULL);
}
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled[call_id];
op->flags = 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_OK;
op->data.send_status_from_server.status_details = "xyz";
op->flags = 0;
op->reserved = NULL;
op++;
error =
grpc_call_start_batch(server_calls[call_id], ops, (size_t)(op - ops),
tag(SERVER_END_BASE_TAG + call_id), NULL);
GPR_ASSERT(GRPC_CALL_OK == error);
GPR_ASSERT(pending_server_recv_calls > 0);
pending_server_recv_calls--;
pending_server_end_calls++;
} else {
int call_id = ev_tag - SERVER_END_BASE_TAG;
GPR_ASSERT(call_id >= 0);
GPR_ASSERT(call_id < NUM_CALLS);
if (was_cancelled[call_id]) {
cancelled_calls_on_server++;
}
GPR_ASSERT(pending_server_end_calls > 0);
pending_server_end_calls--;
grpc_call_destroy(server_calls[call_id]);
}
}
gpr_log(
GPR_INFO,
"Done. %d total calls: %d cancelled at server, %d cancelled at client.",
NUM_CALLS, cancelled_calls_on_server, cancelled_calls_on_client);
GPR_ASSERT(cancelled_calls_on_client >= cancelled_calls_on_server);
GPR_ASSERT(cancelled_calls_on_server >= 0.9 * cancelled_calls_on_client);
grpc_byte_buffer_destroy(request_payload);
gpr_slice_unref(request_payload_slice);
grpc_resource_quota_unref(resource_quota);
end_test(&f);
config.tear_down_data(&f);
}
void resource_quota_server_pre_init(void) {}

@ -89,11 +89,11 @@ static void test_get(int port) {
grpc_http_response response; grpc_http_response response;
memset(&response, 0, sizeof(response)); memset(&response, 0, sizeof(response));
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("test_get"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get");
grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, buffer_pool, &req, grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, resource_quota, &req,
n_seconds_time(15), n_seconds_time(15),
grpc_closure_create(on_finish, &response), &response); grpc_closure_create(on_finish, &response), &response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);
while (!g_done) { while (!g_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
@ -129,11 +129,11 @@ static void test_post(int port) {
grpc_http_response response; grpc_http_response response;
memset(&response, 0, sizeof(response)); memset(&response, 0, sizeof(response));
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("test_post"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_post");
grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, buffer_pool, &req, "hello", grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello",
5, n_seconds_time(15), 5, n_seconds_time(15),
grpc_closure_create(on_finish, &response), &response); grpc_closure_create(on_finish, &response), &response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);
while (!g_done) { while (!g_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;

@ -90,11 +90,11 @@ static void test_get(int port) {
grpc_http_response response; grpc_http_response response;
memset(&response, 0, sizeof(response)); memset(&response, 0, sizeof(response));
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("test_get"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_get");
grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, buffer_pool, &req, grpc_httpcli_get(&exec_ctx, &g_context, &g_pops, resource_quota, &req,
n_seconds_time(15), n_seconds_time(15),
grpc_closure_create(on_finish, &response), &response); grpc_closure_create(on_finish, &response), &response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);
while (!g_done) { while (!g_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
@ -131,11 +131,11 @@ static void test_post(int port) {
grpc_http_response response; grpc_http_response response;
memset(&response, 0, sizeof(response)); memset(&response, 0, sizeof(response));
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("test_post"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("test_post");
grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, buffer_pool, &req, "hello", grpc_httpcli_post(&exec_ctx, &g_context, &g_pops, resource_quota, &req, "hello",
5, n_seconds_time(15), 5, n_seconds_time(15),
grpc_closure_create(on_finish, &response), &response); grpc_closure_create(on_finish, &response), &response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_mu_lock(g_mu); gpr_mu_lock(g_mu);
while (!g_done) { while (!g_done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;

@ -84,7 +84,7 @@ static void test_code(void) {
grpc_endpoint_add_to_pollset_set, grpc_endpoint_add_to_pollset_set,
grpc_endpoint_shutdown, grpc_endpoint_shutdown,
grpc_endpoint_destroy, grpc_endpoint_destroy,
grpc_endpoint_get_buffer_user, grpc_endpoint_get_resource_user,
grpc_endpoint_get_peer}; grpc_endpoint_get_peer};
endpoint.vtable = &vtable; endpoint.vtable = &vtable;

@ -49,10 +49,10 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair(
size_t slice_size) { size_t slice_size) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_test_fixture f; grpc_endpoint_test_fixture f;
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("endpoint_pair_test"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("endpoint_pair_test");
grpc_endpoint_pair p = grpc_endpoint_pair p =
grpc_iomgr_create_endpoint_pair("test", buffer_pool, slice_size); grpc_iomgr_create_endpoint_pair("test", resource_quota, slice_size);
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
f.client_ep = p.client; f.client_ep = p.client;
f.server_ep = p.server; f.server_ep = p.server;

@ -52,18 +52,18 @@ int main(int argc, char **argv) {
of descriptors */ of descriptors */
rlim.rlim_cur = rlim.rlim_max = 10; rlim.rlim_cur = rlim.rlim_max = 10;
GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim)); GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim));
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("fd_conservation_posix_test"); grpc_resource_quota_create("fd_conservation_posix_test");
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
p = grpc_iomgr_create_endpoint_pair("test", buffer_pool, 1); p = grpc_iomgr_create_endpoint_pair("test", resource_quota, 1);
grpc_endpoint_destroy(&exec_ctx, p.client); grpc_endpoint_destroy(&exec_ctx, p.client);
grpc_endpoint_destroy(&exec_ctx, p.server); grpc_endpoint_destroy(&exec_ctx, p.server);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(buffer_pool); grpc_resource_quota_unref(resource_quota);
grpc_iomgr_shutdown(); grpc_iomgr_shutdown();
return 0; return 0;

@ -31,7 +31,7 @@
* *
*/ */
#include "src/core/lib/iomgr/buffer_pool.h" #include "src/core/lib/iomgr/resource_quota.h"
#include <grpc/support/alloc.h> #include <grpc/support/alloc.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
@ -49,23 +49,23 @@ grpc_closure *set_bool(bool *p) { return grpc_closure_create(set_bool_cb, p); }
typedef struct { typedef struct {
size_t size; size_t size;
grpc_buffer_user *buffer_user; grpc_resource_user *resource_user;
grpc_closure *then; grpc_closure *then;
} reclaimer_args; } reclaimer_args;
static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args,
grpc_error *error) { grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(error == GRPC_ERROR_NONE);
reclaimer_args *a = args; reclaimer_args *a = args;
grpc_buffer_user_free(exec_ctx, a->buffer_user, a->size); grpc_resource_user_free(exec_ctx, a->resource_user, a->size);
grpc_buffer_user_finish_reclaimation(exec_ctx, a->buffer_user); grpc_resource_user_finish_reclaimation(exec_ctx, a->resource_user);
grpc_closure_run(exec_ctx, a->then, GRPC_ERROR_NONE); grpc_closure_run(exec_ctx, a->then, GRPC_ERROR_NONE);
gpr_free(a); gpr_free(a);
} }
grpc_closure *make_reclaimer(grpc_buffer_user *buffer_user, size_t size, grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size,
grpc_closure *then) { grpc_closure *then) {
reclaimer_args *a = gpr_malloc(sizeof(*a)); reclaimer_args *a = gpr_malloc(sizeof(*a));
a->size = size; a->size = size;
a->buffer_user = buffer_user; a->resource_user = resource_user;
a->then = then; a->then = then;
return grpc_closure_create(reclaimer_cb, a); return grpc_closure_create(reclaimer_cb, a);
} }
@ -79,214 +79,219 @@ grpc_closure *make_unused_reclaimer(grpc_closure *then) {
return grpc_closure_create(unused_reclaimer_cb, then); return grpc_closure_create(unused_reclaimer_cb, then);
} }
static void destroy_user(grpc_buffer_user *usr) { static void destroy_user(grpc_resource_user *usr) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
bool done = false; bool done = false;
grpc_buffer_user_shutdown(&exec_ctx, usr, set_bool(&done)); grpc_resource_user_shutdown(&exec_ctx, usr, set_bool(&done));
grpc_exec_ctx_flush(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
grpc_buffer_user_destroy(&exec_ctx, usr); grpc_resource_user_destroy(&exec_ctx, usr);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
static void test_no_op(void) { static void test_no_op(void) {
gpr_log(GPR_INFO, "** test_no_op **"); gpr_log(GPR_INFO, "** test_no_op **");
grpc_buffer_pool_unref(grpc_buffer_pool_create("test_no_op")); grpc_resource_quota_unref(grpc_resource_quota_create("test_no_op"));
} }
static void test_resize_then_destroy(void) { static void test_resize_then_destroy(void) {
gpr_log(GPR_INFO, "** test_resize_then_destroy **"); gpr_log(GPR_INFO, "** test_resize_then_destroy **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_resize_then_destroy"); grpc_resource_quota *p =
grpc_buffer_pool_resize(p, 1024 * 1024); grpc_resource_quota_create("test_resize_then_destroy");
grpc_buffer_pool_unref(p); grpc_resource_quota_resize(p, 1024 * 1024);
grpc_resource_quota_unref(p);
} }
static void test_buffer_user_no_op(void) { static void test_resource_user_no_op(void) {
gpr_log(GPR_INFO, "** test_buffer_user_no_op **"); gpr_log(GPR_INFO, "** test_resource_user_no_op **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_buffer_user_no_op"); grpc_resource_quota *p =
grpc_buffer_user usr; grpc_resource_quota_create("test_resource_user_no_op");
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user usr;
grpc_buffer_pool_unref(p); grpc_resource_user_init(&usr, p, "usr");
grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_instant_alloc_then_free(void) { static void test_instant_alloc_then_free(void) {
gpr_log(GPR_INFO, "** test_instant_alloc_then_free **"); gpr_log(GPR_INFO, "** test_instant_alloc_then_free **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_instant_alloc_then_free"); grpc_resource_quota *p =
grpc_buffer_pool_resize(p, 1024 * 1024); grpc_resource_quota_create("test_instant_alloc_then_free");
grpc_buffer_user usr; grpc_resource_quota_resize(p, 1024 * 1024);
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user usr;
grpc_resource_user_init(&usr, p, "usr");
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, NULL); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_instant_alloc_free_pair(void) { static void test_instant_alloc_free_pair(void) {
gpr_log(GPR_INFO, "** test_instant_alloc_free_pair **"); gpr_log(GPR_INFO, "** test_instant_alloc_free_pair **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_instant_alloc_free_pair"); grpc_resource_quota *p =
grpc_buffer_pool_resize(p, 1024 * 1024); grpc_resource_quota_create("test_instant_alloc_free_pair");
grpc_buffer_user usr; grpc_resource_quota_resize(p, 1024 * 1024);
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user usr;
grpc_resource_user_init(&usr, p, "usr");
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, NULL); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL);
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_simple_async_alloc(void) { static void test_simple_async_alloc(void) {
gpr_log(GPR_INFO, "** test_simple_async_alloc **"); gpr_log(GPR_INFO, "** test_simple_async_alloc **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_simple_async_alloc"); grpc_resource_quota *p =
grpc_buffer_pool_resize(p, 1024 * 1024); grpc_resource_quota_create("test_simple_async_alloc");
grpc_buffer_user usr; grpc_resource_quota_resize(p, 1024 * 1024);
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user usr;
grpc_resource_user_init(&usr, p, "usr");
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_async_alloc_blocked_by_size(void) { static void test_async_alloc_blocked_by_size(void) {
gpr_log(GPR_INFO, "** test_async_alloc_blocked_by_size **"); gpr_log(GPR_INFO, "** test_async_alloc_blocked_by_size **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_async_alloc_blocked_by_size"); grpc_resource_quota_create("test_async_alloc_blocked_by_size");
grpc_buffer_pool_resize(p, 1); grpc_resource_quota_resize(p, 1);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool done = false; bool done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!done); GPR_ASSERT(!done);
} }
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
GPR_ASSERT(done); GPR_ASSERT(done);
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_scavenge(void) { static void test_scavenge(void) {
gpr_log(GPR_INFO, "** test_scavenge **"); gpr_log(GPR_INFO, "** test_scavenge **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_scavenge"); grpc_resource_quota *p = grpc_resource_quota_create("test_scavenge");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr1; grpc_resource_user usr1;
grpc_buffer_user usr2; grpc_resource_user usr2;
grpc_buffer_user_init(&usr1, p, "usr1"); grpc_resource_user_init(&usr1, p, "usr1");
grpc_buffer_user_init(&usr2, p, "usr2"); grpc_resource_user_init(&usr2, p, "usr2");
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr1, 1024); grpc_resource_user_free(&exec_ctx, &usr1, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr2, 1024); grpc_resource_user_free(&exec_ctx, &usr2, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr1); destroy_user(&usr1);
destroy_user(&usr2); destroy_user(&usr2);
} }
static void test_scavenge_blocked(void) { static void test_scavenge_blocked(void) {
gpr_log(GPR_INFO, "** test_scavenge_blocked **"); gpr_log(GPR_INFO, "** test_scavenge_blocked **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_scavenge_blocked"); grpc_resource_quota *p = grpc_resource_quota_create("test_scavenge_blocked");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr1; grpc_resource_user usr1;
grpc_buffer_user usr2; grpc_resource_user usr2;
grpc_buffer_user_init(&usr1, p, "usr1"); grpc_resource_user_init(&usr1, p, "usr1");
grpc_buffer_user_init(&usr2, p, "usr2"); grpc_resource_user_init(&usr2, p, "usr2");
bool done; bool done;
{ {
done = false; done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
done = false; done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!done); GPR_ASSERT(!done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr1, 1024); grpc_resource_user_free(&exec_ctx, &usr1, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr2, 1024); grpc_resource_user_free(&exec_ctx, &usr2, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr1); destroy_user(&usr1);
destroy_user(&usr2); destroy_user(&usr2);
} }
static void test_blocked_until_scheduled_reclaim(void) { static void test_blocked_until_scheduled_reclaim(void) {
gpr_log(GPR_INFO, "** test_blocked_until_scheduled_reclaim **"); gpr_log(GPR_INFO, "** test_blocked_until_scheduled_reclaim **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_blocked_until_scheduled_reclaim"); grpc_resource_quota_create("test_blocked_until_scheduled_reclaim");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
bool reclaim_done = false; bool reclaim_done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, &exec_ctx, &usr, false,
make_reclaimer(&usr, 1024, set_bool(&reclaim_done))); make_reclaimer(&usr, 1024, set_bool(&reclaim_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -294,40 +299,40 @@ static void test_blocked_until_scheduled_reclaim(void) {
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(reclaim_done); GPR_ASSERT(reclaim_done);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
gpr_log(GPR_INFO, "** test_blocked_until_scheduled_reclaim_and_scavenge **"); gpr_log(GPR_INFO, "** test_blocked_until_scheduled_reclaim_and_scavenge **");
grpc_buffer_pool *p = grpc_buffer_pool_create( grpc_resource_quota *p = grpc_resource_quota_create(
"test_blocked_until_scheduled_reclaim_and_scavenge"); "test_blocked_until_scheduled_reclaim_and_scavenge");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr1; grpc_resource_user usr1;
grpc_buffer_user usr2; grpc_resource_user usr2;
grpc_buffer_user_init(&usr1, p, "usr1"); grpc_resource_user_init(&usr1, p, "usr1");
grpc_buffer_user_init(&usr2, p, "usr2"); grpc_resource_user_init(&usr2, p, "usr2");
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr1, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
bool reclaim_done = false; bool reclaim_done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr1, false, &exec_ctx, &usr1, false,
make_reclaimer(&usr1, 1024, set_bool(&reclaim_done))); make_reclaimer(&usr1, 1024, set_bool(&reclaim_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -335,39 +340,39 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) {
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr2, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(reclaim_done); GPR_ASSERT(reclaim_done);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr2, 1024); grpc_resource_user_free(&exec_ctx, &usr2, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr1); destroy_user(&usr1);
destroy_user(&usr2); destroy_user(&usr2);
} }
static void test_blocked_until_scheduled_destructive_reclaim(void) { static void test_blocked_until_scheduled_destructive_reclaim(void) {
gpr_log(GPR_INFO, "** test_blocked_until_scheduled_destructive_reclaim **"); gpr_log(GPR_INFO, "** test_blocked_until_scheduled_destructive_reclaim **");
grpc_buffer_pool *p = grpc_buffer_pool_create( grpc_resource_quota *p = grpc_resource_quota_create(
"test_blocked_until_scheduled_destructive_reclaim"); "test_blocked_until_scheduled_destructive_reclaim");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
bool reclaim_done = false; bool reclaim_done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, true, &exec_ctx, &usr, true,
make_reclaimer(&usr, 1024, set_bool(&reclaim_done))); make_reclaimer(&usr, 1024, set_bool(&reclaim_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -375,41 +380,41 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) {
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(reclaim_done); GPR_ASSERT(reclaim_done);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
} }
static void test_unused_reclaim_is_cancelled(void) { static void test_unused_reclaim_is_cancelled(void) {
gpr_log(GPR_INFO, "** test_unused_reclaim_is_cancelled **"); gpr_log(GPR_INFO, "** test_unused_reclaim_is_cancelled **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_unused_reclaim_is_cancelled"); grpc_resource_quota_create("test_unused_reclaim_is_cancelled");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool benign_done = false; bool benign_done = false;
bool destructive_done = false; bool destructive_done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, make_unused_reclaimer(set_bool(&benign_done))); &exec_ctx, &usr, false, make_unused_reclaimer(set_bool(&benign_done)));
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, true, &exec_ctx, &usr, true,
make_unused_reclaimer(set_bool(&destructive_done))); make_unused_reclaimer(set_bool(&destructive_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!benign_done); GPR_ASSERT(!benign_done);
GPR_ASSERT(!destructive_done); GPR_ASSERT(!destructive_done);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
GPR_ASSERT(benign_done); GPR_ASSERT(benign_done);
GPR_ASSERT(destructive_done); GPR_ASSERT(destructive_done);
@ -417,26 +422,26 @@ static void test_unused_reclaim_is_cancelled(void) {
static void test_benign_reclaim_is_preferred(void) { static void test_benign_reclaim_is_preferred(void) {
gpr_log(GPR_INFO, "** test_benign_reclaim_is_preferred **"); gpr_log(GPR_INFO, "** test_benign_reclaim_is_preferred **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_benign_reclaim_is_preferred"); grpc_resource_quota_create("test_benign_reclaim_is_preferred");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool benign_done = false; bool benign_done = false;
bool destructive_done = false; bool destructive_done = false;
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, &exec_ctx, &usr, false,
make_reclaimer(&usr, 1024, set_bool(&benign_done))); make_reclaimer(&usr, 1024, set_bool(&benign_done)));
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, true, &exec_ctx, &usr, true,
make_unused_reclaimer(set_bool(&destructive_done))); make_unused_reclaimer(set_bool(&destructive_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -446,7 +451,7 @@ static void test_benign_reclaim_is_preferred(void) {
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(benign_done); GPR_ASSERT(benign_done);
GPR_ASSERT(!destructive_done); GPR_ASSERT(!destructive_done);
@ -454,10 +459,10 @@ static void test_benign_reclaim_is_preferred(void) {
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
GPR_ASSERT(benign_done); GPR_ASSERT(benign_done);
GPR_ASSERT(destructive_done); GPR_ASSERT(destructive_done);
@ -465,26 +470,26 @@ static void test_benign_reclaim_is_preferred(void) {
static void test_multiple_reclaims_can_be_triggered(void) { static void test_multiple_reclaims_can_be_triggered(void) {
gpr_log(GPR_INFO, "** test_multiple_reclaims_can_be_triggered **"); gpr_log(GPR_INFO, "** test_multiple_reclaims_can_be_triggered **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_multiple_reclaims_can_be_triggered"); grpc_resource_quota_create("test_multiple_reclaims_can_be_triggered");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool benign_done = false; bool benign_done = false;
bool destructive_done = false; bool destructive_done = false;
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, &exec_ctx, &usr, false,
make_reclaimer(&usr, 512, set_bool(&benign_done))); make_reclaimer(&usr, 512, set_bool(&benign_done)));
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, true, &exec_ctx, &usr, true,
make_reclaimer(&usr, 512, set_bool(&destructive_done))); make_reclaimer(&usr, 512, set_bool(&destructive_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -494,7 +499,7 @@ static void test_multiple_reclaims_can_be_triggered(void) {
{ {
bool done = false; bool done = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(benign_done); GPR_ASSERT(benign_done);
GPR_ASSERT(destructive_done); GPR_ASSERT(destructive_done);
@ -502,62 +507,62 @@ static void test_multiple_reclaims_can_be_triggered(void) {
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
destroy_user(&usr); destroy_user(&usr);
GPR_ASSERT(benign_done); GPR_ASSERT(benign_done);
GPR_ASSERT(destructive_done); GPR_ASSERT(destructive_done);
} }
static void test_buffer_user_stays_allocated_until_memory_released(void) { static void test_resource_user_stays_allocated_until_memory_released(void) {
gpr_log(GPR_INFO, gpr_log(GPR_INFO,
"** test_buffer_user_stays_allocated_until_memory_released **"); "** test_resource_user_stays_allocated_until_memory_released **");
grpc_buffer_pool *p = grpc_buffer_pool_create( grpc_resource_quota *p = grpc_resource_quota_create(
"test_buffer_user_stays_allocated_until_memory_released"); "test_resource_user_stays_allocated_until_memory_released");
grpc_buffer_pool_resize(p, 1024 * 1024); grpc_resource_quota_resize(p, 1024 * 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool done = false; bool done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, NULL); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, NULL);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
grpc_buffer_user_shutdown(&exec_ctx, &usr, set_bool(&done)); grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!done); GPR_ASSERT(!done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_destroy(&exec_ctx, &usr); grpc_resource_user_destroy(&exec_ctx, &usr);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
} }
static void test_pools_merged_on_buffer_user_deletion(void) { static void test_pools_merged_on_resource_user_deletion(void) {
gpr_log(GPR_INFO, "** test_pools_merged_on_buffer_user_deletion **"); gpr_log(GPR_INFO, "** test_pools_merged_on_resource_user_deletion **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_pools_merged_on_buffer_user_deletion"); grpc_resource_quota_create("test_pools_merged_on_resource_user_deletion");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
bool done = false; bool done = false;
bool reclaimer_cancelled = false; bool reclaimer_cancelled = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, &exec_ctx, &usr, false,
make_unused_reclaimer(set_bool(&reclaimer_cancelled))); make_unused_reclaimer(set_bool(&reclaimer_cancelled)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -566,45 +571,45 @@ static void test_pools_merged_on_buffer_user_deletion(void) {
{ {
bool allocated = false; bool allocated = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(allocated); GPR_ASSERT(allocated);
GPR_ASSERT(!reclaimer_cancelled); GPR_ASSERT(!reclaimer_cancelled);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_shutdown(&exec_ctx, &usr, set_bool(&done)); grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!done); GPR_ASSERT(!done);
GPR_ASSERT(!reclaimer_cancelled); GPR_ASSERT(!reclaimer_cancelled);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(done); GPR_ASSERT(done);
GPR_ASSERT(reclaimer_cancelled); GPR_ASSERT(reclaimer_cancelled);
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_destroy(&exec_ctx, &usr); grpc_resource_user_destroy(&exec_ctx, &usr);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
} }
static void test_reclaimers_can_be_posted_repeatedly(void) { static void test_reclaimers_can_be_posted_repeatedly(void) {
gpr_log(GPR_INFO, "** test_reclaimers_can_be_posted_repeatedly **"); gpr_log(GPR_INFO, "** test_reclaimers_can_be_posted_repeatedly **");
grpc_buffer_pool *p = grpc_resource_quota *p =
grpc_buffer_pool_create("test_reclaimers_can_be_posted_repeatedly"); grpc_resource_quota_create("test_reclaimers_can_be_posted_repeatedly");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
{ {
bool allocated = false; bool allocated = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(allocated); GPR_ASSERT(allocated);
} }
@ -612,7 +617,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
bool reclaimer_done = false; bool reclaimer_done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_post_reclaimer( grpc_resource_user_post_reclaimer(
&exec_ctx, &usr, false, &exec_ctx, &usr, false,
make_reclaimer(&usr, 1024, set_bool(&reclaimer_done))); make_reclaimer(&usr, 1024, set_bool(&reclaimer_done)));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
@ -621,7 +626,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
{ {
bool allocated = false; bool allocated = false;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated)); grpc_resource_user_alloc(&exec_ctx, &usr, 1024, set_bool(&allocated));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(allocated); GPR_ASSERT(allocated);
GPR_ASSERT(reclaimer_done); GPR_ASSERT(reclaimer_done);
@ -629,25 +634,26 @@ static void test_reclaimers_can_be_posted_repeatedly(void) {
} }
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_free(&exec_ctx, &usr, 1024); grpc_resource_user_free(&exec_ctx, &usr, 1024);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
destroy_user(&usr); destroy_user(&usr);
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
} }
static void test_one_slice(void) { static void test_one_slice(void) {
gpr_log(GPR_INFO, "** test_one_slice **"); gpr_log(GPR_INFO, "** test_one_slice **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_one_slice"); grpc_resource_quota *p = grpc_resource_quota_create("test_one_slice");
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
grpc_buffer_user_slice_allocator alloc; grpc_resource_user_slice_allocator alloc;
int num_allocs = 0; int num_allocs = 0;
grpc_buffer_user_slice_allocator_init(&alloc, &usr, inc_int_cb, &num_allocs); grpc_resource_user_slice_allocator_init(&alloc, &usr, inc_int_cb,
&num_allocs);
gpr_slice_buffer buffer; gpr_slice_buffer buffer;
gpr_slice_buffer_init(&buffer); gpr_slice_buffer_init(&buffer);
@ -655,28 +661,30 @@ static void test_one_slice(void) {
{ {
const int start_allocs = num_allocs; const int start_allocs = num_allocs;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer); grpc_resource_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(num_allocs == start_allocs + 1); GPR_ASSERT(num_allocs == start_allocs + 1);
} }
gpr_slice_buffer_destroy(&buffer); gpr_slice_buffer_destroy(&buffer);
destroy_user(&usr); destroy_user(&usr);
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
} }
static void test_one_slice_deleted_late(void) { static void test_one_slice_deleted_late(void) {
gpr_log(GPR_INFO, "** test_one_slice_deleted_late **"); gpr_log(GPR_INFO, "** test_one_slice_deleted_late **");
grpc_buffer_pool *p = grpc_buffer_pool_create("test_one_slice_deleted_late"); grpc_resource_quota *p =
grpc_buffer_pool_resize(p, 1024); grpc_resource_quota_create("test_one_slice_deleted_late");
grpc_resource_quota_resize(p, 1024);
grpc_buffer_user usr; grpc_resource_user usr;
grpc_buffer_user_init(&usr, p, "usr"); grpc_resource_user_init(&usr, p, "usr");
grpc_buffer_user_slice_allocator alloc; grpc_resource_user_slice_allocator alloc;
int num_allocs = 0; int num_allocs = 0;
grpc_buffer_user_slice_allocator_init(&alloc, &usr, inc_int_cb, &num_allocs); grpc_resource_user_slice_allocator_init(&alloc, &usr, inc_int_cb,
&num_allocs);
gpr_slice_buffer buffer; gpr_slice_buffer buffer;
gpr_slice_buffer_init(&buffer); gpr_slice_buffer_init(&buffer);
@ -684,7 +692,7 @@ static void test_one_slice_deleted_late(void) {
{ {
const int start_allocs = num_allocs; const int start_allocs = num_allocs;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer); grpc_resource_user_alloc_slices(&exec_ctx, &alloc, 1024, 1, &buffer);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(num_allocs == start_allocs + 1); GPR_ASSERT(num_allocs == start_allocs + 1);
} }
@ -692,17 +700,17 @@ static void test_one_slice_deleted_late(void) {
bool done = false; bool done = false;
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_shutdown(&exec_ctx, &usr, set_bool(&done)); grpc_resource_user_shutdown(&exec_ctx, &usr, set_bool(&done));
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(!done); GPR_ASSERT(!done);
} }
grpc_buffer_pool_unref(p); grpc_resource_quota_unref(p);
gpr_slice_buffer_destroy(&buffer); gpr_slice_buffer_destroy(&buffer);
GPR_ASSERT(done); GPR_ASSERT(done);
{ {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_buffer_user_destroy(&exec_ctx, &usr); grpc_resource_user_destroy(&exec_ctx, &usr);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
} }
} }
@ -712,7 +720,7 @@ int main(int argc, char **argv) {
grpc_init(); grpc_init();
test_no_op(); test_no_op();
test_resize_then_destroy(); test_resize_then_destroy();
test_buffer_user_no_op(); test_resource_user_no_op();
test_instant_alloc_then_free(); test_instant_alloc_then_free();
test_instant_alloc_free_pair(); test_instant_alloc_free_pair();
test_simple_async_alloc(); test_simple_async_alloc();
@ -725,8 +733,8 @@ int main(int argc, char **argv) {
test_unused_reclaim_is_cancelled(); test_unused_reclaim_is_cancelled();
test_benign_reclaim_is_preferred(); test_benign_reclaim_is_preferred();
test_multiple_reclaims_can_be_triggered(); test_multiple_reclaims_can_be_triggered();
test_buffer_user_stays_allocated_until_memory_released(); test_resource_user_stays_allocated_until_memory_released();
test_pools_merged_on_buffer_user_deletion(); test_pools_merged_on_resource_user_deletion();
test_reclaimers_can_be_posted_repeatedly(); test_reclaimers_can_be_posted_repeatedly();
test_one_slice(); test_one_slice();
test_one_slice_deleted_late(); test_one_slice_deleted_late();

@ -176,10 +176,10 @@ static void read_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv); create_sockets(sv);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("read_test"); grpc_resource_quota *resource_quota = grpc_resource_quota_create("read_test");
ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), buffer_pool, ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota,
slice_size, "test"); slice_size, "test");
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
written_bytes = fill_socket_partial(sv[0], num_bytes); written_bytes = fill_socket_partial(sv[0], num_bytes);
@ -226,10 +226,11 @@ static void large_read_test(size_t slice_size) {
create_sockets(sv); create_sockets(sv);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("large_read_test"); grpc_resource_quota *resource_quota =
ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), buffer_pool, grpc_resource_quota_create("large_read_test");
ep = grpc_tcp_create(grpc_fd_create(sv[1], "large_read_test"), resource_quota,
slice_size, "test"); slice_size, "test");
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
written_bytes = fill_socket(sv[0]); written_bytes = fill_socket(sv[0]);
@ -364,10 +365,11 @@ static void write_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv); create_sockets(sv);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("write_test"); grpc_resource_quota *resource_quota =
ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), buffer_pool, grpc_resource_quota_create("write_test");
ep = grpc_tcp_create(grpc_fd_create(sv[1], "write_test"), resource_quota,
GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "test"); GRPC_TCP_DEFAULT_READ_SLICE_SIZE, "test");
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
state.ep = ep; state.ep = ep;
@ -430,11 +432,12 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
create_sockets(sv); create_sockets(sv);
grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create("release_fd_test"); grpc_resource_quota *resource_quota =
ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), buffer_pool, grpc_resource_quota_create("release_fd_test");
ep = grpc_tcp_create(grpc_fd_create(sv[1], "read_test"), resource_quota,
slice_size, "test"); slice_size, "test");
GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset);
written_bytes = fill_socket_partial(sv[0], num_bytes); written_bytes = fill_socket_partial(sv[0], num_bytes);
@ -520,13 +523,13 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair(
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
create_sockets(sv); create_sockets(sv);
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("tcp_posix_test_socketpair"); grpc_resource_quota_create("tcp_posix_test_socketpair");
f.client_ep = grpc_tcp_create(grpc_fd_create(sv[0], "fixture:client"), f.client_ep = grpc_tcp_create(grpc_fd_create(sv[0], "fixture:client"),
buffer_pool, slice_size, "test"); resource_quota, slice_size, "test");
f.server_ep = grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"), f.server_ep = grpc_tcp_create(grpc_fd_create(sv[1], "fixture:server"),
buffer_pool, slice_size, "test"); resource_quota, slice_size, "test");
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset);
grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, f.server_ep, g_pollset);

@ -56,10 +56,10 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
grpc_endpoint_test_fixture f; grpc_endpoint_test_fixture f;
grpc_endpoint_pair tcp; grpc_endpoint_pair tcp;
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("secure_endpoint_test"); grpc_resource_quota_create("secure_endpoint_test");
tcp = grpc_iomgr_create_endpoint_pair("fixture", buffer_pool, slice_size); tcp = grpc_iomgr_create_endpoint_pair("fixture", resource_quota, slice_size);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset);
grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.server, g_pollset);

@ -46,7 +46,7 @@ typedef struct grpc_mock_endpoint {
gpr_slice_buffer read_buffer; gpr_slice_buffer read_buffer;
gpr_slice_buffer *on_read_out; gpr_slice_buffer *on_read_out;
grpc_closure *on_read; grpc_closure *on_read;
grpc_buffer_user buffer_user; grpc_resource_user resource_user;
} grpc_mock_endpoint; } grpc_mock_endpoint;
static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
@ -83,7 +83,7 @@ static void unref(grpc_exec_ctx *exec_ctx, grpc_mock_endpoint *m) {
if (0 == --m->refs) { if (0 == --m->refs) {
gpr_mu_unlock(&m->mu); gpr_mu_unlock(&m->mu);
gpr_slice_buffer_destroy(&m->read_buffer); gpr_slice_buffer_destroy(&m->read_buffer);
grpc_buffer_user_destroy(exec_ctx, &m->buffer_user); grpc_resource_user_destroy(exec_ctx, &m->resource_user);
gpr_free(m); gpr_free(m);
} else { } else {
gpr_mu_unlock(&m->mu); gpr_mu_unlock(&m->mu);
@ -104,8 +104,8 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
GRPC_ERROR_CREATE("Endpoint Shutdown"), NULL); GRPC_ERROR_CREATE("Endpoint Shutdown"), NULL);
m->on_read = NULL; m->on_read = NULL;
} }
grpc_buffer_user_shutdown(exec_ctx, &m->buffer_user, grpc_resource_user_shutdown(exec_ctx, &m->resource_user,
grpc_closure_create(me_finish_shutdown, m)); grpc_closure_create(me_finish_shutdown, m));
gpr_mu_unlock(&m->mu); gpr_mu_unlock(&m->mu);
} }
@ -118,9 +118,9 @@ static char *me_get_peer(grpc_endpoint *ep) {
return gpr_strdup("fake:mock_endpoint"); return gpr_strdup("fake:mock_endpoint");
} }
static grpc_buffer_user *me_get_buffer_user(grpc_endpoint *ep) { static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep; grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
return &m->buffer_user; return &m->resource_user;
} }
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; } static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
@ -133,18 +133,18 @@ static const grpc_endpoint_vtable vtable = {
me_add_to_pollset_set, me_add_to_pollset_set,
me_shutdown, me_shutdown,
me_destroy, me_destroy,
me_get_buffer_user, me_get_resource_user,
me_get_peer, me_get_peer,
}; };
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice), grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
grpc_buffer_pool *buffer_pool) { grpc_resource_quota *resource_quota) {
grpc_mock_endpoint *m = gpr_malloc(sizeof(*m)); grpc_mock_endpoint *m = gpr_malloc(sizeof(*m));
m->base.vtable = &vtable; m->base.vtable = &vtable;
m->refs = 2; m->refs = 2;
char *name; char *name;
gpr_asprintf(&name, "mock_endpoint_%" PRIxPTR, (intptr_t)m); gpr_asprintf(&name, "mock_endpoint_%" PRIxPTR, (intptr_t)m);
grpc_buffer_user_init(&m->buffer_user, buffer_pool, name); grpc_resource_user_init(&m->resource_user, resource_quota, name);
gpr_free(name); gpr_free(name);
gpr_slice_buffer_init(&m->read_buffer); gpr_slice_buffer_init(&m->read_buffer);
gpr_mu_init(&m->mu); gpr_mu_init(&m->mu);

@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/endpoint.h"
grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice), grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
grpc_buffer_pool *buffer_pool); grpc_resource_quota *resource_quota);
void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx, void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx,
grpc_endpoint *mock_endpoint, gpr_slice slice); grpc_endpoint *mock_endpoint, gpr_slice slice);

@ -46,7 +46,7 @@ typedef struct {
gpr_slice_buffer read_buffer; gpr_slice_buffer read_buffer;
gpr_slice_buffer *on_read_out; gpr_slice_buffer *on_read_out;
grpc_closure *on_read; grpc_closure *on_read;
grpc_buffer_user buffer_user; grpc_resource_user resource_user;
} half; } half;
struct passthru_endpoint { struct passthru_endpoint {
@ -142,7 +142,7 @@ static void me_really_destroy(grpc_exec_ctx *exec_ctx, void *ep,
static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
half *m = (half *)ep; half *m = (half *)ep;
grpc_buffer_user_shutdown(exec_ctx, &m->buffer_user, grpc_resource_user_shutdown(exec_ctx, &m->resource_user,
grpc_closure_create(me_really_destroy, m)); grpc_closure_create(me_really_destroy, m));
} }
@ -152,9 +152,9 @@ static char *me_get_peer(grpc_endpoint *ep) {
static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; } static grpc_workqueue *me_get_workqueue(grpc_endpoint *ep) { return NULL; }
static grpc_buffer_user *me_get_buffer_user(grpc_endpoint *ep) { static grpc_resource_user *me_get_resource_user(grpc_endpoint *ep) {
half *m = (half *)ep; half *m = (half *)ep;
return &m->buffer_user; return &m->resource_user;
} }
static const grpc_endpoint_vtable vtable = { static const grpc_endpoint_vtable vtable = {
@ -165,12 +165,12 @@ static const grpc_endpoint_vtable vtable = {
me_add_to_pollset_set, me_add_to_pollset_set,
me_shutdown, me_shutdown,
me_destroy, me_destroy,
me_get_buffer_user, me_get_resource_user,
me_get_peer, me_get_peer,
}; };
static void half_init(half *m, passthru_endpoint *parent, static void half_init(half *m, passthru_endpoint *parent,
grpc_buffer_pool *buffer_pool, const char *half_name) { grpc_resource_quota *resource_quota, const char *half_name) {
m->base.vtable = &vtable; m->base.vtable = &vtable;
m->parent = parent; m->parent = parent;
gpr_slice_buffer_init(&m->read_buffer); gpr_slice_buffer_init(&m->read_buffer);
@ -178,18 +178,18 @@ static void half_init(half *m, passthru_endpoint *parent,
char *name; char *name;
gpr_asprintf(&name, "passthru_endpoint_%s_%" PRIxPTR, half_name, gpr_asprintf(&name, "passthru_endpoint_%s_%" PRIxPTR, half_name,
(intptr_t)parent); (intptr_t)parent);
grpc_buffer_user_init(&m->buffer_user, buffer_pool, name); grpc_resource_user_init(&m->resource_user, resource_quota, name);
gpr_free(name); gpr_free(name);
} }
void grpc_passthru_endpoint_create(grpc_endpoint **client, void grpc_passthru_endpoint_create(grpc_endpoint **client,
grpc_endpoint **server, grpc_endpoint **server,
grpc_buffer_pool *buffer_pool) { grpc_resource_quota *resource_quota) {
passthru_endpoint *m = gpr_malloc(sizeof(*m)); passthru_endpoint *m = gpr_malloc(sizeof(*m));
m->halves = 2; m->halves = 2;
m->shutdown = 0; m->shutdown = 0;
half_init(&m->client, m, buffer_pool, "client"); half_init(&m->client, m, resource_quota, "client");
half_init(&m->server, m, buffer_pool, "server"); half_init(&m->server, m, resource_quota, "server");
gpr_mu_init(&m->mu); gpr_mu_init(&m->mu);
*client = &m->client.base; *client = &m->client.base;
*server = &m->server.base; *server = &m->server.base;

@ -38,6 +38,6 @@
void grpc_passthru_endpoint_create(grpc_endpoint **client, void grpc_passthru_endpoint_create(grpc_endpoint **client,
grpc_endpoint **server, grpc_endpoint **server,
grpc_buffer_pool *buffer_pool); grpc_resource_quota *resource_quota);
#endif #endif

@ -99,12 +99,12 @@ void grpc_free_port_using_server(char *server, int port) {
req.http.path = path; req.http.path = path;
grpc_httpcli_context_init(&context); grpc_httpcli_context_init(&context);
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("port_server_client/free"); grpc_resource_quota_create("port_server_client/free");
grpc_httpcli_get(&exec_ctx, &context, &pr.pops, buffer_pool, &req, grpc_httpcli_get(&exec_ctx, &context, &pr.pops, resource_quota, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10),
grpc_closure_create(freed_port_from_server, &pr), &rsp); grpc_closure_create(freed_port_from_server, &pr), &rsp);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
gpr_mu_lock(pr.mu); gpr_mu_lock(pr.mu);
while (!pr.done) { while (!pr.done) {
grpc_pollset_worker *worker = NULL; grpc_pollset_worker *worker = NULL;
@ -170,13 +170,13 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg,
req.http.path = "/get"; req.http.path = "/get";
grpc_http_response_destroy(&pr->response); grpc_http_response_destroy(&pr->response);
memset(&pr->response, 0, sizeof(pr->response)); memset(&pr->response, 0, sizeof(pr->response));
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("port_server_client/pick_retry"); grpc_resource_quota_create("port_server_client/pick_retry");
grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pops, buffer_pool, &req, grpc_httpcli_get(exec_ctx, pr->ctx, &pr->pops, resource_quota, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10),
grpc_closure_create(got_port_from_server, pr), grpc_closure_create(got_port_from_server, pr),
&pr->response); &pr->response);
grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(exec_ctx, resource_quota);
return; return;
} }
GPR_ASSERT(response); GPR_ASSERT(response);
@ -217,13 +217,13 @@ int grpc_pick_port_using_server(char *server) {
req.http.path = "/get"; req.http.path = "/get";
grpc_httpcli_context_init(&context); grpc_httpcli_context_init(&context);
grpc_buffer_pool *buffer_pool = grpc_resource_quota *resource_quota =
grpc_buffer_pool_create("port_server_client/pick"); grpc_resource_quota_create("port_server_client/pick");
grpc_httpcli_get(&exec_ctx, &context, &pr.pops, buffer_pool, &req, grpc_httpcli_get(&exec_ctx, &context, &pr.pops, resource_quota, &req,
GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(10),
grpc_closure_create(got_port_from_server, &pr), grpc_closure_create(got_port_from_server, &pr),
&pr.response); &pr.response);
grpc_buffer_pool_internal_unref(&exec_ctx, buffer_pool); grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_exec_ctx_finish(&exec_ctx); grpc_exec_ctx_finish(&exec_ctx);
gpr_mu_lock(pr.mu); gpr_mu_lock(pr.mu);
while (pr.port == -1) { while (pr.port == -1) {

@ -34,10 +34,10 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <grpc++/buffer_pool.h>
#include <grpc++/channel.h> #include <grpc++/channel.h>
#include <grpc++/client_context.h> #include <grpc++/client_context.h>
#include <grpc++/create_channel.h> #include <grpc++/create_channel.h>
#include <grpc++/resource_quota.h>
#include <grpc++/security/auth_metadata_processor.h> #include <grpc++/security/auth_metadata_processor.h>
#include <grpc++/security/credentials.h> #include <grpc++/security/credentials.h>
#include <grpc++/security/server_credentials.h> #include <grpc++/security/server_credentials.h>
@ -1481,19 +1481,20 @@ TEST_P(SecureEnd2endTest, ClientAuthContext) {
} }
} }
class BufferPoolEnd2endTest : public End2endTest { class ResourceQuotaEnd2endTest : public End2endTest {
public: public:
BufferPoolEnd2endTest() : server_buffer_pool_("server_buffer_pool") {} ResourceQuotaEnd2endTest()
: server_resource_quota_("server_resource_quota") {}
virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE { virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE {
builder->SetBufferPool(server_buffer_pool_); builder->SetResourceQuota(server_resource_quota_);
} }
private: private:
BufferPool server_buffer_pool_; ResourceQuota server_resource_quota_;
}; };
TEST_P(BufferPoolEnd2endTest, SimpleRequest) { TEST_P(ResourceQuotaEnd2endTest, SimpleRequest) {
ResetStub(); ResetStub();
EchoRequest request; EchoRequest request;
@ -1543,7 +1544,7 @@ INSTANTIATE_TEST_CASE_P(SecureEnd2end, SecureEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(false, false, ::testing::ValuesIn(CreateTestScenarios(false, false,
true))); true)));
INSTANTIATE_TEST_CASE_P(BufferPoolEnd2end, BufferPoolEnd2endTest, INSTANTIATE_TEST_CASE_P(ResourceQuotaEnd2end, ResourceQuotaEnd2endTest,
::testing::ValuesIn(CreateTestScenarios(false, true, ::testing::ValuesIn(CreateTestScenarios(false, true,
true))); true)));

@ -37,8 +37,8 @@
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <grpc++/buffer_pool.h>
#include <grpc++/generic/async_generic_service.h> #include <grpc++/generic/async_generic_service.h>
#include <grpc++/resource_quota.h>
#include <grpc++/security/server_credentials.h> #include <grpc++/security/server_credentials.h>
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
@ -96,9 +96,9 @@ class AsyncQpsServerTest : public Server {
srv_cqs_.emplace_back(builder.AddCompletionQueue()); srv_cqs_.emplace_back(builder.AddCompletionQueue());
} }
if (config.buffer_pool_size() > 0) { if (config.resource_quota_size() > 0) {
builder.SetBufferPool( builder.SetResourceQuota(ResourceQuota("AsyncQpsServerTest")
BufferPool("AsyncQpsServerTest").Resize(config.buffer_pool_size())); .Resize(config.resource_quota_size()));
} }
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();

@ -33,7 +33,7 @@
#include <thread> #include <thread>
#include <grpc++/buffer_pool.h> #include <grpc++/resource_quota.h>
#include <grpc++/security/server_credentials.h> #include <grpc++/security/server_credentials.h>
#include <grpc++/server.h> #include <grpc++/server.h>
#include <grpc++/server_builder.h> #include <grpc++/server_builder.h>
@ -94,9 +94,9 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
Server::CreateServerCredentials(config)); Server::CreateServerCredentials(config));
gpr_free(server_address); gpr_free(server_address);
if (config.buffer_pool_size() > 0) { if (config.resource_quota_size() > 0) {
builder.SetBufferPool( builder.SetResourceQuota(ResourceQuota("AsyncQpsServerTest")
BufferPool("AsyncQpsServerTest").Resize(config.buffer_pool_size())); .Resize(config.resource_quota_size()));
} }
builder.RegisterService(&service_); builder.RegisterService(&service_);

@ -761,7 +761,6 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = include/grpc++/alarm.h \ INPUT = include/grpc++/alarm.h \
include/grpc++/buffer_pool.h \
include/grpc++/channel.h \ include/grpc++/channel.h \
include/grpc++/client_context.h \ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \ include/grpc++/completion_queue.h \
@ -788,6 +787,7 @@ include/grpc++/impl/sync_no_cxx11.h \
include/grpc++/impl/thd.h \ include/grpc++/impl/thd.h \
include/grpc++/impl/thd_cxx11.h \ include/grpc++/impl/thd_cxx11.h \
include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \ include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \ include/grpc++/security/auth_metadata_processor.h \
include/grpc++/security/credentials.h \ include/grpc++/security/credentials.h \

@ -761,7 +761,6 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = include/grpc++/alarm.h \ INPUT = include/grpc++/alarm.h \
include/grpc++/buffer_pool.h \
include/grpc++/channel.h \ include/grpc++/channel.h \
include/grpc++/client_context.h \ include/grpc++/client_context.h \
include/grpc++/completion_queue.h \ include/grpc++/completion_queue.h \
@ -788,6 +787,7 @@ include/grpc++/impl/sync_no_cxx11.h \
include/grpc++/impl/thd.h \ include/grpc++/impl/thd.h \
include/grpc++/impl/thd_cxx11.h \ include/grpc++/impl/thd_cxx11.h \
include/grpc++/impl/thd_no_cxx11.h \ include/grpc++/impl/thd_no_cxx11.h \
include/grpc++/resource_quota.h \
include/grpc++/security/auth_context.h \ include/grpc++/security/auth_context.h \
include/grpc++/security/auth_metadata_processor.h \ include/grpc++/security/auth_metadata_processor.h \
include/grpc++/security/credentials.h \ include/grpc++/security/credentials.h \
@ -879,11 +879,11 @@ src/cpp/client/create_channel_internal.cc \
src/cpp/client/create_channel_posix.cc \ src/cpp/client/create_channel_posix.cc \
src/cpp/client/credentials_cc.cc \ src/cpp/client/credentials_cc.cc \
src/cpp/client/generic_stub.cc \ src/cpp/client/generic_stub.cc \
src/cpp/common/buffer_pool_cc.cc \
src/cpp/common/channel_arguments.cc \ src/cpp/common/channel_arguments.cc \
src/cpp/common/channel_filter.cc \ src/cpp/common/channel_filter.cc \
src/cpp/common/completion_queue_cc.cc \ src/cpp/common/completion_queue_cc.cc \
src/cpp/common/core_codegen.cc \ src/cpp/common/core_codegen.cc \
src/cpp/common/resource_quota_cc.cc \
src/cpp/common/rpc_method.cc \ src/cpp/common/rpc_method.cc \
src/cpp/server/async_generic_service.cc \ src/cpp/server/async_generic_service.cc \
src/cpp/server/create_default_thread_pool.cc \ src/cpp/server/create_default_thread_pool.cc \

@ -803,7 +803,6 @@ src/core/lib/debug/trace.h \
src/core/lib/http/format_request.h \ src/core/lib/http/format_request.h \
src/core/lib/http/httpcli.h \ src/core/lib/http/httpcli.h \
src/core/lib/http/parser.h \ src/core/lib/http/parser.h \
src/core/lib/iomgr/buffer_pool.h \
src/core/lib/iomgr/closure.h \ src/core/lib/iomgr/closure.h \
src/core/lib/iomgr/combiner.h \ src/core/lib/iomgr/combiner.h \
src/core/lib/iomgr/endpoint.h \ src/core/lib/iomgr/endpoint.h \
@ -827,6 +826,7 @@ src/core/lib/iomgr/pollset_set.h \
src/core/lib/iomgr/pollset_set_windows.h \ src/core/lib/iomgr/pollset_set_windows.h \
src/core/lib/iomgr/pollset_windows.h \ src/core/lib/iomgr/pollset_windows.h \
src/core/lib/iomgr/resolve_address.h \ src/core/lib/iomgr/resolve_address.h \
src/core/lib/iomgr/resource_quota.h \
src/core/lib/iomgr/sockaddr.h \ src/core/lib/iomgr/sockaddr.h \
src/core/lib/iomgr/sockaddr_posix.h \ src/core/lib/iomgr/sockaddr_posix.h \
src/core/lib/iomgr/sockaddr_utils.h \ src/core/lib/iomgr/sockaddr_utils.h \
@ -969,7 +969,6 @@ src/core/lib/debug/trace.c \
src/core/lib/http/format_request.c \ src/core/lib/http/format_request.c \
src/core/lib/http/httpcli.c \ src/core/lib/http/httpcli.c \
src/core/lib/http/parser.c \ src/core/lib/http/parser.c \
src/core/lib/iomgr/buffer_pool.c \
src/core/lib/iomgr/closure.c \ src/core/lib/iomgr/closure.c \
src/core/lib/iomgr/combiner.c \ src/core/lib/iomgr/combiner.c \
src/core/lib/iomgr/endpoint.c \ src/core/lib/iomgr/endpoint.c \
@ -993,6 +992,7 @@ src/core/lib/iomgr/pollset_set_windows.c \
src/core/lib/iomgr/pollset_windows.c \ src/core/lib/iomgr/pollset_windows.c \
src/core/lib/iomgr/resolve_address_posix.c \ src/core/lib/iomgr/resolve_address_posix.c \
src/core/lib/iomgr/resolve_address_windows.c \ src/core/lib/iomgr/resolve_address_windows.c \
src/core/lib/iomgr/resource_quota.c \
src/core/lib/iomgr/sockaddr_utils.c \ src/core/lib/iomgr/sockaddr_utils.c \
src/core/lib/iomgr/socket_utils_common_posix.c \ src/core/lib/iomgr/socket_utils_common_posix.c \
src/core/lib/iomgr/socket_utils_linux.c \ src/core/lib/iomgr/socket_utils_linux.c \

@ -115,7 +115,7 @@ def _ping_pong_scenario(name, rpc_type,
categories=DEFAULT_CATEGORIES, categories=DEFAULT_CATEGORIES,
channels=None, channels=None,
outstanding=None, outstanding=None,
buffer_pool_size=None): resource_quota_size=None):
"""Creates a basic ping pong scenario.""" """Creates a basic ping pong scenario."""
scenario = { scenario = {
'name': name, 'name': name,
@ -142,8 +142,8 @@ def _ping_pong_scenario(name, rpc_type,
'warmup_seconds': warmup_seconds, 'warmup_seconds': warmup_seconds,
'benchmark_seconds': BENCHMARK_SECONDS 'benchmark_seconds': BENCHMARK_SECONDS
} }
if buffer_pool_size: if resource_quota_size:
scenario['server_config']['buffer_pool_size'] = buffer_pool_size scenario['server_config']['resource_quota_size'] = resource_quota_size
if use_generic_payload: if use_generic_payload:
if server_type != 'ASYNC_GENERIC_SERVER': if server_type != 'ASYNC_GENERIC_SERVER':
raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.') raise Exception('Use ASYNC_GENERIC_SERVER for generic payload.')
@ -242,14 +242,14 @@ class CXXLanguage:
categories=smoketest_categories+[SCALABLE]) categories=smoketest_categories+[SCALABLE])
yield _ping_pong_scenario( yield _ping_pong_scenario(
'cpp_protobuf_%s_%s_qps_unconstrained_%s_500kib_buffer_pool' % (synchronicity, rpc_type, secstr), 'cpp_protobuf_%s_%s_qps_unconstrained_%s_500kib_resource_quota' % (synchronicity, rpc_type, secstr),
rpc_type=rpc_type.upper(), rpc_type=rpc_type.upper(),
client_type='%s_CLIENT' % synchronicity.upper(), client_type='%s_CLIENT' % synchronicity.upper(),
server_type='%s_SERVER' % synchronicity.upper(), server_type='%s_SERVER' % synchronicity.upper(),
unconstrained_client=synchronicity, unconstrained_client=synchronicity,
secure=secure, secure=secure,
categories=smoketest_categories+[SCALABLE], categories=smoketest_categories+[SCALABLE],
buffer_pool_size=500*1024) resource_quota_size=500*1024)
for channels in geometric_progression(1, 20000, math.sqrt(10)): for channels in geometric_progression(1, 20000, math.sqrt(10)):
for outstanding in geometric_progression(1, 200000, math.sqrt(10)): for outstanding in geometric_progression(1, 200000, math.sqrt(10)):

@ -132,23 +132,6 @@
"third_party": false, "third_party": false,
"type": "target" "type": "target"
}, },
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "buffer_pool_test",
"src": [
"test/core/iomgr/buffer_pool_test.c"
],
"third_party": false,
"type": "target"
},
{ {
"deps": [ "deps": [
"gpr", "gpr",
@ -1704,6 +1687,23 @@
"third_party": false, "third_party": false,
"type": "target" "type": "target"
}, },
{
"deps": [
"gpr",
"gpr_test_util",
"grpc",
"grpc_test_util"
],
"headers": [],
"is_filegroup": false,
"language": "c",
"name": "resource_quota_test",
"src": [
"test/core/iomgr/resource_quota_test.c"
],
"third_party": false,
"type": "target"
},
{ {
"deps": [ "deps": [
"gpr", "gpr",
@ -6028,7 +6028,6 @@
"test/core/end2end/end2end_tests.h", "test/core/end2end/end2end_tests.h",
"test/core/end2end/tests/bad_hostname.c", "test/core/end2end/tests/bad_hostname.c",
"test/core/end2end/tests/binary_metadata.c", "test/core/end2end/tests/binary_metadata.c",
"test/core/end2end/tests/buffer_pool_server.c",
"test/core/end2end/tests/call_creds.c", "test/core/end2end/tests/call_creds.c",
"test/core/end2end/tests/cancel_after_accept.c", "test/core/end2end/tests/cancel_after_accept.c",
"test/core/end2end/tests/cancel_after_client_done.c", "test/core/end2end/tests/cancel_after_client_done.c",
@ -6063,6 +6062,7 @@
"test/core/end2end/tests/registered_call.c", "test/core/end2end/tests/registered_call.c",
"test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_flags.c",
"test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/request_with_payload.c",
"test/core/end2end/tests/resource_quota_server.c",
"test/core/end2end/tests/server_finishes_request.c", "test/core/end2end/tests/server_finishes_request.c",
"test/core/end2end/tests/shutdown_finishes_calls.c", "test/core/end2end/tests/shutdown_finishes_calls.c",
"test/core/end2end/tests/shutdown_finishes_tags.c", "test/core/end2end/tests/shutdown_finishes_tags.c",
@ -6095,7 +6095,6 @@
"test/core/end2end/end2end_tests.h", "test/core/end2end/end2end_tests.h",
"test/core/end2end/tests/bad_hostname.c", "test/core/end2end/tests/bad_hostname.c",
"test/core/end2end/tests/binary_metadata.c", "test/core/end2end/tests/binary_metadata.c",
"test/core/end2end/tests/buffer_pool_server.c",
"test/core/end2end/tests/cancel_after_accept.c", "test/core/end2end/tests/cancel_after_accept.c",
"test/core/end2end/tests/cancel_after_client_done.c", "test/core/end2end/tests/cancel_after_client_done.c",
"test/core/end2end/tests/cancel_after_invoke.c", "test/core/end2end/tests/cancel_after_invoke.c",
@ -6129,6 +6128,7 @@
"test/core/end2end/tests/registered_call.c", "test/core/end2end/tests/registered_call.c",
"test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_flags.c",
"test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/request_with_payload.c",
"test/core/end2end/tests/resource_quota_server.c",
"test/core/end2end/tests/server_finishes_request.c", "test/core/end2end/tests/server_finishes_request.c",
"test/core/end2end/tests/shutdown_finishes_calls.c", "test/core/end2end/tests/shutdown_finishes_calls.c",
"test/core/end2end/tests/shutdown_finishes_tags.c", "test/core/end2end/tests/shutdown_finishes_tags.c",
@ -6403,7 +6403,6 @@
"src/core/lib/http/format_request.h", "src/core/lib/http/format_request.h",
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.h", "src/core/lib/iomgr/combiner.h",
"src/core/lib/iomgr/endpoint.h", "src/core/lib/iomgr/endpoint.h",
@ -6427,6 +6426,7 @@
"src/core/lib/iomgr/pollset_set_windows.h", "src/core/lib/iomgr/pollset_set_windows.h",
"src/core/lib/iomgr/pollset_windows.h", "src/core/lib/iomgr/pollset_windows.h",
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.h", "src/core/lib/iomgr/sockaddr_utils.h",
@ -6516,8 +6516,6 @@
"src/core/lib/http/httpcli.h", "src/core/lib/http/httpcli.h",
"src/core/lib/http/parser.c", "src/core/lib/http/parser.c",
"src/core/lib/http/parser.h", "src/core/lib/http/parser.h",
"src/core/lib/iomgr/buffer_pool.c",
"src/core/lib/iomgr/buffer_pool.h",
"src/core/lib/iomgr/closure.c", "src/core/lib/iomgr/closure.c",
"src/core/lib/iomgr/closure.h", "src/core/lib/iomgr/closure.h",
"src/core/lib/iomgr/combiner.c", "src/core/lib/iomgr/combiner.c",
@ -6564,6 +6562,8 @@
"src/core/lib/iomgr/resolve_address.h", "src/core/lib/iomgr/resolve_address.h",
"src/core/lib/iomgr/resolve_address_posix.c", "src/core/lib/iomgr/resolve_address_posix.c",
"src/core/lib/iomgr/resolve_address_windows.c", "src/core/lib/iomgr/resolve_address_windows.c",
"src/core/lib/iomgr/resource_quota.c",
"src/core/lib/iomgr/resource_quota.h",
"src/core/lib/iomgr/sockaddr.h", "src/core/lib/iomgr/sockaddr.h",
"src/core/lib/iomgr/sockaddr_posix.h", "src/core/lib/iomgr/sockaddr_posix.h",
"src/core/lib/iomgr/sockaddr_utils.c", "src/core/lib/iomgr/sockaddr_utils.c",
@ -7242,7 +7242,6 @@
], ],
"headers": [ "headers": [
"include/grpc++/alarm.h", "include/grpc++/alarm.h",
"include/grpc++/buffer_pool.h",
"include/grpc++/channel.h", "include/grpc++/channel.h",
"include/grpc++/client_context.h", "include/grpc++/client_context.h",
"include/grpc++/completion_queue.h", "include/grpc++/completion_queue.h",
@ -7269,6 +7268,7 @@
"include/grpc++/impl/thd.h", "include/grpc++/impl/thd.h",
"include/grpc++/impl/thd_cxx11.h", "include/grpc++/impl/thd_cxx11.h",
"include/grpc++/impl/thd_no_cxx11.h", "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h", "include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h", "include/grpc++/security/auth_metadata_processor.h",
"include/grpc++/security/credentials.h", "include/grpc++/security/credentials.h",
@ -7299,7 +7299,6 @@
"name": "grpc++_base", "name": "grpc++_base",
"src": [ "src": [
"include/grpc++/alarm.h", "include/grpc++/alarm.h",
"include/grpc++/buffer_pool.h",
"include/grpc++/channel.h", "include/grpc++/channel.h",
"include/grpc++/client_context.h", "include/grpc++/client_context.h",
"include/grpc++/completion_queue.h", "include/grpc++/completion_queue.h",
@ -7326,6 +7325,7 @@
"include/grpc++/impl/thd.h", "include/grpc++/impl/thd.h",
"include/grpc++/impl/thd_cxx11.h", "include/grpc++/impl/thd_cxx11.h",
"include/grpc++/impl/thd_no_cxx11.h", "include/grpc++/impl/thd_no_cxx11.h",
"include/grpc++/resource_quota.h",
"include/grpc++/security/auth_context.h", "include/grpc++/security/auth_context.h",
"include/grpc++/security/auth_metadata_processor.h", "include/grpc++/security/auth_metadata_processor.h",
"include/grpc++/security/credentials.h", "include/grpc++/security/credentials.h",
@ -7354,12 +7354,12 @@
"src/cpp/client/create_channel_posix.cc", "src/cpp/client/create_channel_posix.cc",
"src/cpp/client/credentials_cc.cc", "src/cpp/client/credentials_cc.cc",
"src/cpp/client/generic_stub.cc", "src/cpp/client/generic_stub.cc",
"src/cpp/common/buffer_pool_cc.cc",
"src/cpp/common/channel_arguments.cc", "src/cpp/common/channel_arguments.cc",
"src/cpp/common/channel_filter.cc", "src/cpp/common/channel_filter.cc",
"src/cpp/common/channel_filter.h", "src/cpp/common/channel_filter.h",
"src/cpp/common/completion_queue_cc.cc", "src/cpp/common/completion_queue_cc.cc",
"src/cpp/common/core_codegen.cc", "src/cpp/common/core_codegen.cc",
"src/cpp/common/resource_quota_cc.cc",
"src/cpp/common/rpc_method.cc", "src/cpp/common/rpc_method.cc",
"src/cpp/server/async_generic_service.cc", "src/cpp/server/async_generic_service.cc",
"src/cpp/server/create_default_thread_pool.cc", "src/cpp/server/create_default_thread_pool.cc",

File diff suppressed because it is too large Load Diff

@ -98,17 +98,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin_encoder_test", "vcxproj
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buffer_pool_test", "vcxproj\test\buffer_pool_test\buffer_pool_test.vcxproj", "{46480473-88FC-8C53-3509-FC7F4DC3A8CD}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "census_context_test", "vcxproj\test\census_context_test\census_context_test.vcxproj", "{5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "census_context_test", "vcxproj\test\census_context_test\census_context_test.vcxproj", "{5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}"
ProjectSection(myProperties) = preProject ProjectSection(myProperties) = preProject
lib = "False" lib = "False"
@ -1304,6 +1293,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolve_address_test", "vcx
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resource_quota_test", "vcxproj\test\resource_quota_test\resource_quota_test.vcxproj", "{6084F546-5D66-5CB5-63CF-DC960F14B545}"
ProjectSection(myProperties) = preProject
lib = "False"
EndProjectSection
ProjectSection(ProjectDependencies) = postProject
{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
{29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
{EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "secure_channel_create_test", "vcxproj\test\secure_channel_create_test\secure_channel_create_test.vcxproj", "{62B25398-7173-928E-689E-53860B0ACFC4}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "secure_channel_create_test", "vcxproj\test\secure_channel_create_test\secure_channel_create_test.vcxproj", "{62B25398-7173-928E-689E-53860B0ACFC4}"
ProjectSection(myProperties) = preProject ProjectSection(myProperties) = preProject
lib = "False" lib = "False"
@ -1685,22 +1685,6 @@ Global
{D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|Win32.Build.0 = Release|Win32 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|Win32.Build.0 = Release|Win32
{D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|x64.ActiveCfg = Release|x64 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|x64.ActiveCfg = Release|x64
{D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|x64.Build.0 = Release|x64 {D5C70922-D68E-0E9D-9988-995E0F9A79AE}.Release-DLL|x64.Build.0 = Release|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug|Win32.ActiveCfg = Debug|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug|x64.ActiveCfg = Debug|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release|Win32.ActiveCfg = Release|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release|x64.ActiveCfg = Release|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug|Win32.Build.0 = Debug|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug|x64.Build.0 = Debug|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release|Win32.Build.0 = Release|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release|x64.Build.0 = Release|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug-DLL|Win32.Build.0 = Debug|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug-DLL|x64.ActiveCfg = Debug|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Debug-DLL|x64.Build.0 = Debug|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release-DLL|Win32.ActiveCfg = Release|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release-DLL|Win32.Build.0 = Release|Win32
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release-DLL|x64.ActiveCfg = Release|x64
{46480473-88FC-8C53-3509-FC7F4DC3A8CD}.Release-DLL|x64.Build.0 = Release|x64
{5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Debug|Win32.ActiveCfg = Debug|Win32 {5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Debug|Win32.ActiveCfg = Debug|Win32
{5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Debug|x64.ActiveCfg = Debug|x64 {5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Debug|x64.ActiveCfg = Debug|x64
{5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Release|Win32.ActiveCfg = Release|Win32 {5C1CFC2D-AF3C-D7CB-BA74-D267E91CBC73}.Release|Win32.ActiveCfg = Release|Win32
@ -3509,6 +3493,22 @@ Global
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|Win32.Build.0 = Release|Win32 {8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|Win32.Build.0 = Release|Win32
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|x64.ActiveCfg = Release|x64 {8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|x64.ActiveCfg = Release|x64
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|x64.Build.0 = Release|x64 {8279AF6C-9584-67F3-1547-B204864FCCA7}.Release-DLL|x64.Build.0 = Release|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug|Win32.ActiveCfg = Debug|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug|x64.ActiveCfg = Debug|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release|Win32.ActiveCfg = Release|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release|x64.ActiveCfg = Release|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug|Win32.Build.0 = Debug|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug|x64.Build.0 = Debug|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release|Win32.Build.0 = Release|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release|x64.Build.0 = Release|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug-DLL|Win32.Build.0 = Debug|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug-DLL|x64.ActiveCfg = Debug|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Debug-DLL|x64.Build.0 = Debug|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release-DLL|Win32.ActiveCfg = Release|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release-DLL|Win32.Build.0 = Release|Win32
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release-DLL|x64.ActiveCfg = Release|x64
{6084F546-5D66-5CB5-63CF-DC960F14B545}.Release-DLL|x64.Build.0 = Release|x64
{62B25398-7173-928E-689E-53860B0ACFC4}.Debug|Win32.ActiveCfg = Debug|Win32 {62B25398-7173-928E-689E-53860B0ACFC4}.Debug|Win32.ActiveCfg = Debug|Win32
{62B25398-7173-928E-689E-53860B0ACFC4}.Debug|x64.ActiveCfg = Debug|x64 {62B25398-7173-928E-689E-53860B0ACFC4}.Debug|x64.ActiveCfg = Debug|x64
{62B25398-7173-928E-689E-53860B0ACFC4}.Release|Win32.ActiveCfg = Release|Win32 {62B25398-7173-928E-689E-53860B0ACFC4}.Release|Win32.ActiveCfg = Release|Win32

@ -259,7 +259,6 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\buffer_pool.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\client_context.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\client_context.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\completion_queue.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\completion_queue.h" />
@ -286,6 +285,7 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_cxx11.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_cxx11.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\resource_quota.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_metadata_processor.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_metadata_processor.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\credentials.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\credentials.h" />
@ -396,8 +396,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\buffer_pool_cc.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_filter.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_filter.cc">
@ -406,6 +404,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\resource_quota_cc.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc">

@ -46,9 +46,6 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc">
<Filter>src\cpp\client</Filter> <Filter>src\cpp\client</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\buffer_pool_cc.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
@ -61,6 +58,9 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\resource_quota_cc.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
@ -111,9 +111,6 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h">
<Filter>include\grpc++</Filter> <Filter>include\grpc++</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\buffer_pool.h">
<Filter>include\grpc++</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h">
<Filter>include\grpc++</Filter> <Filter>include\grpc++</Filter>
</ClInclude> </ClInclude>
@ -192,6 +189,9 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h">
<Filter>include\grpc++\impl</Filter> <Filter>include\grpc++\impl</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\resource_quota.h">
<Filter>include\grpc++</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h">
<Filter>include\grpc++\security</Filter> <Filter>include\grpc++\security</Filter>
</ClInclude> </ClInclude>

@ -259,7 +259,6 @@
<ItemGroup> <ItemGroup>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\buffer_pool.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\client_context.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\client_context.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\completion_queue.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\completion_queue.h" />
@ -286,6 +285,7 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_cxx11.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_cxx11.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\resource_quota.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_metadata_processor.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_metadata_processor.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\credentials.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\credentials.h" />
@ -382,8 +382,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\buffer_pool_cc.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_filter.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_filter.cc">
@ -392,6 +390,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\resource_quota_cc.cc">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\server\async_generic_service.cc">

@ -31,9 +31,6 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\client\generic_stub.cc">
<Filter>src\cpp\client</Filter> <Filter>src\cpp\client</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\buffer_pool_cc.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\channel_arguments.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
@ -46,6 +43,9 @@
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\core_codegen.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\resource_quota_cc.cc">
<Filter>src\cpp\common</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc"> <ClCompile Include="$(SolutionDir)\..\src\cpp\common\rpc_method.cc">
<Filter>src\cpp\common</Filter> <Filter>src\cpp\common</Filter>
</ClCompile> </ClCompile>
@ -96,9 +96,6 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\alarm.h">
<Filter>include\grpc++</Filter> <Filter>include\grpc++</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\buffer_pool.h">
<Filter>include\grpc++</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\channel.h">
<Filter>include\grpc++</Filter> <Filter>include\grpc++</Filter>
</ClInclude> </ClInclude>
@ -177,6 +174,9 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\thd_no_cxx11.h">
<Filter>include\grpc++\impl</Filter> <Filter>include\grpc++\impl</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\resource_quota.h">
<Filter>include\grpc++</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h"> <ClInclude Include="$(SolutionDir)\..\include\grpc++\security\auth_context.h">
<Filter>include\grpc++\security</Filter> <Filter>include\grpc++\security</Filter>
</ClInclude> </ClInclude>

@ -312,7 +312,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" />
@ -336,6 +335,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" />
@ -497,8 +497,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c">
@ -545,6 +543,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c">

@ -52,9 +52,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -124,6 +121,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -722,9 +722,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
@ -794,6 +791,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>

@ -205,7 +205,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" />
@ -229,6 +228,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" />
@ -345,8 +345,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c">
@ -393,6 +391,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c">

@ -106,9 +106,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -178,6 +175,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -509,9 +509,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
@ -581,6 +578,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>

@ -302,7 +302,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\format_request.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\httpcli.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\endpoint.h" />
@ -326,6 +325,7 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_set_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\pollset_windows.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_posix.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" /> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.h" />
@ -465,8 +465,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\combiner.c">
@ -513,6 +511,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\socket_utils_common_posix.c">

@ -55,9 +55,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\http\parser.c">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -127,6 +124,9 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address_windows.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.c">
<Filter>src\core\lib\iomgr</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c"> <ClCompile Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr_utils.c">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClCompile> </ClCompile>
@ -632,9 +632,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\http\parser.h">
<Filter>src\core\lib\http</Filter> <Filter>src\core\lib\http</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\buffer_pool.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\closure.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
@ -704,6 +701,9 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resolve_address.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\resource_quota.h">
<Filter>src\core\lib\iomgr</Filter>
</ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h"> <ClInclude Include="$(SolutionDir)\..\src\core\lib\iomgr\sockaddr.h">
<Filter>src\core\lib\iomgr</Filter> <Filter>src\core\lib\iomgr</Filter>
</ClInclude> </ClInclude>

@ -157,8 +157,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\buffer_pool_server.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_client_done.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_client_done.c">
@ -223,6 +221,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\resource_quota_server.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\shutdown_finishes_calls.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\shutdown_finishes_calls.c">

@ -10,9 +10,6 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\buffer_pool_server.c">
<Filter>test\core\end2end\tests</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
@ -109,6 +106,9 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\resource_quota_server.c">
<Filter>test\core\end2end\tests</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>

@ -157,8 +157,6 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\buffer_pool_server.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\call_creds.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\call_creds.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\cancel_after_accept.c">
@ -225,6 +223,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\resource_quota_server.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c">
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\shutdown_finishes_calls.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\shutdown_finishes_calls.c">

@ -10,9 +10,6 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\binary_metadata.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\buffer_pool_server.c">
<Filter>test\core\end2end\tests</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\call_creds.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\call_creds.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
@ -112,6 +109,9 @@
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\request_with_payload.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\resource_quota_server.c">
<Filter>test\core\end2end\tests</Filter>
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c"> <ClCompile Include="$(SolutionDir)\..\test\core\end2end\tests\server_finishes_request.c">
<Filter>test\core\end2end\tests</Filter> <Filter>test\core\end2end\tests</Filter>
</ClCompile> </ClCompile>

@ -20,7 +20,7 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{46480473-88FC-8C53-3509-FC7F4DC3A8CD}</ProjectGuid> <ProjectGuid>{6084F546-5D66-5CB5-63CF-DC960F14B545}</ProjectGuid>
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> <IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
</PropertyGroup> </PropertyGroup>
@ -60,14 +60,14 @@
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> <PropertyGroup Condition="'$(Configuration)'=='Debug'">
<TargetName>buffer_pool_test</TargetName> <TargetName>resource_quota_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'"> <PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetName>buffer_pool_test</TargetName> <TargetName>resource_quota_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> <Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@ -158,7 +158,7 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\iomgr\buffer_pool_test.c"> <ClCompile Include="$(SolutionDir)\..\test\core\iomgr\resource_quota_test.c">
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<ClCompile Include="$(SolutionDir)\..\test\core\iomgr\buffer_pool_test.c"> <ClCompile Include="$(SolutionDir)\..\test\core\iomgr\resource_quota_test.c">
<Filter>test\core\iomgr</Filter> <Filter>test\core\iomgr</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="test"> <Filter Include="test">
<UniqueIdentifier>{94e599c3-a059-4581-0cac-d15361ec8a7d}</UniqueIdentifier> <UniqueIdentifier>{06783e32-dbf0-7e7c-7b50-12b278f9cc12}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="test\core"> <Filter Include="test\core">
<UniqueIdentifier>{6d25d413-0043-5a1c-52f7-7d25809be372}</UniqueIdentifier> <UniqueIdentifier>{c4f432b6-577b-e3ed-fec9-a915af5ebbd5}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="test\core\iomgr"> <Filter Include="test\core\iomgr">
<UniqueIdentifier>{64b38e90-4497-be2e-cee1-402590cbea8a}</UniqueIdentifier> <UniqueIdentifier>{fcc82d68-ffb2-0843-83aa-175006c43aeb}</UniqueIdentifier>
</Filter> </Filter>
</ItemGroup> </ItemGroup>
</Project> </Project>
Loading…
Cancel
Save