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

Unified Diff: ui/compositor/compositor.cc

Issue 13604007: Fix large mis-paint when resizing windows aura chrome (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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/compositor/compositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
===================================================================
--- ui/compositor/compositor.cc (revision 188861)
+++ ui/compositor/compositor.cc (working copy)
@@ -410,6 +410,7 @@
last_started_frame_(0),
last_ended_frame_(0),
disable_schedule_composite_(false),
+ is_resizing_ (false),
compositor_lock_(NULL) {
root_web_layer_ = cc::Layer::Create();
root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f));
@@ -496,6 +497,14 @@
host_->set_has_transparent_background(host_has_transparent_background);
}
+#if defined (OS_WIN)
+#ifndef NDEBUG
+const int kResizePaintLatency = 12 * 16;
+#else
+const int kResizePaintLatency = 4 * 16;
+#endif
+#endif // OS_WIN.
+
void Compositor::Draw(bool force_clear) {
DCHECK(!g_compositor_thread);
@@ -509,6 +518,19 @@
// compositeImmediately() directly.
layout();
host_->Composite(base::TimeTicks::Now());
+
+#if defined(OS_WIN)
+ // While we resize, we are usually a few frames behind. By blocking
+ // the UI thread here we minize the area that is mis-painted, specially
+ // in the non-client area. See RenderWidgetHostViewAura::SetBounds for
+ // more details.
+ if (is_resizing_ && (last_ended_frame_ > 1)) {
cpu_(ooo_6.6-7.5) 2013/04/04 02:09:07 when chrome starts we hit here with frames 0 and 1
+ is_resizing_ = false;
+ base::PlatformThread::Sleep(
+ base::TimeDelta::FromMilliseconds(kResizePaintLatency));
jonathan.backer 2013/04/04 17:25:09 My experience has been that there are a lot of eve
+ }
+#endif
+
}
if (!pending_swap.posted())
NotifyEnd();
@@ -539,6 +561,8 @@
size_ = size_in_pixel;
host_->SetViewportSize(size_in_pixel, size_in_pixel);
root_web_layer_->SetBounds(size_in_pixel);
+
+ is_resizing_ = true;
}
if (device_scale_factor_ != scale) {
device_scale_factor_ = scale;
« no previous file with comments | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698