Call Widget::Init() after OverlayWindowViews constructor
Calling Widget::Init() from OverlayWindowViews constructor seems too early. Widget::Init() triggers calls to virtual functions such as OnNativeWidgetMove() while OverlayWindowViews hasn't been constructed fully. To cope with this, the |is_initialized_| flag was used as a trigger for early returns. This turned out error-prone as some crucial parts of the virtual functions were skipped, resulting in the PiP window becoming blank and unusable on some systems. It seems safer in general to call Widget::Init() on a constructed OverlayWindowViews object anyway. With this CL, we still call SetUpViews() in the constructor to set up all the views::View pointers that are dereferenced as a result of Widget::Init(). Since the root view is not available at this stage (it gets created by Widget::Init()), we keep the child views in a temporary container. We defer the initialization steps that require the root View to a new helper function OverlayWindowViews::OnRootViewReady(). Bug: 1058852 Change-Id: I7434fc6067fae0b5fcc0135d6c3b7b8ff62d79d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107991 Commit-Queue: Wojciech Dzierżanowski <wdzierzanowski@opera.com> Reviewed-by:Allen Bauer <kylixrd@chromium.org> Cr-Commit-Position: refs/heads/master@{#751824}
Showing
This diff is collapsed.
Please register or sign in to comment