• Kurt Horimoto's avatar
    [iOS] Start broadcasting when BVC's view is visible. · e7d6b922
    Kurt Horimoto authored
    BVC previously used self.visible, which is set in |-viewWillAppear:|, as
    a trigger to start broadcasting its UI state.  However, cancelled
    UIViewController transitions can sometimes result in |-viewWillAppear:|
    being called without its accompanying |-viewDidAppear:| and
    |-viewWillDisappear:| selectors.  As a result, BVC continued to
    broadcast its UI even if its views were removed from the hierarchy and
    deallocated, thus resulting in the crash from crbug.com/915123.
    
    This CL updates BVC.broadcasting to be gated on BVC.viewVisible, which
    is instead set in |-viewDidAppear:| after a successful presentation.
    In addition to mitigating the crash, this also is an improvement
    semantically, as BVC should not be broadcasting its state until it is
    fully presented.  If objects care about BVC's UI during a transition,
    it should be using the transition coordinator.
    
    Currently, the BVC's broadcasted values are only used by
    FullscreenController, and no scrolling is occurring in between
    |-viewWillAppear:| and |-viewDidAppear:|, meaning that this CL has
    no functional change.
    
    Bug: 915123, 916581
    Change-Id: Ifc0245e6e93f823c733be41ea471954912e7b577
    Reviewed-on: https://chromium-review.googlesource.com/c/1388713Reviewed-by: default avataredchin <edchin@chromium.org>
    Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
    Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#618654}
    e7d6b922
browser_view_controller.mm 199 KB