diff options
author | Noah Eisen <ncteisen@google.com> | 2018-06-07 22:52:23 -0700 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2018-06-14 14:58:09 -0400 |
commit | 373fc6dc40a7d12bb257d67188ca3aa3c997d8a6 (patch) | |
tree | a0bf04f2f5ee080b1adeb6d9dc59a91157ae0d45 /test/cpp/interop | |
parent | 58e0cbf9fb67186ee67be5bb71aba36e9cfebe7f (diff) |
Manual fixes to enable performance- clang tidy checks
Diffstat (limited to 'test/cpp/interop')
-rw-r--r-- | test/cpp/interop/http2_client.cc | 11 | ||||
-rw-r--r-- | test/cpp/interop/http2_client.h | 6 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.cc | 4 | ||||
-rw-r--r-- | test/cpp/interop/interop_client.h | 4 | ||||
-rw-r--r-- | test/cpp/interop/interop_server.cc | 8 | ||||
-rw-r--r-- | test/cpp/interop/server_helper.h | 8 |
6 files changed, 21 insertions, 20 deletions
diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc index 543f159265..bc7f0f5edb 100644 --- a/test/cpp/interop/http2_client.cc +++ b/test/cpp/interop/http2_client.cc @@ -42,16 +42,16 @@ const int kLargeRequestSize = 271828; const int kLargeResponseSize = 314159; } // namespace -Http2Client::ServiceStub::ServiceStub(std::shared_ptr<Channel> channel) - : channel_(channel) { +Http2Client::ServiceStub::ServiceStub(const std::shared_ptr<Channel>& channel) + : channel_(std::move(channel)) { stub_ = TestService::NewStub(channel); } TestService::Stub* Http2Client::ServiceStub::Get() { return stub_.get(); } -Http2Client::Http2Client(std::shared_ptr<Channel> channel) +Http2Client::Http2Client(const std::shared_ptr<Channel>& channel) : serviceStub_(channel), - channel_(channel), + channel_(std::move(channel)), defaultRequest_(BuildDefaultRequest()) {} bool Http2Client::AssertStatusCode(const Status& s, StatusCode expected_code) { @@ -140,7 +140,8 @@ bool Http2Client::DoPing() { return true; } -void Http2Client::MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel) { +void Http2Client::MaxStreamsWorker( + const std::shared_ptr<grpc::Channel>& channel) { SimpleResponse response; AssertStatusCode(SendUnaryCall(&response), grpc::StatusCode::OK); GPR_ASSERT(response.payload().body() == diff --git a/test/cpp/interop/http2_client.h b/test/cpp/interop/http2_client.h index 2bcfdd69db..269d3b32e2 100644 --- a/test/cpp/interop/http2_client.h +++ b/test/cpp/interop/http2_client.h @@ -31,7 +31,7 @@ namespace testing { class Http2Client { public: - explicit Http2Client(std::shared_ptr<Channel> channel); + explicit Http2Client(const std::shared_ptr<Channel>& channel); ~Http2Client() {} bool DoRstAfterHeader(); @@ -44,7 +44,7 @@ class Http2Client { private: class ServiceStub { public: - ServiceStub(std::shared_ptr<Channel> channel); + ServiceStub(const std::shared_ptr<Channel>& channel); TestService::Stub* Get(); @@ -53,7 +53,7 @@ class Http2Client { std::shared_ptr<Channel> channel_; }; - void MaxStreamsWorker(std::shared_ptr<grpc::Channel> channel); + void MaxStreamsWorker(const std::shared_ptr<grpc::Channel>& channel); bool AssertStatusCode(const Status& s, StatusCode expected_code); Status SendUnaryCall(SimpleResponse* response); SimpleRequest BuildDefaultRequest(); diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index aaaa21de5b..fce99a1697 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -113,11 +113,11 @@ void InteropClient::ServiceStub::Reset( } } -void InteropClient::Reset(std::shared_ptr<Channel> channel) { +void InteropClient::Reset(const std::shared_ptr<Channel>& channel) { serviceStub_.Reset(std::move(channel)); } -InteropClient::InteropClient(std::shared_ptr<Channel> channel, +InteropClient::InteropClient(const std::shared_ptr<Channel>& channel, bool new_stub_every_test_case, bool do_not_abort_on_transient_failures) : serviceStub_(std::move(channel), new_stub_every_test_case), diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index a146212ff6..480eb3f4b6 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -40,12 +40,12 @@ class InteropClient { /// created for every test case /// If do_not_abort_on_transient_failures is true, abort() is not called in /// case of transient failures (like connection failures) - explicit InteropClient(std::shared_ptr<Channel> channel, + explicit InteropClient(const std::shared_ptr<Channel>& channel, bool new_stub_every_test_case, bool do_not_abort_on_transient_failures); ~InteropClient() {} - void Reset(std::shared_ptr<Channel> channel); + void Reset(const std::shared_ptr<Channel>& channel); bool DoEmpty(); bool DoLargeUnary(); diff --git a/test/cpp/interop/interop_server.cc b/test/cpp/interop/interop_server.cc index f55d624b21..6570bbf969 100644 --- a/test/cpp/interop/interop_server.cc +++ b/test/cpp/interop/interop_server.cc @@ -317,25 +317,25 @@ class TestServiceImpl : public TestService::Service { }; void grpc::testing::interop::RunServer( - std::shared_ptr<ServerCredentials> creds) { + const std::shared_ptr<ServerCredentials>& creds) { RunServer(creds, FLAGS_port, nullptr, nullptr); } void grpc::testing::interop::RunServer( - std::shared_ptr<ServerCredentials> creds, + const std::shared_ptr<ServerCredentials>& creds, std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>> server_options) { RunServer(creds, FLAGS_port, nullptr, std::move(server_options)); } void grpc::testing::interop::RunServer( - std::shared_ptr<ServerCredentials> creds, const int port, + const std::shared_ptr<ServerCredentials>& creds, const int port, ServerStartedCondition* server_started_condition) { RunServer(creds, port, server_started_condition, nullptr); } void grpc::testing::interop::RunServer( - std::shared_ptr<ServerCredentials> creds, const int port, + const std::shared_ptr<ServerCredentials>& creds, const int port, ServerStartedCondition* server_started_condition, std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>> server_options) { diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index 265874df70..1bfbf8e474 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -63,7 +63,7 @@ struct ServerStartedCondition { /// Run gRPC interop server using port FLAGS_port. /// /// \param creds The credentials associated with the server. -void RunServer(std::shared_ptr<ServerCredentials> creds); +void RunServer(const std::shared_ptr<ServerCredentials>& creds); /// Run gRPC interop server. /// @@ -71,7 +71,7 @@ void RunServer(std::shared_ptr<ServerCredentials> creds); /// \param port Port to use for the server. /// \param server_started_condition (optional) Struct holding mutex, condition /// variable, and condition used to notify when the server has started. -void RunServer(std::shared_ptr<ServerCredentials> creds, int port, +void RunServer(const std::shared_ptr<ServerCredentials>& creds, int port, ServerStartedCondition* server_started_condition); /// Run gRPC interop server. @@ -79,7 +79,7 @@ void RunServer(std::shared_ptr<ServerCredentials> creds, int port, /// \param creds The credentials associated with the server. /// \param server_options List of options to set when building the server. void RunServer( - std::shared_ptr<ServerCredentials> creds, + const std::shared_ptr<ServerCredentials>& creds, std::unique_ptr<std::vector<std::unique_ptr<ServerBuilderOption>>> server_options); @@ -91,7 +91,7 @@ void RunServer( /// \param server_started_condition (optional) Struct holding mutex, condition // variable, and condition used to notify when the server has started. void RunServer( - std::shared_ptr<ServerCredentials> creds, const int port, + const std::shared_ptr<ServerCredentials>& creds, const int port, ServerStartedCondition* server_started_condition, std::unique_ptr<std::vector<std::unique_ptr<grpc::ServerBuilderOption>>> server_options); |