• Yi Su's avatar
    Use WeakPtr for WebFramesManagerImpl to prevent crashes · 124046e3
    Yi Su authored
    Some crashes happen in WebFramesManagerImpl::OnFrameBecameAvailable,
    probably due to a lifecycle issue of WebStateImpl/CRWWebController.
    When these classes are destroyed, WebFramesManagerImpl::OnWebViewUpdate
    should be called and callbacks for JS messages should be unregistered.
    However this might not be true according to crash reports.
    
    Use WeakPtr in WebFramesManagerImpl for callbacks should help suppress
    crashes, and we need further investigation to fix the lifecycle issue
    and revert this patch.
    
    Bug: 990842,991616,991950
    Change-Id: I746c53eaa920bd96d6820edd563d2b7f94f7eb50
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742135Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
    Commit-Queue: Yi Su <mrsuyi@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#685214}
    124046e3
web_frames_manager_impl.mm 7.33 KB