[iwyu] resource quota (#29538)

* [iwyu] resource quota

* fix

* Automated change: Fix sanity tests

Co-authored-by: ctiller <ctiller@users.noreply.github.com>
pull/29273/head^2
Craig Tiller 3 years ago committed by GitHub
parent 18bec00b58
commit be1a2ee500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      BUILD
  2. 6
      CMakeLists.txt
  3. 6
      build_autogenerated.yaml
  4. 15
      src/core/lib/resource_quota/api.cc
  5. 4
      src/core/lib/resource_quota/api.h
  6. 6
      src/core/lib/resource_quota/arena.cc
  7. 1
      src/core/lib/resource_quota/arena.h
  8. 11
      src/core/lib/resource_quota/memory_quota.cc
  9. 11
      src/core/lib/resource_quota/memory_quota.h
  10. 8
      src/core/lib/resource_quota/resource_quota.h
  11. 2
      src/core/lib/resource_quota/thread_quota.cc
  12. 4
      src/core/lib/resource_quota/thread_quota.h
  13. 2
      tools/dockerfile/grpc_iwyu/iwyu.sh

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

6
CMakeLists.txt generated

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

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

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

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

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

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

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

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

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

@ -16,6 +16,8 @@
#include "src/core/lib/resource_quota/thread_quota.h"
#include <grpc/support/log.h>
namespace grpc_core {
ThreadQuota::ThreadQuota() = default;

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

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

Loading…
Cancel
Save