[roll] Roll fuchsia [fidl][cpp] Synchronized ServerBinding

Adds {fidl,fdf}::ServerBinding, a thread-unsafe server binding object
that trades threading restrictions for synchronous unbinding.

fidl::ServerBinding dispatches messages from a Zircon channel.
fdf::ServerBinding dispatches messages from a driver channel. They share
most of the implementation but the comments are duplicated for ease of
user learning.

The API is roughly modeled off of fidl::Binding. |Unbind| was omitted
because it's less often used, and is not trivial to add: it would need
to extract the channel from the wrapped ServerBindingRef. We could add
it in a backwards-compatible way in the future.

fidl::CloseHandler is not exactly equivalent to the set_error_handler in
HLCPP: the former would surface both user-initiated and external error
teardown, whereas the latter only surfaces error. This new behavior
proved to be more robust because people don't have to duplicate cleanup
logic in both the user-initiated teardown code paths and error code paths.
In the new C++ bindings, there are a lot more ways to user-initiate a
teardown: every completer has a .Close() function. Now all these would
feed into a CloseHandler callback which is a central place to perform
other cleanup.

The tests are also modeled off of
//sdk/ctf/tests/pkg/fidl/cpp/binding_unittest.cc. Added new tests that
test we reliably crash if the user tried to use the binding from
multiple threads or from an incorrect driver dispatcher.

I migrated some examples to fidl::ServerBinding. The examples are all
"self-managed" use cases so they don't really show an idiomatic use of
fidl::ServerBinding -- a binding set is arguably a better fit.
fidl::ServerBinding is useful during simple tests, or servers with only
a single client connection (very rare), or when the user needs a custom
data structure to hold the servers where binding set doesn't meet the
needs. E.g. in flatland it's common to maintain a ID-to-server
dictionary and have servers managed in that dictionary.

Original-Bug: 95685

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/743282
Original-Revision: 22bfb0871d06df2cca7b6ba5dd6fc5f2c895515a
GitOrigin-RevId: 1218c3649a807b759ea2809f41868aae78532157
Change-Id: Ia1ef11e26b7b9bb7568d75a9e91aa83eb97b7b59
1 file changed
tree: 5c12d40bd1316d3d4cd2629dbed48e1cfff016c2
  1. git-hooks/
  2. infra/
  3. third_party/
  4. cts
  5. firmware
  6. flower
  7. jiri.lock
  8. minimal
  9. prebuilts
  10. README.md
  11. stem
  12. test_durations
  13. toolchain
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.