Reviewer comments except for void * fixed

pull/16842/head
Yash Tibrewal 6 years ago
parent 6a5f39db3c
commit 1ea195b6f3
  1. 5
      include/grpcpp/impl/codegen/channel_interface.h
  2. 4
      include/grpcpp/impl/codegen/client_context.h
  3. 9
      include/grpcpp/impl/codegen/client_interceptor.h
  4. 10
      include/grpcpp/impl/codegen/intercepted_channel.h
  5. 2
      include/grpcpp/impl/codegen/interceptor_common.h
  6. 16
      include/grpcpp/impl/codegen/server_interceptor.h
  7. 1
      include/grpcpp/impl/codegen/server_interface.h
  8. 2
      test/cpp/end2end/interceptors_util.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,

@ -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_;

@ -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;

@ -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
#endif // GRPCPP_IMPL_CODEGEN_INTERCEPTED_CHANNEL_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 {

@ -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>>&

@ -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>

@ -306,4 +306,4 @@ class Verifier {
};
} // namespace testing
} // namespace grpc
} // namespace grpc

Loading…
Cancel
Save