• Trent Apted's avatar
    Make ActivityLog observe ScriptExecutor via a base::RepeatingCallback · 8f733b9e
    Trent Apted authored
    There once was a ScriptExecutionObserver::Delegate, but it disappeared
    in some past refactoring. The lifetime around ScriptExecutionObserver
    is quite complex, and relies on base::ObserverList being a
    SupportsWeakPtr, which we want to stop doing for https://crbug.com/888973.
    
    There is now exactly one ScriptExecutionObserver implementation
    (ActivityLog), and the observer list only ever has exactly 1 or zero
    observers in it; added and removed in concert with a TabHelper.
    WebViewGuest also has an ObserverList<ScriptExecutionObserver>, but
    it never added any observers to it.
    
    We can instead make ActivityLog responsible for the lifetime of its
    callbacks from ScriptExecutor. It already dispenses WeakPtrs to itself.
    
    Bug: 888973
    Change-Id: Ic773bbcbabea70627b48ef8e0e29ff4e16d1e1f5
    Reviewed-on: https://chromium-review.googlesource.com/c/1256398
    Commit-Queue: Trent Apted <tapted@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#596454}
    8f733b9e
script_executor.h 4.28 KB