Commit 85aa6103 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

MacPWAs: Fix part of fullscreen-exit hang

NativeWidgetMac::CloseNow expects that the callbacks for window closure
will happen before the function exits. For out-of-process windows, this
will not be the case (and the callbacks will never be made because the
host interface will have been destroyed).

In out-of-process mode, add explicit calls to these callbacks.

This matches the behavior BridgedNativeWidgetHostImpl's
OnBridgeFactoryHostDestroying (which has the same problem where the
window destroy callbacks won't come in).

Bug: 915572
Change-Id: Ie65dfef1a7e483364ee95df2e52083c777523a61
Reviewed-on: https://chromium-review.googlesource.com/c/1388722
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarSidney San Martín <sdy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618682}
parent cb537be6
...@@ -122,6 +122,10 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl ...@@ -122,6 +122,10 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl
void InitWindow(const Widget::InitParams& params); void InitWindow(const Widget::InitParams& params);
// Close the window immediately. This function may result in |this| being
// deleted.
void CloseWindowNow();
// Changes the bounds of the window and the hosted layer if present. The // Changes the bounds of the window and the hosted layer if present. The
// origin is a location in screen coordinates except for "child" windows, // origin is a location in screen coordinates except for "child" windows,
// which are positioned relative to their parent. SetBounds() considers a // which are positioned relative to their parent. SetBounds() considers a
......
...@@ -248,6 +248,22 @@ void BridgedNativeWidgetHostImpl::InitWindow(const Widget::InitParams& params) { ...@@ -248,6 +248,22 @@ void BridgedNativeWidgetHostImpl::InitWindow(const Widget::InitParams& params) {
bridge()->SetVisibilityState(WindowVisibilityState::kShowInactive); bridge()->SetVisibilityState(WindowVisibilityState::kShowInactive);
} }
void BridgedNativeWidgetHostImpl::CloseWindowNow() {
bool is_out_of_process = !bridge_impl_;
// Note that CloseWindowNow may delete |this| for in-process windows.
if (bridge())
bridge()->CloseWindowNow();
// If it is out-of-process, then simulate the calls that would have been
// during window closure.
if (is_out_of_process) {
OnWindowWillClose();
while (!children_.empty())
children_.front()->CloseWindowNow();
OnWindowHasClosed();
}
}
void BridgedNativeWidgetHostImpl::SetBounds(const gfx::Rect& bounds) { void BridgedNativeWidgetHostImpl::SetBounds(const gfx::Rect& bounds) {
UpdateLocalWindowFrame(bounds); UpdateLocalWindowFrame(bounds);
bridge()->SetBounds(bounds, bridge()->SetBounds(bounds,
......
...@@ -383,9 +383,9 @@ void NativeWidgetMac::Close() { ...@@ -383,9 +383,9 @@ void NativeWidgetMac::Close() {
} }
void NativeWidgetMac::CloseNow() { void NativeWidgetMac::CloseNow() {
if (bridge()) if (bridge_host_)
bridge()->CloseWindowNow(); bridge_host_->CloseWindowNow();
// Note: |bridge_host_| will be deleted her, and |this| will be deleted here // Note: |bridge_host_| will be deleted here, and |this| will be deleted here
// when ownership_ == NATIVE_WIDGET_OWNS_WIDGET, // when ownership_ == NATIVE_WIDGET_OWNS_WIDGET,
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment