Use C++11 final and override

pull/8602/head
Vijay Pai 8 years ago
parent 80b292709c
commit c0b2acb1a0
  1. 2
      include/grpc++/alarm.h
  2. 14
      include/grpc++/channel.h
  3. 12
      include/grpc++/ext/proto_server_reflection_plugin.h
  4. 4
      include/grpc++/generic/async_generic_service.h
  5. 2
      include/grpc++/generic/generic_stub.h
  6. 64
      include/grpc++/impl/codegen/async_stream.h
  7. 8
      include/grpc++/impl/codegen/async_unary_call.h
  8. 14
      include/grpc++/impl/codegen/call.h
  9. 3
      include/grpc++/impl/codegen/config.h
  10. 62
      include/grpc++/impl/codegen/core_codegen.h
  11. 10
      include/grpc++/impl/codegen/method_handler_impl.h
  12. 22
      include/grpc++/impl/codegen/proto_utils.h
  13. 10
      include/grpc++/impl/codegen/server_interface.h
  14. 76
      include/grpc++/impl/codegen/sync_stream.h
  15. 8
      include/grpc++/impl/grpc_library.h
  16. 2
      include/grpc++/resource_quota.h
  17. 20
      include/grpc++/server.h
  18. 2
      include/grpc++/support/byte_buffer.h
  19. 2
      include/grpc++/support/slice.h
  20. 48
      src/compiler/cpp_generator.cc
  21. 6
      src/cpp/client/channel_cc.cc
  22. 8
      src/cpp/client/client_context.cc
  23. 6
      src/cpp/client/cronet_credentials.cc
  24. 6
      src/cpp/client/insecure_credentials.cc
  25. 14
      src/cpp/client/secure_credentials.h
  26. 2
      src/cpp/common/channel_filter.h
  27. 20
      src/cpp/common/secure_auth_context.h
  28. 4
      src/cpp/ext/proto_server_reflection.h
  29. 4
      src/cpp/server/dynamic_thread_pool.h
  30. 6
      src/cpp/server/insecure_server_credentials.cc
  31. 10
      src/cpp/server/secure_server_credentials.h
  32. 26
      src/cpp/server/server_cc.cc
  33. 6
      src/cpp/server/server_context.cc
  34. 52
      test/cpp/codegen/compiler_test_golden
  35. 4
      test/cpp/common/auth_property_iterator_test.cc
  36. 8
      test/cpp/end2end/async_end2end_test.cc
  37. 4
      test/cpp/end2end/client_crash_test_server.cc
  38. 16
      test/cpp/end2end/end2end_test.cc
  39. 6
      test/cpp/end2end/filter_end2end_test.cc
  40. 4
      test/cpp/end2end/generic_end2end_test.cc
  41. 16
      test/cpp/end2end/hybrid_end2end_test.cc
  42. 56
      test/cpp/end2end/mock_test.cc
  43. 2
      test/cpp/end2end/proto_server_reflection_test.cc
  44. 20
      test/cpp/end2end/server_builder_plugin_test.cc
  45. 6
      test/cpp/end2end/server_crash_test.cc
  46. 6
      test/cpp/end2end/shutdown_test.cc
  47. 6
      test/cpp/end2end/streaming_throughput_test.cc
  48. 8
      test/cpp/end2end/test_service_impl.h
  49. 26
      test/cpp/end2end/thread_stress_test.cc
  50. 2
      test/cpp/qps/client.h
  51. 40
      test/cpp/qps/client_async.cc
  52. 10
      test/cpp/qps/client_sync.cc
  53. 0
      test/cpp/qps/gen_build_yaml.py
  54. 6
      test/cpp/qps/interarrival.h
  55. 12
      test/cpp/qps/qps_worker.cc
  56. 24
      test/cpp/qps/report.h
  57. 18
      test/cpp/qps/server_async.cc
  58. 8
      test/cpp/qps/server_sync.cc
  59. 6
      test/cpp/thread_manager/thread_manager_test.cc
  60. 2
      test/cpp/util/cli_call.h
  61. 6
      test/cpp/util/cli_call_test.cc
  62. 8
      test/cpp/util/grpc_tool_test.cc
  63. 6
      test/cpp/util/metrics_server.h
  64. 4
      test/cpp/util/proto_file_parser.cc
  65. 8
      test/cpp/util/proto_reflection_descriptor_database.h
  66. 10
      test/cpp/util/test_credentials_provider.cc

@ -78,7 +78,7 @@ class Alarm : private GrpcLibraryCodegen {
class AlarmEntry : public CompletionQueueTag { class AlarmEntry : public CompletionQueueTag {
public: public:
AlarmEntry(void* tag) : tag_(tag) {} AlarmEntry(void* tag) : tag_(tag) {}
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
*tag = tag_; *tag = tag_;
return true; return true;
} }

@ -46,7 +46,7 @@ struct grpc_channel;
namespace grpc { namespace grpc {
/// Channels represent a connection to an endpoint. Created by \a CreateChannel. /// Channels represent a connection to an endpoint. Created by \a CreateChannel.
class Channel GRPC_FINAL : public ChannelInterface, class Channel final : public ChannelInterface,
public CallHook, public CallHook,
public std::enable_shared_from_this<Channel>, public std::enable_shared_from_this<Channel>,
private GrpcLibraryCodegen { private GrpcLibraryCodegen {
@ -55,7 +55,7 @@ class Channel GRPC_FINAL : public ChannelInterface,
/// 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.
grpc_connectivity_state GetState(bool try_to_connect) GRPC_OVERRIDE; grpc_connectivity_state GetState(bool try_to_connect) override;
private: private:
template <class InputMessage, class OutputMessage> template <class InputMessage, class OutputMessage>
@ -69,15 +69,15 @@ class Channel GRPC_FINAL : public ChannelInterface,
Channel(const grpc::string& host, grpc_channel* c_channel); Channel(const grpc::string& host, grpc_channel* c_channel);
Call CreateCall(const RpcMethod& method, ClientContext* context, Call CreateCall(const RpcMethod& method, ClientContext* context,
CompletionQueue* cq) GRPC_OVERRIDE; CompletionQueue* cq) override;
void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override;
void* RegisterMethod(const char* method) GRPC_OVERRIDE; void* RegisterMethod(const char* method) override;
void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed, void NotifyOnStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline, CompletionQueue* cq, gpr_timespec deadline, CompletionQueue* cq,
void* tag) GRPC_OVERRIDE; void* tag) override;
bool WaitForStateChangeImpl(grpc_connectivity_state last_observed, bool WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) GRPC_OVERRIDE; gpr_timespec deadline) override;
const grpc::string host_; const grpc::string host_;
grpc_channel* const c_channel_; // owned grpc_channel* const c_channel_; // owned

@ -48,12 +48,12 @@ namespace reflection {
class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin { class ProtoServerReflectionPlugin : public ::grpc::ServerBuilderPlugin {
public: public:
ProtoServerReflectionPlugin(); ProtoServerReflectionPlugin();
::grpc::string name() GRPC_OVERRIDE; ::grpc::string name() override;
void InitServer(::grpc::ServerInitializer* si) GRPC_OVERRIDE; void InitServer(::grpc::ServerInitializer* si) override;
void Finish(::grpc::ServerInitializer* si) GRPC_OVERRIDE; void Finish(::grpc::ServerInitializer* si) override;
void ChangeArguments(const ::grpc::string& name, void* value) GRPC_OVERRIDE; void ChangeArguments(const ::grpc::string& name, void* value) override;
bool has_async_methods() const GRPC_OVERRIDE; bool has_async_methods() const override;
bool has_sync_methods() const GRPC_OVERRIDE; bool has_sync_methods() const override;
private: private:
std::shared_ptr<grpc::ProtoServerReflection> reflection_service_; std::shared_ptr<grpc::ProtoServerReflection> reflection_service_;

@ -44,7 +44,7 @@ namespace grpc {
typedef ServerAsyncReaderWriter<ByteBuffer, ByteBuffer> typedef ServerAsyncReaderWriter<ByteBuffer, ByteBuffer>
GenericServerAsyncReaderWriter; GenericServerAsyncReaderWriter;
class GenericServerContext GRPC_FINAL : public ServerContext { class GenericServerContext final : public ServerContext {
public: public:
const grpc::string& method() const { return method_; } const grpc::string& method() const { return method_; }
const grpc::string& host() const { return host_; } const grpc::string& host() const { return host_; }
@ -57,7 +57,7 @@ class GenericServerContext GRPC_FINAL : public ServerContext {
grpc::string host_; grpc::string host_;
}; };
class AsyncGenericService GRPC_FINAL { class AsyncGenericService final {
public: public:
AsyncGenericService() : server_(nullptr) {} AsyncGenericService() : server_(nullptr) {}

@ -45,7 +45,7 @@ typedef ClientAsyncReaderWriter<ByteBuffer, ByteBuffer>
// Generic stubs provide a type-unsafe interface to call gRPC methods // Generic stubs provide a type-unsafe interface to call gRPC methods
// by name. // by name.
class GenericStub GRPC_FINAL { class GenericStub final {
public: public:
explicit GenericStub(std::shared_ptr<ChannelInterface> channel) explicit GenericStub(std::shared_ptr<ChannelInterface> channel)
: channel_(channel) {} : channel_(channel) {}

@ -108,7 +108,7 @@ class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface,
public AsyncReaderInterface<R> {}; public AsyncReaderInterface<R> {};
template <class R> template <class R>
class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> { class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
public: public:
/// Create a stream and write the first request out. /// Create a stream and write the first request out.
template <class W> template <class W>
@ -125,7 +125,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
call_.PerformOps(&init_ops_); call_.PerformOps(&init_ops_);
} }
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -133,7 +133,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Read(R* msg, void* tag) GRPC_OVERRIDE { void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag); read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_); read_ops_.RecvInitialMetadata(context_);
@ -142,7 +142,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
call_.PerformOps(&read_ops_); call_.PerformOps(&read_ops_);
} }
void Finish(Status* status, void* tag) GRPC_OVERRIDE { void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_); finish_ops_.RecvInitialMetadata(context_);
@ -174,7 +174,7 @@ class ClientAsyncWriterInterface : public ClientAsyncStreamingInterface,
}; };
template <class W> template <class W>
class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> { class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
public: public:
template <class R> template <class R>
ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq,
@ -190,7 +190,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
call_.PerformOps(&init_ops_); call_.PerformOps(&init_ops_);
} }
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -198,20 +198,20 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Write(const W& msg, void* tag) GRPC_OVERRIDE { void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert // TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok()); GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void WritesDone(void* tag) GRPC_OVERRIDE { void WritesDone(void* tag) override {
writes_done_ops_.set_output_tag(tag); writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose(); writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_); call_.PerformOps(&writes_done_ops_);
} }
void Finish(Status* status, void* tag) GRPC_OVERRIDE { void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_); finish_ops_.RecvInitialMetadata(context_);
@ -246,7 +246,7 @@ class ClientAsyncReaderWriterInterface : public ClientAsyncStreamingInterface,
}; };
template <class W, class R> template <class W, class R>
class ClientAsyncReaderWriter GRPC_FINAL class ClientAsyncReaderWriter final
: public ClientAsyncReaderWriterInterface<W, R> { : public ClientAsyncReaderWriterInterface<W, R> {
public: public:
ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq,
@ -259,7 +259,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&init_ops_); call_.PerformOps(&init_ops_);
} }
void ReadInitialMetadata(void* tag) GRPC_OVERRIDE { void ReadInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -267,7 +267,7 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Read(R* msg, void* tag) GRPC_OVERRIDE { void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag); read_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
read_ops_.RecvInitialMetadata(context_); read_ops_.RecvInitialMetadata(context_);
@ -276,20 +276,20 @@ class ClientAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&read_ops_); call_.PerformOps(&read_ops_);
} }
void Write(const W& msg, void* tag) GRPC_OVERRIDE { void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
// TODO(ctiller): don't assert // TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok()); GPR_CODEGEN_ASSERT(write_ops_.SendMessage(msg).ok());
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void WritesDone(void* tag) GRPC_OVERRIDE { void WritesDone(void* tag) override {
writes_done_ops_.set_output_tag(tag); writes_done_ops_.set_output_tag(tag);
writes_done_ops_.ClientSendClose(); writes_done_ops_.ClientSendClose();
call_.PerformOps(&writes_done_ops_); call_.PerformOps(&writes_done_ops_);
} }
void Finish(Status* status, void* tag) GRPC_OVERRIDE { void Finish(Status* status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_); finish_ops_.RecvInitialMetadata(context_);
@ -319,12 +319,12 @@ class ServerAsyncReaderInterface : public ServerAsyncStreamingInterface,
}; };
template <class W, class R> template <class W, class R>
class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> { class ServerAsyncReader final : public ServerAsyncReaderInterface<W, R> {
public: public:
explicit ServerAsyncReader(ServerContext* ctx) explicit ServerAsyncReader(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE { void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -337,13 +337,13 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Read(R* msg, void* tag) GRPC_OVERRIDE { void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag); read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg); read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_); call_.PerformOps(&read_ops_);
} }
void Finish(const W& msg, const Status& status, void* tag) GRPC_OVERRIDE { void Finish(const W& msg, const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -363,7 +363,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
call_.PerformOps(&finish_ops_); call_.PerformOps(&finish_ops_);
} }
void FinishWithError(const Status& status, void* tag) GRPC_OVERRIDE { void FinishWithError(const Status& status, void* tag) override {
GPR_CODEGEN_ASSERT(!status.ok()); GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
@ -379,7 +379,7 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
} }
private: private:
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } void BindCall(Call* call) override { call_ = *call; }
Call call_; Call call_;
ServerContext* ctx_; ServerContext* ctx_;
@ -398,12 +398,12 @@ class ServerAsyncWriterInterface : public ServerAsyncStreamingInterface,
}; };
template <class W> template <class W>
class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> { class ServerAsyncWriter final : public ServerAsyncWriterInterface<W> {
public: public:
explicit ServerAsyncWriter(ServerContext* ctx) explicit ServerAsyncWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE { void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -416,7 +416,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Write(const W& msg, void* tag) GRPC_OVERRIDE { void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_, write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -431,7 +431,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Finish(const Status& status, void* tag) GRPC_OVERRIDE { void Finish(const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -446,7 +446,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
} }
private: private:
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } void BindCall(Call* call) override { call_ = *call; }
Call call_; Call call_;
ServerContext* ctx_; ServerContext* ctx_;
@ -465,13 +465,13 @@ class ServerAsyncReaderWriterInterface : public ServerAsyncStreamingInterface,
}; };
template <class W, class R> template <class W, class R>
class ServerAsyncReaderWriter GRPC_FINAL class ServerAsyncReaderWriter final
: public ServerAsyncReaderWriterInterface<W, R> { : public ServerAsyncReaderWriterInterface<W, R> {
public: public:
explicit ServerAsyncReaderWriter(ServerContext* ctx) explicit ServerAsyncReaderWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE { void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag); meta_ops_.set_output_tag(tag);
@ -484,13 +484,13 @@ class ServerAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&meta_ops_); call_.PerformOps(&meta_ops_);
} }
void Read(R* msg, void* tag) GRPC_OVERRIDE { void Read(R* msg, void* tag) override {
read_ops_.set_output_tag(tag); read_ops_.set_output_tag(tag);
read_ops_.RecvMessage(msg); read_ops_.RecvMessage(msg);
call_.PerformOps(&read_ops_); call_.PerformOps(&read_ops_);
} }
void Write(const W& msg, void* tag) GRPC_OVERRIDE { void Write(const W& msg, void* tag) override {
write_ops_.set_output_tag(tag); write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
write_ops_.SendInitialMetadata(ctx_->initial_metadata_, write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -505,7 +505,7 @@ class ServerAsyncReaderWriter GRPC_FINAL
call_.PerformOps(&write_ops_); call_.PerformOps(&write_ops_);
} }
void Finish(const Status& status, void* tag) GRPC_OVERRIDE { void Finish(const Status& status, void* tag) override {
finish_ops_.set_output_tag(tag); finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) { if (!ctx_->sent_initial_metadata_) {
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_, finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
@ -522,7 +522,7 @@ class ServerAsyncReaderWriter GRPC_FINAL
private: private:
friend class ::grpc::Server; friend class ::grpc::Server;
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } void BindCall(Call* call) override { call_ = *call; }
Call call_; Call call_;
ServerContext* ctx_; ServerContext* ctx_;

@ -55,7 +55,7 @@ class ClientAsyncResponseReaderInterface {
}; };
template <class R> template <class R>
class ClientAsyncResponseReader GRPC_FINAL class ClientAsyncResponseReader final
: public ClientAsyncResponseReaderInterface<R> { : public ClientAsyncResponseReaderInterface<R> {
public: public:
template <class W> template <class W>
@ -113,13 +113,13 @@ class ClientAsyncResponseReader GRPC_FINAL
}; };
template <class W> template <class W>
class ServerAsyncResponseWriter GRPC_FINAL class ServerAsyncResponseWriter final
: public ServerAsyncStreamingInterface { : public ServerAsyncStreamingInterface {
public: public:
explicit ServerAsyncResponseWriter(ServerContext* ctx) explicit ServerAsyncResponseWriter(ServerContext* ctx)
: call_(nullptr, nullptr, nullptr), ctx_(ctx) {} : call_(nullptr, nullptr, nullptr), ctx_(ctx) {}
void SendInitialMetadata(void* tag) GRPC_OVERRIDE { void SendInitialMetadata(void* tag) override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag); meta_buf_.set_output_tag(tag);
@ -168,7 +168,7 @@ class ServerAsyncResponseWriter GRPC_FINAL
} }
private: private:
void BindCall(Call* call) GRPC_OVERRIDE { call_ = *call; } void BindCall(Call* call) override { call_ = *call; }
Call call_; Call call_;
ServerContext* ctx_; ServerContext* ctx_;

@ -337,16 +337,16 @@ class DeserializeFunc {
}; };
template <class R> template <class R>
class DeserializeFuncType GRPC_FINAL : public DeserializeFunc { class DeserializeFuncType final : public DeserializeFunc {
public: public:
DeserializeFuncType(R* message) : message_(message) {} DeserializeFuncType(R* message) : message_(message) {}
Status Deserialize(grpc_byte_buffer* buf, Status Deserialize(grpc_byte_buffer* buf,
int max_receive_message_size) GRPC_OVERRIDE { int max_receive_message_size) override {
return SerializationTraits<R>::Deserialize(buf, message_, return SerializationTraits<R>::Deserialize(buf, message_,
max_receive_message_size); max_receive_message_size);
} }
~DeserializeFuncType() GRPC_OVERRIDE {} ~DeserializeFuncType() override {}
private: private:
R* message_; // Not a managed pointer because management is external to this R* message_; // Not a managed pointer because management is external to this
@ -603,7 +603,7 @@ class CallOpSet : public CallOpSetInterface,
public Op6 { public Op6 {
public: public:
CallOpSet() : return_tag_(this) {} CallOpSet() : return_tag_(this) {}
void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE { void FillOps(grpc_op* ops, size_t* nops) override {
this->Op1::AddOp(ops, nops); this->Op1::AddOp(ops, nops);
this->Op2::AddOp(ops, nops); this->Op2::AddOp(ops, nops);
this->Op3::AddOp(ops, nops); this->Op3::AddOp(ops, nops);
@ -612,7 +612,7 @@ class CallOpSet : public CallOpSetInterface,
this->Op6::AddOp(ops, nops); this->Op6::AddOp(ops, nops);
} }
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
this->Op1::FinishOp(status, max_receive_message_size_); this->Op1::FinishOp(status, max_receive_message_size_);
this->Op2::FinishOp(status, max_receive_message_size_); this->Op2::FinishOp(status, max_receive_message_size_);
this->Op3::FinishOp(status, max_receive_message_size_); this->Op3::FinishOp(status, max_receive_message_size_);
@ -639,14 +639,14 @@ template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>> class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> { class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> {
public: public:
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
typedef CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> Base; typedef CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> Base;
return Base::FinalizeResult(tag, status) && false; return Base::FinalizeResult(tag, status) && false;
} }
}; };
// Straightforward wrapping of the C call object // Straightforward wrapping of the C call object
class Call GRPC_FINAL { class Call final {
public: public:
/* call is owned by the caller */ /* call is owned by the caller */
Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq) Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)

@ -34,9 +34,6 @@
#ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H #ifndef GRPCXX_IMPL_CODEGEN_CONFIG_H
#define GRPCXX_IMPL_CODEGEN_CONFIG_H #define GRPCXX_IMPL_CODEGEN_CONFIG_H
#define GRPC_FINAL final
#define GRPC_OVERRIDE override
#ifndef GRPC_CUSTOM_STRING #ifndef GRPC_CUSTOM_STRING
#include <string> #include <string>
#define GRPC_CUSTOM_STRING std::string #define GRPC_CUSTOM_STRING std::string

@ -46,55 +46,55 @@ namespace grpc {
class CoreCodegen : public CoreCodegenInterface { class CoreCodegen : public CoreCodegenInterface {
private: private:
grpc_completion_queue* grpc_completion_queue_create(void* reserved) grpc_completion_queue* grpc_completion_queue_create(void* reserved)
GRPC_OVERRIDE; override;
void grpc_completion_queue_destroy(grpc_completion_queue* cq) GRPC_OVERRIDE; void grpc_completion_queue_destroy(grpc_completion_queue* cq) override;
grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag, grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
gpr_timespec deadline, gpr_timespec deadline,
void* reserved) GRPC_OVERRIDE; void* reserved) override;
void* gpr_malloc(size_t size) GRPC_OVERRIDE; void* gpr_malloc(size_t size) override;
void gpr_free(void* p) GRPC_OVERRIDE; void gpr_free(void* p) override;
void gpr_mu_init(gpr_mu* mu) GRPC_OVERRIDE; void gpr_mu_init(gpr_mu* mu) override;
void gpr_mu_destroy(gpr_mu* mu) GRPC_OVERRIDE; void gpr_mu_destroy(gpr_mu* mu) override;
void gpr_mu_lock(gpr_mu* mu) GRPC_OVERRIDE; void gpr_mu_lock(gpr_mu* mu) override;
void gpr_mu_unlock(gpr_mu* mu) GRPC_OVERRIDE; void gpr_mu_unlock(gpr_mu* mu) override;
void gpr_cv_init(gpr_cv* cv) GRPC_OVERRIDE; void gpr_cv_init(gpr_cv* cv) override;
void gpr_cv_destroy(gpr_cv* cv) GRPC_OVERRIDE; void gpr_cv_destroy(gpr_cv* cv) override;
int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu, int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
gpr_timespec abs_deadline) GRPC_OVERRIDE; gpr_timespec abs_deadline) override;
void gpr_cv_signal(gpr_cv* cv) GRPC_OVERRIDE; void gpr_cv_signal(gpr_cv* cv) override;
void gpr_cv_broadcast(gpr_cv* cv) GRPC_OVERRIDE; void gpr_cv_broadcast(gpr_cv* cv) override;
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE; void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) override;
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader, int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
grpc_byte_buffer* buffer) GRPC_OVERRIDE; grpc_byte_buffer* buffer) override;
void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader) void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader* reader)
GRPC_OVERRIDE; override;
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader, int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
gpr_slice* slice) GRPC_OVERRIDE; gpr_slice* slice) override;
grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice, grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
size_t nslices) GRPC_OVERRIDE; size_t nslices) override;
gpr_slice gpr_slice_malloc(size_t length) GRPC_OVERRIDE; gpr_slice gpr_slice_malloc(size_t length) override;
void gpr_slice_unref(gpr_slice slice) GRPC_OVERRIDE; void gpr_slice_unref(gpr_slice slice) override;
gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) GRPC_OVERRIDE; gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override;
void gpr_slice_buffer_add(gpr_slice_buffer* sb, void gpr_slice_buffer_add(gpr_slice_buffer* sb,
gpr_slice slice) GRPC_OVERRIDE; gpr_slice slice) override;
void gpr_slice_buffer_pop(gpr_slice_buffer* sb) GRPC_OVERRIDE; void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override;
void grpc_metadata_array_init(grpc_metadata_array* array) GRPC_OVERRIDE; void grpc_metadata_array_init(grpc_metadata_array* array) override;
void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE; void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE; gpr_timespec gpr_inf_future(gpr_clock_type type) override;
gpr_timespec gpr_time_0(gpr_clock_type type) GRPC_OVERRIDE; gpr_timespec gpr_time_0(gpr_clock_type type) override;
virtual const Status& ok() GRPC_OVERRIDE; virtual const Status& ok() override;
virtual const Status& cancelled() GRPC_OVERRIDE; virtual const Status& cancelled() override;
void assert_fail(const char* failed_assertion) GRPC_OVERRIDE; void assert_fail(const char* failed_assertion) override;
}; };
} // namespace grpc } // namespace grpc

@ -50,7 +50,7 @@ class RpcMethodHandler : public MethodHandler {
ServiceType* service) ServiceType* service)
: func_(func), service_(service) {} : func_(func), service_(service) {}
void RunHandler(const HandlerParameter& param) GRPC_FINAL { void RunHandler(const HandlerParameter& param) final {
RequestType req; RequestType req;
Status status = SerializationTraits<RequestType>::Deserialize( Status status = SerializationTraits<RequestType>::Deserialize(
param.request, &req, param.max_receive_message_size); param.request, &req, param.max_receive_message_size);
@ -96,7 +96,7 @@ class ClientStreamingHandler : public MethodHandler {
ServiceType* service) ServiceType* service)
: func_(func), service_(service) {} : func_(func), service_(service) {}
void RunHandler(const HandlerParameter& param) GRPC_FINAL { void RunHandler(const HandlerParameter& param) final {
ServerReader<RequestType> reader(param.call, param.server_context); ServerReader<RequestType> reader(param.call, param.server_context);
ResponseType rsp; ResponseType rsp;
Status status = func_(service_, param.server_context, &reader, &rsp); Status status = func_(service_, param.server_context, &reader, &rsp);
@ -136,7 +136,7 @@ class ServerStreamingHandler : public MethodHandler {
ServiceType* service) ServiceType* service)
: func_(func), service_(service) {} : func_(func), service_(service) {}
void RunHandler(const HandlerParameter& param) GRPC_FINAL { void RunHandler(const HandlerParameter& param) final {
RequestType req; RequestType req;
Status status = SerializationTraits<RequestType>::Deserialize( Status status = SerializationTraits<RequestType>::Deserialize(
param.request, &req, param.max_receive_message_size); param.request, &req, param.max_receive_message_size);
@ -180,7 +180,7 @@ class TemplatedBidiStreamingHandler : public MethodHandler {
std::function<Status(ServerContext*, Streamer*)> func) std::function<Status(ServerContext*, Streamer*)> func)
: func_(func), write_needed_(WriteNeeded) {} : func_(func), write_needed_(WriteNeeded) {}
void RunHandler(const HandlerParameter& param) GRPC_FINAL { void RunHandler(const HandlerParameter& param) final {
Streamer stream(param.call, param.server_context); Streamer stream(param.call, param.server_context);
Status status = func_(param.server_context, &stream); Status status = func_(param.server_context, &stream);
@ -266,7 +266,7 @@ class UnknownMethodHandler : public MethodHandler {
ops->ServerSendStatus(context->trailing_metadata_, status); ops->ServerSendStatus(context->trailing_metadata_, status);
} }
void RunHandler(const HandlerParameter& param) GRPC_FINAL { void RunHandler(const HandlerParameter& param) final {
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops; CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops;
FillOps(param.server_context, &ops); FillOps(param.server_context, &ops);
param.call->PerformOps(&ops); param.call->PerformOps(&ops);

@ -52,7 +52,7 @@ namespace internal {
const int kGrpcBufferWriterMaxBufferLength = 8192; const int kGrpcBufferWriterMaxBufferLength = 8192;
class GrpcBufferWriter GRPC_FINAL class GrpcBufferWriter final
: public ::grpc::protobuf::io::ZeroCopyOutputStream { : public ::grpc::protobuf::io::ZeroCopyOutputStream {
public: public:
explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size) explicit GrpcBufferWriter(grpc_byte_buffer** bp, int block_size)
@ -61,13 +61,13 @@ class GrpcBufferWriter GRPC_FINAL
slice_buffer_ = &(*bp)->data.raw.slice_buffer; slice_buffer_ = &(*bp)->data.raw.slice_buffer;
} }
~GrpcBufferWriter() GRPC_OVERRIDE { ~GrpcBufferWriter() override {
if (have_backup_) { if (have_backup_) {
g_core_codegen_interface->gpr_slice_unref(backup_slice_); g_core_codegen_interface->gpr_slice_unref(backup_slice_);
} }
} }
bool Next(void** data, int* size) GRPC_OVERRIDE { bool Next(void** data, int* size) override {
if (have_backup_) { if (have_backup_) {
slice_ = backup_slice_; slice_ = backup_slice_;
have_backup_ = false; have_backup_ = false;
@ -82,7 +82,7 @@ class GrpcBufferWriter GRPC_FINAL
return true; return true;
} }
void BackUp(int count) GRPC_OVERRIDE { void BackUp(int count) override {
g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_); g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_);
if (count == block_size_) { if (count == block_size_) {
backup_slice_ = slice_; backup_slice_ = slice_;
@ -95,7 +95,7 @@ class GrpcBufferWriter GRPC_FINAL
byte_count_ -= count; byte_count_ -= count;
} }
grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { return byte_count_; } grpc::protobuf::int64 ByteCount() const override { return byte_count_; }
private: private:
const int block_size_; const int block_size_;
@ -106,7 +106,7 @@ class GrpcBufferWriter GRPC_FINAL
gpr_slice slice_; gpr_slice slice_;
}; };
class GrpcBufferReader GRPC_FINAL class GrpcBufferReader final
: public ::grpc::protobuf::io::ZeroCopyInputStream { : public ::grpc::protobuf::io::ZeroCopyInputStream {
public: public:
explicit GrpcBufferReader(grpc_byte_buffer* buffer) explicit GrpcBufferReader(grpc_byte_buffer* buffer)
@ -117,11 +117,11 @@ class GrpcBufferReader GRPC_FINAL
"Couldn't initialize byte buffer reader"); "Couldn't initialize byte buffer reader");
} }
} }
~GrpcBufferReader() GRPC_OVERRIDE { ~GrpcBufferReader() override {
g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_); g_core_codegen_interface->grpc_byte_buffer_reader_destroy(&reader_);
} }
bool Next(const void** data, int* size) GRPC_OVERRIDE { bool Next(const void** data, int* size) override {
if (!status_.ok()) { if (!status_.ok()) {
return false; return false;
} }
@ -147,9 +147,9 @@ class GrpcBufferReader GRPC_FINAL
Status status() const { return status_; } Status status() const { return status_; }
void BackUp(int count) GRPC_OVERRIDE { backup_count_ = count; } void BackUp(int count) override { backup_count_ = count; }
bool Skip(int count) GRPC_OVERRIDE { bool Skip(int count) override {
const void* data; const void* data;
int size; int size;
while (Next(&data, &size)) { while (Next(&data, &size)) {
@ -164,7 +164,7 @@ class GrpcBufferReader GRPC_FINAL
return false; return false;
} }
grpc::protobuf::int64 ByteCount() const GRPC_OVERRIDE { grpc::protobuf::int64 ByteCount() const override {
return byte_count_ - backup_count_; return byte_count_ - backup_count_;
} }

@ -142,7 +142,7 @@ class ServerInterface : public CallHook {
bool delete_on_finalize); bool delete_on_finalize);
virtual ~BaseAsyncRequest() {} virtual ~BaseAsyncRequest() {}
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; bool FinalizeResult(void** tag, bool* status) override;
protected: protected:
ServerInterface* const server_; ServerInterface* const server_;
@ -168,7 +168,7 @@ class ServerInterface : public CallHook {
ServerCompletionQueue* notification_cq); ServerCompletionQueue* notification_cq);
}; };
class NoPayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { class NoPayloadAsyncRequest final : public RegisteredAsyncRequest {
public: public:
NoPayloadAsyncRequest(void* registered_method, ServerInterface* server, NoPayloadAsyncRequest(void* registered_method, ServerInterface* server,
ServerContext* context, ServerContext* context,
@ -183,7 +183,7 @@ class ServerInterface : public CallHook {
}; };
template <class Message> template <class Message>
class PayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { class PayloadAsyncRequest final : public RegisteredAsyncRequest {
public: public:
PayloadAsyncRequest(void* registered_method, ServerInterface* server, PayloadAsyncRequest(void* registered_method, ServerInterface* server,
ServerContext* context, ServerContext* context,
@ -196,7 +196,7 @@ class ServerInterface : public CallHook {
IssueRequest(registered_method, &payload_, notification_cq); IssueRequest(registered_method, &payload_, notification_cq);
} }
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
bool serialization_status = bool serialization_status =
*status && payload_ && *status && payload_ &&
SerializationTraits<Message>::Deserialize( SerializationTraits<Message>::Deserialize(
@ -220,7 +220,7 @@ class ServerInterface : public CallHook {
ServerCompletionQueue* notification_cq, void* tag, ServerCompletionQueue* notification_cq, void* tag,
bool delete_on_finalize); bool delete_on_finalize);
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; bool FinalizeResult(void** tag, bool* status) override;
private: private:
grpc_call_details call_details_; grpc_call_details call_details_;

@ -131,7 +131,7 @@ class ClientReaderInterface : public ClientStreamingInterface,
}; };
template <class R> template <class R>
class ClientReader GRPC_FINAL : public ClientReaderInterface<R> { class ClientReader final : public ClientReaderInterface<R> {
public: public:
/// Blocking create a stream and write the first request out. /// Blocking create a stream and write the first request out.
template <class W> template <class W>
@ -150,7 +150,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
cq_.Pluck(&ops); cq_.Pluck(&ops);
} }
void WaitForInitialMetadata() GRPC_OVERRIDE { void WaitForInitialMetadata() override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
CallOpSet<CallOpRecvInitialMetadata> ops; CallOpSet<CallOpRecvInitialMetadata> ops;
@ -159,12 +159,12 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
cq_.Pluck(&ops); /// status ignored cq_.Pluck(&ops); /// status ignored
} }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
*sz = call_.max_receive_message_size(); *sz = call_.max_receive_message_size();
return true; return true;
} }
bool Read(R* msg) GRPC_OVERRIDE { bool Read(R* msg) override {
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops; CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
@ -174,7 +174,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
return cq_.Pluck(&ops) && ops.got_message; return cq_.Pluck(&ops) && ops.got_message;
} }
Status Finish() GRPC_OVERRIDE { Status Finish() override {
CallOpSet<CallOpClientRecvStatus> ops; CallOpSet<CallOpClientRecvStatus> ops;
Status status; Status status;
ops.ClientRecvStatus(context_, &status); ops.ClientRecvStatus(context_, &status);
@ -230,7 +230,7 @@ class ClientWriter : public ClientWriterInterface<W> {
} }
using WriterInterface<W>::Write; using WriterInterface<W>::Write;
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { bool Write(const W& msg, const WriteOptions& options) override {
CallOpSet<CallOpSendMessage> ops; CallOpSet<CallOpSendMessage> ops;
if (!ops.SendMessage(msg, options).ok()) { if (!ops.SendMessage(msg, options).ok()) {
return false; return false;
@ -239,7 +239,7 @@ class ClientWriter : public ClientWriterInterface<W> {
return cq_.Pluck(&ops); return cq_.Pluck(&ops);
} }
bool WritesDone() GRPC_OVERRIDE { bool WritesDone() override {
CallOpSet<CallOpClientSendClose> ops; CallOpSet<CallOpClientSendClose> ops;
ops.ClientSendClose(); ops.ClientSendClose();
call_.PerformOps(&ops); call_.PerformOps(&ops);
@ -247,7 +247,7 @@ class ClientWriter : public ClientWriterInterface<W> {
} }
/// Read the final response and wait for the final status. /// Read the final response and wait for the final status.
Status Finish() GRPC_OVERRIDE { Status Finish() override {
Status status; Status status;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
finish_ops_.RecvInitialMetadata(context_); finish_ops_.RecvInitialMetadata(context_);
@ -287,7 +287,7 @@ class ClientReaderWriterInterface : public ClientStreamingInterface,
}; };
template <class W, class R> template <class W, class R>
class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> { class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
public: public:
/// Blocking create a stream. /// Blocking create a stream.
ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method,
@ -300,7 +300,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
cq_.Pluck(&ops); cq_.Pluck(&ops);
} }
void WaitForInitialMetadata() GRPC_OVERRIDE { void WaitForInitialMetadata() override {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_); GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
CallOpSet<CallOpRecvInitialMetadata> ops; CallOpSet<CallOpRecvInitialMetadata> ops;
@ -309,12 +309,12 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
cq_.Pluck(&ops); // status ignored cq_.Pluck(&ops); // status ignored
} }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
*sz = call_.max_receive_message_size(); *sz = call_.max_receive_message_size();
return true; return true;
} }
bool Read(R* msg) GRPC_OVERRIDE { bool Read(R* msg) override {
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops; CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
@ -325,21 +325,21 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
} }
using WriterInterface<W>::Write; using WriterInterface<W>::Write;
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { bool Write(const W& msg, const WriteOptions& options) override {
CallOpSet<CallOpSendMessage> ops; CallOpSet<CallOpSendMessage> ops;
if (!ops.SendMessage(msg, options).ok()) return false; if (!ops.SendMessage(msg, options).ok()) return false;
call_.PerformOps(&ops); call_.PerformOps(&ops);
return cq_.Pluck(&ops); return cq_.Pluck(&ops);
} }
bool WritesDone() GRPC_OVERRIDE { bool WritesDone() override {
CallOpSet<CallOpClientSendClose> ops; CallOpSet<CallOpClientSendClose> ops;
ops.ClientSendClose(); ops.ClientSendClose();
call_.PerformOps(&ops); call_.PerformOps(&ops);
return cq_.Pluck(&ops); return cq_.Pluck(&ops);
} }
Status Finish() GRPC_OVERRIDE { Status Finish() override {
CallOpSet<CallOpRecvInitialMetadata, CallOpClientRecvStatus> ops; CallOpSet<CallOpRecvInitialMetadata, CallOpClientRecvStatus> ops;
if (!context_->initial_metadata_received_) { if (!context_->initial_metadata_received_) {
ops.RecvInitialMetadata(context_); ops.RecvInitialMetadata(context_);
@ -363,11 +363,11 @@ class ServerReaderInterface : public ServerStreamingInterface,
public ReaderInterface<R> {}; public ReaderInterface<R> {};
template <class R> template <class R>
class ServerReader GRPC_FINAL : public ServerReaderInterface<R> { class ServerReader final : public ServerReaderInterface<R> {
public: public:
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
void SendInitialMetadata() GRPC_OVERRIDE { void SendInitialMetadata() override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops; CallOpSet<CallOpSendInitialMetadata> ops;
@ -381,12 +381,12 @@ class ServerReader GRPC_FINAL : public ServerReaderInterface<R> {
call_->cq()->Pluck(&ops); call_->cq()->Pluck(&ops);
} }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
*sz = call_->max_receive_message_size(); *sz = call_->max_receive_message_size();
return true; return true;
} }
bool Read(R* msg) GRPC_OVERRIDE { bool Read(R* msg) override {
CallOpSet<CallOpRecvMessage<R>> ops; CallOpSet<CallOpRecvMessage<R>> ops;
ops.RecvMessage(msg); ops.RecvMessage(msg);
call_->PerformOps(&ops); call_->PerformOps(&ops);
@ -404,11 +404,11 @@ class ServerWriterInterface : public ServerStreamingInterface,
public WriterInterface<W> {}; public WriterInterface<W> {};
template <class W> template <class W>
class ServerWriter GRPC_FINAL : public ServerWriterInterface<W> { class ServerWriter final : public ServerWriterInterface<W> {
public: public:
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
void SendInitialMetadata() GRPC_OVERRIDE { void SendInitialMetadata() override {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_); GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops; CallOpSet<CallOpSendInitialMetadata> ops;
@ -423,7 +423,7 @@ class ServerWriter GRPC_FINAL : public ServerWriterInterface<W> {
} }
using WriterInterface<W>::Write; using WriterInterface<W>::Write;
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { bool Write(const W& msg, const WriteOptions& options) override {
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> ops; CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> ops;
if (!ops.SendMessage(msg, options).ok()) { if (!ops.SendMessage(msg, options).ok()) {
return false; return false;
@ -454,7 +454,7 @@ class ServerReaderWriterInterface : public ServerStreamingInterface,
// Actual implementation of bi-directional streaming // Actual implementation of bi-directional streaming
namespace internal { namespace internal {
template <class W, class R> template <class W, class R>
class ServerReaderWriterBody GRPC_FINAL { class ServerReaderWriterBody final {
public: public:
ServerReaderWriterBody(Call* call, ServerContext* ctx) ServerReaderWriterBody(Call* call, ServerContext* ctx)
: call_(call), ctx_(ctx) {} : call_(call), ctx_(ctx) {}
@ -510,20 +510,20 @@ class ServerReaderWriterBody GRPC_FINAL {
// class to represent the user API for a bidirectional streaming call // class to represent the user API for a bidirectional streaming call
template <class W, class R> template <class W, class R>
class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W, R> { class ServerReaderWriter final : public ServerReaderWriterInterface<W, R> {
public: public:
ServerReaderWriter(Call* call, ServerContext* ctx) : body_(call, ctx) {} ServerReaderWriter(Call* call, ServerContext* ctx) : body_(call, ctx) {}
void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } void SendInitialMetadata() override { body_.SendInitialMetadata(); }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
return body_.NextMessageSize(sz); return body_.NextMessageSize(sz);
} }
bool Read(R* msg) GRPC_OVERRIDE { return body_.Read(msg); } bool Read(R* msg) override { return body_.Read(msg); }
using WriterInterface<W>::Write; using WriterInterface<W>::Write;
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE { bool Write(const W& msg, const WriteOptions& options) override {
return body_.Write(msg, options); return body_.Write(msg, options);
} }
@ -541,19 +541,19 @@ class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W, R> {
/// must have exactly 1 Read and exactly 1 Write, in that order, to function /// must have exactly 1 Read and exactly 1 Write, in that order, to function
/// correctly. Otherwise, the RPC is in error. /// correctly. Otherwise, the RPC is in error.
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class ServerUnaryStreamer GRPC_FINAL class ServerUnaryStreamer final
: public ServerReaderWriterInterface<ResponseType, RequestType> { : public ServerReaderWriterInterface<ResponseType, RequestType> {
public: public:
ServerUnaryStreamer(Call* call, ServerContext* ctx) ServerUnaryStreamer(Call* call, ServerContext* ctx)
: body_(call, ctx), read_done_(false), write_done_(false) {} : body_(call, ctx), read_done_(false), write_done_(false) {}
void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } void SendInitialMetadata() override { body_.SendInitialMetadata(); }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
return body_.NextMessageSize(sz); return body_.NextMessageSize(sz);
} }
bool Read(RequestType* request) GRPC_OVERRIDE { bool Read(RequestType* request) override {
if (read_done_) { if (read_done_) {
return false; return false;
} }
@ -563,7 +563,7 @@ class ServerUnaryStreamer GRPC_FINAL
using WriterInterface<ResponseType>::Write; using WriterInterface<ResponseType>::Write;
bool Write(const ResponseType& response, bool Write(const ResponseType& response,
const WriteOptions& options) GRPC_OVERRIDE { const WriteOptions& options) override {
if (write_done_ || !read_done_) { if (write_done_ || !read_done_) {
return false; return false;
} }
@ -583,19 +583,19 @@ class ServerUnaryStreamer GRPC_FINAL
/// but the server responds to it as though it were a bidi streaming call that /// but the server responds to it as though it were a bidi streaming call that
/// must first have exactly 1 Read and then any number of Writes. /// must first have exactly 1 Read and then any number of Writes.
template <class RequestType, class ResponseType> template <class RequestType, class ResponseType>
class ServerSplitStreamer GRPC_FINAL class ServerSplitStreamer final
: public ServerReaderWriterInterface<ResponseType, RequestType> { : public ServerReaderWriterInterface<ResponseType, RequestType> {
public: public:
ServerSplitStreamer(Call* call, ServerContext* ctx) ServerSplitStreamer(Call* call, ServerContext* ctx)
: body_(call, ctx), read_done_(false) {} : body_(call, ctx), read_done_(false) {}
void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); } void SendInitialMetadata() override { body_.SendInitialMetadata(); }
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
return body_.NextMessageSize(sz); return body_.NextMessageSize(sz);
} }
bool Read(RequestType* request) GRPC_OVERRIDE { bool Read(RequestType* request) override {
if (read_done_) { if (read_done_) {
return false; return false;
} }
@ -605,7 +605,7 @@ class ServerSplitStreamer GRPC_FINAL
using WriterInterface<ResponseType>::Write; using WriterInterface<ResponseType>::Write;
bool Write(const ResponseType& response, bool Write(const ResponseType& response,
const WriteOptions& options) GRPC_OVERRIDE { const WriteOptions& options) override {
return read_done_ && body_.Write(response, options); return read_done_ && body_.Write(response, options);
} }

@ -44,17 +44,17 @@
namespace grpc { namespace grpc {
namespace internal { namespace internal {
class GrpcLibrary GRPC_FINAL : public GrpcLibraryInterface { class GrpcLibrary final : public GrpcLibraryInterface {
public: public:
void init() GRPC_OVERRIDE { grpc_init(); } void init() override { grpc_init(); }
void shutdown() GRPC_OVERRIDE { grpc_shutdown(); } void shutdown() override { grpc_shutdown(); }
}; };
static GrpcLibrary g_gli; static GrpcLibrary g_gli;
static CoreCodegen g_core_codegen; static CoreCodegen g_core_codegen;
/// Instantiating this class ensures the proper initialization of gRPC. /// Instantiating this class ensures the proper initialization of gRPC.
class GrpcLibraryInitializer GRPC_FINAL { class GrpcLibraryInitializer final {
public: public:
GrpcLibraryInitializer() { GrpcLibraryInitializer() {
if (grpc::g_glip == nullptr) { if (grpc::g_glip == nullptr) {

@ -44,7 +44,7 @@ namespace grpc {
/// A ResourceQuota can be attached to a server (via ServerBuilder), or a client /// A ResourceQuota can be attached to a server (via ServerBuilder), or a client
/// channel (via ChannelArguments). gRPC will attempt to keep memory used by /// channel (via ChannelArguments). gRPC will attempt to keep memory used by
/// all attached entities below the ResourceQuota bound. /// all attached entities below the ResourceQuota bound.
class ResourceQuota GRPC_FINAL { class ResourceQuota final {
public: public:
explicit ResourceQuota(const grpc::string& name); explicit ResourceQuota(const grpc::string& name);
ResourceQuota(); ResourceQuota();

@ -64,7 +64,7 @@ class ThreadPoolInterface;
/// Models a gRPC server. /// Models a gRPC server.
/// ///
/// Servers are configured and started via \a grpc::ServerBuilder. /// Servers are configured and started via \a grpc::ServerBuilder.
class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen { class Server final : public ServerInterface, private GrpcLibraryCodegen {
public: public:
~Server(); ~Server();
@ -72,7 +72,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
/// ///
/// \warning The server must be either shutting down or some other thread must /// \warning The server must be either shutting down or some other thread must
/// call \a Shutdown for this function to ever return. /// call \a Shutdown for this function to ever return.
void Wait() GRPC_OVERRIDE; void Wait() override;
/// Global Callbacks /// Global Callbacks
/// ///
@ -144,11 +144,11 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
/// Register a service. This call does not take ownership of the service. /// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the Server instance. /// The service must exist for the lifetime of the Server instance.
bool RegisterService(const grpc::string* host, bool RegisterService(const grpc::string* host,
Service* service) GRPC_OVERRIDE; Service* service) override;
/// Register a generic service. This call does not take ownership of the /// Register a generic service. This call does not take ownership of the
/// service. The service must exist for the lifetime of the Server instance. /// service. The service must exist for the lifetime of the Server instance.
void RegisterAsyncGenericService(AsyncGenericService* service) GRPC_OVERRIDE; void RegisterAsyncGenericService(AsyncGenericService* service) override;
/// Tries to bind \a server to the given \a addr. /// Tries to bind \a server to the given \a addr.
/// ///
@ -162,7 +162,7 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
/// ///
/// \warning It's an error to call this method on an already started server. /// \warning It's an error to call this method on an already started server.
int AddListeningPort(const grpc::string& addr, int AddListeningPort(const grpc::string& addr,
ServerCredentials* creds) GRPC_OVERRIDE; ServerCredentials* creds) override;
/// Start the server. /// Start the server.
/// ///
@ -172,17 +172,17 @@ class Server GRPC_FINAL : public ServerInterface, private GrpcLibraryCodegen {
/// \param num_cqs How many completion queues does \a cqs hold. /// \param num_cqs How many completion queues does \a cqs hold.
/// ///
/// \return true on a successful shutdown. /// \return true on a successful shutdown.
bool Start(ServerCompletionQueue** cqs, size_t num_cqs) GRPC_OVERRIDE; bool Start(ServerCompletionQueue** cqs, size_t num_cqs) override;
void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) override;
void ShutdownInternal(gpr_timespec deadline) GRPC_OVERRIDE; void ShutdownInternal(gpr_timespec deadline) override;
int max_receive_message_size() const GRPC_OVERRIDE { int max_receive_message_size() const override {
return max_receive_message_size_; return max_receive_message_size_;
}; };
grpc_server* server() GRPC_OVERRIDE { return server_; }; grpc_server* server() override { return server_; };
ServerInitializer* initializer(); ServerInitializer* initializer();

@ -47,7 +47,7 @@
namespace grpc { namespace grpc {
/// A sequence of bytes. /// A sequence of bytes.
class ByteBuffer GRPC_FINAL { class ByteBuffer final {
public: public:
/// Constuct an empty buffer. /// Constuct an empty buffer.
ByteBuffer() : buffer_(nullptr) {} ByteBuffer() : buffer_(nullptr) {}

@ -44,7 +44,7 @@ namespace grpc {
/// A slice represents a contiguous reference counted array of bytes. /// A slice represents a contiguous reference counted array of bytes.
/// It is cheap to take references to a slice, and it is cheap to create a /// It is cheap to take references to a slice, and it is cheap to create a
/// slice pointing to a subset of another slice. /// slice pointing to a subset of another slice.
class Slice GRPC_FINAL { class Slice final {
public: public:
/// Construct an empty slice. /// Construct an empty slice.
Slice(); Slice();

@ -322,7 +322,7 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method,
printer->Print( printer->Print(
*vars, *vars,
"::grpc::Status $Method$(::grpc::ClientContext* context, " "::grpc::Status $Method$(::grpc::ClientContext* context, "
"const $Request$& request, $Response$* response) GRPC_OVERRIDE;\n"); "const $Request$& request, $Response$* response) override;\n");
printer->Print( printer->Print(
*vars, *vars,
"std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> " "std::unique_ptr< ::grpc::ClientAsyncResponseReader< $Response$>> "
@ -417,37 +417,37 @@ void PrintHeaderClientMethod(Printer *printer, const Method *method,
"::grpc::ClientAsyncResponseReader< $Response$>* " "::grpc::ClientAsyncResponseReader< $Response$>* "
"Async$Method$Raw(::grpc::ClientContext* context, " "Async$Method$Raw(::grpc::ClientContext* context, "
"const $Request$& request, " "const $Request$& request, "
"::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n"); "::grpc::CompletionQueue* cq) override;\n");
} else if (method->ClientOnlyStreaming()) { } else if (method->ClientOnlyStreaming()) {
printer->Print(*vars, printer->Print(*vars,
"::grpc::ClientWriter< $Request$>* $Method$Raw(" "::grpc::ClientWriter< $Request$>* $Method$Raw("
"::grpc::ClientContext* context, $Response$* response) " "::grpc::ClientContext* context, $Response$* response) "
"GRPC_OVERRIDE;\n"); "override;\n");
printer->Print( printer->Print(
*vars, *vars,
"::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw(" "::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw("
"::grpc::ClientContext* context, $Response$* response, " "::grpc::ClientContext* context, $Response$* response, "
"::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); "::grpc::CompletionQueue* cq, void* tag) override;\n");
} else if (method->ServerOnlyStreaming()) { } else if (method->ServerOnlyStreaming()) {
printer->Print(*vars, printer->Print(*vars,
"::grpc::ClientReader< $Response$>* $Method$Raw(" "::grpc::ClientReader< $Response$>* $Method$Raw("
"::grpc::ClientContext* context, const $Request$& request)" "::grpc::ClientContext* context, const $Request$& request)"
" GRPC_OVERRIDE;\n"); " override;\n");
printer->Print( printer->Print(
*vars, *vars,
"::grpc::ClientAsyncReader< $Response$>* Async$Method$Raw(" "::grpc::ClientAsyncReader< $Response$>* Async$Method$Raw("
"::grpc::ClientContext* context, const $Request$& request, " "::grpc::ClientContext* context, const $Request$& request, "
"::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); "::grpc::CompletionQueue* cq, void* tag) override;\n");
} else if (method->BidiStreaming()) { } else if (method->BidiStreaming()) {
printer->Print( printer->Print(
*vars, *vars,
"::grpc::ClientReaderWriter< $Request$, $Response$>* " "::grpc::ClientReaderWriter< $Request$, $Response$>* "
"$Method$Raw(::grpc::ClientContext* context) GRPC_OVERRIDE;\n"); "$Method$Raw(::grpc::ClientContext* context) override;\n");
printer->Print( printer->Print(
*vars, *vars,
"::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* "
"Async$Method$Raw(::grpc::ClientContext* context, " "Async$Method$Raw(::grpc::ClientContext* context, "
"::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); "::grpc::CompletionQueue* cq, void* tag) override;\n");
} }
} }
} }
@ -509,7 +509,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method,
" ::grpc::Service::MarkMethodAsync($Idx$);\n" " ::grpc::Service::MarkMethodAsync($Idx$);\n"
"}\n"); "}\n");
printer->Print(*vars, printer->Print(*vars,
"~WithAsyncMethod_$Method$() GRPC_OVERRIDE {\n" "~WithAsyncMethod_$Method$() override {\n"
" BaseClassMustBeDerivedFromService(this);\n" " BaseClassMustBeDerivedFromService(this);\n"
"}\n"); "}\n");
if (method->NoStreaming()) { if (method->NoStreaming()) {
@ -518,7 +518,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method,
"// disable synchronous version of this method\n" "// disable synchronous version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" "$Response$* response) final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -540,7 +540,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method,
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, " "::grpc::ServerContext* context, "
"::grpc::ServerReader< $Request$>* reader, " "::grpc::ServerReader< $Request$>* reader, "
"$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" "$Response$* response) final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -561,7 +561,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method,
"// disable synchronous version of this method\n" "// disable synchronous version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " "::grpc::ServerWriter< $Response$>* writer) final override "
"{\n" "{\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
@ -585,7 +585,7 @@ void PrintHeaderServerMethodAsync(Printer *printer, const Method *method,
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, " "::grpc::ServerContext* context, "
"::grpc::ServerReaderWriter< $Response$, $Request$>* stream) " "::grpc::ServerReaderWriter< $Response$, $Request$>* stream) "
"GRPC_FINAL GRPC_OVERRIDE {\n" "final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -632,7 +632,7 @@ void PrintHeaderServerMethodStreamedUnary(
"std::placeholders::_2)));\n" "std::placeholders::_2)));\n"
"}\n"); "}\n");
printer->Print(*vars, printer->Print(*vars,
"~WithStreamedUnaryMethod_$Method$() GRPC_OVERRIDE {\n" "~WithStreamedUnaryMethod_$Method$() override {\n"
" BaseClassMustBeDerivedFromService(this);\n" " BaseClassMustBeDerivedFromService(this);\n"
"}\n"); "}\n");
printer->Print( printer->Print(
@ -640,7 +640,7 @@ void PrintHeaderServerMethodStreamedUnary(
"// disable regular version of this method\n" "// disable regular version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" "$Response$* response) final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -683,7 +683,7 @@ void PrintHeaderServerMethodSplitStreaming(
"std::placeholders::_2)));\n" "std::placeholders::_2)));\n"
"}\n"); "}\n");
printer->Print(*vars, printer->Print(*vars,
"~WithSplitStreamingMethod_$Method$() GRPC_OVERRIDE {\n" "~WithSplitStreamingMethod_$Method$() override {\n"
" BaseClassMustBeDerivedFromService(this);\n" " BaseClassMustBeDerivedFromService(this);\n"
"}\n"); "}\n");
printer->Print( printer->Print(
@ -691,7 +691,7 @@ void PrintHeaderServerMethodSplitStreaming(
"// disable regular version of this method\n" "// disable regular version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " "::grpc::ServerWriter< $Response$>* writer) final override "
"{\n" "{\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
@ -727,7 +727,7 @@ void PrintHeaderServerMethodGeneric(
" ::grpc::Service::MarkMethodGeneric($Idx$);\n" " ::grpc::Service::MarkMethodGeneric($Idx$);\n"
"}\n"); "}\n");
printer->Print(*vars, printer->Print(*vars,
"~WithGenericMethod_$Method$() GRPC_OVERRIDE {\n" "~WithGenericMethod_$Method$() override {\n"
" BaseClassMustBeDerivedFromService(this);\n" " BaseClassMustBeDerivedFromService(this);\n"
"}\n"); "}\n");
if (method->NoStreaming()) { if (method->NoStreaming()) {
@ -736,7 +736,7 @@ void PrintHeaderServerMethodGeneric(
"// disable synchronous version of this method\n" "// disable synchronous version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" "$Response$* response) final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -747,7 +747,7 @@ void PrintHeaderServerMethodGeneric(
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, " "::grpc::ServerContext* context, "
"::grpc::ServerReader< $Request$>* reader, " "::grpc::ServerReader< $Request$>* reader, "
"$Response$* response) GRPC_FINAL GRPC_OVERRIDE {\n" "$Response$* response) final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -757,7 +757,7 @@ void PrintHeaderServerMethodGeneric(
"// disable synchronous version of this method\n" "// disable synchronous version of this method\n"
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, const $Request$* request, " "::grpc::ServerContext* context, const $Request$* request, "
"::grpc::ServerWriter< $Response$>* writer) GRPC_FINAL GRPC_OVERRIDE " "::grpc::ServerWriter< $Response$>* writer) final override "
"{\n" "{\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
@ -769,7 +769,7 @@ void PrintHeaderServerMethodGeneric(
"::grpc::Status $Method$(" "::grpc::Status $Method$("
"::grpc::ServerContext* context, " "::grpc::ServerContext* context, "
"::grpc::ServerReaderWriter< $Response$, $Request$>* stream) " "::grpc::ServerReaderWriter< $Response$, $Request$>* stream) "
"GRPC_FINAL GRPC_OVERRIDE {\n" "final override {\n"
" abort();\n" " abort();\n"
" return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n" " return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, \"\");\n"
"}\n"); "}\n");
@ -784,7 +784,7 @@ void PrintHeaderService(Printer *printer, const Service *service,
printer->Print(service->GetLeadingComments().c_str()); printer->Print(service->GetLeadingComments().c_str());
printer->Print(*vars, printer->Print(*vars,
"class $Service$ GRPC_FINAL {\n" "class $Service$ final {\n"
" public:\n"); " public:\n");
printer->Indent(); printer->Indent();
@ -810,7 +810,7 @@ void PrintHeaderService(Printer *printer, const Service *service,
printer->Outdent(); printer->Outdent();
printer->Print("};\n"); printer->Print("};\n");
printer->Print( printer->Print(
"class Stub GRPC_FINAL : public StubInterface" "class Stub final : public StubInterface"
" {\n public:\n"); " {\n public:\n");
printer->Indent(); printer->Indent();
printer->Print( printer->Print(

@ -106,11 +106,11 @@ grpc_connectivity_state Channel::GetState(bool try_to_connect) {
} }
namespace { namespace {
class TagSaver GRPC_FINAL : public CompletionQueueTag { class TagSaver final : public CompletionQueueTag {
public: public:
explicit TagSaver(void* tag) : tag_(tag) {} explicit TagSaver(void* tag) : tag_(tag) {}
~TagSaver() GRPC_OVERRIDE {} ~TagSaver() override {}
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
*tag = tag_; *tag = tag_;
delete this; delete this;
return true; return true;

@ -45,12 +45,12 @@
namespace grpc { namespace grpc {
class DefaultGlobalClientCallbacks GRPC_FINAL class DefaultGlobalClientCallbacks final
: public ClientContext::GlobalCallbacks { : public ClientContext::GlobalCallbacks {
public: public:
~DefaultGlobalClientCallbacks() GRPC_OVERRIDE {} ~DefaultGlobalClientCallbacks() override {}
void DefaultConstructor(ClientContext* context) GRPC_OVERRIDE {} void DefaultConstructor(ClientContext* context) override {}
void Destructor(ClientContext* context) GRPC_OVERRIDE {} void Destructor(ClientContext* context) override {}
}; };
static DefaultGlobalClientCallbacks g_default_client_callbacks; static DefaultGlobalClientCallbacks g_default_client_callbacks;

@ -40,12 +40,12 @@
namespace grpc { namespace grpc {
class CronetChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { class CronetChannelCredentialsImpl final : public ChannelCredentials {
public: public:
CronetChannelCredentialsImpl(void* engine) : engine_(engine) {} CronetChannelCredentialsImpl(void* engine) : engine_(engine) {}
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannel(
const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { const string& target, const grpc::ChannelArguments& args) override {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return CreateChannelInternal( return CreateChannelInternal(
@ -53,7 +53,7 @@ class CronetChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials {
&channel_args, nullptr)); &channel_args, nullptr));
} }
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { SecureChannelCredentials* AsSecureCredentials() override {
return nullptr; return nullptr;
} }

@ -43,10 +43,10 @@
namespace grpc { namespace grpc {
namespace { namespace {
class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { class InsecureChannelCredentialsImpl final : public ChannelCredentials {
public: public:
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannel(
const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE { const string& target, const grpc::ChannelArguments& args) override {
grpc_channel_args channel_args; grpc_channel_args channel_args;
args.SetChannelArgs(&channel_args); args.SetChannelArgs(&channel_args);
return CreateChannelInternal( return CreateChannelInternal(
@ -54,7 +54,7 @@ class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials {
grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr)); grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr));
} }
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { SecureChannelCredentials* AsSecureCredentials() override {
return nullptr; return nullptr;
} }
}; };

@ -43,34 +43,34 @@
namespace grpc { namespace grpc {
class SecureChannelCredentials GRPC_FINAL : public ChannelCredentials { class SecureChannelCredentials final : public ChannelCredentials {
public: public:
explicit SecureChannelCredentials(grpc_channel_credentials* c_creds); explicit SecureChannelCredentials(grpc_channel_credentials* c_creds);
~SecureChannelCredentials() { grpc_channel_credentials_release(c_creds_); } ~SecureChannelCredentials() { grpc_channel_credentials_release(c_creds_); }
grpc_channel_credentials* GetRawCreds() { return c_creds_; } grpc_channel_credentials* GetRawCreds() { return c_creds_; }
std::shared_ptr<grpc::Channel> CreateChannel( std::shared_ptr<grpc::Channel> CreateChannel(
const string& target, const grpc::ChannelArguments& args) GRPC_OVERRIDE; const string& target, const grpc::ChannelArguments& args) override;
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } SecureChannelCredentials* AsSecureCredentials() override { return this; }
private: private:
grpc_channel_credentials* const c_creds_; grpc_channel_credentials* const c_creds_;
}; };
class SecureCallCredentials GRPC_FINAL : public CallCredentials { class SecureCallCredentials final : public CallCredentials {
public: public:
explicit SecureCallCredentials(grpc_call_credentials* c_creds); explicit SecureCallCredentials(grpc_call_credentials* c_creds);
~SecureCallCredentials() { grpc_call_credentials_release(c_creds_); } ~SecureCallCredentials() { grpc_call_credentials_release(c_creds_); }
grpc_call_credentials* GetRawCreds() { return c_creds_; } grpc_call_credentials* GetRawCreds() { return c_creds_; }
bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE; bool ApplyToCall(grpc_call* call) override;
SecureCallCredentials* AsSecureCredentials() GRPC_OVERRIDE { return this; } SecureCallCredentials* AsSecureCredentials() override { return this; }
private: private:
grpc_call_credentials* const c_creds_; grpc_call_credentials* const c_creds_;
}; };
class MetadataCredentialsPluginWrapper GRPC_FINAL { class MetadataCredentialsPluginWrapper final {
public: public:
static void Destroy(void* wrapper); static void Destroy(void* wrapper);
static void GetMetadata(void* wrapper, grpc_auth_metadata_context context, static void GetMetadata(void* wrapper, grpc_auth_metadata_context context,

@ -268,7 +268,7 @@ namespace internal {
// Members of this class correspond to the members of the C // Members of this class correspond to the members of the C
// grpc_channel_filter struct. // grpc_channel_filter struct.
template <typename ChannelDataType, typename CallDataType> template <typename ChannelDataType, typename CallDataType>
class ChannelFilter GRPC_FINAL { class ChannelFilter final {
public: public:
static const size_t channel_data_size = sizeof(ChannelDataType); static const size_t channel_data_size = sizeof(ChannelDataType);

@ -40,30 +40,30 @@ struct grpc_auth_context;
namespace grpc { namespace grpc {
class SecureAuthContext GRPC_FINAL : public AuthContext { class SecureAuthContext final : public AuthContext {
public: public:
SecureAuthContext(grpc_auth_context* ctx, bool take_ownership); SecureAuthContext(grpc_auth_context* ctx, bool take_ownership);
~SecureAuthContext() GRPC_OVERRIDE; ~SecureAuthContext() override;
bool IsPeerAuthenticated() const GRPC_OVERRIDE; bool IsPeerAuthenticated() const override;
std::vector<grpc::string_ref> GetPeerIdentity() const GRPC_OVERRIDE; std::vector<grpc::string_ref> GetPeerIdentity() const override;
grpc::string GetPeerIdentityPropertyName() const GRPC_OVERRIDE; grpc::string GetPeerIdentityPropertyName() const override;
std::vector<grpc::string_ref> FindPropertyValues( std::vector<grpc::string_ref> FindPropertyValues(
const grpc::string& name) const GRPC_OVERRIDE; const grpc::string& name) const override;
AuthPropertyIterator begin() const GRPC_OVERRIDE; AuthPropertyIterator begin() const override;
AuthPropertyIterator end() const GRPC_OVERRIDE; AuthPropertyIterator end() const override;
void AddProperty(const grpc::string& key, void AddProperty(const grpc::string& key,
const grpc::string_ref& value) GRPC_OVERRIDE; const grpc::string_ref& value) override;
virtual bool SetPeerIdentityPropertyName(const grpc::string& name) virtual bool SetPeerIdentityPropertyName(const grpc::string& name)
GRPC_OVERRIDE; override;
private: private:
grpc_auth_context* ctx_; grpc_auth_context* ctx_;

@ -42,7 +42,7 @@
namespace grpc { namespace grpc {
class ProtoServerReflection GRPC_FINAL class ProtoServerReflection final
: public reflection::v1alpha::ServerReflection::Service { : public reflection::v1alpha::ServerReflection::Service {
public: public:
ProtoServerReflection(); ProtoServerReflection();
@ -56,7 +56,7 @@ class ProtoServerReflection GRPC_FINAL
ServerContext* context, ServerContext* context,
ServerReaderWriter<reflection::v1alpha::ServerReflectionResponse, ServerReaderWriter<reflection::v1alpha::ServerReflectionResponse,
reflection::v1alpha::ServerReflectionRequest>* stream) reflection::v1alpha::ServerReflectionRequest>* stream)
GRPC_OVERRIDE; override;
private: private:
Status ListService(ServerContext* context, Status ListService(ServerContext* context,

@ -46,12 +46,12 @@
namespace grpc { namespace grpc {
class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface { class DynamicThreadPool final : public ThreadPoolInterface {
public: public:
explicit DynamicThreadPool(int reserve_threads); explicit DynamicThreadPool(int reserve_threads);
~DynamicThreadPool(); ~DynamicThreadPool();
void Add(const std::function<void()>& callback) GRPC_OVERRIDE; void Add(const std::function<void()>& callback) override;
private: private:
class DynamicThread { class DynamicThread {

@ -38,14 +38,14 @@
namespace grpc { namespace grpc {
namespace { namespace {
class InsecureServerCredentialsImpl GRPC_FINAL : public ServerCredentials { class InsecureServerCredentialsImpl final : public ServerCredentials {
public: public:
int AddPortToServer(const grpc::string& addr, int AddPortToServer(const grpc::string& addr,
grpc_server* server) GRPC_OVERRIDE { grpc_server* server) override {
return grpc_server_add_insecure_http2_port(server, addr.c_str()); return grpc_server_add_insecure_http2_port(server, addr.c_str());
} }
void SetAuthMetadataProcessor( void SetAuthMetadataProcessor(
const std::shared_ptr<AuthMetadataProcessor>& processor) GRPC_OVERRIDE { const std::shared_ptr<AuthMetadataProcessor>& processor) override {
(void)processor; (void)processor;
GPR_ASSERT(0); // Should not be called on InsecureServerCredentials. GPR_ASSERT(0); // Should not be called on InsecureServerCredentials.
} }

@ -44,7 +44,7 @@
namespace grpc { namespace grpc {
class AuthMetadataProcessorAyncWrapper GRPC_FINAL { class AuthMetadataProcessorAyncWrapper final {
public: public:
static void Destroy(void* wrapper); static void Destroy(void* wrapper);
@ -64,19 +64,19 @@ class AuthMetadataProcessorAyncWrapper GRPC_FINAL {
std::shared_ptr<AuthMetadataProcessor> processor_; std::shared_ptr<AuthMetadataProcessor> processor_;
}; };
class SecureServerCredentials GRPC_FINAL : public ServerCredentials { class SecureServerCredentials final : public ServerCredentials {
public: public:
explicit SecureServerCredentials(grpc_server_credentials* creds) explicit SecureServerCredentials(grpc_server_credentials* creds)
: creds_(creds) {} : creds_(creds) {}
~SecureServerCredentials() GRPC_OVERRIDE { ~SecureServerCredentials() override {
grpc_server_credentials_release(creds_); grpc_server_credentials_release(creds_);
} }
int AddPortToServer(const grpc::string& addr, int AddPortToServer(const grpc::string& addr,
grpc_server* server) GRPC_OVERRIDE; grpc_server* server) override;
void SetAuthMetadataProcessor( void SetAuthMetadataProcessor(
const std::shared_ptr<AuthMetadataProcessor>& processor) GRPC_OVERRIDE; const std::shared_ptr<AuthMetadataProcessor>& processor) override;
private: private:
grpc_server_credentials* creds_; grpc_server_credentials* creds_;

@ -55,11 +55,11 @@
namespace grpc { namespace grpc {
class DefaultGlobalCallbacks GRPC_FINAL : public Server::GlobalCallbacks { class DefaultGlobalCallbacks final : public Server::GlobalCallbacks {
public: public:
~DefaultGlobalCallbacks() GRPC_OVERRIDE {} ~DefaultGlobalCallbacks() override {}
void PreSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} void PreSynchronousRequest(ServerContext* context) override {}
void PostSynchronousRequest(ServerContext* context) GRPC_OVERRIDE {} void PostSynchronousRequest(ServerContext* context) override {}
}; };
static std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr; static std::shared_ptr<Server::GlobalCallbacks> g_callbacks = nullptr;
@ -79,7 +79,7 @@ class Server::UnimplementedAsyncRequestContext {
GenericServerAsyncReaderWriter generic_stream_; GenericServerAsyncReaderWriter generic_stream_;
}; };
class Server::UnimplementedAsyncRequest GRPC_FINAL class Server::UnimplementedAsyncRequest final
: public UnimplementedAsyncRequestContext, : public UnimplementedAsyncRequestContext,
public GenericAsyncRequest { public GenericAsyncRequest {
public: public:
@ -89,7 +89,7 @@ class Server::UnimplementedAsyncRequest GRPC_FINAL
server_(server), server_(server),
cq_(cq) {} cq_(cq) {}
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; bool FinalizeResult(void** tag, bool* status) override;
ServerContext* context() { return &server_context_; } ServerContext* context() { return &server_context_; }
GenericServerAsyncReaderWriter* stream() { return &generic_stream_; } GenericServerAsyncReaderWriter* stream() { return &generic_stream_; }
@ -101,13 +101,13 @@ class Server::UnimplementedAsyncRequest GRPC_FINAL
typedef SneakyCallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> typedef SneakyCallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus>
UnimplementedAsyncResponseOp; UnimplementedAsyncResponseOp;
class Server::UnimplementedAsyncResponse GRPC_FINAL class Server::UnimplementedAsyncResponse final
: public UnimplementedAsyncResponseOp { : public UnimplementedAsyncResponseOp {
public: public:
UnimplementedAsyncResponse(UnimplementedAsyncRequest* request); UnimplementedAsyncResponse(UnimplementedAsyncRequest* request);
~UnimplementedAsyncResponse() { delete request_; } ~UnimplementedAsyncResponse() { delete request_; }
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
bool r = UnimplementedAsyncResponseOp::FinalizeResult(tag, status); bool r = UnimplementedAsyncResponseOp::FinalizeResult(tag, status);
delete this; delete this;
return r; return r;
@ -122,7 +122,7 @@ class ShutdownTag : public CompletionQueueTag {
bool FinalizeResult(void** tag, bool* status) { return false; } bool FinalizeResult(void** tag, bool* status) { return false; }
}; };
class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { class Server::SyncRequest final : public CompletionQueueTag {
public: public:
SyncRequest(RpcServiceMethod* method, void* tag) SyncRequest(RpcServiceMethod* method, void* tag)
: method_(method), : method_(method),
@ -170,7 +170,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
} }
} }
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool FinalizeResult(void** tag, bool* status) override {
if (!*status) { if (!*status) {
grpc_completion_queue_destroy(cq_); grpc_completion_queue_destroy(cq_);
} }
@ -182,7 +182,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
return true; return true;
} }
class CallData GRPC_FINAL { class CallData final {
public: public:
explicit CallData(Server* server, SyncRequest* mrd) explicit CallData(Server* server, SyncRequest* mrd)
: cq_(mrd->cq_), : cq_(mrd->cq_),
@ -255,7 +255,7 @@ class Server::SyncRequestThreadManager : public ThreadManager {
cq_timeout_msec_(cq_timeout_msec), cq_timeout_msec_(cq_timeout_msec),
global_callbacks_(global_callbacks) {} global_callbacks_(global_callbacks) {}
WorkStatus PollForWork(void** tag, bool* ok) GRPC_OVERRIDE { WorkStatus PollForWork(void** tag, bool* ok) override {
*tag = nullptr; *tag = nullptr;
gpr_timespec deadline = gpr_timespec deadline =
gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN); gpr_time_from_millis(cq_timeout_msec_, GPR_TIMESPAN);
@ -272,7 +272,7 @@ class Server::SyncRequestThreadManager : public ThreadManager {
GPR_UNREACHABLE_CODE(return TIMEOUT); GPR_UNREACHABLE_CODE(return TIMEOUT);
} }
void DoWork(void* tag, bool ok) GRPC_OVERRIDE { void DoWork(void* tag, bool ok) override {
SyncRequest* sync_req = static_cast<SyncRequest*>(tag); SyncRequest* sync_req = static_cast<SyncRequest*>(tag);
if (!sync_req) { if (!sync_req) {

@ -48,7 +48,7 @@ namespace grpc {
// CompletionOp // CompletionOp
class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface { class ServerContext::CompletionOp final : public CallOpSetInterface {
public: public:
// initial refs: one in the server context, one in the cq // initial refs: one in the server context, one in the cq
CompletionOp() CompletionOp()
@ -58,8 +58,8 @@ class ServerContext::CompletionOp GRPC_FINAL : public CallOpSetInterface {
finalized_(false), finalized_(false),
cancelled_(0) {} cancelled_(0) {}
void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE; void FillOps(grpc_op* ops, size_t* nops) override;
bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; bool FinalizeResult(void** tag, bool* status) override;
bool CheckCancelled(CompletionQueue* cq) { bool CheckCancelled(CompletionQueue* cq) {
cq->TryPluck(this); cq->TryPluck(this);

@ -67,7 +67,7 @@ namespace testing {
// ServiceA detached comment 2 // ServiceA detached comment 2
// //
// ServiceA leading comment 1 // ServiceA leading comment 1
class ServiceA GRPC_FINAL { class ServiceA final {
public: public:
class StubInterface { class StubInterface {
public: public:
@ -94,10 +94,10 @@ class ServiceA GRPC_FINAL {
virtual ::grpc::ClientWriterInterface< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) = 0; virtual ::grpc::ClientWriterInterface< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) = 0;
virtual ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) = 0; virtual ::grpc::ClientAsyncWriterInterface< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) = 0;
}; };
class Stub GRPC_FINAL : public StubInterface { class Stub final : public StubInterface {
public: public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; ::grpc::Status MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq)); return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodA1Raw(context, request, cq));
} }
@ -110,9 +110,9 @@ class ServiceA GRPC_FINAL {
private: private:
std::shared_ptr< ::grpc::ChannelInterface> channel_; std::shared_ptr< ::grpc::ChannelInterface> channel_;
::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodA1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override;
::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) GRPC_OVERRIDE; ::grpc::ClientWriter< ::grpc::testing::Request>* MethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response) override;
::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE; ::grpc::ClientAsyncWriter< ::grpc::testing::Request>* AsyncMethodA2Raw(::grpc::ClientContext* context, ::grpc::testing::Response* response, ::grpc::CompletionQueue* cq, void* tag) override;
const ::grpc::RpcMethod rpcmethod_MethodA1_; const ::grpc::RpcMethod rpcmethod_MethodA1_;
const ::grpc::RpcMethod rpcmethod_MethodA2_; const ::grpc::RpcMethod rpcmethod_MethodA2_;
}; };
@ -140,11 +140,11 @@ class ServiceA GRPC_FINAL {
WithAsyncMethod_MethodA1() { WithAsyncMethod_MethodA1() {
::grpc::Service::MarkMethodAsync(0); ::grpc::Service::MarkMethodAsync(0);
} }
~WithAsyncMethod_MethodA1() GRPC_OVERRIDE { ~WithAsyncMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -160,11 +160,11 @@ class ServiceA GRPC_FINAL {
WithAsyncMethod_MethodA2() { WithAsyncMethod_MethodA2() {
::grpc::Service::MarkMethodAsync(1); ::grpc::Service::MarkMethodAsync(1);
} }
~WithAsyncMethod_MethodA2() GRPC_OVERRIDE { ~WithAsyncMethod_MethodA2() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -181,11 +181,11 @@ class ServiceA GRPC_FINAL {
WithGenericMethod_MethodA1() { WithGenericMethod_MethodA1() {
::grpc::Service::MarkMethodGeneric(0); ::grpc::Service::MarkMethodGeneric(0);
} }
~WithGenericMethod_MethodA1() GRPC_OVERRIDE { ~WithGenericMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -198,11 +198,11 @@ class ServiceA GRPC_FINAL {
WithGenericMethod_MethodA2() { WithGenericMethod_MethodA2() {
::grpc::Service::MarkMethodGeneric(1); ::grpc::Service::MarkMethodGeneric(1);
} }
~WithGenericMethod_MethodA2() GRPC_OVERRIDE { ~WithGenericMethod_MethodA2() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodA2(::grpc::ServerContext* context, ::grpc::ServerReader< ::grpc::testing::Request>* reader, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -216,11 +216,11 @@ class ServiceA GRPC_FINAL {
::grpc::Service::MarkMethodStreamed(0, ::grpc::Service::MarkMethodStreamed(0,
new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodA1<BaseClass>::StreamedMethodA1, this, std::placeholders::_1, std::placeholders::_2))); new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodA1<BaseClass>::StreamedMethodA1, this, std::placeholders::_1, std::placeholders::_2)));
} }
~WithStreamedUnaryMethod_MethodA1() GRPC_OVERRIDE { ~WithStreamedUnaryMethod_MethodA1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable regular version of this method // disable regular version of this method
::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodA1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -233,7 +233,7 @@ class ServiceA GRPC_FINAL {
}; };
// ServiceB leading comment 1 // ServiceB leading comment 1
class ServiceB GRPC_FINAL { class ServiceB final {
public: public:
class StubInterface { class StubInterface {
public: public:
@ -247,17 +247,17 @@ class ServiceB GRPC_FINAL {
private: private:
virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0; virtual ::grpc::ClientAsyncResponseReaderInterface< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) = 0;
}; };
class Stub GRPC_FINAL : public StubInterface { class Stub final : public StubInterface {
public: public:
Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel); Stub(const std::shared_ptr< ::grpc::ChannelInterface>& channel);
::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) GRPC_OVERRIDE; ::grpc::Status MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::testing::Response* response) override;
std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) { std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>> AsyncMethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq)); return std::unique_ptr< ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>>(AsyncMethodB1Raw(context, request, cq));
} }
private: private:
std::shared_ptr< ::grpc::ChannelInterface> channel_; std::shared_ptr< ::grpc::ChannelInterface> channel_;
::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) GRPC_OVERRIDE; ::grpc::ClientAsyncResponseReader< ::grpc::testing::Response>* AsyncMethodB1Raw(::grpc::ClientContext* context, const ::grpc::testing::Request& request, ::grpc::CompletionQueue* cq) override;
const ::grpc::RpcMethod rpcmethod_MethodB1_; const ::grpc::RpcMethod rpcmethod_MethodB1_;
}; };
static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions()); static std::unique_ptr<Stub> NewStub(const std::shared_ptr< ::grpc::ChannelInterface>& channel, const ::grpc::StubOptions& options = ::grpc::StubOptions());
@ -278,11 +278,11 @@ class ServiceB GRPC_FINAL {
WithAsyncMethod_MethodB1() { WithAsyncMethod_MethodB1() {
::grpc::Service::MarkMethodAsync(0); ::grpc::Service::MarkMethodAsync(0);
} }
~WithAsyncMethod_MethodB1() GRPC_OVERRIDE { ~WithAsyncMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -299,11 +299,11 @@ class ServiceB GRPC_FINAL {
WithGenericMethod_MethodB1() { WithGenericMethod_MethodB1() {
::grpc::Service::MarkMethodGeneric(0); ::grpc::Service::MarkMethodGeneric(0);
} }
~WithGenericMethod_MethodB1() GRPC_OVERRIDE { ~WithGenericMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable synchronous version of this method // disable synchronous version of this method
::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }
@ -317,11 +317,11 @@ class ServiceB GRPC_FINAL {
::grpc::Service::MarkMethodStreamed(0, ::grpc::Service::MarkMethodStreamed(0,
new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodB1<BaseClass>::StreamedMethodB1, this, std::placeholders::_1, std::placeholders::_2))); new ::grpc::StreamedUnaryHandler< ::grpc::testing::Request, ::grpc::testing::Response>(std::bind(&WithStreamedUnaryMethod_MethodB1<BaseClass>::StreamedMethodB1, this, std::placeholders::_1, std::placeholders::_2)));
} }
~WithStreamedUnaryMethod_MethodB1() GRPC_OVERRIDE { ~WithStreamedUnaryMethod_MethodB1() override {
BaseClassMustBeDerivedFromService(this); BaseClassMustBeDerivedFromService(this);
} }
// disable regular version of this method // disable regular version of this method
::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) GRPC_FINAL GRPC_OVERRIDE { ::grpc::Status MethodB1(::grpc::ServerContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response) final override {
abort(); abort();
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, ""); return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
} }

@ -56,7 +56,7 @@ class TestAuthPropertyIterator : public AuthPropertyIterator {
class AuthPropertyIteratorTest : public ::testing::Test { class AuthPropertyIteratorTest : public ::testing::Test {
protected: protected:
void SetUp() GRPC_OVERRIDE { void SetUp() override {
ctx_ = grpc_auth_context_create(NULL); ctx_ = grpc_auth_context_create(NULL);
grpc_auth_context_add_cstring_property(ctx_, "name", "chapi"); grpc_auth_context_add_cstring_property(ctx_, "name", "chapi");
grpc_auth_context_add_cstring_property(ctx_, "name", "chapo"); grpc_auth_context_add_cstring_property(ctx_, "name", "chapo");
@ -64,7 +64,7 @@ class AuthPropertyIteratorTest : public ::testing::Test {
EXPECT_EQ(1, EXPECT_EQ(1,
grpc_auth_context_set_peer_identity_property_name(ctx_, "name")); grpc_auth_context_set_peer_identity_property_name(ctx_, "name"));
} }
void TearDown() GRPC_OVERRIDE { grpc_auth_context_release(ctx_); } void TearDown() override { grpc_auth_context_release(ctx_); }
grpc_auth_context* ctx_; grpc_auth_context* ctx_;
}; };

@ -211,10 +211,10 @@ bool plugin_has_sync_methods(std::unique_ptr<ServerBuilderPlugin>& plugin) {
// that needs to be tested here. // that needs to be tested here.
class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption { class ServerBuilderSyncPluginDisabler : public ::grpc::ServerBuilderOption {
public: public:
void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {} void UpdateArguments(ChannelArguments* arg) override {}
void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
GRPC_OVERRIDE { override {
plugins->erase(std::remove_if(plugins->begin(), plugins->end(), plugins->erase(std::remove_if(plugins->begin(), plugins->end(),
plugin_has_sync_methods), plugin_has_sync_methods),
plugins->end()); plugins->end());
@ -246,7 +246,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
protected: protected:
AsyncEnd2endTest() { GetParam().Log(); } AsyncEnd2endTest() { GetParam().Log(); }
void SetUp() GRPC_OVERRIDE { void SetUp() override {
poll_overrider_.reset(new PollingOverrider(!GetParam().disable_blocking)); poll_overrider_.reset(new PollingOverrider(!GetParam().disable_blocking));
port_ = grpc_pick_unused_port_or_die(); port_ = grpc_pick_unused_port_or_die();
@ -269,7 +269,7 @@ class AsyncEnd2endTest : public ::testing::TestWithParam<TestScenario> {
gpr_tls_set(&g_is_async_end2end_test, 1); gpr_tls_set(&g_is_async_end2end_test, 1);
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
server_->Shutdown(); server_->Shutdown();
void* ignored_tag; void* ignored_tag;
bool ignored_ok; bool ignored_ok;

@ -58,11 +58,11 @@ using namespace gflags;
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class ServiceImpl GRPC_FINAL class ServiceImpl final
: public ::grpc::testing::EchoTestService::Service { : public ::grpc::testing::EchoTestService::Service {
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE { override {
EchoRequest request; EchoRequest request;
EchoResponse response; EchoResponse response;
while (stream->Read(&request)) { while (stream->Read(&request)) {

@ -92,12 +92,12 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin {
is_blocking_(is_blocking), is_blocking_(is_blocking),
is_successful_(is_successful) {} is_successful_(is_successful) {}
bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; } bool IsBlocking() const override { return is_blocking_; }
Status GetMetadata(grpc::string_ref service_url, grpc::string_ref method_name, Status GetMetadata(grpc::string_ref service_url, grpc::string_ref method_name,
const grpc::AuthContext& channel_auth_context, const grpc::AuthContext& channel_auth_context,
std::multimap<grpc::string, grpc::string>* metadata) std::multimap<grpc::string, grpc::string>* metadata)
GRPC_OVERRIDE { override {
EXPECT_GT(service_url.length(), 0UL); EXPECT_GT(service_url.length(), 0UL);
EXPECT_GT(method_name.length(), 0UL); EXPECT_GT(method_name.length(), 0UL);
EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated()); EXPECT_TRUE(channel_auth_context.IsPeerAuthenticated());
@ -145,11 +145,11 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor {
} }
// Interface implementation // Interface implementation
bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; } bool IsBlocking() const override { return is_blocking_; }
Status Process(const InputMetadata& auth_metadata, AuthContext* context, Status Process(const InputMetadata& auth_metadata, AuthContext* context,
OutputMetadata* consumed_auth_metadata, OutputMetadata* consumed_auth_metadata,
OutputMetadata* response_metadata) GRPC_OVERRIDE { OutputMetadata* response_metadata) override {
EXPECT_TRUE(consumed_auth_metadata != nullptr); EXPECT_TRUE(consumed_auth_metadata != nullptr);
EXPECT_TRUE(context != nullptr); EXPECT_TRUE(context != nullptr);
EXPECT_TRUE(response_metadata != nullptr); EXPECT_TRUE(response_metadata != nullptr);
@ -185,7 +185,7 @@ class Proxy : public ::grpc::testing::EchoTestService::Service {
: stub_(grpc::testing::EchoTestService::NewStub(channel)) {} : stub_(grpc::testing::EchoTestService::NewStub(channel)) {}
Status Echo(ServerContext* server_context, const EchoRequest* request, Status Echo(ServerContext* server_context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
std::unique_ptr<ClientContext> client_context = std::unique_ptr<ClientContext> client_context =
ClientContext::FromServerContext(*server_context); ClientContext::FromServerContext(*server_context);
return stub_->Echo(client_context.get(), *request, response); return stub_->Echo(client_context.get(), *request, response);
@ -199,7 +199,7 @@ class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service { : public ::grpc::testing::duplicate::EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message("no package"); response->set_message("no package");
return Status::OK; return Status::OK;
} }
@ -229,7 +229,7 @@ class End2endTest : public ::testing::TestWithParam<TestScenario> {
GetParam().Log(); GetParam().Log();
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
if (is_server_started_) { if (is_server_started_) {
server_->Shutdown(); server_->Shutdown();
if (proxy_server_) proxy_server_->Shutdown(); if (proxy_server_) proxy_server_->Shutdown();
@ -1496,7 +1496,7 @@ class ResourceQuotaEnd2endTest : public End2endTest {
ResourceQuotaEnd2endTest() ResourceQuotaEnd2endTest()
: server_resource_quota_("server_resource_quota") {} : server_resource_quota_("server_resource_quota") {}
virtual void ConfigureServerBuilder(ServerBuilder* builder) GRPC_OVERRIDE { virtual void ConfigureServerBuilder(ServerBuilder* builder) override {
builder->SetResourceQuota(server_resource_quota_); builder->SetResourceQuota(server_resource_quota_);
} }

@ -126,7 +126,7 @@ class CallDataImpl : public CallData {
: CallData(channel_data) {} : CallData(channel_data) {}
void StartTransportStreamOp(grpc_exec_ctx* exec_ctx, grpc_call_element* elem, void StartTransportStreamOp(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
TransportStreamOp* op) GRPC_OVERRIDE { TransportStreamOp* op) override {
// Incrementing the counter could be done from the ctor, but we want // Incrementing the counter could be done from the ctor, but we want
// to test that the individual methods are actually called correctly. // to test that the individual methods are actually called correctly.
if (op->recv_initial_metadata() != nullptr) IncrementCallCounter(); if (op->recv_initial_metadata() != nullptr) IncrementCallCounter();
@ -138,7 +138,7 @@ class FilterEnd2endTest : public ::testing::Test {
protected: protected:
FilterEnd2endTest() : server_host_("localhost") {} FilterEnd2endTest() : server_host_("localhost") {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
int port = grpc_pick_unused_port_or_die(); int port = grpc_pick_unused_port_or_die();
server_address_ << server_host_ << ":" << port; server_address_ << server_host_ << ":" << port;
// Setup server // Setup server
@ -150,7 +150,7 @@ class FilterEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
server_->Shutdown(); server_->Shutdown();
void* ignored_tag; void* ignored_tag;
bool ignored_ok; bool ignored_ok;

@ -75,7 +75,7 @@ class GenericEnd2endTest : public ::testing::Test {
protected: protected:
GenericEnd2endTest() : server_host_("localhost") {} GenericEnd2endTest() : server_host_("localhost") {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
int port = grpc_pick_unused_port_or_die(); int port = grpc_pick_unused_port_or_die();
server_address_ << server_host_ << ":" << port; server_address_ << server_host_ << ":" << port;
// Setup server // Setup server
@ -91,7 +91,7 @@ class GenericEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
server_->Shutdown(); server_->Shutdown();
void* ignored_tag; void* ignored_tag;
bool ignored_ok; bool ignored_ok;

@ -188,7 +188,7 @@ class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service { : public ::grpc::testing::duplicate::EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message(request->message() + "_dup"); response->set_message(request->message() + "_dup");
return Status::OK; return Status::OK;
} }
@ -230,7 +230,7 @@ class HybridEnd2endTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
if (server_) { if (server_) {
server_->Shutdown(); server_->Shutdown();
} }
@ -451,7 +451,7 @@ class StreamedUnaryDupPkg
public: public:
Status StreamedEcho(ServerContext* context, Status StreamedEcho(ServerContext* context,
ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
GRPC_OVERRIDE { override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;
@ -489,7 +489,7 @@ class FullyStreamedUnaryDupPkg
public: public:
Status StreamedEcho(ServerContext* context, Status StreamedEcho(ServerContext* context,
ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
GRPC_OVERRIDE { override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;
@ -528,7 +528,7 @@ class SplitResponseStreamDupPkg
public: public:
Status StreamedResponseStream( Status StreamedResponseStream(
ServerContext* context, ServerContext* context,
ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE { ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;
@ -568,7 +568,7 @@ class FullySplitStreamedDupPkg
public: public:
Status StreamedResponseStream( Status StreamedResponseStream(
ServerContext* context, ServerContext* context,
ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE { ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;
@ -607,7 +607,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService {
public: public:
Status StreamedEcho(ServerContext* context, Status StreamedEcho(ServerContext* context,
ServerUnaryStreamer<EchoRequest, EchoResponse>* stream) ServerUnaryStreamer<EchoRequest, EchoResponse>* stream)
GRPC_OVERRIDE { override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;
@ -620,7 +620,7 @@ class FullyStreamedDupPkg : public duplicate::EchoTestService::StreamedService {
} }
Status StreamedResponseStream( Status StreamedResponseStream(
ServerContext* context, ServerContext* context,
ServerSplitStreamer<EchoRequest, EchoResponse>* stream) GRPC_OVERRIDE { ServerSplitStreamer<EchoRequest, EchoResponse>* stream) override {
EchoRequest req; EchoRequest req;
EchoResponse resp; EchoResponse resp;
uint32_t next_msg_sz; uint32_t next_msg_sz;

@ -61,46 +61,46 @@ namespace testing {
namespace { namespace {
template <class W, class R> template <class W, class R>
class MockClientReaderWriter GRPC_FINAL class MockClientReaderWriter final
: public ClientReaderWriterInterface<W, R> { : public ClientReaderWriterInterface<W, R> {
public: public:
void WaitForInitialMetadata() GRPC_OVERRIDE {} void WaitForInitialMetadata() override {}
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
*sz = UINT_MAX; *sz = UINT_MAX;
return true; return true;
} }
bool Read(R* msg) GRPC_OVERRIDE { return true; } bool Read(R* msg) override { return true; }
bool Write(const W& msg) GRPC_OVERRIDE { return true; } bool Write(const W& msg) override { return true; }
bool WritesDone() GRPC_OVERRIDE { return true; } bool WritesDone() override { return true; }
Status Finish() GRPC_OVERRIDE { return Status::OK; } Status Finish() override { return Status::OK; }
}; };
template <> template <>
class MockClientReaderWriter<EchoRequest, EchoResponse> GRPC_FINAL class MockClientReaderWriter<EchoRequest, EchoResponse> final
: public ClientReaderWriterInterface<EchoRequest, EchoResponse> { : public ClientReaderWriterInterface<EchoRequest, EchoResponse> {
public: public:
MockClientReaderWriter() : writes_done_(false) {} MockClientReaderWriter() : writes_done_(false) {}
void WaitForInitialMetadata() GRPC_OVERRIDE {} void WaitForInitialMetadata() override {}
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE { bool NextMessageSize(uint32_t* sz) override {
*sz = UINT_MAX; *sz = UINT_MAX;
return true; return true;
} }
bool Read(EchoResponse* msg) GRPC_OVERRIDE { bool Read(EchoResponse* msg) override {
if (writes_done_) return false; if (writes_done_) return false;
msg->set_message(last_message_); msg->set_message(last_message_);
return true; return true;
} }
bool Write(const EchoRequest& msg, bool Write(const EchoRequest& msg,
const WriteOptions& options) GRPC_OVERRIDE { const WriteOptions& options) override {
gpr_log(GPR_INFO, "mock recv msg %s", msg.message().c_str()); gpr_log(GPR_INFO, "mock recv msg %s", msg.message().c_str());
last_message_ = msg.message(); last_message_ = msg.message();
return true; return true;
} }
bool WritesDone() GRPC_OVERRIDE { bool WritesDone() override {
writes_done_ = true; writes_done_ = true;
return true; return true;
} }
Status Finish() GRPC_OVERRIDE { return Status::OK; } Status Finish() override { return Status::OK; }
private: private:
bool writes_done_; bool writes_done_;
@ -113,51 +113,51 @@ class MockStub : public EchoTestService::StubInterface {
MockStub() {} MockStub() {}
~MockStub() {} ~MockStub() {}
Status Echo(ClientContext* context, const EchoRequest& request, Status Echo(ClientContext* context, const EchoRequest& request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message(request.message()); response->set_message(request.message());
return Status::OK; return Status::OK;
} }
Status Unimplemented(ClientContext* context, const EchoRequest& request, Status Unimplemented(ClientContext* context, const EchoRequest& request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
return Status::OK; return Status::OK;
} }
private: private:
ClientAsyncResponseReaderInterface<EchoResponse>* AsyncEchoRaw( ClientAsyncResponseReaderInterface<EchoResponse>* AsyncEchoRaw(
ClientContext* context, const EchoRequest& request, ClientContext* context, const EchoRequest& request,
CompletionQueue* cq) GRPC_OVERRIDE { CompletionQueue* cq) override {
return nullptr; return nullptr;
} }
ClientWriterInterface<EchoRequest>* RequestStreamRaw( ClientWriterInterface<EchoRequest>* RequestStreamRaw(
ClientContext* context, EchoResponse* response) GRPC_OVERRIDE { ClientContext* context, EchoResponse* response) override {
return nullptr; return nullptr;
} }
ClientAsyncWriterInterface<EchoRequest>* AsyncRequestStreamRaw( ClientAsyncWriterInterface<EchoRequest>* AsyncRequestStreamRaw(
ClientContext* context, EchoResponse* response, CompletionQueue* cq, ClientContext* context, EchoResponse* response, CompletionQueue* cq,
void* tag) GRPC_OVERRIDE { void* tag) override {
return nullptr; return nullptr;
} }
ClientReaderInterface<EchoResponse>* ResponseStreamRaw( ClientReaderInterface<EchoResponse>* ResponseStreamRaw(
ClientContext* context, const EchoRequest& request) GRPC_OVERRIDE { ClientContext* context, const EchoRequest& request) override {
return nullptr; return nullptr;
} }
ClientAsyncReaderInterface<EchoResponse>* AsyncResponseStreamRaw( ClientAsyncReaderInterface<EchoResponse>* AsyncResponseStreamRaw(
ClientContext* context, const EchoRequest& request, CompletionQueue* cq, ClientContext* context, const EchoRequest& request, CompletionQueue* cq,
void* tag) GRPC_OVERRIDE { void* tag) override {
return nullptr; return nullptr;
} }
ClientReaderWriterInterface<EchoRequest, EchoResponse>* BidiStreamRaw( ClientReaderWriterInterface<EchoRequest, EchoResponse>* BidiStreamRaw(
ClientContext* context) GRPC_OVERRIDE { ClientContext* context) override {
return new MockClientReaderWriter<EchoRequest, EchoResponse>(); return new MockClientReaderWriter<EchoRequest, EchoResponse>();
} }
ClientAsyncReaderWriterInterface<EchoRequest, EchoResponse>* ClientAsyncReaderWriterInterface<EchoRequest, EchoResponse>*
AsyncBidiStreamRaw(ClientContext* context, CompletionQueue* cq, AsyncBidiStreamRaw(ClientContext* context, CompletionQueue* cq,
void* tag) GRPC_OVERRIDE { void* tag) override {
return nullptr; return nullptr;
} }
ClientAsyncResponseReaderInterface<EchoResponse>* AsyncUnimplementedRaw( ClientAsyncResponseReaderInterface<EchoResponse>* AsyncUnimplementedRaw(
ClientContext* context, const EchoRequest& request, ClientContext* context, const EchoRequest& request,
CompletionQueue* cq) GRPC_OVERRIDE { CompletionQueue* cq) override {
return nullptr; return nullptr;
} }
}; };
@ -216,14 +216,14 @@ class FakeClient {
class TestServiceImpl : public EchoTestService::Service { class TestServiceImpl : public EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message(request->message()); response->set_message(request->message());
return Status::OK; return Status::OK;
} }
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE { override {
EchoRequest request; EchoRequest request;
EchoResponse response; EchoResponse response;
while (stream->Read(&request)) { while (stream->Read(&request)) {
@ -239,7 +239,7 @@ class MockTest : public ::testing::Test {
protected: protected:
MockTest() {} MockTest() {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
int port = grpc_pick_unused_port_or_die(); int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port; server_address_ << "localhost:" << port;
// Setup server // Setup server
@ -250,7 +250,7 @@ class MockTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void TearDown() override { server_->Shutdown(); }
void ResetStub() { void ResetStub() {
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =

@ -56,7 +56,7 @@ class ProtoServerReflectionTest : public ::testing::Test {
public: public:
ProtoServerReflectionTest() {} ProtoServerReflectionTest() {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
port_ = grpc_pick_unused_port_or_die(); port_ = grpc_pick_unused_port_or_die();
ref_desc_pool_ = protobuf::DescriptorPool::generated_pool(); ref_desc_pool_ = protobuf::DescriptorPool::generated_pool();

@ -65,29 +65,29 @@ class TestServerBuilderPlugin : public ServerBuilderPlugin {
register_service_ = false; register_service_ = false;
} }
grpc::string name() GRPC_OVERRIDE { return PLUGIN_NAME; } grpc::string name() override { return PLUGIN_NAME; }
void InitServer(ServerInitializer* si) GRPC_OVERRIDE { void InitServer(ServerInitializer* si) override {
init_server_is_called_ = true; init_server_is_called_ = true;
if (register_service_) { if (register_service_) {
si->RegisterService(service_); si->RegisterService(service_);
} }
} }
void Finish(ServerInitializer* si) GRPC_OVERRIDE { finish_is_called_ = true; } void Finish(ServerInitializer* si) override { finish_is_called_ = true; }
void ChangeArguments(const grpc::string& name, void* value) GRPC_OVERRIDE { void ChangeArguments(const grpc::string& name, void* value) override {
change_arguments_is_called_ = true; change_arguments_is_called_ = true;
} }
bool has_async_methods() const GRPC_OVERRIDE { bool has_async_methods() const override {
if (register_service_) { if (register_service_) {
return service_->has_async_methods(); return service_->has_async_methods();
} }
return false; return false;
} }
bool has_sync_methods() const GRPC_OVERRIDE { bool has_sync_methods() const override {
if (register_service_) { if (register_service_) {
return service_->has_synchronous_methods(); return service_->has_synchronous_methods();
} }
@ -112,10 +112,10 @@ class InsertPluginServerBuilderOption : public ServerBuilderOption {
public: public:
InsertPluginServerBuilderOption() { register_service_ = false; } InsertPluginServerBuilderOption() { register_service_ = false; }
void UpdateArguments(ChannelArguments* arg) GRPC_OVERRIDE {} void UpdateArguments(ChannelArguments* arg) override {}
void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins) void UpdatePlugins(std::vector<std::unique_ptr<ServerBuilderPlugin>>* plugins)
GRPC_OVERRIDE { override {
plugins->clear(); plugins->clear();
std::unique_ptr<TestServerBuilderPlugin> plugin( std::unique_ptr<TestServerBuilderPlugin> plugin(
@ -154,7 +154,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
public: public:
ServerBuilderPluginTest() {} ServerBuilderPluginTest() {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
port_ = grpc_pick_unused_port_or_die(); port_ = grpc_pick_unused_port_or_die();
builder_.reset(new ServerBuilder()); builder_.reset(new ServerBuilder());
} }
@ -202,7 +202,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
stub_ = grpc::testing::EchoTestService::NewStub(channel_); stub_ = grpc::testing::EchoTestService::NewStub(channel_);
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
auto plugin = CheckPresent(); auto plugin = CheckPresent();
EXPECT_TRUE(plugin); EXPECT_TRUE(plugin);
EXPECT_TRUE(plugin->init_server_is_called()); EXPECT_TRUE(plugin->init_server_is_called());

@ -60,14 +60,14 @@ namespace testing {
namespace { namespace {
class ServiceImpl GRPC_FINAL class ServiceImpl final
: public ::grpc::testing::EchoTestService::Service { : public ::grpc::testing::EchoTestService::Service {
public: public:
ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {} ServiceImpl() : bidi_stream_count_(0), response_stream_count_(0) {}
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE { override {
bidi_stream_count_++; bidi_stream_count_++;
EchoRequest request; EchoRequest request;
EchoResponse response; EchoResponse response;
@ -82,7 +82,7 @@ class ServiceImpl GRPC_FINAL
} }
Status ResponseStream(ServerContext* context, const EchoRequest* request, Status ResponseStream(ServerContext* context, const EchoRequest* request,
ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE { ServerWriter<EchoResponse>* writer) override {
EchoResponse response; EchoResponse response;
response_stream_count_++; response_stream_count_++;
for (int i = 0;; i++) { for (int i = 0;; i++) {

@ -61,7 +61,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {} explicit TestServiceImpl(gpr_event* ev) : ev_(ev) {}
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
gpr_event_set(ev_, (void*)1); gpr_event_set(ev_, (void*)1);
while (!context->IsCancelled()) { while (!context->IsCancelled()) {
} }
@ -76,7 +76,7 @@ class ShutdownTest : public ::testing::Test {
public: public:
ShutdownTest() : shutdown_(false), service_(&ev_) { gpr_event_init(&ev_); } ShutdownTest() : shutdown_(false), service_(&ev_) { gpr_event_init(&ev_); }
void SetUp() GRPC_OVERRIDE { void SetUp() override {
port_ = grpc_pick_unused_port_or_die(); port_ = grpc_pick_unused_port_or_die();
server_ = SetUpServer(port_); server_ = SetUpServer(port_);
} }
@ -91,7 +91,7 @@ class ShutdownTest : public ::testing::Test {
return server; return server;
} }
void TearDown() GRPC_OVERRIDE { GPR_ASSERT(shutdown_); } void TearDown() override { GPR_ASSERT(shutdown_); }
void ResetStub() { void ResetStub() {
string target = "dns:localhost:" + to_string(port_); string target = "dns:localhost:" + to_string(port_);

@ -123,7 +123,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
// Only implement the one method we will be calling for brevity. // Only implement the one method we will be calling for brevity.
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE { override {
EchoRequest request; EchoRequest request;
gpr_atm should_exit; gpr_atm should_exit;
gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0)); gpr_atm_rel_store(&should_exit, static_cast<gpr_atm>(0));
@ -147,7 +147,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
class End2endTest : public ::testing::Test { class End2endTest : public ::testing::Test {
protected: protected:
void SetUp() GRPC_OVERRIDE { void SetUp() override {
int port = grpc_pick_unused_port_or_die(); int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port; server_address_ << "localhost:" << port;
// Setup server // Setup server
@ -158,7 +158,7 @@ class End2endTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void TearDown() override { server_->Shutdown(); }
void ResetStub() { void ResetStub() {
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =

@ -63,20 +63,20 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
: signal_client_(false), host_(new grpc::string(host)) {} : signal_client_(false), host_(new grpc::string(host)) {}
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE; EchoResponse* response) override;
// Unimplemented is left unimplemented to test the returned error. // Unimplemented is left unimplemented to test the returned error.
Status RequestStream(ServerContext* context, Status RequestStream(ServerContext* context,
ServerReader<EchoRequest>* reader, ServerReader<EchoRequest>* reader,
EchoResponse* response) GRPC_OVERRIDE; EchoResponse* response) override;
Status ResponseStream(ServerContext* context, const EchoRequest* request, Status ResponseStream(ServerContext* context, const EchoRequest* request,
ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE; ServerWriter<EchoResponse>* writer) override;
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE; override;
bool signal_client() { bool signal_client() {
std::unique_lock<std::mutex> lock(mu_); std::unique_lock<std::mutex> lock(mu_);

@ -86,7 +86,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
TestServiceImpl() : signal_client_(false) {} TestServiceImpl() : signal_client_(false) {}
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message(request->message()); response->set_message(request->message());
MaybeEchoDeadline(context, request, response); MaybeEchoDeadline(context, request, response);
if (request->has_param() && request->param().client_cancel_after_us()) { if (request->has_param() && request->param().client_cancel_after_us()) {
@ -118,7 +118,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
Status RequestStream(ServerContext* context, Status RequestStream(ServerContext* context,
ServerReader<EchoRequest>* reader, ServerReader<EchoRequest>* reader,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
EchoRequest request; EchoRequest request;
response->set_message(""); response->set_message("");
while (reader->Read(&request)) { while (reader->Read(&request)) {
@ -130,7 +130,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
// Return 3 messages. // Return 3 messages.
// TODO(yangg) make it generic by adding a parameter into EchoRequest // TODO(yangg) make it generic by adding a parameter into EchoRequest
Status ResponseStream(ServerContext* context, const EchoRequest* request, Status ResponseStream(ServerContext* context, const EchoRequest* request,
ServerWriter<EchoResponse>* writer) GRPC_OVERRIDE { ServerWriter<EchoResponse>* writer) override {
EchoResponse response; EchoResponse response;
response.set_message(request->message() + "0"); response.set_message(request->message() + "0");
writer->Write(response); writer->Write(response);
@ -144,7 +144,7 @@ class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
Status BidiStream(ServerContext* context, Status BidiStream(ServerContext* context,
ServerReaderWriter<EchoResponse, EchoRequest>* stream) ServerReaderWriter<EchoResponse, EchoRequest>* stream)
GRPC_OVERRIDE { override {
EchoRequest request; EchoRequest request;
EchoResponse response; EchoResponse response;
while (stream->Read(&request)) { while (stream->Read(&request)) {
@ -169,7 +169,7 @@ class TestServiceImplDupPkg
: public ::grpc::testing::duplicate::EchoTestService::Service { : public ::grpc::testing::duplicate::EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
response->set_message("no package"); response->set_message("no package");
return Status::OK; return Status::OK;
} }
@ -215,12 +215,12 @@ class CommonStressTest {
class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> { class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
public: public:
void SetUp() GRPC_OVERRIDE { void SetUp() override {
ServerBuilder builder; ServerBuilder builder;
SetUpStart(&builder, &service_); SetUpStart(&builder, &service_);
SetUpEnd(&builder); SetUpEnd(&builder);
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
TearDownStart(); TearDownStart();
TearDownEnd(); TearDownEnd();
} }
@ -232,7 +232,7 @@ class CommonStressTestSyncServer : public CommonStressTest<TestServiceImpl> {
class CommonStressTestAsyncServer class CommonStressTestAsyncServer
: public CommonStressTest<grpc::testing::EchoTestService::AsyncService> { : public CommonStressTest<grpc::testing::EchoTestService::AsyncService> {
public: public:
void SetUp() GRPC_OVERRIDE { void SetUp() override {
shutting_down_ = false; shutting_down_ = false;
ServerBuilder builder; ServerBuilder builder;
SetUpStart(&builder, &service_); SetUpStart(&builder, &service_);
@ -247,7 +247,7 @@ class CommonStressTestAsyncServer
new std::thread(&CommonStressTestAsyncServer::ProcessRpcs, this)); new std::thread(&CommonStressTestAsyncServer::ProcessRpcs, this));
} }
} }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
{ {
unique_lock<mutex> l(mu_); unique_lock<mutex> l(mu_);
TearDownStart(); TearDownStart();
@ -323,8 +323,8 @@ template <class Common>
class End2endTest : public ::testing::Test { class End2endTest : public ::testing::Test {
protected: protected:
End2endTest() {} End2endTest() {}
void SetUp() GRPC_OVERRIDE { common_.SetUp(); } void SetUp() override { common_.SetUp(); }
void TearDown() GRPC_OVERRIDE { common_.TearDown(); } void TearDown() override { common_.TearDown(); }
void ResetStub() { common_.ResetStub(); } void ResetStub() { common_.ResetStub(); }
Common common_; Common common_;
@ -369,8 +369,8 @@ class AsyncClientEnd2endTest : public ::testing::Test {
protected: protected:
AsyncClientEnd2endTest() : rpcs_outstanding_(0) {} AsyncClientEnd2endTest() : rpcs_outstanding_(0) {}
void SetUp() GRPC_OVERRIDE { common_.SetUp(); } void SetUp() override { common_.SetUp(); }
void TearDown() GRPC_OVERRIDE { void TearDown() override {
void* ignored_tag; void* ignored_tag;
bool ignored_ok; bool ignored_ok;
while (cq_.Next(&ignored_tag, &ignored_ok)) while (cq_.Next(&ignored_tag, &ignored_ok))

@ -113,7 +113,7 @@ class ClientRequestCreator<ByteBuffer> {
} }
}; };
class HistogramEntry GRPC_FINAL { class HistogramEntry final {
public: public:
HistogramEntry() : value_used_(false), status_used_(false) {} HistogramEntry() : value_used_(false), status_used_(false) {}
bool value_used() const { return value_used_; } bool value_used() const { return value_used_; }

@ -93,8 +93,8 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
callback_(on_done), callback_(on_done),
next_issue_(next_issue), next_issue_(next_issue),
start_req_(start_req) {} start_req_(start_req) {}
~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {} ~ClientRpcContextUnaryImpl() override {}
void Start(CompletionQueue* cq) GRPC_OVERRIDE { void Start(CompletionQueue* cq) override {
cq_ = cq; cq_ = cq;
if (!next_issue_) { // ready to issue if (!next_issue_) { // ready to issue
RunNextState(true, nullptr); RunNextState(true, nullptr);
@ -102,7 +102,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
alarm_.reset(new Alarm(cq_, next_issue_(), ClientRpcContext::tag(this))); alarm_.reset(new Alarm(cq_, next_issue_(), ClientRpcContext::tag(this)));
} }
} }
bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { bool RunNextState(bool ok, HistogramEntry* entry) override {
switch (next_state_) { switch (next_state_) {
case State::READY: case State::READY:
start_ = UsageTimer::Now(); start_ = UsageTimer::Now();
@ -121,7 +121,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext {
return false; return false;
} }
} }
ClientRpcContext* StartNewClone() GRPC_OVERRIDE { ClientRpcContext* StartNewClone() override {
return new ClientRpcContextUnaryImpl(stub_, req_, next_issue_, start_req_, return new ClientRpcContextUnaryImpl(stub_, req_, next_issue_, start_req_,
callback_); callback_);
} }
@ -217,7 +217,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
} }
return num_threads; return num_threads;
} }
void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL { void DestroyMultithreading() override final {
for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) { for (auto ss = shutdown_state_.begin(); ss != shutdown_state_.end(); ++ss) {
std::lock_guard<std::mutex> lock((*ss)->mutex); std::lock_guard<std::mutex> lock((*ss)->mutex);
(*ss)->shutdown = true; (*ss)->shutdown = true;
@ -229,7 +229,7 @@ class AsyncClient : public ClientImpl<StubType, RequestType> {
} }
bool ThreadFunc(HistogramEntry* entry, bool ThreadFunc(HistogramEntry* entry,
size_t thread_idx) GRPC_OVERRIDE GRPC_FINAL { size_t thread_idx) override final {
void* got_tag; void* got_tag;
bool ok; bool ok;
@ -279,7 +279,7 @@ static std::unique_ptr<BenchmarkService::Stub> BenchmarkStubCreator(
return BenchmarkService::NewStub(ch); return BenchmarkService::NewStub(ch);
} }
class AsyncUnaryClient GRPC_FINAL class AsyncUnaryClient final
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> { : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public: public:
explicit AsyncUnaryClient(const ClientConfig& config) explicit AsyncUnaryClient(const ClientConfig& config)
@ -287,7 +287,7 @@ class AsyncUnaryClient GRPC_FINAL
config, SetupCtx, BenchmarkStubCreator) { config, SetupCtx, BenchmarkStubCreator) {
StartThreads(num_async_threads_); StartThreads(num_async_threads_);
} }
~AsyncUnaryClient() GRPC_OVERRIDE {} ~AsyncUnaryClient() override {}
private: private:
static void CheckDone(grpc::Status s, SimpleResponse* response, static void CheckDone(grpc::Status s, SimpleResponse* response,
@ -329,13 +329,13 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
callback_(on_done), callback_(on_done),
next_issue_(next_issue), next_issue_(next_issue),
start_req_(start_req) {} start_req_(start_req) {}
~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {} ~ClientRpcContextStreamingImpl() override {}
void Start(CompletionQueue* cq) GRPC_OVERRIDE { void Start(CompletionQueue* cq) override {
cq_ = cq; cq_ = cq;
stream_ = start_req_(stub_, &context_, cq, ClientRpcContext::tag(this)); stream_ = start_req_(stub_, &context_, cq, ClientRpcContext::tag(this));
next_state_ = State::STREAM_IDLE; next_state_ = State::STREAM_IDLE;
} }
bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { bool RunNextState(bool ok, HistogramEntry* entry) override {
while (true) { while (true) {
switch (next_state_) { switch (next_state_) {
case State::STREAM_IDLE: case State::STREAM_IDLE:
@ -377,7 +377,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
} }
} }
} }
ClientRpcContext* StartNewClone() GRPC_OVERRIDE { ClientRpcContext* StartNewClone() override {
return new ClientRpcContextStreamingImpl(stub_, req_, next_issue_, return new ClientRpcContextStreamingImpl(stub_, req_, next_issue_,
start_req_, callback_); start_req_, callback_);
} }
@ -410,7 +410,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext {
stream_; stream_;
}; };
class AsyncStreamingClient GRPC_FINAL class AsyncStreamingClient final
: public AsyncClient<BenchmarkService::Stub, SimpleRequest> { : public AsyncClient<BenchmarkService::Stub, SimpleRequest> {
public: public:
explicit AsyncStreamingClient(const ClientConfig& config) explicit AsyncStreamingClient(const ClientConfig& config)
@ -419,7 +419,7 @@ class AsyncStreamingClient GRPC_FINAL
StartThreads(num_async_threads_); StartThreads(num_async_threads_);
} }
~AsyncStreamingClient() GRPC_OVERRIDE {} ~AsyncStreamingClient() override {}
private: private:
static void CheckDone(grpc::Status s, SimpleResponse* response) {} static void CheckDone(grpc::Status s, SimpleResponse* response) {}
@ -458,8 +458,8 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
callback_(on_done), callback_(on_done),
next_issue_(next_issue), next_issue_(next_issue),
start_req_(start_req) {} start_req_(start_req) {}
~ClientRpcContextGenericStreamingImpl() GRPC_OVERRIDE {} ~ClientRpcContextGenericStreamingImpl() override {}
void Start(CompletionQueue* cq) GRPC_OVERRIDE { void Start(CompletionQueue* cq) override {
cq_ = cq; cq_ = cq;
const grpc::string kMethodName( const grpc::string kMethodName(
"/grpc.testing.BenchmarkService/StreamingCall"); "/grpc.testing.BenchmarkService/StreamingCall");
@ -467,7 +467,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
ClientRpcContext::tag(this)); ClientRpcContext::tag(this));
next_state_ = State::STREAM_IDLE; next_state_ = State::STREAM_IDLE;
} }
bool RunNextState(bool ok, HistogramEntry* entry) GRPC_OVERRIDE { bool RunNextState(bool ok, HistogramEntry* entry) override {
while (true) { while (true) {
switch (next_state_) { switch (next_state_) {
case State::STREAM_IDLE: case State::STREAM_IDLE:
@ -509,7 +509,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext {
} }
} }
} }
ClientRpcContext* StartNewClone() GRPC_OVERRIDE { ClientRpcContext* StartNewClone() override {
return new ClientRpcContextGenericStreamingImpl(stub_, req_, next_issue_, return new ClientRpcContextGenericStreamingImpl(stub_, req_, next_issue_,
start_req_, callback_); start_req_, callback_);
} }
@ -546,7 +546,7 @@ static std::unique_ptr<grpc::GenericStub> GenericStubCreator(
return std::unique_ptr<grpc::GenericStub>(new grpc::GenericStub(ch)); return std::unique_ptr<grpc::GenericStub>(new grpc::GenericStub(ch));
} }
class GenericAsyncStreamingClient GRPC_FINAL class GenericAsyncStreamingClient final
: public AsyncClient<grpc::GenericStub, ByteBuffer> { : public AsyncClient<grpc::GenericStub, ByteBuffer> {
public: public:
explicit GenericAsyncStreamingClient(const ClientConfig& config) explicit GenericAsyncStreamingClient(const ClientConfig& config)
@ -555,7 +555,7 @@ class GenericAsyncStreamingClient GRPC_FINAL
StartThreads(num_async_threads_); StartThreads(num_async_threads_);
} }
~GenericAsyncStreamingClient() GRPC_OVERRIDE {} ~GenericAsyncStreamingClient() override {}
private: private:
static void CheckDone(grpc::Status s, ByteBuffer* response) {} static void CheckDone(grpc::Status s, ByteBuffer* response) {}

@ -108,10 +108,10 @@ class SynchronousClient
std::vector<SimpleResponse> responses_; std::vector<SimpleResponse> responses_;
private: private:
void DestroyMultithreading() GRPC_OVERRIDE GRPC_FINAL { EndThreads(); } void DestroyMultithreading() override final { EndThreads(); }
}; };
class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { class SynchronousUnaryClient final : public SynchronousClient {
public: public:
SynchronousUnaryClient(const ClientConfig& config) SynchronousUnaryClient(const ClientConfig& config)
: SynchronousClient(config) { : SynchronousClient(config) {
@ -119,7 +119,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
} }
~SynchronousUnaryClient() {} ~SynchronousUnaryClient() {}
bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE { bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override {
if (!WaitToIssue(thread_idx)) { if (!WaitToIssue(thread_idx)) {
return true; return true;
} }
@ -135,7 +135,7 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient {
} }
}; };
class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { class SynchronousStreamingClient final : public SynchronousClient {
public: public:
SynchronousStreamingClient(const ClientConfig& config) SynchronousStreamingClient(const ClientConfig& config)
: SynchronousClient(config) { : SynchronousClient(config) {
@ -165,7 +165,7 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient {
delete[] context_; delete[] context_;
} }
bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) GRPC_OVERRIDE { bool ThreadFunc(HistogramEntry* entry, size_t thread_idx) override {
if (!WaitToIssue(thread_idx)) { if (!WaitToIssue(thread_idx)) {
return true; return true;
} }

@ -69,11 +69,11 @@ inline RandomDistInterface::~RandomDistInterface() {}
// independent identical stationary sources. For more information, // independent identical stationary sources. For more information,
// see http://en.wikipedia.org/wiki/Exponential_distribution // see http://en.wikipedia.org/wiki/Exponential_distribution
class ExpDist GRPC_FINAL : public RandomDistInterface { class ExpDist final : public RandomDistInterface {
public: public:
explicit ExpDist(double lambda) : lambda_recip_(1.0 / lambda) {} explicit ExpDist(double lambda) : lambda_recip_(1.0 / lambda) {}
~ExpDist() GRPC_OVERRIDE {} ~ExpDist() override {}
double transform(double uni) const GRPC_OVERRIDE { double transform(double uni) const override {
// Note: Use 1.0-uni above to avoid NaN if uni is 0 // Note: Use 1.0-uni above to avoid NaN if uni is 0
return lambda_recip_ * (-log(1.0 - uni)); return lambda_recip_ * (-log(1.0 - uni));
} }

@ -100,7 +100,7 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
abort(); abort();
} }
class ScopedProfile GRPC_FINAL { class ScopedProfile final {
public: public:
ScopedProfile(const char* filename, bool enable) : enable_(enable) { ScopedProfile(const char* filename, bool enable) : enable_(enable) {
if (enable_) grpc_profiler_start(filename); if (enable_) grpc_profiler_start(filename);
@ -113,14 +113,14 @@ class ScopedProfile GRPC_FINAL {
const bool enable_; const bool enable_;
}; };
class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { class WorkerServiceImpl final : public WorkerService::Service {
public: public:
WorkerServiceImpl(int server_port, QpsWorker* worker) WorkerServiceImpl(int server_port, QpsWorker* worker)
: acquired_(false), server_port_(server_port), worker_(worker) {} : acquired_(false), server_port_(server_port), worker_(worker) {}
Status RunClient(ServerContext* ctx, Status RunClient(ServerContext* ctx,
ServerReaderWriter<ClientStatus, ClientArgs>* stream) ServerReaderWriter<ClientStatus, ClientArgs>* stream)
GRPC_OVERRIDE { override {
InstanceGuard g(this); InstanceGuard g(this);
if (!g.Acquired()) { if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy"); return Status(StatusCode::RESOURCE_EXHAUSTED, "Client worker busy");
@ -134,7 +134,7 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
Status RunServer(ServerContext* ctx, Status RunServer(ServerContext* ctx,
ServerReaderWriter<ServerStatus, ServerArgs>* stream) ServerReaderWriter<ServerStatus, ServerArgs>* stream)
GRPC_OVERRIDE { override {
InstanceGuard g(this); InstanceGuard g(this);
if (!g.Acquired()) { if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy"); return Status(StatusCode::RESOURCE_EXHAUSTED, "Server worker busy");
@ -147,12 +147,12 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
} }
Status CoreCount(ServerContext* ctx, const CoreRequest*, Status CoreCount(ServerContext* ctx, const CoreRequest*,
CoreResponse* resp) GRPC_OVERRIDE { CoreResponse* resp) override {
resp->set_cores(gpr_cpu_num_cores()); resp->set_cores(gpr_cpu_num_cores());
return Status::OK; return Status::OK;
} }
Status QuitWorker(ServerContext* ctx, const Void*, Void*) GRPC_OVERRIDE { Status QuitWorker(ServerContext* ctx, const Void*, Void*) override {
InstanceGuard g(this); InstanceGuard g(this);
if (!g.Acquired()) { if (!g.Acquired()) {
return Status(StatusCode::RESOURCE_EXHAUSTED, "Quitting worker busy"); return Status(StatusCode::RESOURCE_EXHAUSTED, "Quitting worker busy");

@ -82,10 +82,10 @@ class CompositeReporter : public Reporter {
/** Adds a \a reporter to the composite. */ /** Adds a \a reporter to the composite. */
void add(std::unique_ptr<Reporter> reporter); void add(std::unique_ptr<Reporter> reporter);
void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPS(const ScenarioResult& result) override;
void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPSPerCore(const ScenarioResult& result) override;
void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; void ReportLatency(const ScenarioResult& result) override;
void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; void ReportTimes(const ScenarioResult& result) override;
private: private:
std::vector<std::unique_ptr<Reporter> > reporters_; std::vector<std::unique_ptr<Reporter> > reporters_;
@ -97,10 +97,10 @@ class GprLogReporter : public Reporter {
GprLogReporter(const string& name) : Reporter(name) {} GprLogReporter(const string& name) : Reporter(name) {}
private: private:
void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPS(const ScenarioResult& result) override;
void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPSPerCore(const ScenarioResult& result) override;
void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; void ReportLatency(const ScenarioResult& result) override;
void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; void ReportTimes(const ScenarioResult& result) override;
}; };
/** Dumps the report to a JSON file. */ /** Dumps the report to a JSON file. */
@ -110,10 +110,10 @@ class JsonReporter : public Reporter {
: Reporter(name), report_file_(report_file) {} : Reporter(name), report_file_(report_file) {}
private: private:
void ReportQPS(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPS(const ScenarioResult& result) override;
void ReportQPSPerCore(const ScenarioResult& result) GRPC_OVERRIDE; void ReportQPSPerCore(const ScenarioResult& result) override;
void ReportLatency(const ScenarioResult& result) GRPC_OVERRIDE; void ReportLatency(const ScenarioResult& result) override;
void ReportTimes(const ScenarioResult& result) GRPC_OVERRIDE; void ReportTimes(const ScenarioResult& result) override;
const string report_file_; const string report_file_;
}; };

@ -58,7 +58,7 @@ namespace testing {
template <class RequestType, class ResponseType, class ServiceType, template <class RequestType, class ResponseType, class ServiceType,
class ServerContextType> class ServerContextType>
class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server { class AsyncQpsServerTest final : public grpc::testing::Server {
public: public:
AsyncQpsServerTest( AsyncQpsServerTest(
const ServerConfig &config, const ServerConfig &config,
@ -196,7 +196,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
return reinterpret_cast<ServerRpcContext *>(tag); return reinterpret_cast<ServerRpcContext *>(tag);
} }
class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext { class ServerRpcContextUnaryImpl final : public ServerRpcContext {
public: public:
ServerRpcContextUnaryImpl( ServerRpcContextUnaryImpl(
std::function<void(ServerContextType *, RequestType *, std::function<void(ServerContextType *, RequestType *,
@ -213,11 +213,11 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
request_method_(srv_ctx_.get(), &req_, &response_writer_, request_method_(srv_ctx_.get(), &req_, &response_writer_,
AsyncQpsServerTest::tag(this)); AsyncQpsServerTest::tag(this));
} }
~ServerRpcContextUnaryImpl() GRPC_OVERRIDE {} ~ServerRpcContextUnaryImpl() override {}
bool RunNextState(bool ok) GRPC_OVERRIDE { bool RunNextState(bool ok) override {
return (this->*next_state_)(ok); return (this->*next_state_)(ok);
} }
void Reset() GRPC_OVERRIDE { void Reset() override {
srv_ctx_.reset(new ServerContextType); srv_ctx_.reset(new ServerContextType);
req_ = RequestType(); req_ = RequestType();
response_writer_ = response_writer_ =
@ -257,7 +257,7 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
grpc::ServerAsyncResponseWriter<ResponseType> response_writer_; grpc::ServerAsyncResponseWriter<ResponseType> response_writer_;
}; };
class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext { class ServerRpcContextStreamingImpl final : public ServerRpcContext {
public: public:
ServerRpcContextStreamingImpl( ServerRpcContextStreamingImpl(
std::function<void( std::function<void(
@ -273,11 +273,11 @@ class AsyncQpsServerTest GRPC_FINAL : public grpc::testing::Server {
stream_(srv_ctx_.get()) { stream_(srv_ctx_.get()) {
request_method_(srv_ctx_.get(), &stream_, AsyncQpsServerTest::tag(this)); request_method_(srv_ctx_.get(), &stream_, AsyncQpsServerTest::tag(this));
} }
~ServerRpcContextStreamingImpl() GRPC_OVERRIDE {} ~ServerRpcContextStreamingImpl() override {}
bool RunNextState(bool ok) GRPC_OVERRIDE { bool RunNextState(bool ok) override {
return (this->*next_state_)(ok); return (this->*next_state_)(ok);
} }
void Reset() GRPC_OVERRIDE { void Reset() override {
srv_ctx_.reset(new ServerContextType); srv_ctx_.reset(new ServerContextType);
req_ = RequestType(); req_ = RequestType();
stream_ = grpc::ServerAsyncReaderWriter<ResponseType, RequestType>( stream_ = grpc::ServerAsyncReaderWriter<ResponseType, RequestType>(

@ -48,10 +48,10 @@
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service { class BenchmarkServiceImpl final : public BenchmarkService::Service {
public: public:
Status UnaryCall(ServerContext* context, const SimpleRequest* request, Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) GRPC_OVERRIDE { SimpleResponse* response) override {
if (request->response_size() > 0) { if (request->response_size() > 0) {
if (!Server::SetPayload(request->response_type(), if (!Server::SetPayload(request->response_type(),
request->response_size(), request->response_size(),
@ -63,7 +63,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service {
} }
Status StreamingCall( Status StreamingCall(
ServerContext* context, ServerContext* context,
ServerReaderWriter<SimpleResponse, SimpleRequest>* stream) GRPC_OVERRIDE { ServerReaderWriter<SimpleResponse, SimpleRequest>* stream) override {
SimpleRequest request; SimpleRequest request;
while (stream->Read(&request)) { while (stream->Read(&request)) {
SimpleResponse response; SimpleResponse response;
@ -80,7 +80,7 @@ class BenchmarkServiceImpl GRPC_FINAL : public BenchmarkService::Service {
} }
}; };
class SynchronousServer GRPC_FINAL : public grpc::testing::Server { class SynchronousServer final : public grpc::testing::Server {
public: public:
explicit SynchronousServer(const ServerConfig& config) : Server(config) { explicit SynchronousServer(const ServerConfig& config) : Server(config) {
ServerBuilder builder; ServerBuilder builder;

@ -43,7 +43,7 @@
#include "test/cpp/util/test_config.h" #include "test/cpp/util/test_config.h"
namespace grpc { namespace grpc {
class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager { class ThreadManagerTest final : public grpc::ThreadManager {
public: public:
ThreadManagerTest() ThreadManagerTest()
: ThreadManager(kMinPollers, kMaxPollers), : ThreadManager(kMinPollers, kMaxPollers),
@ -52,8 +52,8 @@ class ThreadManagerTest GRPC_FINAL : public grpc::ThreadManager {
num_work_found_(0) {} num_work_found_(0) {}
grpc::ThreadManager::WorkStatus PollForWork(void **tag, grpc::ThreadManager::WorkStatus PollForWork(void **tag,
bool *ok) GRPC_OVERRIDE; bool *ok) override;
void DoWork(void *tag, bool ok) GRPC_OVERRIDE; void DoWork(void *tag, bool ok) override;
void PerformTest(); void PerformTest();
private: private:

@ -43,7 +43,7 @@
namespace grpc { namespace grpc {
namespace testing { namespace testing {
class CliCall GRPC_FINAL { class CliCall final {
public: public:
typedef std::multimap<grpc::string, grpc::string> OutgoingMetadataContainer; typedef std::multimap<grpc::string, grpc::string> OutgoingMetadataContainer;
typedef std::multimap<grpc::string_ref, grpc::string_ref> typedef std::multimap<grpc::string_ref, grpc::string_ref>

@ -56,7 +56,7 @@ namespace testing {
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
if (!context->client_metadata().empty()) { if (!context->client_metadata().empty()) {
for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator
iter = context->client_metadata().begin(); iter = context->client_metadata().begin();
@ -75,7 +75,7 @@ class CliCallTest : public ::testing::Test {
protected: protected:
CliCallTest() {} CliCallTest() {}
void SetUp() GRPC_OVERRIDE { void SetUp() override {
int port = grpc_pick_unused_port_or_die(); int port = grpc_pick_unused_port_or_die();
server_address_ << "localhost:" << port; server_address_ << "localhost:" << port;
// Setup server // Setup server
@ -86,7 +86,7 @@ class CliCallTest : public ::testing::Test {
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();
} }
void TearDown() GRPC_OVERRIDE { server_->Shutdown(); } void TearDown() override { server_->Shutdown(); }
void ResetStub() { void ResetStub() {
channel_ = channel_ =

@ -93,13 +93,13 @@ DECLARE_bool(l);
namespace { namespace {
class TestCliCredentials GRPC_FINAL : public grpc::testing::CliCredentials { class TestCliCredentials final : public grpc::testing::CliCredentials {
public: public:
std::shared_ptr<grpc::ChannelCredentials> GetCredentials() const std::shared_ptr<grpc::ChannelCredentials> GetCredentials() const
GRPC_OVERRIDE { override {
return InsecureChannelCredentials(); return InsecureChannelCredentials();
} }
const grpc::string GetCredentialUsage() const GRPC_OVERRIDE { return ""; } const grpc::string GetCredentialUsage() const override { return ""; }
}; };
bool PrintStream(std::stringstream* ss, const grpc::string& output) { bool PrintStream(std::stringstream* ss, const grpc::string& output) {
@ -118,7 +118,7 @@ size_t ArraySize(T& a) {
class TestServiceImpl : public ::grpc::testing::EchoTestService::Service { class TestServiceImpl : public ::grpc::testing::EchoTestService::Service {
public: public:
Status Echo(ServerContext* context, const EchoRequest* request, Status Echo(ServerContext* context, const EchoRequest* request,
EchoResponse* response) GRPC_OVERRIDE { EchoResponse* response) override {
if (!context->client_metadata().empty()) { if (!context->client_metadata().empty()) {
for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator
iter = context->client_metadata().begin(); iter = context->client_metadata().begin();

@ -83,13 +83,13 @@ class QpsGauge {
std::mutex num_queries_mu_; std::mutex num_queries_mu_;
}; };
class MetricsServiceImpl GRPC_FINAL : public MetricsService::Service { class MetricsServiceImpl final : public MetricsService::Service {
public: public:
grpc::Status GetAllGauges(ServerContext* context, const EmptyMessage* request, grpc::Status GetAllGauges(ServerContext* context, const EmptyMessage* request,
ServerWriter<GaugeResponse>* writer) GRPC_OVERRIDE; ServerWriter<GaugeResponse>* writer) override;
grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request, grpc::Status GetGauge(ServerContext* context, const GaugeRequest* request,
GaugeResponse* response) GRPC_OVERRIDE; GaugeResponse* response) override;
// Create a QpsGauge with name 'name'. is_present is set to true if the Gauge // Create a QpsGauge with name 'name'. is_present is set to true if the Gauge
// is already present in the map. // is already present in the map.

@ -61,7 +61,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector {
explicit ErrorPrinter(ProtoFileParser* parser) : parser_(parser) {} explicit ErrorPrinter(ProtoFileParser* parser) : parser_(parser) {}
void AddError(const grpc::string& filename, int line, int column, void AddError(const grpc::string& filename, int line, int column,
const grpc::string& message) GRPC_OVERRIDE { const grpc::string& message) override {
std::ostringstream oss; std::ostringstream oss;
oss << "error " << filename << " " << line << " " << column << " " oss << "error " << filename << " " << line << " " << column << " "
<< message << "\n"; << message << "\n";
@ -69,7 +69,7 @@ class ErrorPrinter : public protobuf::compiler::MultiFileErrorCollector {
} }
void AddWarning(const grpc::string& filename, int line, int column, void AddWarning(const grpc::string& filename, int line, int column,
const grpc::string& message) GRPC_OVERRIDE { const grpc::string& message) override {
std::cerr << "warning " << filename << " " << line << " " << column << " " std::cerr << "warning " << filename << " " << line << " " << column << " "
<< message << std::endl; << message << std::endl;
} }

@ -62,14 +62,14 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// Find a file by file name. Fills in in *output and returns true if found. // Find a file by file name. Fills in in *output and returns true if found.
// Otherwise, returns false, leaving the contents of *output undefined. // Otherwise, returns false, leaving the contents of *output undefined.
bool FindFileByName(const string& filename, bool FindFileByName(const string& filename,
protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; protobuf::FileDescriptorProto* output) override;
// Find the file that declares the given fully-qualified symbol name. // Find the file that declares the given fully-qualified symbol name.
// If found, fills in *output and returns true, otherwise returns false // If found, fills in *output and returns true, otherwise returns false
// and leaves *output undefined. // and leaves *output undefined.
bool FindFileContainingSymbol(const string& symbol_name, bool FindFileContainingSymbol(const string& symbol_name,
protobuf::FileDescriptorProto* output) protobuf::FileDescriptorProto* output)
GRPC_OVERRIDE; override;
// Find the file which defines an extension extending the given message type // Find the file which defines an extension extending the given message type
// with the given field number. If found, fills in *output and returns true, // with the given field number. If found, fills in *output and returns true,
@ -77,7 +77,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// must be a fully-qualified type name. // must be a fully-qualified type name.
bool FindFileContainingExtension( bool FindFileContainingExtension(
const string& containing_type, int field_number, const string& containing_type, int field_number,
protobuf::FileDescriptorProto* output) GRPC_OVERRIDE; protobuf::FileDescriptorProto* output) override;
// Finds the tag numbers used by all known extensions of // Finds the tag numbers used by all known extensions of
// extendee_type, and appends them to output in an undefined // extendee_type, and appends them to output in an undefined
@ -87,7 +87,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
// numbers. Returns true if the search was successful, otherwise // numbers. Returns true if the search was successful, otherwise
// returns false and leaves output unchanged. // returns false and leaves output unchanged.
bool FindAllExtensionNumbers(const string& extendee_type, bool FindAllExtensionNumbers(const string& extendee_type,
std::vector<int>* output) GRPC_OVERRIDE; std::vector<int>* output) override;
// Provide a list of full names of registered services // Provide a list of full names of registered services
bool GetServices(std::vector<grpc::string>* output); bool GetServices(std::vector<grpc::string>* output);

@ -64,11 +64,11 @@ class CredentialsProvider {
class DefaultCredentialsProvider : public CredentialsProvider { class DefaultCredentialsProvider : public CredentialsProvider {
public: public:
~DefaultCredentialsProvider() GRPC_OVERRIDE {} ~DefaultCredentialsProvider() override {}
void AddSecureType(const grpc::string& type, void AddSecureType(const grpc::string& type,
std::unique_ptr<CredentialTypeProvider> type_provider) std::unique_ptr<CredentialTypeProvider> type_provider)
GRPC_OVERRIDE { override {
// This clobbers any existing entry for type, except the defaults, which // This clobbers any existing entry for type, except the defaults, which
// can't be clobbered. // can't be clobbered.
grpc::unique_lock<grpc::mutex> lock(mu_); grpc::unique_lock<grpc::mutex> lock(mu_);
@ -84,7 +84,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
} }
std::shared_ptr<ChannelCredentials> GetChannelCredentials( std::shared_ptr<ChannelCredentials> GetChannelCredentials(
const grpc::string& type, ChannelArguments* args) GRPC_OVERRIDE { const grpc::string& type, ChannelArguments* args) override {
if (type == grpc::testing::kInsecureCredentialsType) { if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureChannelCredentials(); return InsecureChannelCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) { } else if (type == grpc::testing::kTlsCredentialsType) {
@ -105,7 +105,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
} }
std::shared_ptr<ServerCredentials> GetServerCredentials( std::shared_ptr<ServerCredentials> GetServerCredentials(
const grpc::string& type) GRPC_OVERRIDE { const grpc::string& type) override {
if (type == grpc::testing::kInsecureCredentialsType) { if (type == grpc::testing::kInsecureCredentialsType) {
return InsecureServerCredentials(); return InsecureServerCredentials();
} else if (type == grpc::testing::kTlsCredentialsType) { } else if (type == grpc::testing::kTlsCredentialsType) {
@ -127,7 +127,7 @@ class DefaultCredentialsProvider : public CredentialsProvider {
->GetServerCredentials(); ->GetServerCredentials();
} }
} }
std::vector<grpc::string> GetSecureCredentialsTypeList() GRPC_OVERRIDE { std::vector<grpc::string> GetSecureCredentialsTypeList() override {
std::vector<grpc::string> types; std::vector<grpc::string> types;
types.push_back(grpc::testing::kTlsCredentialsType); types.push_back(grpc::testing::kTlsCredentialsType);
grpc::unique_lock<grpc::mutex> lock(mu_); grpc::unique_lock<grpc::mutex> lock(mu_);

Loading…
Cancel
Save