• liberato@chromium.org's avatar
    SequenceBound<T> for classes with affinity to a sequence. · d91dacc0
    liberato@chromium.org authored
    SequenceBound<T> allows for easy creation, posting, and destruction
    objects of type T on a designated Sequence.  It does not expose the
    underlying pointer to T, so it's hard to accidentally pass them around
    in callbacks that are then run on the wrong thread.
    
    A SequenceBound<> may be created anywhere, passed (moved) between
    threads, etc., safely.  Destruction of the SequenceBound schedules
    destruction of the underlying instance of T on the appropriate thread.
    
    Not implemented here (but prototyped elsewhere) are weak pointers
    to these objects that may be passed and used between threads safely;
    utility functions to generate thread-hopping callbacks; support for
    strong shared ownership semantics.
    
    Tests: sequence_bound_unittest.cc
    
    Cq-Include-Trybots: luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
    Change-Id: I3bbf7e975884fce8e18f3bb15a0d211ead58a619
    Reviewed-on: https://chromium-review.googlesource.com/875241
    Commit-Queue: Frank Liberato <liberato@chromium.org>
    Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Reviewed-by: default avatarTaiju Tsuiki <tzik@chromium.org>
    Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#591429}
    d91dacc0
sequence_bound.h 8.35 KB