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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 23804004: [cc] Update UIResource test threading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove whitespace Created 7 years, 3 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 | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 773a689ac03749590685580a88dafb9cb92fcf0b..16248776b7f124dce1e7480a3b99bc33775073c9 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -5,6 +5,7 @@
#include "cc/trees/layer_tree_host.h"
#include <algorithm>
+#include <set>
#include <stack>
#include "base/bind.h"
@@ -1177,10 +1178,24 @@ void LayerTreeHost::DeleteUIResource(UIResourceId uid) {
}
void LayerTreeHost::RecreateUIResources(bool resource_lost) {
+ // Enumerate the resources that will be created when the queue is processed
+ // so that we don't re-create resources unnecessarily.
+ std::set<UIResourceId> already_recreated_resources;
aelias_OOO_until_Jul13 2013/09/07 21:34:09 Hmm, I'm not wholly opposed to having this, but we
ccameron 2013/09/08 01:54:33 The behavior that this works around is a strange t
+ for (UIResourceRequestQueue::const_iterator iter =
+ ui_resource_request_queue_.begin();
+ iter != ui_resource_request_queue_.end(); ++iter) {
+ const UIResourceRequest& request = *iter;
+ if (request.type == UIResourceRequest::UIResourceCreate)
+ already_recreated_resources.insert(request.id);
+ else if (request.type == UIResourceRequest::UIResourceDelete)
+ already_recreated_resources.erase(request.id);
+ }
for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
iter != ui_resource_client_map_.end();
++iter) {
UIResourceId uid = iter->first;
+ if (already_recreated_resources.count(uid))
+ continue;
UIResourceRequest request;
request.type = UIResourceRequest::UIResourceCreate;
request.id = uid;
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698