diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 71b7d3ff85831da36a1222cf89d118f2def628e5..f81cd7605d2c7a009ff9f78eea93e7e30c12f696 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -49,7 +49,7 @@ class ClientAsyncResponseReader GRPC_FINAL { public: ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - const google::protobuf::Message& request, void* tag) + const grpc::protobuf::Message& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 77d1363618424736fd2edf00add1d9c8e4a94159..51260aed3d708f1e1cb2d9bac07f142ada4df13d 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -37,12 +37,6 @@ #include <grpc++/status.h> #include <grpc++/impl/call.h> -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - struct grpc_call; namespace grpc { diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 87e5e9ad6c47c2a1bef39b4b46aa4de7a535a6d5..c55d7c2d5860fb2c602066549cff1354e7c4a8f4 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -47,12 +47,6 @@ using std::chrono::system_clock; struct grpc_call; struct grpc_completion_queue; -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - namespace grpc { class CallOpBuffer; diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 0ca12604038932792d746a17e61d66eecff21bd5..f741e3c36bbce44e3aa29c29f25e1962b694096d 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -106,8 +106,8 @@ class CompletionQueue { friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + const grpc::protobuf::Message &request, + grpc::protobuf::Message *result); // Wraps grpc_completion_queue_pluck. // Cannot be mixed with calls to Next(). diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 3e199e3eaefdb70f3f42ecc9c81df6a2708b75e5..5de56629735f617ff8442f1529bfa853d299a79a 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -42,12 +42,6 @@ #include <memory> #include <map> -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - struct grpc_call; struct grpc_op; @@ -67,8 +61,8 @@ class CallOpBuffer : public CompletionQueueTag { std::multimap<grpc::string, grpc::string> *metadata); void AddSendInitialMetadata(ClientContext *ctx); void AddRecvInitialMetadata(ClientContext *ctx); - void AddSendMessage(const google::protobuf::Message &message); - void AddRecvMessage(google::protobuf::Message *message); + void AddSendMessage(const grpc::protobuf::Message &message); + void AddRecvMessage(grpc::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(ClientContext *ctx, Status *status); void AddServerSendStatus(std::multimap<grpc::string, grpc::string> *metadata, @@ -95,10 +89,10 @@ class CallOpBuffer : public CompletionQueueTag { std::multimap<grpc::string, grpc::string> *recv_initial_metadata_; grpc_metadata_array recv_initial_metadata_arr_; // Send message - const google::protobuf::Message *send_message_; + const grpc::protobuf::Message *send_message_; grpc_byte_buffer *send_message_buf_; // Recv message - google::protobuf::Message *recv_message_; + grpc::protobuf::Message *recv_message_; grpc_byte_buffer *recv_message_buf_; // Client send close bool client_send_close_; diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index d8703264e60327c65abf2331c099f3d3f58a8e7c..23cf3a66df811688d48bbed926e2183713a95daf 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -34,11 +34,8 @@ #ifndef GRPCXX_IMPL_CLIENT_UNARY_CALL_H #define GRPCXX_IMPL_CLIENT_UNARY_CALL_H -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google + +#include <grpc++/config.h> namespace grpc { @@ -51,8 +48,8 @@ class Status; // Wrapper that performs a blocking unary call Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + const grpc::protobuf::Message &request, + grpc::protobuf::Message *result); } // namespace grpc diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index ab407f5c4682e66d1c0408d956a5cd326507c676..e8909ac1846516ba0e7093bdc16a526c8b9666fd 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -34,12 +34,6 @@ #ifndef GRPCXX_IMPL_RPC_METHOD_H #define GRPCXX_IMPL_RPC_METHOD_H -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - namespace grpc { class RpcMethod { diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index ff94c7e6c001260352379c12adc2245e04423e2f..325c8812cafe968c6e86eaa225ff38154f2b027b 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -56,13 +56,13 @@ class MethodHandler { virtual ~MethodHandler() {} struct HandlerParameter { HandlerParameter(Call* c, ServerContext* context, - const google::protobuf::Message* req, - google::protobuf::Message* resp) + const grpc::protobuf::Message* req, + grpc::protobuf::Message* resp) : call(c), server_context(context), request(req), response(resp) {} Call* call; ServerContext* server_context; - const google::protobuf::Message* request; - google::protobuf::Message* response; + const grpc::protobuf::Message* request; + grpc::protobuf::Message* response; }; virtual Status RunHandler(const HandlerParameter& param) = 0; }; @@ -165,8 +165,8 @@ class RpcServiceMethod : public RpcMethod { // Takes ownership of the handler and two prototype objects. RpcServiceMethod(const char* name, RpcMethod::RpcType type, MethodHandler* handler, - google::protobuf::Message* request_prototype, - google::protobuf::Message* response_prototype) + grpc::protobuf::Message* request_prototype, + grpc::protobuf::Message* response_prototype) : RpcMethod(name, type), handler_(handler), request_prototype_(request_prototype), @@ -174,17 +174,17 @@ class RpcServiceMethod : public RpcMethod { MethodHandler* handler() { return handler_.get(); } - google::protobuf::Message* AllocateRequestProto() { + grpc::protobuf::Message* AllocateRequestProto() { return request_prototype_->New(); } - google::protobuf::Message* AllocateResponseProto() { + grpc::protobuf::Message* AllocateResponseProto() { return response_prototype_->New(); } private: std::unique_ptr<MethodHandler> handler_; - std::unique_ptr<google::protobuf::Message> request_prototype_; - std::unique_ptr<google::protobuf::Message> response_prototype_; + std::unique_ptr<grpc::protobuf::Message> request_prototype_; + std::unique_ptr<grpc::protobuf::Message> response_prototype_; }; // This class contains all the method information for an rpc service. It is diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 7481d64d6af58168a73d91d1f47a39b722498ea8..7cd3ddad6b7a9f594805869938c2ec5160b6c4fa 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -34,11 +34,7 @@ #ifndef GRPCXX_IMPL_SERVICE_TYPE_H #define GRPCXX_IMPL_SERVICE_TYPE_H -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google +#include <grpc++/config.h> namespace grpc { @@ -72,7 +68,7 @@ class AsynchronousService { public: virtual void RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, + ::grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) = 0; }; @@ -91,7 +87,7 @@ class AsynchronousService { protected: void RequestAsyncUnary(int index, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) { dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, @@ -104,7 +100,7 @@ class AsynchronousService { stream, cq, tag); } void RequestServerStreaming(int index, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) { dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 3282b82d04eade3549a72928073dcb9d477a74b5..e3ba93e4877781ca1bd0d9d3f9ed0d22a4e1ea76 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -47,12 +47,6 @@ struct grpc_server; -namespace google { -namespace protobuf { -class Message; -} // namespace protobuf -} // namespace google - namespace grpc { class AsynchronousService; class RpcService; @@ -101,7 +95,7 @@ class Server GRPC_FINAL : private CallHook, // DispatchImpl void RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag); diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index d95a379757e4d684789930a9f4b68ebf7faaea73..7625bcc38d314896e4eaaf4cd729bf7ec2259f07 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -88,7 +88,7 @@ class ClientReader GRPC_FINAL : public ClientStreamingInterface, public: // Blocking create a stream and write the first request out. ClientReader(ChannelInterface* channel, const RpcMethod& method, - ClientContext* context, const google::protobuf::Message& request) + ClientContext* context, const grpc::protobuf::Message& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -142,7 +142,7 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface, public: // Blocking create a stream. ClientWriter(ChannelInterface* channel, const RpcMethod& method, - ClientContext* context, google::protobuf::Message* response) + ClientContext* context, grpc::protobuf::Message* response) : context_(context), response_(response), call_(channel->CreateCall(method, context, &cq_)) { @@ -179,7 +179,7 @@ class ClientWriter GRPC_FINAL : public ClientStreamingInterface, private: ClientContext* context_; - google::protobuf::Message* const response_; + grpc::protobuf::Message* const response_; CompletionQueue cq_; Call call_; }; @@ -386,7 +386,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncStreamingInterface, // Create a stream and write the first request out. ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - const google::protobuf::Message& request, void* tag) + const grpc::protobuf::Message& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -436,7 +436,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, public: ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, - google::protobuf::Message* response, void* tag) + grpc::protobuf::Message* response, void* tag) : context_(context), response_(response), call_(channel->CreateCall(method, context, cq)) { @@ -477,7 +477,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncStreamingInterface, private: ClientContext* context_; - google::protobuf::Message* const response_; + grpc::protobuf::Message* const response_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 684b3cbadb49a6c33fa029fd296e1dac2b91b3cf..5c179de9d8feffeba5834811321aed6df71c4cdd 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -44,8 +44,8 @@ namespace grpc { // Wrapper that performs a blocking unary call Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result) { + const grpc::protobuf::Message &request, + grpc::protobuf::Message *result) { CompletionQueue cq; Call call(channel->CreateCall(method, context, &cq)); CallOpBuffer buf; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index f3a691114d2453a1a325277dedc04efbd28ac613..b2b6c627857b84abc9acb5eb889c9024d11c0bab 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -163,11 +163,11 @@ void CallOpBuffer::AddSendInitialMetadata(ClientContext* ctx) { AddSendInitialMetadata(&ctx->send_initial_metadata_); } -void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { +void CallOpBuffer::AddSendMessage(const grpc::protobuf::Message& message) { send_message_ = &message; } -void CallOpBuffer::AddRecvMessage(google::protobuf::Message* message) { +void CallOpBuffer::AddRecvMessage(grpc::protobuf::Message* message) { recv_message_ = message; recv_message_->Clear(); } diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 69a6bb080e0abed0b637ab443118955528bf9dbb..e6badd5d6e7922c371747123fb5ddc2bb9cbb73d 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -40,7 +40,7 @@ namespace grpc { -bool SerializeProto(const google::protobuf::Message &msg, +bool SerializeProto(const grpc::protobuf::Message &msg, grpc_byte_buffer **bp) { grpc::string msg_str; bool success = msg.SerializeToString(&msg_str); @@ -54,7 +54,7 @@ bool SerializeProto(const google::protobuf::Message &msg, } bool DeserializeProto(grpc_byte_buffer *buffer, - google::protobuf::Message *msg) { + grpc::protobuf::Message *msg) { grpc::string msg_string; grpc_byte_buffer_reader *reader = grpc_byte_buffer_reader_create(buffer); gpr_slice slice; diff --git a/src/cpp/proto/proto_utils.h b/src/cpp/proto/proto_utils.h index a0af4d6465d6e0cac71008f3dbf63eb89b82b26b..7a1b1f8b7cb289776c681d72b6a1feca1234de39 100644 --- a/src/cpp/proto/proto_utils.h +++ b/src/cpp/proto/proto_utils.h @@ -34,23 +34,20 @@ #ifndef GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H #define GRPC_INTERNAL_CPP_PROTO_PROTO_UTILS_H +#include <grpc++/config.h> + struct grpc_byte_buffer; -namespace google { -namespace protobuf { -class Message; -} -} namespace grpc { // Serialize the msg into a buffer created inside the function. The caller // should destroy the returned buffer when done with it. If serialization fails, // false is returned and buffer is left unchanged. -bool SerializeProto(const google::protobuf::Message &msg, +bool SerializeProto(const grpc::protobuf::Message &msg, grpc_byte_buffer **buffer); // The caller keeps ownership of buffer and msg. -bool DeserializeProto(grpc_byte_buffer *buffer, google::protobuf::Message *msg); +bool DeserializeProto(grpc_byte_buffer *buffer, grpc::protobuf::Message *msg); } // namespace grpc diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc index 5f8c2ba10f4cd5511d0a3216c2d920370f48622f..bee75497b8cf39262a585775db687fbdcd2864f9 100644 --- a/src/cpp/server/async_server_context.cc +++ b/src/cpp/server/async_server_context.cc @@ -58,14 +58,14 @@ void AsyncServerContext::Accept(grpc_completion_queue *cq) { call_, GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); } -bool AsyncServerContext::StartRead(google::protobuf::Message *request) { +bool AsyncServerContext::StartRead(grpc::protobuf::Message *request) { GPR_ASSERT(request); request_ = request; grpc_call_error err = grpc_call_start_read_old(call_, this); return err == GRPC_CALL_OK; } -bool AsyncServerContext::StartWrite(const google::protobuf::Message &response, +bool AsyncServerContext::StartWrite(const grpc::protobuf::Message &response, int flags) { grpc_byte_buffer *buffer = nullptr; if (!SerializeProto(response, &buffer)) { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 97bf0f1a6ea8ce9a15a6fb901770a6b197fa6fa7..17b97f6ecff8c5bf66076fb2a6bff6eddad9eebb 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -117,8 +117,8 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { } void Run() { - std::unique_ptr<google::protobuf::Message> req; - std::unique_ptr<google::protobuf::Message> res; + std::unique_ptr<grpc::protobuf::Message> req; + std::unique_ptr<grpc::protobuf::Message> res; if (has_request_payload_) { req.reset(method_->AllocateRequestProto()); if (!DeserializeProto(request_payload_, req.get())) { @@ -298,7 +298,7 @@ void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) { class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { public: AsyncRequest(Server* server, void* registered_method, ServerContext* ctx, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) : tag_(tag), @@ -352,7 +352,7 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { private: void* const tag_; - ::google::protobuf::Message* const request_; + grpc::protobuf::Message* const request_; ServerAsyncStreamingInterface* const stream_; CompletionQueue* const cq_; ServerContext* const ctx_; @@ -364,7 +364,7 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { }; void Server::RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, + grpc::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) { new AsyncRequest(this, registered_method, context, request, stream, cq, tag);