cast and default initializer

pull/18784/head
yang-g 6 years ago
parent 41824319fa
commit 39cfbf9d4a
  1. 6
      include/grpcpp/impl/codegen/message_allocator.h
  2. 2
      src/compiler/cpp_generator.cc
  3. 4
      test/cpp/codegen/compiler_test_golden

@ -26,11 +26,11 @@ namespace experimental {
// call arena in here in the future.
template <typename RequestT, typename ResponseT>
struct RpcAllocatorInfo {
RequestT* request = nullptr;
ResponseT* response = nullptr;
RequestT* request;
ResponseT* response;
// per rpc allocator internal state. MessageAllocator can set it when
// AllocateMessages is called and use it later.
void* allocator_state = nullptr;
void* allocator_state;
};
// Implementations need to be thread-safe

@ -1002,7 +1002,7 @@ void PrintHeaderServerMethodCallback(
"void SetMessageAllocatorFor_$Method$(\n"
" ::grpc::experimental::MessageAllocator< "
"$RealRequest$, $RealResponse$>* allocator) {\n"
" dynamic_cast<::grpc::internal::CallbackUnaryHandler< "
" static_cast<::grpc::internal::CallbackUnaryHandler< "
"$RealRequest$, $RealResponse$>*>(\n"
" ::grpc::Service::experimental().GetHandler($Idx$))\n"
" ->SetMessageAllocator(allocator);\n");

@ -338,7 +338,7 @@ class ServiceA final {
}
void SetMessageAllocatorFor_MethodA1(
::grpc::experimental::MessageAllocator< ::grpc::testing::Request, ::grpc::testing::Response>* allocator) {
dynamic_cast<::grpc::internal::CallbackUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>*>(
static_cast<::grpc::internal::CallbackUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>*>(
::grpc::Service::experimental().GetHandler(0))
->SetMessageAllocator(allocator);
}
@ -812,7 +812,7 @@ class ServiceB final {
}
void SetMessageAllocatorFor_MethodB1(
::grpc::experimental::MessageAllocator< ::grpc::testing::Request, ::grpc::testing::Response>* allocator) {
dynamic_cast<::grpc::internal::CallbackUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>*>(
static_cast<::grpc::internal::CallbackUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>*>(
::grpc::Service::experimental().GetHandler(0))
->SetMessageAllocator(allocator);
}

Loading…
Cancel
Save