• Elly Fong-Jones's avatar
    content: suppress no-op LoadStateChanged · cad9c3d1
    Elly Fong-Jones authored
    Whenever any requests are running, ResourceDispatcherHostImpl polls for state
    changes to running requests, so that these can be reflected in the UI. However,
    ResourceDispatcherHostImpl doesn't remember the previous state of a request, so
    it always calls LoaderDelegate::LoadStateChanged() for any running request, at
    4Hz. This calls into WebContentsImpl::LoadStateChanged(), which *does* have
    access to the previous state, which then notifies the UI of a change.
    
    Instead, WebContentsImpl should check if the state notification is redundant,
    and if so, should ignore it. This will save doing a bunch of work in the UI. In
    principle, ResourceDispatcherHostImpl could do this de-duplication instead, but
    that involves storing more data in RDHI for a very small further decrease in
    work done.
    
    This also fixes the root cause of an old bug where on Mac, the status bar would
    be clobbered (at 4Hz) whenever there was a pending request in the current tab.
    This bug was worked around in the Views status bar code by suppressing updates
    with no text changes, but that workaround never made it to the Cocoa status
    bar.
    
    Bug: 147303
    Change-Id: Idbaded695b161543d1750aa9e6253c3bdd0a145a
    Reviewed-on: https://chromium-review.googlesource.com/895724Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#533309}
    cad9c3d1
web_contents_impl.cc 218 KB