Merge pull request #24491 from vjpai/callback_unary_reactor_code_size

Also reduce templating for ClientUnaryReactor
pull/24651/head
Vijay Pai 4 years ago committed by GitHub
commit 537e372f71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      include/grpcpp/impl/codegen/client_callback.h
  2. 2
      src/compiler/cpp_generator.cc

@ -1191,7 +1191,8 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
class ClientCallbackUnaryFactory {
public:
template <class Request, class Response>
template <class Request, class Response, class BaseRequest = Request,
class BaseResponse = Response>
static void Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc::ClientContext* context, const Request* request,
@ -1203,7 +1204,9 @@ class ClientCallbackUnaryFactory {
new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientCallbackUnaryImpl)))
ClientCallbackUnaryImpl(call, context, request, response, reactor);
ClientCallbackUnaryImpl(call, context,
static_cast<const BaseRequest*>(request),
static_cast<BaseResponse*>(response), reactor);
}
};

@ -1911,6 +1911,8 @@ void PrintSourceClientMethod(grpc_generator::Printer* printer,
"::grpc::experimental::ClientUnaryReactor* reactor) {\n");
printer->Print(*vars,
" ::grpc::internal::ClientCallbackUnaryFactory::Create"
"< ::grpc::protobuf::MessageLite, "
"::grpc::protobuf::MessageLite>"
"(stub_->channel_.get(), stub_->rpcmethod_$Method$_, "
"context, request, response, reactor);\n}\n\n");

Loading…
Cancel
Save