From 32da16b7b69c51000f5a6d61efc8e4073239e962 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Wed, 28 Jul 2021 13:48:12 +0200 Subject: [PATCH 1/3] Do not call CoreWindow::Visible from raster thread --- shell/platform/windows/flutter_window_winuwp.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/platform/windows/flutter_window_winuwp.cc b/shell/platform/windows/flutter_window_winuwp.cc index bda55263c36e2..464dbe1816177 100644 --- a/shell/platform/windows/flutter_window_winuwp.cc +++ b/shell/platform/windows/flutter_window_winuwp.cc @@ -118,7 +118,12 @@ float FlutterWindowWinUWP::GetDpiScale() { } bool FlutterWindowWinUWP::IsVisible() { - return window_.Visible(); + // This is called from raster thread as an optimization to not wait for vsync + // if window is invisible. However CoreWindow is not agile so we can't call + // Visible() from raster thread. For now assume window is always visible. + // Possible solution would be to register a VisibilityChanged handler and + // store the visiblity state in a variable TODO(knopp). + return true; } void FlutterWindowWinUWP::OnDpiChanged( From 0d24582ad34278ce94bfae889630216353813833 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Wed, 28 Jul 2021 13:50:32 +0200 Subject: [PATCH 2/3] tweak --- shell/platform/windows/flutter_window_winuwp.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/windows/flutter_window_winuwp.cc b/shell/platform/windows/flutter_window_winuwp.cc index 464dbe1816177..4655dbaff07cc 100644 --- a/shell/platform/windows/flutter_window_winuwp.cc +++ b/shell/platform/windows/flutter_window_winuwp.cc @@ -122,7 +122,7 @@ bool FlutterWindowWinUWP::IsVisible() { // if window is invisible. However CoreWindow is not agile so we can't call // Visible() from raster thread. For now assume window is always visible. // Possible solution would be to register a VisibilityChanged handler and - // store the visiblity state in a variable TODO(knopp). + // store the visiblity state in a variable. TODO(knopp) return true; } From dbba8630291c2ecba26499a8e9c4a7b53ec44d11 Mon Sep 17 00:00:00 2001 From: Matej Knopp Date: Sat, 7 Aug 2021 21:33:31 +0200 Subject: [PATCH 3/3] Add link to issue --- shell/platform/windows/flutter_window_winuwp.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/shell/platform/windows/flutter_window_winuwp.cc b/shell/platform/windows/flutter_window_winuwp.cc index 4655dbaff07cc..34872c4e189bf 100644 --- a/shell/platform/windows/flutter_window_winuwp.cc +++ b/shell/platform/windows/flutter_window_winuwp.cc @@ -123,6 +123,7 @@ bool FlutterWindowWinUWP::IsVisible() { // Visible() from raster thread. For now assume window is always visible. // Possible solution would be to register a VisibilityChanged handler and // store the visiblity state in a variable. TODO(knopp) + // https://github.com/flutter/flutter/issues/87870 return true; }