• Francois Doray's avatar
    [PM] Make PerformanceManager(Impl)::CallOnGraph thread-safe. · 05d2f46a
    Francois Doray authored
    With this CL, PerformanceManager(Impl)::CallOnGraph can safely be
    called from any sequence, at any time. The callback does not run if
    the call is made before creation of after destruction of the
    Performance Manager.
    
    Implementation details: CallOnGraph always posts a task to the
    Performance Manager sequence. When the task runs on the
    Performance Manager sequence, it checks if a global pointer to
    the Performance Manager if set. This is not racy because the
    pointer is only modified from the Performance Manager sequence.
    If the pointer is set, the task gets the Graph from it and invokes
    the callback that was passed to CallOnGraph. Otherwise, the
    callback does not run.
    
    Bug: 980533
    Change-Id: I3d640e0ae13d012d76bab1483a5d59afb977c1a8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1849213
    Commit-Queue: François Doray <fdoray@chromium.org>
    Reviewed-by: default avatarSigurður Ásgeirsson <siggi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#704602}
    05d2f46a
performance_manager_impl.cc 9.98 KB