diff options
author | Craig Tiller <ctiller@google.com> | 2023-12-14 10:28:10 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-12-14 10:32:58 -0800 |
commit | def3288d935abc6ca6a1fa81bb688669501d76b0 (patch) | |
tree | da0219f9a3d36f9b332062215a7c24f3dd2720bf | |
parent | 96ac691531fa513b1fbf914d66032364867447c7 (diff) | |
download | grpc-grpc-def3288d935abc6ca6a1fa81bb688669501d76b0.tar.gz |
[call-v3] Add some initialization support for the new call architecture (#35301)
Closes #35301
COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35301 from ctiller:init-call-review a2022cc485589ae3096ac4f5e18fde18cd26a671
PiperOrigin-RevId: 590982608
-rw-r--r-- | src/core/lib/channel/channel_stack.cc | 17 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack.h | 3 | ||||
-rw-r--r-- | src/core/lib/transport/transport.h | 5 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/core/lib/channel/channel_stack.cc b/src/core/lib/channel/channel_stack.cc index e71fe67784..3f8edc6dc4 100644 --- a/src/core/lib/channel/channel_stack.cc +++ b/src/core/lib/channel/channel_stack.cc @@ -28,6 +28,7 @@ #include <grpc/support/log.h> #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/channel/channel_fwd.h" #include "src/core/lib/channel/channel_stack_trace.h" #include "src/core/lib/gpr/alloc.h" #include "src/core/lib/surface/channel_init.h" @@ -320,3 +321,19 @@ grpc_channel_stack::MakeServerCallPromise(grpc_core::CallArgs call_args) { return ServerNext(grpc_channel_stack_element(this, this->count - 1))( std::move(call_args)); } + +void grpc_channel_stack::InitClientCallSpine( + grpc_core::CallSpineInterface* call) { + for (size_t i = 0; i < count; i++) { + auto* elem = grpc_channel_stack_element(this, i); + elem->filter->init_call(elem, call); + } +} + +void grpc_channel_stack::InitServerCallSpine( + grpc_core::CallSpineInterface* call) { + for (size_t i = 0; i < count; i++) { + auto* elem = grpc_channel_stack_element(this, count - 1 - i); + elem->filter->init_call(elem, call); + } +} diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h index 5b6649a9ea..1a17bb9084 100644 --- a/src/core/lib/channel/channel_stack.h +++ b/src/core/lib/channel/channel_stack.h @@ -244,6 +244,9 @@ struct grpc_channel_stack { MakeClientCallPromise(grpc_core::CallArgs call_args); grpc_core::ArenaPromise<grpc_core::ServerMetadataHandle> MakeServerCallPromise(grpc_core::CallArgs call_args); + + void InitClientCallSpine(grpc_core::CallSpineInterface* call); + void InitServerCallSpine(grpc_core::CallSpineInterface* call); }; // A call stack tracks a set of related filters for one call, and guarantees diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index d35bdf5179..4beb800367 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -491,6 +491,11 @@ class CallHandler { const RefCountedPtr<CallSpine> spine_; }; +struct CallInitiatorAndHandler { + CallInitiator initiator; + CallHandler handler; +}; + template <typename CallHalf> auto OutgoingMessages(CallHalf& h) { struct Wrapper { |