diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-10-26 16:11:48 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-10-26 16:11:48 -0700 |
commit | 1ea195b6f327136a86d80dd84c4bd85273894357 (patch) | |
tree | b8889fb10c2417e69c1b8ad9cb2866750857b04b /include/grpcpp | |
parent | 6a5f39db3cac4fd21b42eb5c4b4a63b80f4c88ca (diff) |
Reviewer comments except for void * fixed
Diffstat (limited to 'include/grpcpp')
-rw-r--r-- | include/grpcpp/impl/codegen/channel_interface.h | 5 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/client_context.h | 4 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/client_interceptor.h | 9 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/intercepted_channel.h | 10 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/interceptor_common.h | 2 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/server_interceptor.h | 16 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/server_interface.h | 1 |
7 files changed, 22 insertions, 25 deletions
diff --git a/include/grpcpp/impl/codegen/channel_interface.h b/include/grpcpp/impl/codegen/channel_interface.h index 57026a235e..6fd1dd1d9b 100644 --- a/include/grpcpp/impl/codegen/channel_interface.h +++ b/include/grpcpp/impl/codegen/channel_interface.h @@ -122,9 +122,14 @@ class ChannelInterface { CompletionQueue* cq, void* tag) = 0; virtual bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline) = 0; + + // EXPERIMENTAL // This is needed to keep codegen_test_minimal happy. InterceptedChannel needs // to make use of this but can't directly call Channel's implementation // because of the test. + // Returns an empty Call object (rather than being pure) since this is a new + // method and adding a new pure method to an interface would be a breaking + // change (even though this is private and non-API) virtual internal::Call CreateCallInternal(const internal::RpcMethod& method, ClientContext* context, CompletionQueue* cq, diff --git a/include/grpcpp/impl/codegen/client_context.h b/include/grpcpp/impl/codegen/client_context.h index 59c61c4f0e..f53b744dcf 100644 --- a/include/grpcpp/impl/codegen/client_context.h +++ b/include/grpcpp/impl/codegen/client_context.h @@ -404,11 +404,11 @@ class ClientContext { void set_call(grpc_call* call, const std::shared_ptr<Channel>& channel); experimental::ClientRpcInfo* set_client_rpc_info( - const char* method, grpc::Channel* channel, + const char* method, grpc::ChannelInterface* channel, const std::vector< std::unique_ptr<experimental::ClientInterceptorFactoryInterface>>& creators, - int interceptor_pos) { + size_t interceptor_pos) { rpc_info_ = experimental::ClientRpcInfo(this, method, channel); rpc_info_.RegisterInterceptors(creators, interceptor_pos); return &rpc_info_; diff --git a/include/grpcpp/impl/codegen/client_interceptor.h b/include/grpcpp/impl/codegen/client_interceptor.h index 8f32814838..9922206815 100644 --- a/include/grpcpp/impl/codegen/client_interceptor.h +++ b/include/grpcpp/impl/codegen/client_interceptor.h @@ -55,17 +55,16 @@ class ClientRpcInfo { // Getter methods const char* method() { return method_; } - Channel* channel() { return channel_; } + ChannelInterface* channel() { return channel_; } grpc::ClientContext* client_context() { return ctx_; } private: ClientRpcInfo(grpc::ClientContext* ctx, const char* method, - grpc::Channel* channel) + grpc::ChannelInterface* channel) : ctx_(ctx), method_(method), channel_(channel) {} // Runs interceptor at pos \a pos. void RunInterceptor( - experimental::InterceptorBatchMethods* interceptor_methods, - unsigned int pos) { + experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { GPR_CODEGEN_ASSERT(pos < interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } @@ -83,7 +82,7 @@ class ClientRpcInfo { grpc::ClientContext* ctx_ = nullptr; const char* method_ = nullptr; - grpc::Channel* channel_ = nullptr; + grpc::ChannelInterface* channel_ = nullptr; std::vector<std::unique_ptr<experimental::Interceptor>> interceptors_; bool hijacked_ = false; int hijacked_interceptor_ = false; diff --git a/include/grpcpp/impl/codegen/intercepted_channel.h b/include/grpcpp/impl/codegen/intercepted_channel.h index dd4b2d8712..612e56d862 100644 --- a/include/grpcpp/impl/codegen/intercepted_channel.h +++ b/include/grpcpp/impl/codegen/intercepted_channel.h @@ -45,14 +45,12 @@ class InterceptedChannel : public ChannelInterface { InterceptedChannel(ChannelInterface* channel, int pos) : channel_(channel), interceptor_pos_(pos) {} - internal::Call CreateCall(const internal::RpcMethod& method, - ClientContext* context, - CompletionQueue* cq) override { + Call CreateCall(const RpcMethod& method, ClientContext* context, + CompletionQueue* cq) override { return channel_->CreateCallInternal(method, context, cq, interceptor_pos_); } - void PerformOpsOnCall(internal::CallOpSetInterface* ops, - internal::Call* call) override { + void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override { return channel_->PerformOpsOnCall(ops, call); } void* RegisterMethod(const char* method) override { @@ -79,4 +77,4 @@ class InterceptedChannel : public ChannelInterface { } // namespace internal } // namespace grpc -#endif // GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H
\ No newline at end of file +#endif // GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_H diff --git a/include/grpcpp/impl/codegen/interceptor_common.h b/include/grpcpp/impl/codegen/interceptor_common.h index 21b27f3672..4d744b94f9 100644 --- a/include/grpcpp/impl/codegen/interceptor_common.h +++ b/include/grpcpp/impl/codegen/interceptor_common.h @@ -55,8 +55,6 @@ class InternalInterceptorBatchMethods virtual void SetRecvStatus(Status* status) = 0; virtual void SetRecvTrailingMetadata(internal::MetadataMap* map) = 0; - - virtual std::unique_ptr<ChannelInterface> GetInterceptedChannel() = 0; }; class InterceptorBatchMethodsImpl : public InternalInterceptorBatchMethods { diff --git a/include/grpcpp/impl/codegen/server_interceptor.h b/include/grpcpp/impl/codegen/server_interceptor.h index 6a8b908747..c39e9a988d 100644 --- a/include/grpcpp/impl/codegen/server_interceptor.h +++ b/include/grpcpp/impl/codegen/server_interceptor.h @@ -55,21 +55,19 @@ class ServerRpcInfo { const char* method() { return method_; } grpc::ServerContext* server_context() { return ctx_; } - public: - // Runs interceptor at pos \a pos. - void RunInterceptor( - experimental::InterceptorBatchMethods* interceptor_methods, - unsigned int pos) { - GPR_CODEGEN_ASSERT(pos < interceptors_.size()); - interceptors_[pos]->Intercept(interceptor_methods); - } - private: ServerRpcInfo(grpc::ServerContext* ctx, const char* method) : ctx_(ctx), method_(method) { ref_.store(1); } + // Runs interceptor at pos \a pos. + void RunInterceptor( + experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { + GPR_CODEGEN_ASSERT(pos < interceptors_.size()); + interceptors_[pos]->Intercept(interceptor_methods); + } + void RegisterInterceptors( const std::vector< std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>& diff --git a/include/grpcpp/impl/codegen/server_interface.h b/include/grpcpp/impl/codegen/server_interface.h index dab08057cd..92c87a5f7e 100644 --- a/include/grpcpp/impl/codegen/server_interface.h +++ b/include/grpcpp/impl/codegen/server_interface.h @@ -20,7 +20,6 @@ #define GRPCPP_IMPL_CODEGEN_SERVER_INTERFACE_H #include <grpc/impl/codegen/grpc_types.h> -//#include <grpcpp/alarm.h> #include <grpcpp/impl/codegen/byte_buffer.h> #include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/call_hook.h> |