diff --git a/BUILD b/BUILD index e9f56995410..5e192dadfdc 100644 --- a/BUILD +++ b/BUILD @@ -1523,12 +1523,18 @@ grpc_cc_library( hdrs = [ "src/core/lib/resource_quota/memory_quota.h", ], + external_deps = [ + "absl/status", + "absl/strings", + "absl/utility", + ], deps = [ "activity", "dual_ref_counted", "event_engine_memory_allocator", "exec_ctx_wakeup_scheduler", "gpr_base", + "grpc_trace", "loop", "map", "orphanable", @@ -2170,6 +2176,7 @@ grpc_cc_library( "avl", "bitset", "channel_args", + "channel_args_preconditioning", "channel_stack_builder", "channel_stack_type", "chunked_vector", @@ -2202,6 +2209,7 @@ grpc_cc_library( "slice_refcount", "sockaddr_utils", "table", + "thread_quota", "time", "uri_parser", "useful", diff --git a/CMakeLists.txt b/CMakeLists.txt index 68f1b24b3cd..cc0602abfb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5971,6 +5971,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_POSIX) ${_gRPC_ALLTARGETS_LIBRARIES} absl::statusor absl::variant + absl::utility gpr ) @@ -7575,6 +7576,7 @@ target_link_libraries(arena_promise_test ${_gRPC_ALLTARGETS_LIBRARIES} absl::statusor absl::variant + absl::utility gpr ) @@ -10693,6 +10695,7 @@ target_link_libraries(for_each_test absl::flat_hash_set absl::statusor absl::variant + absl::utility gpr ) @@ -12906,6 +12909,7 @@ target_link_libraries(memory_quota_test ${_gRPC_ALLTARGETS_LIBRARIES} absl::statusor absl::variant + absl::utility gpr ) @@ -13500,6 +13504,7 @@ target_link_libraries(pipe_test ${_gRPC_ALLTARGETS_LIBRARIES} absl::statusor absl::variant + absl::utility gpr ) @@ -14347,6 +14352,7 @@ target_link_libraries(resource_quota_test ${_gRPC_ALLTARGETS_LIBRARIES} absl::statusor absl::variant + absl::utility gpr ) diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 93b4a27ce15..21d629b296e 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -3813,6 +3813,7 @@ targets: deps: - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr platforms: - linux @@ -4478,6 +4479,7 @@ targets: deps: - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr uses_polling: false - name: async_end2end_test @@ -5799,6 +5801,7 @@ targets: - absl/container:flat_hash_set - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr uses_polling: false - name: generic_end2end_test @@ -6566,6 +6569,7 @@ targets: deps: - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr uses_polling: false - name: message_allocator_end2end_test @@ -6810,6 +6814,7 @@ targets: deps: - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr uses_polling: false - name: poll_test @@ -7168,6 +7173,7 @@ targets: deps: - absl/status:statusor - absl/types:variant + - absl/utility:utility - gpr uses_polling: false - name: retry_throttle_test diff --git a/src/core/lib/resource_quota/api.cc b/src/core/lib/resource_quota/api.cc index 2cad657f464..c470bb99075 100644 --- a/src/core/lib/resource_quota/api.cc +++ b/src/core/lib/resource_quota/api.cc @@ -16,11 +16,24 @@ #include "src/core/lib/resource_quota/api.h" +#include <stdint.h> + +#include <atomic> +#include <memory> +#include <string> +#include <utility> + +#include "absl/strings/str_cat.h" + #include <grpc/grpc.h> -#include "src/core/lib/gpr/useful.h" +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/channel_args_preconditioning.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/resource_quota/memory_quota.h" #include "src/core/lib/resource_quota/resource_quota.h" +#include "src/core/lib/resource_quota/thread_quota.h" namespace grpc_core { diff --git a/src/core/lib/resource_quota/api.h b/src/core/lib/resource_quota/api.h index 42c44ad8c4a..178479049f0 100644 --- a/src/core/lib/resource_quota/api.h +++ b/src/core/lib/resource_quota/api.h @@ -17,6 +17,10 @@ #include <grpc/support/port_platform.h> +#include <stddef.h> + +#include <grpc/impl/codegen/grpc_types.h> + #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/config/core_configuration.h" #include "src/core/lib/resource_quota/resource_quota.h" diff --git a/src/core/lib/resource_quota/arena.cc b/src/core/lib/resource_quota/arena.cc index 7d7e1857b56..37caf2453ba 100644 --- a/src/core/lib/resource_quota/arena.cc +++ b/src/core/lib/resource_quota/arena.cc @@ -20,17 +20,11 @@ #include "src/core/lib/resource_quota/arena.h" -#include <string.h> - #include <new> #include <grpc/support/alloc.h> -#include <grpc/support/atm.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> #include "src/core/lib/gpr/alloc.h" -#include "src/core/lib/gprpp/memory.h" namespace { diff --git a/src/core/lib/resource_quota/arena.h b/src/core/lib/resource_quota/arena.h index 542b09a351c..b30bb6600b6 100644 --- a/src/core/lib/resource_quota/arena.h +++ b/src/core/lib/resource_quota/arena.h @@ -34,6 +34,7 @@ #include <new> #include <utility> +#include <grpc/event_engine/memory_allocator.h> #include <grpc/support/alloc.h> #include <grpc/support/sync.h> diff --git a/src/core/lib/resource_quota/memory_quota.cc b/src/core/lib/resource_quota/memory_quota.cc index fcbf7dc52b1..710ff1820e5 100644 --- a/src/core/lib/resource_quota/memory_quota.cc +++ b/src/core/lib/resource_quota/memory_quota.cc @@ -16,8 +16,18 @@ #include "src/core/lib/resource_quota/memory_quota.h" +#include <inttypes.h> + +#include <algorithm> #include <atomic> +#include <tuple> +#include <type_traits> + +#include "absl/status/status.h" +#include "absl/strings/str_cat.h" +#include "absl/utility/utility.h" +#include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/mpscq.h" #include "src/core/lib/promise/exec_ctx_wakeup_scheduler.h" @@ -25,7 +35,6 @@ #include "src/core/lib/promise/map.h" #include "src/core/lib/promise/race.h" #include "src/core/lib/promise/seq.h" -#include "src/core/lib/resource_quota/memory_quota.h" #include "src/core/lib/resource_quota/trace.h" namespace grpc_core { diff --git a/src/core/lib/resource_quota/memory_quota.h b/src/core/lib/resource_quota/memory_quota.h index b47d0e35819..681bd7ad8ef 100644 --- a/src/core/lib/resource_quota/memory_quota.h +++ b/src/core/lib/resource_quota/memory_quota.h @@ -17,18 +17,29 @@ #include <grpc/support/port_platform.h> +#include <stdint.h> + #include <algorithm> #include <atomic> #include <cstddef> #include <limits> #include <memory> #include <queue> +#include <string> +#include <utility> #include <vector> +#include "absl/base/thread_annotations.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" + #include <grpc/event_engine/memory_allocator.h> +#include <grpc/event_engine/memory_request.h> #include <grpc/slice.h> +#include <grpc/support/log.h> #include "src/core/lib/gprpp/orphanable.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" #include "src/core/lib/gprpp/time.h" #include "src/core/lib/promise/activity.h" diff --git a/src/core/lib/resource_quota/resource_quota.h b/src/core/lib/resource_quota/resource_quota.h index 5a0b8830422..6a03df87117 100644 --- a/src/core/lib/resource_quota/resource_quota.h +++ b/src/core/lib/resource_quota/resource_quota.h @@ -17,16 +17,24 @@ #include <grpc/support/port_platform.h> +#include <string> +#include <utility> + +#include "absl/strings/string_view.h" + #include <grpc/impl/codegen/grpc_types.h> #include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/cpp_impl_of.h" +#include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/resource_quota/memory_quota.h" #include "src/core/lib/resource_quota/thread_quota.h" namespace grpc_core { class ResourceQuota; + using ResourceQuotaRefPtr = RefCountedPtr<ResourceQuota>; class ResourceQuota : public RefCounted<ResourceQuota>, diff --git a/src/core/lib/resource_quota/thread_quota.cc b/src/core/lib/resource_quota/thread_quota.cc index c935be0d7f2..24c4c3ace8d 100644 --- a/src/core/lib/resource_quota/thread_quota.cc +++ b/src/core/lib/resource_quota/thread_quota.cc @@ -16,6 +16,8 @@ #include "src/core/lib/resource_quota/thread_quota.h" +#include <grpc/support/log.h> + namespace grpc_core { ThreadQuota::ThreadQuota() = default; diff --git a/src/core/lib/resource_quota/thread_quota.h b/src/core/lib/resource_quota/thread_quota.h index c0ae46da459..9b09b027c27 100644 --- a/src/core/lib/resource_quota/thread_quota.h +++ b/src/core/lib/resource_quota/thread_quota.h @@ -18,8 +18,12 @@ #include <grpc/support/port_platform.h> #include <cstddef> +#include <limits> + +#include "absl/base/thread_annotations.h" #include "src/core/lib/gprpp/ref_counted.h" +#include "src/core/lib/gprpp/ref_counted_ptr.h" #include "src/core/lib/gprpp/sync.h" namespace grpc_core { diff --git a/tools/dockerfile/grpc_iwyu/iwyu.sh b/tools/dockerfile/grpc_iwyu/iwyu.sh index f62b4e7348e..84910141e45 100755 --- a/tools/dockerfile/grpc_iwyu/iwyu.sh +++ b/tools/dockerfile/grpc_iwyu/iwyu.sh @@ -30,7 +30,7 @@ cat compile_commands.json | sed "s,\"file\": \",\"file\": \"${IWYU_ROOT}/,g" > c # figure out which files to include cat compile_commands.json | jq -r '.[].file' \ - | grep -E "^src/core/lib/(config|promise|uri)/" \ + | grep -E "^src/core/lib/(config|resource_quota|promise|uri)/" \ | grep -v -E "/upb-generated/|/upbdefs-generated/" \ | sort \ | tee iwyu_files.txt