mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-23 15:37:51 +01:00
Don't generate update tasks while layout is occurring.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@369 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
587eb7871d
commit
9d2dbef101
@ -89,19 +89,17 @@ gfx::PluginWindowHandle WebWidgetHost::GetWindowedPluginAt(int x, int y)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WebWidgetHost::DoPaint() {
|
void WebWidgetHost::DoPaint() {
|
||||||
has_update_task_ = false;
|
|
||||||
|
|
||||||
// TODO(cef): The below code is cross-platform but the IsIdle() method
|
// TODO(cef): The below code is cross-platform but the IsIdle() method
|
||||||
// currently requires patches to Chromium. Since this code is only executed
|
// currently requires patches to Chromium. Since this code is only executed
|
||||||
// on Windows it's been stuck behind an #ifdef for now to avoid having to
|
// on Windows it's been stuck behind an #ifdef for now to avoid having to
|
||||||
// patch Chromium code on other platforms.
|
// patch Chromium code on other platforms.
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
if (MessageLoop::current()->IsIdle()) {
|
if (MessageLoop::current()->IsIdle()) {
|
||||||
|
has_update_task_ = false;
|
||||||
// Paint to the delegate. The rect argument is unused.
|
// Paint to the delegate. The rect argument is unused.
|
||||||
Paint(gfx::Rect());
|
Paint(gfx::Rect());
|
||||||
} else {
|
} else {
|
||||||
// Try again later.
|
// Try again later.
|
||||||
has_update_task_ = true;
|
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
||||||
}
|
}
|
||||||
|
@ -502,7 +502,7 @@ void WebWidgetHost::Paint(const gfx::Rect& /*dirty_rect*/) {
|
|||||||
|
|
||||||
// Draw children
|
// Draw children
|
||||||
UpdateWindow(view_);
|
UpdateWindow(view_);
|
||||||
} else if(!damaged_rgn.isEmpty()) {
|
} else {
|
||||||
// Paint to the delegate.
|
// Paint to the delegate.
|
||||||
DCHECK(paint_delegate_);
|
DCHECK(paint_delegate_);
|
||||||
const SkBitmap& bitmap = canvas_->getDevice()->accessBitmap(false);
|
const SkBitmap& bitmap = canvas_->getDevice()->accessBitmap(false);
|
||||||
@ -531,8 +531,9 @@ void WebWidgetHost::InvalidateRect(const gfx::Rect& rect)
|
|||||||
RECT r = rect.ToRECT();
|
RECT r = rect.ToRECT();
|
||||||
::InvalidateRect(view_, &r, FALSE);
|
::InvalidateRect(view_, &r, FALSE);
|
||||||
} else {
|
} else {
|
||||||
// Paint() will be called by DoPaint().
|
// Don't post a paint task if this invalidation occurred during layout or if
|
||||||
if (!has_update_task_) {
|
// a paint task is already pending. Paint() will be called by DoPaint().
|
||||||
|
if (!layouting_ && !has_update_task_) {
|
||||||
has_update_task_ = true;
|
has_update_task_ = true;
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
base::Bind(&WebWidgetHost::DoPaint, weak_factory_.GetWeakPtr()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user