Fix and format build after rebase

pull/23916/head
Karthik Ravi Shankar 5 years ago
parent dc3e1097e9
commit a23578444c
  1. 13
      include/grpcpp/impl/codegen/client_context.h
  2. 42
      include/grpcpp/impl/codegen/method_handler_impl.h
  3. 4
      include/grpcpp/impl/codegen/rpc_service_method.h
  4. 29
      include/grpcpp/impl/codegen/server_callback_handlers.h
  5. 18
      include/grpcpp/impl/codegen/server_context.h
  6. 6
      include/grpcpp/impl/codegen/server_interface.h
  7. 12
      include/grpcpp/impl/codegen/sync_stream_impl.h
  8. 3
      src/cpp/client/client_context.cc

@ -71,7 +71,6 @@ class ClientCallbackUnaryImpl;
class ClientContextAccessor;
} // namespace internal
class ServerContext;
template <class R>
class ClientReader;
template <class W>
@ -87,12 +86,14 @@ class ClientAsyncReaderWriter;
template <class R>
class ClientAsyncResponseReader;
class ServerContextBase;
class CallbackServerContext;
} // namespace grpc_impl
namespace grpc {
class ServerContext;
class ServerContextBase;
class CallbackServerContext;
namespace testing {
class InteropClientContextInspector;
} // namespace testing
@ -208,10 +209,10 @@ class ClientContext {
/// \return A newly constructed \a ClientContext instance based on \a
/// server_context, with traits propagated (copied) according to \a options.
static std::unique_ptr<ClientContext> FromServerContext(
const grpc_impl::ServerContext& server_context,
const grpc::ServerContext& server_context,
PropagationOptions options = PropagationOptions());
static std::unique_ptr<ClientContext> FromCallbackServerContext(
const grpc_impl::CallbackServerContext& server_context,
const grpc::CallbackServerContext& server_context,
PropagationOptions options = PropagationOptions());
/// Add the (\a meta_key, \a meta_value) pair to the metadata associated with
@ -491,7 +492,7 @@ class ClientContext {
void SendCancelToInterceptors();
static std::unique_ptr<ClientContext> FromInternalServerContext(
const grpc_impl::ServerContextBase& server_context,
const grpc::ServerContextBase& server_context,
PropagationOptions options);
bool initial_metadata_received_;

@ -65,10 +65,9 @@ class RpcMethodHandler : public ::grpc::internal::MethodHandler {
::grpc::Status status = param.status;
if (status.ok()) {
status = CatchingFunctionHandler([this, &param, &rsp] {
return func_(
service_,
static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &rsp);
return func_(service_,
static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &rsp);
});
static_cast<RequestType*>(param.request)->~RequestType();
}
@ -131,16 +130,14 @@ class ClientStreamingHandler : public ::grpc::internal::MethodHandler {
void RunHandler(const HandlerParameter& param) final {
::grpc_impl::ServerReader<RequestType> reader(
param.call,
static_cast<::grpc::ServerContext*>(param.server_context));
param.call, static_cast<::grpc::ServerContext*>(param.server_context));
ResponseType rsp;
::grpc::Status status =
CatchingFunctionHandler([this, &param, &reader, &rsp] {
return func_(
service_,
static_cast<::grpc::ServerContext*>(param.server_context),
&reader, &rsp);
});
::grpc::Status status = CatchingFunctionHandler([this, &param, &reader,
&rsp] {
return func_(service_,
static_cast<::grpc::ServerContext*>(param.server_context),
&reader, &rsp);
});
::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
::grpc::internal::CallOpSendMessage,
@ -188,10 +185,9 @@ class ServerStreamingHandler : public ::grpc::internal::MethodHandler {
param.call,
static_cast<::grpc::ServerContext*>(param.server_context));
status = CatchingFunctionHandler([this, &param, &writer] {
return func_(
service_,
static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &writer);
return func_(service_,
static_cast<::grpc::ServerContext*>(param.server_context),
static_cast<RequestType*>(param.request), &writer);
});
static_cast<RequestType*>(param.request)->~RequestType();
}
@ -250,17 +246,15 @@ template <class Streamer, bool WriteNeeded>
class TemplatedBidiStreamingHandler : public ::grpc::internal::MethodHandler {
public:
TemplatedBidiStreamingHandler(
std::function<::grpc::Status(::grpc::ServerContext*, Streamer*)>
func)
std::function<::grpc::Status(::grpc::ServerContext*, Streamer*)> func)
: func_(func), write_needed_(WriteNeeded) {}
void RunHandler(const HandlerParameter& param) final {
Streamer stream(param.call, static_cast<::grpc::ServerContext*>(
param.server_context));
Streamer stream(param.call,
static_cast<::grpc::ServerContext*>(param.server_context));
::grpc::Status status = CatchingFunctionHandler([this, &param, &stream] {
return func_(
static_cast<::grpc::ServerContext*>(param.server_context),
&stream);
return func_(static_cast<::grpc::ServerContext*>(param.server_context),
&stream);
});
::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,

@ -49,8 +49,8 @@ class MethodHandler {
/// \param requester : used only by the callback API. It is a function
/// called by the RPC Controller to request another RPC (and also
/// to set up the state required to make that request possible)
HandlerParameter(Call* c, ::grpc::ServerContextBase* context,
void* req, Status req_status, void* handler_data,
HandlerParameter(Call* c, ::grpc::ServerContextBase* context, void* req,
Status req_status, void* handler_data,
std::function<void()> requester)
: call(c),
server_context(context),

@ -52,8 +52,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
auto* call = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackUnaryImpl)))
ServerCallbackUnaryImpl(
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, allocator_state, std::move(param.call_requester));
param.server_context->BeginCompletionOp(
param.call, [call](bool) { call->MaybeDone(); }, call);
@ -62,8 +61,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
if (param.status.ok()) {
reactor = ::grpc::internal::CatchingReactorGetter<ServerUnaryReactor>(
get_reactor_,
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
call->request(), call->response());
}
@ -266,8 +264,7 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
auto* reader = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackReaderImpl)))
ServerCallbackReaderImpl(
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, std::move(param.call_requester));
// Inlineable OnDone can be false in the CompletionOp callback because there
// is no read reactor that has an inlineable OnDone; this only applies to
@ -282,8 +279,7 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
reactor = ::grpc::internal::CatchingReactorGetter<
ServerReadReactor<RequestType>>(
get_reactor_,
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
reader->response());
}
@ -299,8 +295,8 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
}
private:
std::function<ServerReadReactor<RequestType>*(
::grpc::CallbackServerContext*, ResponseType*)>
std::function<ServerReadReactor<RequestType>*(::grpc::CallbackServerContext*,
ResponseType*)>
get_reactor_;
class ServerCallbackReaderImpl : public ServerCallbackReader<RequestType> {
@ -451,8 +447,7 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler {
auto* writer = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackWriterImpl)))
ServerCallbackWriterImpl(
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, static_cast<RequestType*>(param.request),
std::move(param.call_requester));
// Inlineable OnDone can be false in the CompletionOp callback because there
@ -468,8 +463,7 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler {
reactor = ::grpc::internal::CatchingReactorGetter<
ServerWriteReactor<ResponseType>>(
get_reactor_,
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
writer->request());
}
if (reactor == nullptr) {
@ -671,8 +665,7 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler {
auto* stream = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
param.call->call(), sizeof(ServerCallbackReaderWriterImpl)))
ServerCallbackReaderWriterImpl(
static_cast<::grpc::CallbackServerContext*>(
param.server_context),
static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, std::move(param.call_requester));
// Inlineable OnDone can be false in the CompletionOp callback because there
// is no bidi reactor that has an inlineable OnDone; this only applies to
@ -686,8 +679,8 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler {
if (param.status.ok()) {
reactor = ::grpc::internal::CatchingReactorGetter<
ServerBidiReactor<RequestType, ResponseType>>(
get_reactor_, static_cast<::grpc::CallbackServerContext*>(
param.server_context));
get_reactor_,
static_cast<::grpc::CallbackServerContext*>(param.server_context));
}
if (reactor == nullptr) {

@ -49,7 +49,6 @@ struct grpc_call;
struct census_context;
namespace grpc_impl {
class ClientContext;
class Server;
template <class W, class R>
class ServerAsyncReader;
@ -94,10 +93,19 @@ class ErrorMethodHandler;
} // namespace grpc_impl
namespace grpc {
class ClientContext;
class CompletionQueue;
class GenericServerContext;
class ServerInterface;
// TODO(vjpai): Remove namespace experimental when de-experimentalized fully.
namespace experimental {
typedef ::grpc::ServerContextBase ServerContextBase;
typedef ::grpc::CallbackServerContext CallbackServerContext;
} // namespace experimental
#ifndef GRPC_CALLBACK_API_NONEXPERIMENTAL
namespace experimental {
#endif
@ -369,7 +377,7 @@ class ServerContextBase {
friend class ::grpc_impl::internal::ErrorMethodHandler;
template <class Base>
friend class ::grpc_impl::internal::FinishOnlyReactor;
friend class ::grpc_impl::ClientContext;
friend class ::grpc::ClientContext;
friend class ::grpc::GenericServerContext;
#ifdef GRPC_CALLBACK_API_NONEXPERIMENTAL
friend class ::grpc::GenericCallbackServerContext;
@ -592,9 +600,9 @@ class CallbackServerContext : public ServerContextBase {
} // namespace grpc
static_assert(std::is_base_of<::grpc::ServerContextBase,
::grpc::ServerContext>::value,
"improper base class");
static_assert(
std::is_base_of<::grpc::ServerContextBase, ::grpc::ServerContext>::value,
"improper base class");
static_assert(std::is_base_of<::grpc::ServerContextBase,
::grpc::CallbackServerContext>::value,
"improper base class");

@ -191,8 +191,7 @@ class ServerInterface : public internal::CallHook {
class BaseAsyncRequest : public internal::CompletionQueueTag {
public:
BaseAsyncRequest(ServerInterface* server,
::grpc::ServerContext* context,
BaseAsyncRequest(ServerInterface* server, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream,
::grpc::CompletionQueue* call_cq,
::grpc::ServerCompletionQueue* notification_cq, void* tag,
@ -270,8 +269,7 @@ class ServerInterface : public internal::CallHook {
class PayloadAsyncRequest final : public RegisteredAsyncRequest {
public:
PayloadAsyncRequest(internal::RpcServiceMethod* registered_method,
ServerInterface* server,
::grpc::ServerContext* context,
ServerInterface* server, ::grpc::ServerContext* context,
internal::ServerAsyncStreamingInterface* stream,
::grpc::CompletionQueue* call_cq,
::grpc::ServerCompletionQueue* notification_cq,

@ -707,8 +707,7 @@ namespace internal {
template <class W, class R>
class ServerReaderWriterBody final {
public:
ServerReaderWriterBody(grpc::internal::Call* call,
::grpc::ServerContext* ctx)
ServerReaderWriterBody(grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: call_(call), ctx_(ctx) {}
void SendInitialMetadata() {
@ -805,8 +804,7 @@ class ServerReaderWriter final : public ServerReaderWriterInterface<W, R> {
friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler<
ServerReaderWriter<W, R>, false>;
ServerReaderWriter(::grpc::internal::Call* call,
::grpc::ServerContext* ctx)
ServerReaderWriter(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx) {}
};
@ -875,8 +873,7 @@ class ServerUnaryStreamer final
friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler<
ServerUnaryStreamer<RequestType, ResponseType>, true>;
ServerUnaryStreamer(::grpc::internal::Call* call,
::grpc::ServerContext* ctx)
ServerUnaryStreamer(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx), read_done_(false), write_done_(false) {}
};
@ -937,8 +934,7 @@ class ServerSplitStreamer final
friend class ::grpc_impl::internal::TemplatedBidiStreamingHandler<
ServerSplitStreamer<RequestType, ResponseType>, false>;
ServerSplitStreamer(::grpc::internal::Call* call,
::grpc::ServerContext* ctx)
ServerSplitStreamer(::grpc::internal::Call* call, ::grpc::ServerContext* ctx)
: body_(call, ctx), read_done_(false) {}
};

@ -97,8 +97,7 @@ std::unique_ptr<ClientContext> ClientContext::FromInternalServerContext(
}
std::unique_ptr<ClientContext> ClientContext::FromServerContext(
const grpc::ServerContext& server_context,
PropagationOptions options) {
const grpc::ServerContext& server_context, PropagationOptions options) {
return FromInternalServerContext(server_context, options);
}

Loading…
Cancel
Save