• Dana Fried's avatar
    Working hover card implementation using a state machine. · 0a8d0279
    Dana Fried authored
    Much more reliable capture based on a state machine. Now thumbnail
    capture walks through the following steps:
     - Navigating to new page
     - Navigation complete
     - Capture requested
     - Frame capture
     - Cooldown*
     - Capture complete**
    
     * Cooldown allows us to continue capturing for a short period of time
       after a page indicates it's loaded; this gives the renderer time to
       actually draw the final version of the page
    ** Once we've captured a background page, there's no further need to try
       to capture it again unless it navigates, or the user makes it active,
       interacts, and then leaves again (a case we handle separately).
    
    Typically these states move forward. However, there are potential issues
    with trying to frame capture a visible/active tab, so we pause video
    capture while a page is active and then return to capturing it after the
    user switches away. Since we do not show preview images for the current
    tab in desktop mode, it's not a problem. For tablet mode (Mohnstrudel),
    if the tabstrip is observing the thumbnail image for the current tab,
    the tab will be captured.
    
    This complex behavior of stepping forward and backwards based on whether
    a tab is visible, being observed, etc. is all handled by
    ThumbnailTabHelper::ThumbnailTabHelperState::UpdateCaptureState().
    
    Still to do:
     - Create a queue of thumbnails to be captured that prioritizes
       thumbnails for pages that are being or have recently been observed,
       to actively limit the number of thumbnails we are trying to observe
       at once in order to save memory. In-flight thumbnails are
       uncompressed, which can have a significant impact on RAM usage.
    
    Bug: 1057713, 1059862, 1068459
    Fixes: 1068459
    Change-Id: If81798c0d3df26a5c309e834483042a5b5f24857
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2145161
    Commit-Queue: Dana Fried <dfried@chromium.org>
    Reviewed-by: default avatarCollin Baker <collinbaker@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#761111}
    0a8d0279
thumbnail_tab_helper.cc 22 KB