diff options
author | dpolukhin@google.com <dpolukhin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-09 08:19:33 +0000 |
---|---|---|
committer | dpolukhin@google.com <dpolukhin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-09 08:19:33 +0000 |
commit | 780af60775a8e2cc5e099382fce226046f891fec (patch) | |
tree | e9b93ecbab5e0553132a41ee808699da93038a6a /chrome | |
parent | 80fc08c5decf9b58812eb891e240a921dd7caaa6 (diff) | |
download | chromium_src-780af60775a8e2cc5e099382fce226046f891fec.zip chromium_src-780af60775a8e2cc5e099382fce226046f891fec.tar.gz chromium_src-780af60775a8e2cc5e099382fce226046f891fec.tar.bz2 |
Fix performance regression New Tab Warm introduced in http://codereview.chromium.org/660087
Prevents extra layouts and setting window size.
BUG=37533
TEST=Difference perf regression should be fixed, see perf monitor here http://build.chromium.org/buildbot/perf/xp-release-dual-core/new-tab-ui-warm/report.html?history=150&rev=-1
Review URL: http://codereview.chromium.org/669238
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/tab_contents/tab_contents_view_win.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/chrome/browser/views/tab_contents/tab_contents_view_win.cc b/chrome/browser/views/tab_contents/tab_contents_view_win.cc index 95f1219..9161668 100644 --- a/chrome/browser/views/tab_contents/tab_contents_view_win.cc +++ b/chrome/browser/views/tab_contents/tab_contents_view_win.cc @@ -171,7 +171,11 @@ void TabContentsViewWin::OnTabCrashed() { void TabContentsViewWin::SizeContents(const gfx::Size& size) { // TODO(brettw) this is a hack and should be removed. See tab_contents_view.h. - WasSized(size); + + // Set new window size. It will fire OnWindowPosChanged and we will do + // the rest in WasSized. + UINT swp_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE; + SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); } void TabContentsViewWin::Focus() { @@ -455,7 +459,8 @@ void TabContentsViewWin::OnSize(UINT param, const CSize& size) { // DefWindowProc, OnSize is NOT called on window resize. This handler // is called only once when the window is created. - WidgetWin::OnSize(param, size); + // Don't call base class OnSize to avoid useless layout for 0x0 size. + // We will get OnWindowPosChanged later and layout root view in WasSized. // Hack for thinkpad touchpad driver. // Set fake scrollbars so that we can get scroll messages, @@ -506,17 +511,15 @@ void TabContentsViewWin::WasShown() { } void TabContentsViewWin::WasSized(const gfx::Size& size) { - UINT swp_flags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE; - SetWindowPos(NULL, 0, 0, size.width(), size.height(), swp_flags); if (tab_contents()->interstitial_page()) tab_contents()->interstitial_page()->SetSize(size); RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); if (rwhv) rwhv->SetSize(size); - // Relayout root view. Usually root view layout happens in OnSize. But because - // we handle OnWindowPosChanged without calling DefWindowProc (it sends - // OnSize and OnMove) we don't receive OnSize so we have to make layout here. + // We have to layout root view here because we handle OnWindowPosChanged + // without calling DefWindowProc (it sends OnSize and OnMove) so we don't + // receive OnSize. LayoutRootView(); } |