• Jered Gray's avatar
    Stop initializing HintCache on UI thread · 35dcd9d1
    Jered Gray authored
    Previously, the HintCache's initialization, which involved adding all
    hints contained within a hint vector to the cache, was being handled
    on the UI thread. This initialization could take a significant amount
    of time and triggered the creation of a jank startup performance bug.
    
    The logic has been modified so that the HintCache is no longer
    initialized on the UI thread. It is instead initialized within its
    constructor during PreviewsHints::CreateFromHintsComponent() on a
    background thread.
    
    This is accomplished via a HintCache::Data object. Once the hints are
    fully added to Data, it is moved into the HintCache's constructor. The
    HintCache is immutable after construction.
    
    Not only does this remove all of the costly UI thread processing, but
    it also eliminates the expensive intermediate hint vector.
    
    Bug: 910251
    Change-Id: I04a28248ad1ce790f999da06f48e3c5aabfcb812
    Reviewed-on: https://chromium-review.googlesource.com/c/1356226
    Commit-Queue: Jered Gray <jegray@chromium.org>
    Reviewed-by: default avatarDoug Arnett <dougarnett@chromium.org>
    Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#613196}
    35dcd9d1
hint_cache.cc 2.89 KB