• nick's avatar
    [TaskManager] Allow a Task to mutate its PID after creation · 6c760df2
    nick authored
    Prior to this change, WebContentsTaskProvider would defer task creation if the
    PID was not known at RenderFrameCreated time. However, for a newly-cloned
    WebContents, no event ever occurred to re-create the Task once the process
    finished launching. This was bug 738169.
    
    Fix the problem by never deferring task_manager::Task creation; instead, create
    Tasks for all live, current RenderFrameHosts. If the PID is not known immediately,
    allow it to be set on the task at a later time (when RenderProcessHost::IsReady()
    becomes true).
    
    Because the TaskManagerImpl was written with the expectation that Tasks have
    a constant PID, PID mutation is implemented in terms of temporarily removing the
    task, mutating the PID, and re-adding it.
    
    In WebContentsTaskProvider, we no longer need to implement RenderProcessGone.
    
    In TaskGroup, don't waste time collecting stats for a null process ID.
    
    Tests are added exercising this bug, and its subframe equivalent. Test coverage
    is added for the PID==0 case, and we ensure that the "Memory" column is
    populated with something nonzero.
    
    BUG=738169
    
    Review-Url: https://codereview.chromium.org/2961423002
    Cr-Commit-Position: refs/heads/master@{#491180}
    6c760df2
task.h 8.92 KB