Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 589043004: Restrict the number of cases where we force the compositor to do a synchronous paint to resizing an… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index 4f6c7d4c64d425e58f0648d3fb1ff190b39493a6..60cf1fbd4131c11b55bc96dd902d22ae51de38e9 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -83,7 +83,9 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
should_animate_window_close_(false),
pending_close_(false),
has_non_client_view_(false),
- tooltip_(NULL) {
+ tooltip_(NULL),
+ need_synchronous_paint_(false),
+ in_sizing_loop_(false) {
}
DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() {
@@ -717,6 +719,22 @@ void DesktopWindowTreeHostWin::HandleClose() {
}
bool DesktopWindowTreeHostWin::HandleCommand(int command) {
+ // Windows uses the 4 lower order bits of |notification_code| for type-
+ // specific information so we must exclude this when comparing.
+ static const int sc_mask = 0xFFF0;
+ switch (command & sc_mask) {
+ case SC_RESTORE:
+ case SC_MAXIMIZE:
+ need_synchronous_paint_ = true;
+ break;
+
+ case SC_SIZE:
+ in_sizing_loop_ = true;
+ break;
+
+ default:
+ break;
+ }
return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command);
}
@@ -752,10 +770,16 @@ void DesktopWindowTreeHostWin::HandleDisplayChange() {
}
void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() {
+ if (in_sizing_loop_)
+ need_synchronous_paint_ = true;
native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange();
}
void DesktopWindowTreeHostWin::HandleEndWMSizeMove() {
+ if (in_sizing_loop_) {
+ need_synchronous_paint_ = false;
+ in_sizing_loop_ = false;
+ }
native_widget_delegate_->OnNativeWidgetEndUserBoundsChange();
}
@@ -912,8 +936,15 @@ bool DesktopWindowTreeHostWin::HandleScrollEvent(
}
void DesktopWindowTreeHostWin::HandleWindowSizeChanging() {
- if (compositor())
+ if (compositor() && need_synchronous_paint_) {
compositor()->FinishAllRendering();
+ // If we received the window size changing notification due to a restore or
+ // maximize operation, then we can reset the need_synchronous_paint_ flag
+ // here. For a sizing operation, the flag will be reset at the end of the
+ // operation.
+ if (!in_sizing_loop_)
+ need_synchronous_paint_ = false;
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698