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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc

Issue 528173002: 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@master
Patch Set: Code review comments 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
6 6
7 #include "base/win/metro.h" 7 #include "base/win/metro.h"
8 #include "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 internal::NativeWidgetDelegate* native_widget_delegate, 76 internal::NativeWidgetDelegate* native_widget_delegate,
77 DesktopNativeWidgetAura* desktop_native_widget_aura) 77 DesktopNativeWidgetAura* desktop_native_widget_aura)
78 : message_handler_(new HWNDMessageHandler(this)), 78 : message_handler_(new HWNDMessageHandler(this)),
79 native_widget_delegate_(native_widget_delegate), 79 native_widget_delegate_(native_widget_delegate),
80 desktop_native_widget_aura_(desktop_native_widget_aura), 80 desktop_native_widget_aura_(desktop_native_widget_aura),
81 content_window_(NULL), 81 content_window_(NULL),
82 drag_drop_client_(NULL), 82 drag_drop_client_(NULL),
83 should_animate_window_close_(false), 83 should_animate_window_close_(false),
84 pending_close_(false), 84 pending_close_(false),
85 has_non_client_view_(false), 85 has_non_client_view_(false),
86 tooltip_(NULL) { 86 tooltip_(NULL),
87 need_synchronous_paint_(false),
88 in_sizing_loop_(false) {
87 } 89 }
88 90
89 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { 91 DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() {
90 // WARNING: |content_window_| has been destroyed by the time we get here. 92 // WARNING: |content_window_| has been destroyed by the time we get here.
91 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); 93 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this);
92 DestroyDispatcher(); 94 DestroyDispatcher();
93 } 95 }
94 96
95 // static 97 // static
96 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { 98 aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) {
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 691
690 void DesktopWindowTreeHostWin::HandleCaptureLost() { 692 void DesktopWindowTreeHostWin::HandleCaptureLost() {
691 OnHostLostWindowCapture(); 693 OnHostLostWindowCapture();
692 } 694 }
693 695
694 void DesktopWindowTreeHostWin::HandleClose() { 696 void DesktopWindowTreeHostWin::HandleClose() {
695 GetWidget()->Close(); 697 GetWidget()->Close();
696 } 698 }
697 699
698 bool DesktopWindowTreeHostWin::HandleCommand(int command) { 700 bool DesktopWindowTreeHostWin::HandleCommand(int command) {
701 // Windows uses the 4 lower order bits of |notification_code| for type-
702 // specific information so we must exclude this when comparing.
703 static const int sc_mask = 0xFFF0;
704 switch (command & sc_mask) {
705 case SC_RESTORE:
706 case SC_MAXIMIZE:
707 need_synchronous_paint_ = true;
708 break;
709
710 case SC_SIZE:
711 in_sizing_loop_ = true;
712 break;
713
714 default:
715 break;
716 }
699 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command); 717 return GetWidget()->widget_delegate()->ExecuteWindowsCommand(command);
700 } 718 }
701 719
702 void DesktopWindowTreeHostWin::HandleAccelerator( 720 void DesktopWindowTreeHostWin::HandleAccelerator(
703 const ui::Accelerator& accelerator) { 721 const ui::Accelerator& accelerator) {
704 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator); 722 GetWidget()->GetFocusManager()->ProcessAccelerator(accelerator);
705 } 723 }
706 724
707 void DesktopWindowTreeHostWin::HandleCreate() { 725 void DesktopWindowTreeHostWin::HandleCreate() {
708 native_widget_delegate_->OnNativeWidgetCreated(true); 726 native_widget_delegate_->OnNativeWidgetCreated(true);
(...skipping 15 matching lines...) Expand all
724 bool DesktopWindowTreeHostWin::HandleInitialFocus( 742 bool DesktopWindowTreeHostWin::HandleInitialFocus(
725 ui::WindowShowState show_state) { 743 ui::WindowShowState show_state) {
726 return GetWidget()->SetInitialFocus(show_state); 744 return GetWidget()->SetInitialFocus(show_state);
727 } 745 }
728 746
729 void DesktopWindowTreeHostWin::HandleDisplayChange() { 747 void DesktopWindowTreeHostWin::HandleDisplayChange() {
730 GetWidget()->widget_delegate()->OnDisplayChanged(); 748 GetWidget()->widget_delegate()->OnDisplayChanged();
731 } 749 }
732 750
733 void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() { 751 void DesktopWindowTreeHostWin::HandleBeginWMSizeMove() {
752 if (in_sizing_loop_)
753 need_synchronous_paint_ = true;
734 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange(); 754 native_widget_delegate_->OnNativeWidgetBeginUserBoundsChange();
735 } 755 }
736 756
737 void DesktopWindowTreeHostWin::HandleEndWMSizeMove() { 757 void DesktopWindowTreeHostWin::HandleEndWMSizeMove() {
758 if (in_sizing_loop_) {
759 need_synchronous_paint_ = false;
760 in_sizing_loop_ = false;
761 }
738 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange(); 762 native_widget_delegate_->OnNativeWidgetEndUserBoundsChange();
739 } 763 }
740 764
741 void DesktopWindowTreeHostWin::HandleMove() { 765 void DesktopWindowTreeHostWin::HandleMove() {
742 native_widget_delegate_->OnNativeWidgetMove(); 766 native_widget_delegate_->OnNativeWidgetMove();
743 OnHostMoved(GetBounds().origin()); 767 OnHostMoved(GetBounds().origin());
744 } 768 }
745 769
746 void DesktopWindowTreeHostWin::HandleWorkAreaChanged() { 770 void DesktopWindowTreeHostWin::HandleWorkAreaChanged() {
747 GetWidget()->widget_delegate()->OnWorkAreaChanged(); 771 GetWidget()->widget_delegate()->OnWorkAreaChanged();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 LPARAM l_param) { 908 LPARAM l_param) {
885 } 909 }
886 910
887 bool DesktopWindowTreeHostWin::HandleScrollEvent( 911 bool DesktopWindowTreeHostWin::HandleScrollEvent(
888 const ui::ScrollEvent& event) { 912 const ui::ScrollEvent& event) {
889 SendEventToProcessor(const_cast<ui::ScrollEvent*>(&event)); 913 SendEventToProcessor(const_cast<ui::ScrollEvent*>(&event));
890 return event.handled(); 914 return event.handled();
891 } 915 }
892 916
893 void DesktopWindowTreeHostWin::HandleWindowSizeChanging() { 917 void DesktopWindowTreeHostWin::HandleWindowSizeChanging() {
894 if (compositor()) 918 if (compositor() && need_synchronous_paint_) {
895 compositor()->FinishAllRendering(); 919 compositor()->FinishAllRendering();
920 // If we received the window size changing notification due to a restore or
921 // maximize operation, then we can reset the need_synchronous_paint_ flag
922 // here. For a sizing operation, the flag will be reset at the end of the
923 // operation.
924 if (!in_sizing_loop_)
925 need_synchronous_paint_ = false;
926 }
896 } 927 }
897 928
898 //////////////////////////////////////////////////////////////////////////////// 929 ////////////////////////////////////////////////////////////////////////////////
899 // DesktopWindowTreeHostWin, private: 930 // DesktopWindowTreeHostWin, private:
900 931
901 Widget* DesktopWindowTreeHostWin::GetWidget() { 932 Widget* DesktopWindowTreeHostWin::GetWidget() {
902 return native_widget_delegate_->AsWidget(); 933 return native_widget_delegate_->AsWidget();
903 } 934 }
904 935
905 const Widget* DesktopWindowTreeHostWin::GetWidget() const { 936 const Widget* DesktopWindowTreeHostWin::GetWidget() const {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 970
940 // static 971 // static
941 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( 972 DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
942 internal::NativeWidgetDelegate* native_widget_delegate, 973 internal::NativeWidgetDelegate* native_widget_delegate,
943 DesktopNativeWidgetAura* desktop_native_widget_aura) { 974 DesktopNativeWidgetAura* desktop_native_widget_aura) {
944 return new DesktopWindowTreeHostWin(native_widget_delegate, 975 return new DesktopWindowTreeHostWin(native_widget_delegate,
945 desktop_native_widget_aura); 976 desktop_native_widget_aura);
946 } 977 }
947 978
948 } // namespace views 979 } // namespace views
OLDNEW
« 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