Chromium Code Reviews| 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; |