summaryrefslogtreecommitdiffstats
path: root/views/widget
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 01:06:08 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-14 01:06:08 +0000
commit7bdd2b9e9114998905a00f256790ebf003064f8a (patch)
tree62da14b708473b37acc2fe9836b7618a2065f2e3 /views/widget
parent01c553f08001332cb00cdb7bb7f02256a0146fe0 (diff)
downloadchromium_src-7bdd2b9e9114998905a00f256790ebf003064f8a.zip
chromium_src-7bdd2b9e9114998905a00f256790ebf003064f8a.tar.gz
chromium_src-7bdd2b9e9114998905a00f256790ebf003064f8a.tar.bz2
Make WidgetWin redraw child windows that are in a different process asynchronously.
This helps with jank (i.e. bug 11701 which I couldn't repro with this) and also with deadlocks (fixes 11421 for painting). BUG=11421,11701 Review URL: http://codereview.chromium.org/115216 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r--views/widget/widget_win.cc33
1 files changed, 30 insertions, 3 deletions
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index 4a4e27e..759bcc9 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -259,6 +259,22 @@ gfx::NativeView WidgetWin::GetNativeView() const {
return hwnd_;
}
+static BOOL CALLBACK EnumChildProcForRedraw(HWND hwnd, LPARAM lparam) {
+ DWORD process_id;
+ GetWindowThreadProcessId(hwnd, &process_id);
+ gfx::Rect invalid_rect = *reinterpret_cast<gfx::Rect*>(lparam);
+
+ RECT window_rect;
+ GetWindowRect(hwnd, &window_rect);
+ invalid_rect.Offset(-window_rect.left, -window_rect.top);
+
+ int flags = RDW_INVALIDATE | RDW_NOCHILDREN;
+ if (process_id == GetCurrentProcessId())
+ flags |= RDW_UPDATENOW;
+ RedrawWindow(hwnd, &invalid_rect.ToRECT(), NULL, flags);
+ return TRUE;
+}
+
void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
if (use_layered_buffer_) {
PaintLayeredWindow();
@@ -273,9 +289,20 @@ void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
::RedrawWindow(GetParent(), parent_update_rect, NULL,
RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN);
} else {
- RECT native_update_rect = update_rect.ToRECT();
- RedrawWindow(hwnd_, &native_update_rect, NULL,
- RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN);
+ // Paint child windows that are in a different process asynchronously.
+ // This prevents a hang in other processes from blocking this process.
+ ::RedrawWindow(hwnd_, &update_rect.ToRECT(), NULL,
+ RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
+
+ // Send the invalid rect in screen coordinates.
+ CRect screen_rect_temp;
+ GetWindowRect(&screen_rect_temp);
+ gfx::Rect screen_rect(screen_rect_temp);
+ gfx::Rect invalid_screen_rect = update_rect;
+ invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
+
+ LPARAM lparam = reinterpret_cast<LPARAM>(&invalid_screen_rect);
+ EnumChildWindows(hwnd_, EnumChildProcForRedraw, lparam);
}
// As we were created with a style of WS_CLIPCHILDREN redraw requests may
// result in an empty paint rect in WM_PAINT (this'll happen if a