• Wez's avatar
    [Fuchsia] Move allocation of PA_HND identifiers into LaunchOptions. · 35e50b5d
    Wez authored
    Mojo's PlatformChannel implemented its own mechanism to allocate PA_HND
    identifiers, and used the PA_USER0 namespace. Separately we had some
    callers expecting to use statically-defined PA_USER0 identifiers to pass
    application-specific handles, creating potential for clashes.
    
    For features like base::FieldTrialList we also need a mechanism to pass
    a handle to a child process at startup, for which we'd ideally have a
    well-known path location in the FDIO namespace supplied to the child.
    Since FDIO namespaces do not yet support non-file/directory handles, we
    need a safe way to allocate an id that the FieldTrial implementation can
    pass via the command-line, similarly to Mojo.
    
    We add an AddHandleToTransfer() helper that appends a handle to a
    handles-to-transfer vector with a unique id, and returns the id, and add
    comments to clarify that PA_USER1 is used for these ids, leaving
    PA_USER0 (and others) free for application use.
    
    Bug: 909851
    Change-Id: If9b8ffaf98155f72cc7a52e5ef0c51ef19048d66
    Reviewed-on: https://chromium-review.googlesource.com/c/1354398Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
    Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
    Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Commit-Queue: Wez <wez@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#612899}
    35e50b5d
launch_fuchsia.cc 9.54 KB