|
|
|
@ -157,14 +157,15 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// (OnSendInitialMetadataDone). Thus it must be dispatched to an executor
|
|
|
|
|
// thread. However, any OnDone needed after that can be inlined because it
|
|
|
|
|
// is already running on an executor thread.
|
|
|
|
|
meta_tag_.Set(call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerUnaryReactor* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerUnaryReactor* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, |
|
|
|
|
ctx_->initial_metadata_flags()); |
|
|
|
|
if (ctx_->compression_level_set()) { |
|
|
|
@ -305,14 +306,15 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// A finish tag with only MaybeDone can have its callback inlined
|
|
|
|
|
// regardless even if OnDone is not inlineable because this callback just
|
|
|
|
|
// checks a ref and then decides whether or not to dispatch OnDone.
|
|
|
|
|
finish_tag_.Set(call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no read reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
finish_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no read reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
if (!ctx_->sent_initial_metadata_) { |
|
|
|
|
finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_, |
|
|
|
|
ctx_->initial_metadata_flags()); |
|
|
|
@ -338,14 +340,15 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callback for this function should not be inlined because it invokes
|
|
|
|
|
// a user-controlled reaction, but any resulting OnDone can be inlined in
|
|
|
|
|
// the executor to which this callback is dispatched.
|
|
|
|
|
meta_tag_.Set(call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerReadReactor<RequestType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerReadReactor<RequestType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, |
|
|
|
|
ctx_->initial_metadata_flags()); |
|
|
|
|
if (ctx_->compression_level_set()) { |
|
|
|
@ -375,12 +378,13 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callback for this function should not be inlined because it invokes
|
|
|
|
|
// a user-controlled reaction, but any resulting OnDone can be inlined in
|
|
|
|
|
// the executor to which this callback is dispatched.
|
|
|
|
|
read_tag_.Set(call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnReadDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&read_ops_, /*can_inline=*/false); |
|
|
|
|
read_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnReadDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&read_ops_, /*can_inline=*/false); |
|
|
|
|
read_ops_.set_core_cq_tag(&read_tag_); |
|
|
|
|
this->BindReactor(reactor); |
|
|
|
|
this->MaybeCallOnCancel(reactor); |
|
|
|
@ -505,14 +509,15 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// A finish tag with only MaybeDone can have its callback inlined
|
|
|
|
|
// regardless even if OnDone is not inlineable because this callback just
|
|
|
|
|
// checks a ref and then decides whether or not to dispatch OnDone.
|
|
|
|
|
finish_tag_.Set(call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no write reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
finish_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no write reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
finish_ops_.set_core_cq_tag(&finish_tag_); |
|
|
|
|
|
|
|
|
|
if (!ctx_->sent_initial_metadata_) { |
|
|
|
@ -533,14 +538,15 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callback for this function should not be inlined because it invokes
|
|
|
|
|
// a user-controlled reaction, but any resulting OnDone can be inlined in
|
|
|
|
|
// the executor to which this callback is dispatched.
|
|
|
|
|
meta_tag_.Set(call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerWriteReactor<ResponseType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerWriteReactor<ResponseType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, |
|
|
|
|
ctx_->initial_metadata_flags()); |
|
|
|
|
if (ctx_->compression_level_set()) { |
|
|
|
@ -595,12 +601,13 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callback for this function should not be inlined because it invokes
|
|
|
|
|
// a user-controlled reaction, but any resulting OnDone can be inlined in
|
|
|
|
|
// the executor to which this callback is dispatched.
|
|
|
|
|
write_tag_.Set(call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnWriteDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&write_ops_, /*can_inline=*/false); |
|
|
|
|
write_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnWriteDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&write_ops_, /*can_inline=*/false); |
|
|
|
|
write_ops_.set_core_cq_tag(&write_tag_); |
|
|
|
|
this->BindReactor(reactor); |
|
|
|
|
this->MaybeCallOnCancel(reactor); |
|
|
|
@ -707,14 +714,15 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// A finish tag with only MaybeDone can have its callback inlined
|
|
|
|
|
// regardless even if OnDone is not inlineable because this callback just
|
|
|
|
|
// checks a ref and then decides whether or not to dispatch OnDone.
|
|
|
|
|
finish_tag_.Set(call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no bidi reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
finish_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool) { |
|
|
|
|
// Inlineable OnDone can be false here because there is
|
|
|
|
|
// no bidi reactor that has an inlineable OnDone; this
|
|
|
|
|
// only applies to the DefaultReactor (which is unary).
|
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/false); |
|
|
|
|
}, |
|
|
|
|
&finish_ops_, /*can_inline=*/true); |
|
|
|
|
finish_ops_.set_core_cq_tag(&finish_tag_); |
|
|
|
|
|
|
|
|
|
if (!ctx_->sent_initial_metadata_) { |
|
|
|
@ -735,14 +743,15 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callback for this function should not be inlined because it invokes
|
|
|
|
|
// a user-controlled reaction, but any resulting OnDone can be inlined in
|
|
|
|
|
// the executor to which this callback is dispatched.
|
|
|
|
|
meta_tag_.Set(call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerBidiReactor<RequestType, ResponseType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this](bool ok) { |
|
|
|
|
ServerBidiReactor<RequestType, ResponseType>* reactor = |
|
|
|
|
reactor_.load(std::memory_order_relaxed); |
|
|
|
|
reactor->OnSendInitialMetadataDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&meta_ops_, /*can_inline=*/false); |
|
|
|
|
meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, |
|
|
|
|
ctx_->initial_metadata_flags()); |
|
|
|
|
if (ctx_->compression_level_set()) { |
|
|
|
@ -798,19 +807,21 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler { |
|
|
|
|
// The callbacks for these functions should not be inlined because they
|
|
|
|
|
// invoke user-controlled reactions, but any resulting OnDones can be
|
|
|
|
|
// inlined in the executor to which a callback is dispatched.
|
|
|
|
|
write_tag_.Set(call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnWriteDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&write_ops_, /*can_inline=*/false); |
|
|
|
|
write_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnWriteDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&write_ops_, /*can_inline=*/false); |
|
|
|
|
write_ops_.set_core_cq_tag(&write_tag_); |
|
|
|
|
read_tag_.Set(call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnReadDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&read_ops_, /*can_inline=*/false); |
|
|
|
|
read_tag_.Set( |
|
|
|
|
call_.call(), |
|
|
|
|
[this, reactor](bool ok) { |
|
|
|
|
reactor->OnReadDone(ok); |
|
|
|
|
this->MaybeDone(/*inlineable_ondone=*/true); |
|
|
|
|
}, |
|
|
|
|
&read_ops_, /*can_inline=*/false); |
|
|
|
|
read_ops_.set_core_cq_tag(&read_tag_); |
|
|
|
|
this->BindReactor(reactor); |
|
|
|
|
this->MaybeCallOnCancel(reactor); |
|
|
|
|