Removing pessimizing moves.

Pass #2.
pull/3214/head
Nicolas "Pixel" Noble 9 years ago
parent ddb58ea560
commit 59588c6162
  1. 2
      test/cpp/end2end/thread_stress_test.cc
  2. 12
      test/cpp/qps/driver.cc
  3. 2
      test/cpp/qps/qps_worker.cc
  4. 2
      test/cpp/qps/server_async.cc
  5. 2
      test/cpp/util/cli_call_test.cc

@ -191,7 +191,7 @@ class End2endTest : public ::testing::Test {
void ResetStub() { void ResetStub() {
std::shared_ptr<Channel> channel = std::shared_ptr<Channel> channel =
CreateChannel(server_address_.str(), InsecureCredentials()); CreateChannel(server_address_.str(), InsecureCredentials());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel)); stub_ = grpc::cpp::test::util::TestService::NewStub(channel);
} }
std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_; std::unique_ptr<grpc::cpp::test::util::TestService::Stub> stub_;

@ -153,14 +153,14 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* servers = new ServerData[num_servers]; auto* servers = new ServerData[num_servers];
for (size_t i = 0; i < num_servers; i++) { for (size_t i = 0; i < num_servers; i++) {
servers[i].stub = std::move( servers[i].stub = Worker::NewStub(CreateChannel(workers[i],
Worker::NewStub(CreateChannel(workers[i], InsecureCredentials()))); InsecureCredentials()));
ServerArgs args; ServerArgs args;
result_server_config = server_config; result_server_config = server_config;
result_server_config.set_host(workers[i]); result_server_config.set_host(workers[i]);
*args.mutable_setup() = server_config; *args.mutable_setup() = server_config;
servers[i].stream = servers[i].stream =
std::move(servers[i].stub->RunServer(runsc::AllocContext(&contexts))); servers[i].stub->RunServer(runsc::AllocContext(&contexts));
GPR_ASSERT(servers[i].stream->Write(args)); GPR_ASSERT(servers[i].stream->Write(args));
ServerStatus init_status; ServerStatus init_status;
GPR_ASSERT(servers[i].stream->Read(&init_status)); GPR_ASSERT(servers[i].stream->Read(&init_status));
@ -181,14 +181,14 @@ std::unique_ptr<ScenarioResult> RunScenario(
// where class contained in std::vector must have a copy constructor // where class contained in std::vector must have a copy constructor
auto* clients = new ClientData[num_clients]; auto* clients = new ClientData[num_clients];
for (size_t i = 0; i < num_clients; i++) { for (size_t i = 0; i < num_clients; i++) {
clients[i].stub = std::move(Worker::NewStub( clients[i].stub = Worker::NewStub(CreateChannel(workers[i + num_servers],
CreateChannel(workers[i + num_servers], InsecureCredentials()))); InsecureCredentials()));
ClientArgs args; ClientArgs args;
result_client_config = client_config; result_client_config = client_config;
result_client_config.set_host(workers[i + num_servers]); result_client_config.set_host(workers[i + num_servers]);
*args.mutable_setup() = client_config; *args.mutable_setup() = client_config;
clients[i].stream = clients[i].stream =
std::move(clients[i].stub->RunTest(runsc::AllocContext(&contexts))); clients[i].stub->RunTest(runsc::AllocContext(&contexts));
GPR_ASSERT(clients[i].stream->Write(args)); GPR_ASSERT(clients[i].stream->Write(args));
ClientStatus init_status; ClientStatus init_status;
GPR_ASSERT(clients[i].stream->Read(&init_status)); GPR_ASSERT(clients[i].stream->Read(&init_status));

@ -229,7 +229,7 @@ QpsWorker::QpsWorker(int driver_port, int server_port) {
gpr_free(server_address); gpr_free(server_address);
server_ = std::move(builder.BuildAndStart()); server_ = builder.BuildAndStart();
} }
QpsWorker::~QpsWorker() {} QpsWorker::~QpsWorker() {}

@ -68,7 +68,7 @@ class AsyncQpsServerTest : public Server {
builder.RegisterAsyncService(&async_service_); builder.RegisterAsyncService(&async_service_);
for (int i = 0; i < config.threads(); i++) { for (int i = 0; i < config.threads(); i++) {
srv_cqs_.emplace_back(std::move(builder.AddCompletionQueue())); srv_cqs_.emplace_back(builder.AddCompletionQueue());
} }
server_ = builder.BuildAndStart(); server_ = builder.BuildAndStart();

@ -90,7 +90,7 @@ class CliCallTest : public ::testing::Test {
void ResetStub() { void ResetStub() {
channel_ = CreateChannel(server_address_.str(), InsecureCredentials()); channel_ = CreateChannel(server_address_.str(), InsecureCredentials());
stub_ = std::move(grpc::cpp::test::util::TestService::NewStub(channel_)); stub_ = grpc::cpp::test::util::TestService::NewStub(channel_);
} }
std::shared_ptr<Channel> channel_; std::shared_ptr<Channel> channel_;

Loading…
Cancel
Save