From 09d0b0cf47dd2bbddd731c37503d2e8506a50179 Mon Sep 17 00:00:00 2001 From: vjpai Date: Fri, 31 Jul 2015 08:39:54 -0700 Subject: [PATCH] Remove lambdas from state machine functions --- test/cpp/qps/client_async.cc | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index e1e44f9ac0d..f517f1ae237 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -348,15 +348,19 @@ class AsyncUnaryClient GRPC_FINAL : public AsyncClient { ~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); } private: + static void CheckDone(grpc::Status s, SimpleResponse* response) {} + static std::unique_ptr> + StartReq(TestService::Stub* stub, grpc::ClientContext* ctx, + const SimpleRequest& request, CompletionQueue* cq) { + return stub->AsyncUnaryCall(ctx, request, cq); + }; static ClientRpcContext* SetupCtx(int channel_id, TestService::Stub* stub, const SimpleRequest& req) { - auto check_done = [](grpc::Status s, SimpleResponse* response) {}; - auto start_req = [](TestService::Stub* stub, grpc::ClientContext* ctx, - const SimpleRequest& request, CompletionQueue* cq) { - return stub->AsyncUnaryCall(ctx, request, cq); - }; - return new ClientRpcContextUnaryImpl( - channel_id, stub, req, start_req, check_done); + return new + ClientRpcContextUnaryImpl(channel_id, stub, req, + AsyncUnaryClient::StartReq, + AsyncUnaryClient::CheckDone); } }; @@ -442,16 +446,20 @@ class AsyncStreamingClient GRPC_FINAL : public AsyncClient { ~AsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); } private: + static void CheckDone(grpc::Status s, SimpleResponse* response) {} + static std::unique_ptr> + StartReq(TestService::Stub* stub, grpc::ClientContext* ctx, + CompletionQueue* cq, void* tag) { + auto stream = stub->AsyncStreamingCall(ctx, cq, tag); + return stream; + }; static ClientRpcContext* SetupCtx(int channel_id, TestService::Stub* stub, const SimpleRequest& req) { - auto check_done = [](grpc::Status s, SimpleResponse* response) {}; - auto start_req = [](TestService::Stub* stub, grpc::ClientContext* ctx, - CompletionQueue* cq, void* tag) { - auto stream = stub->AsyncStreamingCall(ctx, cq, tag); - return stream; - }; return new ClientRpcContextStreamingImpl( - channel_id, stub, req, start_req, check_done); + channel_id, stub, req, + AsyncStreamingClient::StartReq, + AsyncStreamingClient::CheckDone); } };