src/cpp/client/client_callback.cc
Go to the documentation of this file.
1 /*
2  * Copyright 2019 gRPC authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #include <utility>
19 
22 #include <grpcpp/support/status.h>
23 
29 
30 namespace grpc {
31 namespace internal {
32 
34  // Unlike other uses of closure, do not Ref or Unref here since the reactor
35  // object's lifetime is controlled by user code.
37  struct ClosureWithArg {
39  ClientReactor* const reactor;
40  const grpc::Status status;
41  ClosureWithArg(ClientReactor* reactor_arg, grpc::Status s)
42  : reactor(reactor_arg), status(std::move(s)) {
44  &closure,
45  [](void* void_arg, grpc_error_handle) {
46  ClosureWithArg* arg = static_cast<ClosureWithArg*>(void_arg);
47  arg->reactor->OnDone(arg->status);
48  delete arg;
49  },
50  this, grpc_schedule_on_exec_ctx);
51  }
52  };
53  ClosureWithArg* arg = new ClosureWithArg(this, std::move(s));
55 }
56 
59 }
60 
61 } // namespace internal
62 } // namespace grpc
grpc::internal::ClientReactor
Definition: impl/codegen/client_callback.h:115
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
grpc::status
auto status
Definition: cpp/client/credentials_test.cc:200
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc
Definition: grpcpp/alarm.h:33
closure.h
grpc_call_is_trailers_only
bool grpc_call_is_trailers_only(const grpc_call *call)
Definition: call.cc:1872
grpc_core::Executor::Run
static void Run(grpc_closure *closure, grpc_error_handle error, ExecutorType executor_type=ExecutorType::DEFAULT, ExecutorJobType job_type=ExecutorJobType::SHORT)
Definition: executor.cc:398
call
FilterStackCall * call
Definition: call.cc:750
grpc_types.h
client_callback.h
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
closure
grpc_closure closure
Definition: src/core/lib/surface/server.cc:466
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
arg
Definition: cmdline.cc:40
error.h
grpc_core::ExecCtx
Definition: exec_ctx.h:97
executor.h
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc::internal::ClientReactor::InternalTrailersOnly
virtual bool InternalTrailersOnly(const grpc_call *call) const
Definition: src/cpp/client/client_callback.cc:57
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
arg
struct arg arg
exec_ctx.h
closure
Definition: proxy.cc:59
grpc::internal::ClientReactor::InternalScheduleOnDone
virtual void InternalScheduleOnDone(grpc::Status s)
Definition: src/cpp/client/client_callback.cc:33
internal
Definition: benchmark/test/output_test_helper.cc:20
grpc_error
Definition: error_internal.h:42
grpc_closure
Definition: closure.h:56
call.h
status.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:46