aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar kpayson64 <kpayson@google.com>2016-08-15 13:02:44 -0700
committerGravatar GitHub <noreply@github.com>2016-08-15 13:02:44 -0700
commit0c6cce12b4d66d112ca890d8606f6444dc382548 (patch)
tree592dd0a39764a6f4a8de0e01177796d33d3841eb /test
parent5a22a598b3d986a31215e24ee75468eb2e97aa99 (diff)
parent4f17395b81508ceedc824602e52876ae94d13c43 (diff)
Merge pull request #7648 from vjpai/qps_better_ptr
Use unique_ptr properly in QPS async tests
Diffstat (limited to 'test')
-rw-r--r--test/cpp/qps/server_async.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index dea8746331..082b4bc72f 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -108,14 +108,14 @@ class AsyncQpsServerTest : public Server {
auto request_unary =
std::bind(request_unary_function, &async_service_, _1, _2, _3,
srv_cqs_[j].get(), srv_cqs_[j].get(), _4);
- contexts_.push_front(
+ contexts_.emplace_back(
new ServerRpcContextUnaryImpl(request_unary, process_rpc_bound));
}
if (request_streaming_function) {
auto request_streaming =
std::bind(request_streaming_function, &async_service_, _1, _2,
srv_cqs_[j].get(), srv_cqs_[j].get(), _3);
- contexts_.push_front(new ServerRpcContextStreamingImpl(
+ contexts_.emplace_back(new ServerRpcContextStreamingImpl(
request_streaming, process_rpc_bound));
}
}
@@ -146,10 +146,6 @@ class AsyncQpsServerTest : public Server {
while ((*cq)->Next(&got_tag, &ok))
;
}
- while (!contexts_.empty()) {
- delete contexts_.front();
- contexts_.pop_front();
- }
}
private:
@@ -336,7 +332,7 @@ class AsyncQpsServerTest : public Server {
std::unique_ptr<grpc::Server> server_;
std::vector<std::unique_ptr<grpc::ServerCompletionQueue>> srv_cqs_;
ServiceType async_service_;
- std::forward_list<ServerRpcContext *> contexts_;
+ std::vector<std::unique_ptr<ServerRpcContext>> contexts_;
struct PerThreadShutdownState {
mutable std::mutex mutex;