• Etienne Bergeron's avatar
    Change TracingSamplerProfiler observer from async to sync · 683ce594
    Etienne Bergeron authored
    This CL is changing the kind of observer used by the sampling profiler
    wrapper class. The proposed implementation is to use the sync version
    which is fixing early startup tracing/sampling.
    
    The previous code was using a Async observer to keep the class
    thread-safe. Unfortunately, the sampling profiler is not able to start
    early enough on startup. The hooks are at the right place.
    
    The reason why it's not working on startup is because the tasks queue is
    already loaded of startup tasks to be executed on the main thread.
    Thus, after activating tracing, there is a long gab between the point
    where the tigger occurs and when the sampling profiler got created and
    start to collect samples (e.g. OnTraceLogEnabled).
    
    To avoid this delay, we prefer using a Sync observer. That forces the class
    to be thread-safe.
    
    R=oysteine@chromium.org
    CC=​ssid@chromium.org, wittman@chromium.org
    
    Change-Id: I02a1deb2f8aa705ccbf5fb6e7026f4588ca1b319
    Reviewed-on: https://chromium-review.googlesource.com/c/1359293Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
    Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Reviewed-by: default avataroysteine <oysteine@chromium.org>
    Reviewed-by: default avatarKen Rockot <rockot@google.com>
    Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#614784}
    683ce594
renderer_main.cc 8.76 KB