• shrike's avatar
    Reland fix for thumbnail generation. · 7fb8a562
    shrike authored
    This is an attempted relanding of
    https://codereview.chromium.org/1348833003, which was reverted in
    https://codereview.chromium.org/1450083002 . This cl includes changes
    to address the problem in https://crbug.com/555576 .
    
    It turns out that DecrementCapturerCount() can trigger a call to
    content::WebContentsImpl::WasHidden(), which eventually calls
    ThumbnailTabHelper::UpdateThumbnailIfNecessary(), starting the
    thumbnail generation process all over again. It also appears that the
    bitmap capture operation is not necessarily synchronous, so calling
    DecrementCapturerCount() anywhere within ProcessCapturedBitmap()
    potentially disposes of the web contents before the thumbnail has been
    captured.
    
    This new cl differs from the original (1348833003) only in
    thumbnail_tab_helper.cc, where I now unregister the ThumbnailTabHelper
    from further notifications within UpdateThumbnailIfNecessary(), and
    call DecrementCapturerCount() once the final callback is completely
    finished with the web contents.
    
    BUG=530707
    
    Review URL: https://codereview.chromium.org/1461463002
    
    Cr-Commit-Position: refs/heads/master@{#370809}
    7fb8a562
delegated_frame_host.cc 39.1 KB