class CompleterBase
Defined at line 135 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/transaction.h
Manages the lifetime of a transaction and serves as the base class of FIDL
method-specific completers. It ensures that no two-way calls will be silently
dropped without replying or closing, unless the server endpoint has been
unbound.
An individual |CompleterBase| object (and by extension any method completer)
is thread-unsafe. Multi-threaded uses of a |CompleterBase| object requires
external synchronization.
Public Methods
void Close (zx_status_t status)
Instructs the transaction to send an epitaph and then close the underlying transport.
|status| may be an error status, or |ZX_OK|, which indicates normal (expected) closure.
It is an error to close a completer twice.
Defined at line 24 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
bool is_reply_needed ()
Returns if a reply is needed on the completer. A reply is needed when both:
- The FIDL method is two-way.
- The server method handler has yet to make a reply.
unless any of the following apply:
- The completer is moved or converted to an async completer (a reply may be
needed on the new completer).
- The server method handler calls |Close| on the completer.
- The server endpoint is unbound from the message dispatcher due to an
error or an explicit |Unbind| request from a |fidl::ServerBindingRef|.
It is safe to destroy a completer without replying after calling |Unbind|.
Defined at line 31 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
fidl::Status result_of_reply ()
Inspects the status of sending the reply. One may only call this after
making a reply.
A non-ok status indicates internal errors during the reply, such as
encoding or writing to the transport. Note that any error will
automatically lead to unbinding the server, after which the |on_unbound|
callback will be triggered with a detailed reason. As such, this accessor
is only useful when one needs to determine which particular method reply
failed, and can be ignored in general use.
Defined at line 76 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
void SendReply (::fidl::OutgoingMessage * message, fidl::internal::OutgoingTransportContext transport_context)
TODO(https://fxbug.dev/42138399): Use composition instead of inheriting all completers
from |CompleterBase|. This method is unnecessarily exposed to the user.
Defined at line 83 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
void CompleterBase (const CompleterBase & )
Defined at line 137 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/transaction.h
CompleterBase & operator= (const CompleterBase & )
Defined at line 138 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/transaction.h
Protected Methods
void CompleterBase (CompleterBase && other)
Defined at line 46 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
CompleterBase & operator= (CompleterBase && other)
Defined at line 11 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
void ~CompleterBase ()
Defined at line 57 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
std::unique_ptr<Transaction> TakeOwnership ()
Move the contents of |transaction_| to heap and return it.
Defined at line 68 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
void EnableNextDispatch ()
Resumes the asynchronous wait on the underlying channel, enabling another dispatcher thread to
enter the message handler for this binding. This must only be called from the scope of the
message handler.
Defined at line 40 of file ../../sdk/lib/fidl/cpp/wire/transaction.cc
void CompleterBase (Transaction * transaction, bool owned, bool method_expects_reply)
Defined at line 179 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/transaction.h