Fix by clang-tidy

pull/24889/head
Esun Kim 4 years ago
parent 9e7e38dd69
commit decc199ca8
  1. 18
      BUILD
  2. 4
      include/grpc/impl/codegen/atm_windows.h
  3. 2
      include/grpc/impl/codegen/grpc_types.h
  4. 4
      include/grpc/impl/codegen/sync_windows.h
  5. 6
      include/grpcpp/alarm.h
  6. 2
      include/grpcpp/channel.h
  7. 21
      include/grpcpp/impl/codegen/call_op_set.h
  8. 1
      include/grpcpp/impl/codegen/callback_common.h
  9. 8
      include/grpcpp/impl/codegen/client_callback.h
  10. 2
      include/grpcpp/impl/codegen/client_context.h
  11. 1
      include/grpcpp/impl/codegen/client_unary_call.h
  12. 4
      include/grpcpp/impl/codegen/completion_queue.h
  13. 4
      include/grpcpp/impl/codegen/config.h
  14. 1
      include/grpcpp/impl/codegen/config_protobuf.h
  15. 9
      include/grpcpp/impl/codegen/core_codegen.h
  16. 6
      include/grpcpp/impl/codegen/delegating_channel.h
  17. 2
      include/grpcpp/impl/codegen/intercepted_channel.h
  18. 16
      include/grpcpp/impl/codegen/interceptor_common.h
  19. 22
      include/grpcpp/impl/codegen/method_handler_impl.h
  20. 6
      include/grpcpp/impl/codegen/proto_buffer_reader.h
  21. 10
      include/grpcpp/impl/codegen/proto_buffer_writer.h
  22. 2
      include/grpcpp/impl/codegen/proto_utils.h
  23. 2
      include/grpcpp/impl/codegen/rpc_method.h
  24. 36
      include/grpcpp/impl/codegen/server_callback.h
  25. 8
      include/grpcpp/impl/codegen/server_callback_handlers.h
  26. 5
      include/grpcpp/impl/codegen/server_context.h
  27. 12
      include/grpcpp/impl/codegen/server_interface.h
  28. 2
      include/grpcpp/impl/codegen/service_type.h
  29. 2
      include/grpcpp/resource_quota.h
  30. 4
      include/grpcpp/security/credentials.h
  31. 2
      include/grpcpp/server.h
  32. 2
      include/grpcpp/support/channel_arguments.h

18
BUILD

@ -344,6 +344,9 @@ grpc_cc_library(
grpc_cc_library( grpc_cc_library(
name = "grpc++_public_hdrs", name = "grpc++_public_hdrs",
hdrs = GRPCXX_PUBLIC_HDRS, hdrs = GRPCXX_PUBLIC_HDRS,
external_deps = [
"protobuf_headers",
],
) )
grpc_cc_library( grpc_cc_library(
@ -367,6 +370,9 @@ grpc_cc_library(
"src/cpp/common/tls_credentials_options_util.h", "src/cpp/common/tls_credentials_options_util.h",
"src/cpp/server/secure_server_credentials.h", "src/cpp/server/secure_server_credentials.h",
], ],
external_deps = [
"protobuf_headers",
],
language = "c++", language = "c++",
public_hdrs = GRPCXX_PUBLIC_HDRS, public_hdrs = GRPCXX_PUBLIC_HDRS,
select_deps = { select_deps = {
@ -2257,6 +2263,9 @@ grpc_cc_library(
name = "grpc++_base", name = "grpc++_base",
srcs = GRPCXX_SRCS, srcs = GRPCXX_SRCS,
hdrs = GRPCXX_HDRS, hdrs = GRPCXX_HDRS,
external_deps = [
"protobuf_headers",
],
language = "c++", language = "c++",
public_hdrs = GRPCXX_PUBLIC_HDRS, public_hdrs = GRPCXX_PUBLIC_HDRS,
deps = [ deps = [
@ -2271,6 +2280,9 @@ grpc_cc_library(
name = "grpc++_base_unsecure", name = "grpc++_base_unsecure",
srcs = GRPCXX_SRCS, srcs = GRPCXX_SRCS,
hdrs = GRPCXX_HDRS, hdrs = GRPCXX_HDRS,
external_deps = [
"protobuf_headers",
],
language = "c++", language = "c++",
public_hdrs = GRPCXX_PUBLIC_HDRS, public_hdrs = GRPCXX_PUBLIC_HDRS,
deps = [ deps = [
@ -2379,6 +2391,9 @@ grpc_cc_library(
grpc_cc_library( grpc_cc_library(
name = "grpc++_codegen_proto", name = "grpc++_codegen_proto",
external_deps = [
"protobuf_headers",
],
language = "c++", language = "c++",
public_hdrs = [ public_hdrs = [
"include/grpc++/impl/codegen/proto_utils.h", "include/grpc++/impl/codegen/proto_utils.h",
@ -2450,6 +2465,9 @@ grpc_cc_library(
srcs = [ srcs = [
"src/cpp/client/channel_test_peer.cc", "src/cpp/client/channel_test_peer.cc",
], ],
external_deps = [
"gtest",
],
public_hdrs = [ public_hdrs = [
"include/grpc++/test/mock_stream.h", "include/grpc++/test/mock_stream.h",
"include/grpc++/test/server_context_test_spouse.h", "include/grpc++/test/server_context_test_spouse.h",

@ -22,6 +22,8 @@
/** Win32 variant of atm_platform.h */ /** Win32 variant of atm_platform.h */
#include <grpc/impl/codegen/port_platform.h> #include <grpc/impl/codegen/port_platform.h>
#ifdef GPR_WINDOWS
typedef intptr_t gpr_atm; typedef intptr_t gpr_atm;
#define GPR_ATM_MAX INTPTR_MAX #define GPR_ATM_MAX INTPTR_MAX
#define GPR_ATM_MIN INTPTR_MIN #define GPR_ATM_MIN INTPTR_MIN
@ -125,4 +127,6 @@ static __inline gpr_atm gpr_atm_full_xchg(gpr_atm* p, gpr_atm n) {
return (gpr_atm)InterlockedExchangePointer((PVOID*)p, (PVOID)n); return (gpr_atm)InterlockedExchangePointer((PVOID*)p, (PVOID)n);
} }
#endif /* GPR_WINDOWS */
#endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */ #endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */

@ -462,7 +462,7 @@ typedef enum grpc_call_error {
/** Default send/receive message size limits in bytes. -1 for unlimited. */ /** Default send/receive message size limits in bytes. -1 for unlimited. */
/** TODO(roth) Make this match the default receive limit after next release */ /** TODO(roth) Make this match the default receive limit after next release */
#define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH -1 #define GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH (-1)
#define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024) #define GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH (4 * 1024 * 1024)
/** Write Flags: */ /** Write Flags: */

@ -21,6 +21,8 @@
#include <grpc/impl/codegen/port_platform.h> #include <grpc/impl/codegen/port_platform.h>
#ifdef GPR_WINDOWS
#include <grpc/impl/codegen/sync_generic.h> #include <grpc/impl/codegen/sync_generic.h>
typedef struct { typedef struct {
@ -33,4 +35,6 @@ typedef CONDITION_VARIABLE gpr_cv;
typedef INIT_ONCE gpr_once; typedef INIT_ONCE gpr_once;
#define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT
#endif /* GPR_WINDOWS */
#endif /* GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H */ #endif /* GRPC_IMPL_CODEGEN_SYNC_WINDOWS_H */

@ -38,7 +38,7 @@ class Alarm : private ::grpc::GrpcLibraryCodegen {
Alarm(); Alarm();
/// Destroy the given completion queue alarm, cancelling it in the process. /// Destroy the given completion queue alarm, cancelling it in the process.
~Alarm(); ~Alarm() override;
/// DEPRECATED: Create and set a completion queue alarm instance associated to /// DEPRECATED: Create and set a completion queue alarm instance associated to
/// \a cq. /// \a cq.
@ -66,8 +66,8 @@ class Alarm : private ::grpc::GrpcLibraryCodegen {
Alarm& operator=(const Alarm&) = delete; Alarm& operator=(const Alarm&) = delete;
/// Alarms are movable. /// Alarms are movable.
Alarm(Alarm&& rhs) : alarm_(rhs.alarm_) { rhs.alarm_ = nullptr; } Alarm(Alarm&& rhs) noexcept : alarm_(rhs.alarm_) { rhs.alarm_ = nullptr; }
Alarm& operator=(Alarm&& rhs) { Alarm& operator=(Alarm&& rhs) noexcept {
alarm_ = rhs.alarm_; alarm_ = rhs.alarm_;
rhs.alarm_ = nullptr; rhs.alarm_ = nullptr;
return *this; return *this;

@ -56,7 +56,7 @@ class Channel final : public ::grpc::ChannelInterface,
public std::enable_shared_from_this<Channel>, public std::enable_shared_from_this<Channel>,
private ::grpc::GrpcLibraryCodegen { private ::grpc::GrpcLibraryCodegen {
public: public:
~Channel(); ~Channel() override;
/// Get the current channel state. If the channel is in IDLE and /// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect. /// \a try_to_connect is set to true, try to connect.

@ -58,7 +58,7 @@ inline grpc_metadata* FillMetadataArray(
return nullptr; return nullptr;
} }
grpc_metadata* metadata_array = grpc_metadata* metadata_array =
(grpc_metadata*)(g_core_codegen_interface->gpr_malloc( static_cast<grpc_metadata*>(g_core_codegen_interface->gpr_malloc(
(*metadata_count) * sizeof(grpc_metadata))); (*metadata_count) * sizeof(grpc_metadata)));
size_t i = 0; size_t i = 0;
for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) { for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) {
@ -234,7 +234,7 @@ class CallOpSendInitialMetadata {
grpc_op* op = &ops[(*nops)++]; grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_INITIAL_METADATA; op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->flags = flags_; op->flags = flags_;
op->reserved = NULL; op->reserved = nullptr;
initial_metadata_ = initial_metadata_ =
FillMetadataArray(*metadata_map_, &initial_metadata_count_, ""); FillMetadataArray(*metadata_map_, &initial_metadata_count_, "");
op->data.send_initial_metadata.count = initial_metadata_count_; op->data.send_initial_metadata.count = initial_metadata_count_;
@ -318,7 +318,7 @@ class CallOpSendMessage {
grpc_op* op = &ops[(*nops)++]; grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_MESSAGE; op->op = GRPC_OP_SEND_MESSAGE;
op->flags = write_options_.flags(); op->flags = write_options_.flags();
op->reserved = NULL; op->reserved = nullptr;
op->data.send_message.send_message = send_buf_.c_buffer(); op->data.send_message.send_message = send_buf_.c_buffer();
// Flags are per-message: clear them after use. // Flags are per-message: clear them after use.
write_options_.Clear(); write_options_.Clear();
@ -436,7 +436,7 @@ class CallOpRecvMessage {
grpc_op* op = &ops[(*nops)++]; grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
op->data.recv_message.recv_message = recv_buf_.c_buffer_ptr(); op->data.recv_message.recv_message = recv_buf_.c_buffer_ptr();
} }
@ -545,7 +545,7 @@ class CallOpGenericRecvMessage {
grpc_op* op = &ops[(*nops)++]; grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_RECV_MESSAGE; op->op = GRPC_OP_RECV_MESSAGE;
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
op->data.recv_message.recv_message = recv_buf_.c_buffer_ptr(); op->data.recv_message.recv_message = recv_buf_.c_buffer_ptr();
} }
@ -628,7 +628,7 @@ class CallOpClientSendClose {
grpc_op* op = &ops[(*nops)++]; grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
} }
void FinishOp(bool* /*status*/) { send_ = false; } void FinishOp(bool* /*status*/) { send_ = false; }
@ -680,7 +680,7 @@ class CallOpServerSendStatus {
op->data.send_status_from_server.status_details = op->data.send_status_from_server.status_details =
send_error_message_.empty() ? nullptr : &error_message_slice_; send_error_message_.empty() ? nullptr : &error_message_slice_;
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
} }
void FinishOp(bool* /*status*/) { void FinishOp(bool* /*status*/) {
@ -734,7 +734,7 @@ class CallOpRecvInitialMetadata {
op->op = GRPC_OP_RECV_INITIAL_METADATA; op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = metadata_map_->arr(); op->data.recv_initial_metadata.recv_initial_metadata = metadata_map_->arr();
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
} }
void FinishOp(bool* /*status*/) { void FinishOp(bool* /*status*/) {
@ -788,7 +788,7 @@ class CallOpClientRecvStatus {
op->data.recv_status_on_client.status_details = &error_message_; op->data.recv_status_on_client.status_details = &error_message_;
op->data.recv_status_on_client.error_string = &debug_error_string_; op->data.recv_status_on_client.error_string = &debug_error_string_;
op->flags = 0; op->flags = 0;
op->reserved = NULL; op->reserved = nullptr;
} }
void FinishOp(bool* /*status*/) { void FinishOp(bool* /*status*/) {
@ -806,7 +806,8 @@ class CallOpClientRecvStatus {
metadata_map_->GetBinaryErrorDetails()); metadata_map_->GetBinaryErrorDetails());
if (debug_error_string_ != nullptr) { if (debug_error_string_ != nullptr) {
client_context_->set_debug_error_string(debug_error_string_); client_context_->set_debug_error_string(debug_error_string_);
g_core_codegen_interface->gpr_free((void*)debug_error_string_); g_core_codegen_interface->gpr_free(
const_cast<char*>(debug_error_string_));
} }
} }
// TODO(soheil): Find callers that set debug string even for status OK, // TODO(soheil): Find callers that set debug string even for status OK,

@ -24,6 +24,7 @@
#include <grpc/impl/codegen/grpc_types.h> #include <grpc/impl/codegen/grpc_types.h>
#include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/channel_interface.h> #include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/completion_queue_tag.h>
#include <grpcpp/impl/codegen/config.h> #include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/status.h> #include <grpcpp/impl/codegen/status.h>

@ -251,7 +251,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWrite(const Request* req, ::grpc::WriteOptions options) { void StartWrite(const Request* req, ::grpc::WriteOptions options) {
stream_->Write(req, std::move(options)); stream_->Write(req, options);
} }
/// Initiate/post a write operation with specified options and an indication /// Initiate/post a write operation with specified options and an indication
@ -264,7 +264,7 @@ class ClientBidiReactor : public internal::ClientReactor {
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWriteLast(const Request* req, ::grpc::WriteOptions options) { void StartWriteLast(const Request* req, ::grpc::WriteOptions options) {
StartWrite(req, std::move(options.set_last_message())); StartWrite(req, options.set_last_message());
} }
/// Indicate that the RPC will have no more write operations. This can only be /// Indicate that the RPC will have no more write operations. This can only be
@ -391,10 +391,10 @@ class ClientWriteReactor : public internal::ClientReactor {
StartWrite(req, ::grpc::WriteOptions()); StartWrite(req, ::grpc::WriteOptions());
} }
void StartWrite(const Request* req, ::grpc::WriteOptions options) { void StartWrite(const Request* req, ::grpc::WriteOptions options) {
writer_->Write(req, std::move(options)); writer_->Write(req, options);
} }
void StartWriteLast(const Request* req, ::grpc::WriteOptions options) { void StartWriteLast(const Request* req, ::grpc::WriteOptions options) {
StartWrite(req, std::move(options.set_last_message())); StartWrite(req, options.set_last_message());
} }
void StartWritesDone() { writer_->WritesDone(); } void StartWritesDone() { writer_->WritesDone(); }

@ -311,7 +311,7 @@ class ClientContext {
/// ///
/// \see grpc::AuthContext. /// \see grpc::AuthContext.
std::shared_ptr<const grpc::AuthContext> auth_context() const { std::shared_ptr<const grpc::AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) { if (auth_context_ == nullptr) {
auth_context_ = grpc::CreateAuthContext(call_); auth_context_ = grpc::CreateAuthContext(call_);
} }
return auth_context_; return auth_context_;

@ -20,6 +20,7 @@
#define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H #define GRPCPP_IMPL_CODEGEN_CLIENT_UNARY_CALL_H
#include <grpcpp/impl/codegen/call.h> #include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_op_set.h>
#include <grpcpp/impl/codegen/channel_interface.h> #include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/config.h> #include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h> #include <grpcpp/impl/codegen/core_codegen_interface.h>

@ -114,7 +114,7 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
explicit CompletionQueue(grpc_completion_queue* take); explicit CompletionQueue(grpc_completion_queue* take);
/// Destructor. Destroys the owned wrapped completion queue / instance. /// Destructor. Destroys the owned wrapped completion queue / instance.
~CompletionQueue() { ~CompletionQueue() override {
::grpc::g_core_codegen_interface->grpc_completion_queue_destroy(cq_); ::grpc::g_core_codegen_interface->grpc_completion_queue_destroy(cq_);
} }
@ -247,7 +247,7 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
cq_ = ::grpc::g_core_codegen_interface->grpc_completion_queue_create( cq_ = ::grpc::g_core_codegen_interface->grpc_completion_queue_create(
::grpc::g_core_codegen_interface->grpc_completion_queue_factory_lookup( ::grpc::g_core_codegen_interface->grpc_completion_queue_factory_lookup(
&attributes), &attributes),
&attributes, NULL); &attributes, nullptr);
InitialAvalanching(); // reserve this for the future shutdown InitialAvalanching(); // reserve this for the future shutdown
} }

@ -36,8 +36,8 @@ namespace grpc {
// Using grpc::string and grpc::to_string is discouraged in favor of // Using grpc::string and grpc::to_string is discouraged in favor of
// std::string and std::to_string. This is only for legacy code using // std::string and std::to_string. This is only for legacy code using
// them explictly. // them explictly.
using std::string; // deprecated using std::string; // deprecated // NOLINT(misc-unused-using-decls)
using std::to_string; // deprecated using std::to_string; // deprecated // NOLINT(misc-unused-using-decls)
} // namespace grpc } // namespace grpc

@ -90,6 +90,7 @@ namespace util {
typedef GRPC_CUSTOM_UTIL_STATUS Status; typedef GRPC_CUSTOM_UTIL_STATUS Status;
} // namespace util } // namespace util
// NOLINTNEXTLINE(misc-unused-alias-decls)
namespace json = GRPC_CUSTOM_JSONUTIL; namespace json = GRPC_CUSTOM_JSONUTIL;
namespace io { namespace io {

@ -31,10 +31,9 @@ namespace grpc {
/// Implementation of the core codegen interface. /// Implementation of the core codegen interface.
class CoreCodegen final : public CoreCodegenInterface { class CoreCodegen final : public CoreCodegenInterface {
private: private:
virtual const grpc_completion_queue_factory* const grpc_completion_queue_factory* grpc_completion_queue_factory_lookup(
grpc_completion_queue_factory_lookup(
const grpc_completion_queue_attributes* attributes) override; const grpc_completion_queue_attributes* attributes) override;
virtual grpc_completion_queue* grpc_completion_queue_create( grpc_completion_queue* grpc_completion_queue_create(
const grpc_completion_queue_factory* factory, const grpc_completion_queue_factory* factory,
const grpc_completion_queue_attributes* attributes, const grpc_completion_queue_attributes* attributes,
void* reserved) override; void* reserved) override;
@ -115,8 +114,8 @@ class CoreCodegen final : public CoreCodegenInterface {
gpr_timespec gpr_inf_future(gpr_clock_type type) override; gpr_timespec gpr_inf_future(gpr_clock_type type) override;
gpr_timespec gpr_time_0(gpr_clock_type type) override; gpr_timespec gpr_time_0(gpr_clock_type type) override;
virtual const Status& ok() override; const Status& ok() override;
virtual const Status& cancelled() override; const Status& cancelled() override;
void assert_fail(const char* failed_assertion, const char* file, void assert_fail(const char* failed_assertion, const char* file,
int line) override; int line) override;

@ -19,12 +19,16 @@
#ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H #ifndef GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
#define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H #define GRPCPP_IMPL_CODEGEN_DELEGATING_CHANNEL_H
#include <memory>
#include <grpcpp/impl/codegen/channel_interface.h>
namespace grpc { namespace grpc {
namespace experimental { namespace experimental {
class DelegatingChannel : public ::grpc::ChannelInterface { class DelegatingChannel : public ::grpc::ChannelInterface {
public: public:
virtual ~DelegatingChannel() {} ~DelegatingChannel() override {}
DelegatingChannel(std::shared_ptr<::grpc::ChannelInterface> delegate_channel) DelegatingChannel(std::shared_ptr<::grpc::ChannelInterface> delegate_channel)
: delegate_channel_(delegate_channel) {} : delegate_channel_(delegate_channel) {}

@ -34,7 +34,7 @@ class InterceptorBatchMethodsImpl;
/// see the RPC. /// see the RPC.
class InterceptedChannel : public ChannelInterface { class InterceptedChannel : public ChannelInterface {
public: public:
virtual ~InterceptedChannel() { channel_ = nullptr; } ~InterceptedChannel() override { channel_ = nullptr; }
/// Get the current channel state. If the channel is in IDLE and /// Get the current channel state. If the channel is in IDLE and
/// \a try_to_connect is set to true, try to connect. /// \a try_to_connect is set to true, try to connect.

@ -45,7 +45,7 @@ class InterceptorBatchMethodsImpl
} }
} }
~InterceptorBatchMethodsImpl() {} ~InterceptorBatchMethodsImpl() override {}
bool QueryInterceptionHookPoint( bool QueryInterceptionHookPoint(
experimental::InterceptionHookPoints type) override { experimental::InterceptionHookPoints type) override {
@ -223,7 +223,7 @@ class InterceptorBatchMethodsImpl
bool InterceptorsListEmpty() { bool InterceptorsListEmpty() {
auto* client_rpc_info = call_->client_rpc_info(); auto* client_rpc_info = call_->client_rpc_info();
if (client_rpc_info != nullptr) { if (client_rpc_info != nullptr) {
if (client_rpc_info->interceptors_.size() == 0) { if (client_rpc_info->interceptors_.empty()) {
return true; return true;
} else { } else {
return false; return false;
@ -231,8 +231,7 @@ class InterceptorBatchMethodsImpl
} }
auto* server_rpc_info = call_->server_rpc_info(); auto* server_rpc_info = call_->server_rpc_info();
if (server_rpc_info == nullptr || if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) {
server_rpc_info->interceptors_.size() == 0) {
return true; return true;
} }
return false; return false;
@ -247,7 +246,7 @@ class InterceptorBatchMethodsImpl
GPR_CODEGEN_ASSERT(ops_); GPR_CODEGEN_ASSERT(ops_);
auto* client_rpc_info = call_->client_rpc_info(); auto* client_rpc_info = call_->client_rpc_info();
if (client_rpc_info != nullptr) { if (client_rpc_info != nullptr) {
if (client_rpc_info->interceptors_.size() == 0) { if (client_rpc_info->interceptors_.empty()) {
return true; return true;
} else { } else {
RunClientInterceptors(); RunClientInterceptors();
@ -256,8 +255,7 @@ class InterceptorBatchMethodsImpl
} }
auto* server_rpc_info = call_->server_rpc_info(); auto* server_rpc_info = call_->server_rpc_info();
if (server_rpc_info == nullptr || if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) {
server_rpc_info->interceptors_.size() == 0) {
return true; return true;
} }
RunServerInterceptors(); RunServerInterceptors();
@ -273,8 +271,7 @@ class InterceptorBatchMethodsImpl
GPR_CODEGEN_ASSERT(reverse_ == true); GPR_CODEGEN_ASSERT(reverse_ == true);
GPR_CODEGEN_ASSERT(call_->client_rpc_info() == nullptr); GPR_CODEGEN_ASSERT(call_->client_rpc_info() == nullptr);
auto* server_rpc_info = call_->server_rpc_info(); auto* server_rpc_info = call_->server_rpc_info();
if (server_rpc_info == nullptr || if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) {
server_rpc_info->interceptors_.size() == 0) {
return true; return true;
} }
callback_ = std::move(f); callback_ = std::move(f);
@ -489,7 +486,6 @@ class CancelInterceptorBatchMethods
GPR_CODEGEN_ASSERT(false && GPR_CODEGEN_ASSERT(false &&
"It is illegal to call ModifySendStatus on a method " "It is illegal to call ModifySendStatus on a method "
"which has a Cancel notification"); "which has a Cancel notification");
return;
} }
std::multimap<std::string, std::string>* GetSendTrailingMetadata() override { std::multimap<std::string, std::string>* GetSendTrailingMetadata() override {

@ -0,0 +1,22 @@
/*
*
* Copyright 2018 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
#define GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H
#endif // GRPCPP_IMPL_CODEGEN_METHOD_HANDLER_IMPL_H

@ -59,7 +59,7 @@ class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
} }
} }
~ProtoBufferReader() { ~ProtoBufferReader() override {
if (status_.ok()) { if (status_.ok()) {
g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_);
} }
@ -76,7 +76,7 @@ class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
*data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) - *data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) -
backup_count_; backup_count_;
GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX); GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX);
*size = (int)backup_count_; *size = static_cast<int>(backup_count_);
backup_count_ = 0; backup_count_ = 0;
return true; return true;
} }
@ -88,7 +88,7 @@ class ProtoBufferReader : public ::grpc::protobuf::io::ZeroCopyInputStream {
*data = GRPC_SLICE_START_PTR(*slice_); *data = GRPC_SLICE_START_PTR(*slice_);
// On win x64, int is only 32bit // On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(*slice_) <= INT_MAX); GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(*slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(*slice_); byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(*slice_));
return true; return true;
} }

@ -65,12 +65,12 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
GPR_CODEGEN_ASSERT(!byte_buffer->Valid()); GPR_CODEGEN_ASSERT(!byte_buffer->Valid());
/// Create an empty raw byte buffer and look at its underlying slice buffer /// Create an empty raw byte buffer and look at its underlying slice buffer
grpc_byte_buffer* bp = grpc_byte_buffer* bp =
g_core_codegen_interface->grpc_raw_byte_buffer_create(NULL, 0); g_core_codegen_interface->grpc_raw_byte_buffer_create(nullptr, 0);
byte_buffer->set_buffer(bp); byte_buffer->set_buffer(bp);
slice_buffer_ = &bp->data.raw.slice_buffer; slice_buffer_ = &bp->data.raw.slice_buffer;
} }
~ProtoBufferWriter() { ~ProtoBufferWriter() override {
if (have_backup_) { if (have_backup_) {
g_core_codegen_interface->grpc_slice_unref(backup_slice_); g_core_codegen_interface->grpc_slice_unref(backup_slice_);
} }
@ -107,7 +107,7 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
*data = GRPC_SLICE_START_PTR(slice_); *data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit // On win x64, int is only 32bit
GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX); GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_); byte_count_ += * size = static_cast<int>(GRPC_SLICE_LENGTH(slice_));
g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_); g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
return true; return true;
} }
@ -122,7 +122,7 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
/// 4. Mark that we still have the remaining part (for later use/unref) /// 4. Mark that we still have the remaining part (for later use/unref)
GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_))); GPR_CODEGEN_ASSERT(count <= static_cast<int>(GRPC_SLICE_LENGTH(slice_)));
g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_); g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_);
if ((size_t)count == GRPC_SLICE_LENGTH(slice_)) { if (static_cast<size_t>(count) == GRPC_SLICE_LENGTH(slice_)) {
backup_slice_ = slice_; backup_slice_ = slice_;
} else { } else {
backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail( backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail(
@ -133,7 +133,7 @@ class ProtoBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
// on a following Next() call, a reference will be returned to this slice // on a following Next() call, a reference will be returned to this slice
// via GRPC_SLICE_START_PTR, which will not be an address held by // via GRPC_SLICE_START_PTR, which will not be an address held by
// slice_buffer_. // slice_buffer_.
have_backup_ = backup_slice_.refcount != NULL; have_backup_ = backup_slice_.refcount != nullptr;
byte_count_ -= count; byte_count_ -= count;
} }

@ -50,7 +50,7 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb,
"::protobuf::io::ZeroCopyOutputStream"); "::protobuf::io::ZeroCopyOutputStream");
*own_buffer = true; *own_buffer = true;
int byte_size = static_cast<int>(msg.ByteSizeLong()); int byte_size = static_cast<int>(msg.ByteSizeLong());
if ((size_t)byte_size <= GRPC_SLICE_INLINED_SIZE) { if (static_cast<size_t>(byte_size) <= GRPC_SLICE_INLINED_SIZE) {
Slice slice(byte_size); Slice slice(byte_size);
// We serialize directly into the allocated slices memory // We serialize directly into the allocated slices memory
GPR_CODEGEN_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray( GPR_CODEGEN_ASSERT(slice.end() == msg.SerializeWithCachedSizesToArray(

@ -36,7 +36,7 @@ class RpcMethod {
}; };
RpcMethod(const char* name, RpcType type) RpcMethod(const char* name, RpcType type)
: name_(name), method_type_(type), channel_tag_(NULL) {} : name_(name), method_type_(type), channel_tag_(nullptr) {}
RpcMethod(const char* name, RpcType type, RpcMethod(const char* name, RpcType type,
const std::shared_ptr<ChannelInterface>& channel) const std::shared_ptr<ChannelInterface>& channel)

@ -190,7 +190,7 @@ class ServerBidiReactor;
// the API. // the API.
class ServerCallbackUnary : public internal::ServerCallbackCall { class ServerCallbackUnary : public internal::ServerCallbackCall {
public: public:
virtual ~ServerCallbackUnary() {} ~ServerCallbackUnary() override {}
virtual void Finish(::grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
@ -206,7 +206,7 @@ class ServerCallbackUnary : public internal::ServerCallbackCall {
template <class Request> template <class Request>
class ServerCallbackReader : public internal::ServerCallbackCall { class ServerCallbackReader : public internal::ServerCallbackCall {
public: public:
virtual ~ServerCallbackReader() {} ~ServerCallbackReader() override {}
virtual void Finish(::grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
virtual void Read(Request* msg) = 0; virtual void Read(Request* msg) = 0;
@ -220,7 +220,7 @@ class ServerCallbackReader : public internal::ServerCallbackCall {
template <class Response> template <class Response>
class ServerCallbackWriter : public internal::ServerCallbackCall { class ServerCallbackWriter : public internal::ServerCallbackCall {
public: public:
virtual ~ServerCallbackWriter() {} ~ServerCallbackWriter() override {}
virtual void Finish(::grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
@ -237,7 +237,7 @@ class ServerCallbackWriter : public internal::ServerCallbackCall {
template <class Request, class Response> template <class Request, class Response>
class ServerCallbackReaderWriter : public internal::ServerCallbackCall { class ServerCallbackReaderWriter : public internal::ServerCallbackCall {
public: public:
virtual ~ServerCallbackReaderWriter() {} ~ServerCallbackReaderWriter() override {}
virtual void Finish(::grpc::Status s) = 0; virtual void Finish(::grpc::Status s) = 0;
virtual void SendInitialMetadata() = 0; virtual void SendInitialMetadata() = 0;
@ -268,7 +268,7 @@ class ServerBidiReactor : public internal::ServerReactor {
// TODO(vjpai): Switch to default constructor and default initializer when // TODO(vjpai): Switch to default constructor and default initializer when
// gcc-4.x is no longer supported // gcc-4.x is no longer supported
ServerBidiReactor() : stream_(nullptr) {} ServerBidiReactor() : stream_(nullptr) {}
~ServerBidiReactor() = default; ~ServerBidiReactor() override = default;
/// Send any initial metadata stored in the RPC context. If not invoked, /// Send any initial metadata stored in the RPC context. If not invoked,
/// any initial metadata will be passed along with the first Write or the /// any initial metadata will be passed along with the first Write or the
@ -328,11 +328,11 @@ class ServerBidiReactor : public internal::ServerReactor {
stream = stream_.load(std::memory_order_relaxed); stream = stream_.load(std::memory_order_relaxed);
if (stream == nullptr) { if (stream == nullptr) {
backlog_.write_wanted = resp; backlog_.write_wanted = resp;
backlog_.write_options_wanted = std::move(options); backlog_.write_options_wanted = options;
return; return;
} }
} }
stream->Write(resp, std::move(options)); stream->Write(resp, options);
} }
/// Initiate a write operation with specified options and final RPC Status, /// Initiate a write operation with specified options and final RPC Status,
@ -358,12 +358,12 @@ class ServerBidiReactor : public internal::ServerReactor {
if (stream == nullptr) { if (stream == nullptr) {
backlog_.write_and_finish_wanted = true; backlog_.write_and_finish_wanted = true;
backlog_.write_wanted = resp; backlog_.write_wanted = resp;
backlog_.write_options_wanted = std::move(options); backlog_.write_options_wanted = options;
backlog_.status_wanted = std::move(s); backlog_.status_wanted = std::move(s);
return; return;
} }
} }
stream->WriteAndFinish(resp, std::move(options), std::move(s)); stream->WriteAndFinish(resp, options, std::move(s));
} }
/// Inform system of a planned write operation with specified options, but /// Inform system of a planned write operation with specified options, but
@ -375,7 +375,7 @@ class ServerBidiReactor : public internal::ServerReactor {
/// not deleted or modified until OnWriteDone is called. /// not deleted or modified until OnWriteDone is called.
/// \param[in] options The WriteOptions to use for writing this message /// \param[in] options The WriteOptions to use for writing this message
void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) { void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) {
StartWrite(resp, std::move(options.set_last_message())); StartWrite(resp, options.set_last_message());
} }
/// Indicate that the stream is to be finished and the trailing metadata and /// Indicate that the stream is to be finished and the trailing metadata and
@ -484,7 +484,7 @@ template <class Request>
class ServerReadReactor : public internal::ServerReactor { class ServerReadReactor : public internal::ServerReactor {
public: public:
ServerReadReactor() : reader_(nullptr) {} ServerReadReactor() : reader_(nullptr) {}
~ServerReadReactor() = default; ~ServerReadReactor() override = default;
/// The following operation initiations are exactly like ServerBidiReactor. /// The following operation initiations are exactly like ServerBidiReactor.
void StartSendInitialMetadata() { void StartSendInitialMetadata() {
@ -571,7 +571,7 @@ template <class Response>
class ServerWriteReactor : public internal::ServerReactor { class ServerWriteReactor : public internal::ServerReactor {
public: public:
ServerWriteReactor() : writer_(nullptr) {} ServerWriteReactor() : writer_(nullptr) {}
~ServerWriteReactor() = default; ~ServerWriteReactor() override = default;
/// The following operation initiations are exactly like ServerBidiReactor. /// The following operation initiations are exactly like ServerBidiReactor.
void StartSendInitialMetadata() { void StartSendInitialMetadata() {
@ -598,11 +598,11 @@ class ServerWriteReactor : public internal::ServerReactor {
writer = writer_.load(std::memory_order_relaxed); writer = writer_.load(std::memory_order_relaxed);
if (writer == nullptr) { if (writer == nullptr) {
backlog_.write_wanted = resp; backlog_.write_wanted = resp;
backlog_.write_options_wanted = std::move(options); backlog_.write_options_wanted = options;
return; return;
} }
} }
writer->Write(resp, std::move(options)); writer->Write(resp, options);
} }
void StartWriteAndFinish(const Response* resp, ::grpc::WriteOptions options, void StartWriteAndFinish(const Response* resp, ::grpc::WriteOptions options,
::grpc::Status s) { ::grpc::Status s) {
@ -614,15 +614,15 @@ class ServerWriteReactor : public internal::ServerReactor {
if (writer == nullptr) { if (writer == nullptr) {
backlog_.write_and_finish_wanted = true; backlog_.write_and_finish_wanted = true;
backlog_.write_wanted = resp; backlog_.write_wanted = resp;
backlog_.write_options_wanted = std::move(options); backlog_.write_options_wanted = options;
backlog_.status_wanted = std::move(s); backlog_.status_wanted = std::move(s);
return; return;
} }
} }
writer->WriteAndFinish(resp, std::move(options), std::move(s)); writer->WriteAndFinish(resp, options, std::move(s));
} }
void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) { void StartWriteLast(const Response* resp, ::grpc::WriteOptions options) {
StartWrite(resp, std::move(options.set_last_message())); StartWrite(resp, options.set_last_message());
} }
void Finish(::grpc::Status s) { void Finish(::grpc::Status s) {
ServerCallbackWriter<Response>* writer = ServerCallbackWriter<Response>* writer =
@ -688,7 +688,7 @@ class ServerWriteReactor : public internal::ServerReactor {
class ServerUnaryReactor : public internal::ServerReactor { class ServerUnaryReactor : public internal::ServerReactor {
public: public:
ServerUnaryReactor() : call_(nullptr) {} ServerUnaryReactor() : call_(nullptr) {}
~ServerUnaryReactor() = default; ~ServerUnaryReactor() override = default;
/// StartSendInitialMetadata is exactly like ServerBidiReactor. /// StartSendInitialMetadata is exactly like ServerBidiReactor.
void StartSendInitialMetadata() { void StartSendInitialMetadata() {

@ -53,7 +53,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler {
param.call->call(), sizeof(ServerCallbackUnaryImpl))) param.call->call(), sizeof(ServerCallbackUnaryImpl)))
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.call, allocator_state, param.call_requester);
param.server_context->BeginCompletionOp( param.server_context->BeginCompletionOp(
param.call, [call](bool) { call->MaybeDone(); }, call); param.call, [call](bool) { call->MaybeDone(); }, call);
@ -266,7 +266,7 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler {
param.call->call(), sizeof(ServerCallbackReaderImpl))) param.call->call(), sizeof(ServerCallbackReaderImpl)))
ServerCallbackReaderImpl( ServerCallbackReaderImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, std::move(param.call_requester)); param.call, param.call_requester);
// Inlineable OnDone can be false in the CompletionOp callback because there // Inlineable OnDone can be false in the CompletionOp callback because there
// is no read reactor that has an inlineable OnDone; this only applies to // is no read reactor that has an inlineable OnDone; this only applies to
// the DefaultReactor (which is unary). // the DefaultReactor (which is unary).
@ -453,7 +453,7 @@ class CallbackServerStreamingHandler : public ::grpc::internal::MethodHandler {
ServerCallbackWriterImpl( ServerCallbackWriterImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, static_cast<RequestType*>(param.request), param.call, static_cast<RequestType*>(param.request),
std::move(param.call_requester)); param.call_requester);
// Inlineable OnDone can be false in the CompletionOp callback because there // Inlineable OnDone can be false in the CompletionOp callback because there
// is no write reactor that has an inlineable OnDone; this only applies to // is no write reactor that has an inlineable OnDone; this only applies to
// the DefaultReactor (which is unary). // the DefaultReactor (which is unary).
@ -673,7 +673,7 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler {
param.call->call(), sizeof(ServerCallbackReaderWriterImpl))) param.call->call(), sizeof(ServerCallbackReaderWriterImpl)))
ServerCallbackReaderWriterImpl( ServerCallbackReaderWriterImpl(
static_cast<::grpc::CallbackServerContext*>(param.server_context), static_cast<::grpc::CallbackServerContext*>(param.server_context),
param.call, std::move(param.call_requester)); param.call, param.call_requester);
// Inlineable OnDone can be false in the CompletionOp callback because there // Inlineable OnDone can be false in the CompletionOp callback because there
// is no bidi reactor that has an inlineable OnDone; this only applies to // is no bidi reactor that has an inlineable OnDone; this only applies to
// the DefaultReactor (which is unary). // the DefaultReactor (which is unary).

@ -265,7 +265,7 @@ class ServerContextBase {
/// ///
/// \see grpc::AuthContext. /// \see grpc::AuthContext.
std::shared_ptr<const ::grpc::AuthContext> auth_context() const { std::shared_ptr<const ::grpc::AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) { if (auth_context_ == nullptr) {
auth_context_ = ::grpc::CreateAuthContext(call_.call); auth_context_ = ::grpc::CreateAuthContext(call_.call);
} }
return auth_context_; return auth_context_;
@ -415,7 +415,7 @@ class ServerContextBase {
const char* method, ::grpc::internal::RpcMethod::RpcType type, const char* method, ::grpc::internal::RpcMethod::RpcType type,
const std::vector<std::unique_ptr< const std::vector<std::unique_ptr<
::grpc::experimental::ServerInterceptorFactoryInterface>>& creators) { ::grpc::experimental::ServerInterceptorFactoryInterface>>& creators) {
if (creators.size() != 0) { if (!creators.empty()) {
rpc_info_ = new ::grpc::experimental::ServerRpcInfo(this, method, type); rpc_info_ = new ::grpc::experimental::ServerRpcInfo(this, method, type);
rpc_info_->RegisterInterceptors(creators); rpc_info_->RegisterInterceptors(creators);
} }
@ -476,6 +476,7 @@ class ServerContextBase {
}; };
void SetupTestDefaultReactor(std::function<void(::grpc::Status)> func) { void SetupTestDefaultReactor(std::function<void(::grpc::Status)> func) {
// NOLINTNEXTLINE(modernize-make-unique)
test_unary_.reset(new TestServerCallbackUnary(this, std::move(func))); test_unary_.reset(new TestServerCallbackUnary(this, std::move(func)));
} }
bool test_status_set() const { bool test_status_set() const {

@ -64,7 +64,7 @@ class ServerInterceptorFactoryInterface;
class ServerInterface : public internal::CallHook { class ServerInterface : public internal::CallHook {
public: public:
virtual ~ServerInterface() {} ~ServerInterface() override {}
/// \a Shutdown does the following things: /// \a Shutdown does the following things:
/// ///
@ -186,8 +186,8 @@ class ServerInterface : public internal::CallHook {
virtual grpc_server* server() = 0; virtual grpc_server* server() = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops, void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0; internal::Call* call) override = 0;
class BaseAsyncRequest : public internal::CompletionQueueTag { class BaseAsyncRequest : public internal::CompletionQueueTag {
public: public:
@ -196,7 +196,7 @@ class ServerInterface : public internal::CallHook {
::grpc::CompletionQueue* call_cq, ::grpc::CompletionQueue* call_cq,
::grpc::ServerCompletionQueue* notification_cq, void* tag, ::grpc::ServerCompletionQueue* notification_cq, void* tag,
bool delete_on_finalize); bool delete_on_finalize);
virtual ~BaseAsyncRequest(); ~BaseAsyncRequest() override;
bool FinalizeResult(void** tag, bool* status) override; bool FinalizeResult(void** tag, bool* status) override;
@ -228,7 +228,7 @@ class ServerInterface : public internal::CallHook {
void* tag, const char* name, void* tag, const char* name,
internal::RpcMethod::RpcType type); internal::RpcMethod::RpcType type);
virtual bool FinalizeResult(void** tag, bool* status) override { bool FinalizeResult(void** tag, bool* status) override {
/* If we are done intercepting, then there is nothing more for us to do */ /* If we are done intercepting, then there is nothing more for us to do */
if (done_intercepting_) { if (done_intercepting_) {
return BaseAsyncRequest::FinalizeResult(tag, status); return BaseAsyncRequest::FinalizeResult(tag, status);
@ -283,7 +283,7 @@ class ServerInterface : public internal::CallHook {
notification_cq); notification_cq);
} }
~PayloadAsyncRequest() { ~PayloadAsyncRequest() override {
payload_.Release(); // We do not own the payload_ payload_.Release(); // We do not own the payload_
} }

@ -91,7 +91,7 @@ class Service {
bool has_generic_methods() const { bool has_generic_methods() const {
for (const auto& method : methods_) { for (const auto& method : methods_) {
if (method.get() == nullptr) { if (method == nullptr) {
return true; return true;
} }
} }

@ -36,7 +36,7 @@ class ResourceQuota final : private ::grpc::GrpcLibraryCodegen {
/// \param name - a unique name for this ResourceQuota. /// \param name - a unique name for this ResourceQuota.
explicit ResourceQuota(const std::string& name); explicit ResourceQuota(const std::string& name);
ResourceQuota(); ResourceQuota();
~ResourceQuota(); ~ResourceQuota() override;
/// Resize this \a ResourceQuota to a new size. If \a new_size is smaller /// Resize this \a ResourceQuota to a new size. If \a new_size is smaller
/// than the current size of the pool, memory usage will be monotonically /// than the current size of the pool, memory usage will be monotonically

@ -69,7 +69,7 @@ std::shared_ptr<ChannelCredentials> XdsCredentials(
class ChannelCredentials : private grpc::GrpcLibraryCodegen { class ChannelCredentials : private grpc::GrpcLibraryCodegen {
public: public:
ChannelCredentials(); ChannelCredentials();
~ChannelCredentials(); ~ChannelCredentials() override;
protected: protected:
friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( friend std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
@ -126,7 +126,7 @@ class ChannelCredentials : private grpc::GrpcLibraryCodegen {
class CallCredentials : private grpc::GrpcLibraryCodegen { class CallCredentials : private grpc::GrpcLibraryCodegen {
public: public:
CallCredentials(); CallCredentials();
~CallCredentials(); ~CallCredentials() override;
/// Apply this instance's credentials to \a call. /// Apply this instance's credentials to \a call.
virtual bool ApplyToCall(grpc_call* call) = 0; virtual bool ApplyToCall(grpc_call* call) = 0;

@ -58,7 +58,7 @@ class ExternalConnectionAcceptorImpl;
/// \a Server instances. /// \a Server instances.
class Server : public ServerInterface, private GrpcLibraryCodegen { class Server : public ServerInterface, private GrpcLibraryCodegen {
public: public:
~Server(); ~Server() override;
/// Block until the server shuts down. /// Block until the server shuts down.
/// ///

@ -117,7 +117,7 @@ class ChannelArguments {
grpc_channel_args c_channel_args() const { grpc_channel_args c_channel_args() const {
grpc_channel_args out; grpc_channel_args out;
out.num_args = args_.size(); out.num_args = args_.size();
out.args = args_.empty() ? NULL : const_cast<grpc_arg*>(&args_[0]); out.args = args_.empty() ? nullptr : const_cast<grpc_arg*>(&args_[0]);
return out; return out;
} }

Loading…
Cancel
Save