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