[promise-based-endpoint] Instantiate an ExecCtx where required (#35505)

Closes #35505

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35505 from ctiller:pbepec 54c023e589
PiperOrigin-RevId: 597845579
pull/35541/head
Craig Tiller 11 months ago committed by Copybara-Service
parent 9cf228b8a4
commit ddb26d6d3b
  1. 1
      src/core/BUILD
  2. 2
      src/core/lib/transport/promise_endpoint.cc
  3. 5
      src/core/lib/transport/promise_endpoint.h

@ -6484,6 +6484,7 @@ grpc_cc_library(
"slice",
"slice_buffer",
"//:event_engine_base_hdrs",
"//:exec_ctx",
"//:gpr",
],
)

@ -92,6 +92,8 @@ void PromiseEndpoint::ReadState::Complete(absl::Status status,
}
if (ep->Read(
[self = Ref(), num_bytes_requested](absl::Status status) {
ApplicationCallbackExecCtx callback_exec_ctx;
ExecCtx exec_ctx;
self->Complete(std::move(status), num_bytes_requested);
},
&pending_buffer, &read_args)) {

@ -37,6 +37,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/promise/activity.h"
#include "src/core/lib/promise/if.h"
#include "src/core/lib/promise/map.h"
@ -82,6 +83,8 @@ class PromiseEndpoint {
write_state_->waker = Activity::current()->MakeNonOwningWaker();
completed = endpoint_->Write(
[write_state = write_state_](absl::Status status) {
ApplicationCallbackExecCtx callback_exec_ctx;
ExecCtx exec_ctx;
write_state->Complete(std::move(status));
},
&write_state_->buffer, nullptr /* uses default arguments */);
@ -124,6 +127,8 @@ class PromiseEndpoint {
read_state_->waker = Activity::current()->MakeNonOwningWaker();
if (endpoint_->Read(
[read_state = read_state_, num_bytes](absl::Status status) {
ApplicationCallbackExecCtx callback_exec_ctx;
ExecCtx exec_ctx;
read_state->Complete(std::move(status), num_bytes);
},
&read_state_->pending_buffer, &read_args)) {

Loading…
Cancel
Save