diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 22:19:21 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 22:19:21 +0000 |
commit | aa4117f9d083dead1c9c764f0ad14e1c14d00524 (patch) | |
tree | 766cf5af27597abb38a94b16a1644a2c894b1436 /content/browser/renderer_host/render_widget_helper.cc | |
parent | 209f20c8a51c83c2344e5c638f391a9f5dfb827c (diff) | |
download | chromium_src-aa4117f9d083dead1c9c764f0ad14e1c14d00524.zip chromium_src-aa4117f9d083dead1c9c764f0ad14e1c14d00524.tar.gz chromium_src-aa4117f9d083dead1c9c764f0ad14e1c14d00524.tar.bz2 |
Delay UpdateRect until the SwapBuffers callback when accelerated compositing is on.
This is also removing the UpdateRect ack in the accelerated compositing case,
because it is not needed (and adds scheduling constraints that reduce
throughput).
This also sends a "dummy" message to the browser to unblock the UI thread if it's waiting on an UpdateRect when the transition from non-accelerated to accelerated happens: the GPU process may need to round trip to the browser UI thread before sending the SwapBuffers callback.
BUG=58782
TEST=reduced jankiness on aura builds when resizing.
Review URL: http://codereview.chromium.org/8498036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/renderer_host/render_widget_helper.cc')
-rw-r--r-- | content/browser/renderer_host/render_widget_helper.cc | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/content/browser/renderer_host/render_widget_helper.cc b/content/browser/renderer_host/render_widget_helper.cc index 9228e0f..2a791a7 100644 --- a/content/browser/renderer_host/render_widget_helper.cc +++ b/content/browser/renderer_host/render_widget_helper.cc @@ -109,13 +109,17 @@ bool RenderWidgetHelper::WaitForUpdateMsg(int render_widget_id, UpdateMsgProxyMap::iterator it = pending_paints_.find(render_widget_id); if (it != pending_paints_.end()) { - proxy = it->second; + UpdateMsgProxyQueue &queue = it->second; + DCHECK(!queue.empty()); + proxy = queue.front(); // Flag the proxy as cancelled so that when it is run as a task it will // do nothing. proxy->cancelled = true; - pending_paints_.erase(it); + queue.pop_front(); + if (queue.empty()) + pending_paints_.erase(it); } } @@ -140,30 +144,11 @@ bool RenderWidgetHelper::WaitForUpdateMsg(int render_widget_id, void RenderWidgetHelper::DidReceiveUpdateMsg(const IPC::Message& msg) { int render_widget_id = msg.routing_id(); - UpdateMsgProxy* proxy = NULL; + UpdateMsgProxy* proxy = new UpdateMsgProxy(this, msg); { base::AutoLock lock(pending_paints_lock_); - // Visual Studio 2010 has problems converting NULL to the null pointer for - // std::pair. See http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair - // It will work if we pass nullptr. -#if defined(_MSC_VER) && _MSC_VER >= 1600 - RenderWidgetHelper::UpdateMsgProxy* null_proxy = nullptr; -#else - RenderWidgetHelper::UpdateMsgProxy* null_proxy = NULL; -#endif - UpdateMsgProxyMap::value_type new_value(render_widget_id, null_proxy); - - // We expect only a single PaintRect message at a time. Optimize for the - // case that we don't already have an entry by using the 'insert' method. - std::pair<UpdateMsgProxyMap::iterator, bool> result = - pending_paints_.insert(new_value); - if (!result.second) { - NOTREACHED() << "Unexpected PaintRect message!"; - return; - } - - result.first->second = (proxy = new UpdateMsgProxy(this, msg)); + pending_paints_[render_widget_id].push_back(proxy); } // Notify anyone waiting on the UI thread that there is a new entry in the @@ -184,9 +169,12 @@ void RenderWidgetHelper::OnDiscardUpdateMsg(UpdateMsgProxy* proxy) { UpdateMsgProxyMap::iterator it = pending_paints_.find(msg.routing_id()); DCHECK(it != pending_paints_.end()); - DCHECK(it->second == proxy); + UpdateMsgProxyQueue &queue = it->second; + DCHECK(queue.front() == proxy); - pending_paints_.erase(it); + queue.pop_front(); + if (queue.empty()) + pending_paints_.erase(it); } } |