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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set>
8 #include <stack> 9 #include <stack>
9 10
10 #include "base/bind.h" 11 #include "base/bind.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
15 #include "base/stl_util.h" 16 #include "base/stl_util.h"
16 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
17 #include "cc/animation/animation_registrar.h" 18 #include "cc/animation/animation_registrar.h"
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 return; 1171 return;
1171 1172
1172 UIResourceRequest request; 1173 UIResourceRequest request;
1173 request.type = UIResourceRequest::UIResourceDelete; 1174 request.type = UIResourceRequest::UIResourceDelete;
1174 request.id = uid; 1175 request.id = uid;
1175 ui_resource_request_queue_.push_back(request); 1176 ui_resource_request_queue_.push_back(request);
1176 ui_resource_client_map_.erase(uid); 1177 ui_resource_client_map_.erase(uid);
1177 } 1178 }
1178 1179
1179 void LayerTreeHost::RecreateUIResources(bool resource_lost) { 1180 void LayerTreeHost::RecreateUIResources(bool resource_lost) {
1181 // Enumerate the resources that will be created when the queue is processed
1182 // so that we don't re-create resources unnecessarily.
1183 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
1184 for (UIResourceRequestQueue::const_iterator iter =
1185 ui_resource_request_queue_.begin();
1186 iter != ui_resource_request_queue_.end(); ++iter) {
1187 const UIResourceRequest& request = *iter;
1188 if (request.type == UIResourceRequest::UIResourceCreate)
1189 already_recreated_resources.insert(request.id);
1190 else if (request.type == UIResourceRequest::UIResourceDelete)
1191 already_recreated_resources.erase(request.id);
1192 }
1180 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); 1193 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
1181 iter != ui_resource_client_map_.end(); 1194 iter != ui_resource_client_map_.end();
1182 ++iter) { 1195 ++iter) {
1183 UIResourceId uid = iter->first; 1196 UIResourceId uid = iter->first;
1197 if (already_recreated_resources.count(uid))
1198 continue;
1184 UIResourceRequest request; 1199 UIResourceRequest request;
1185 request.type = UIResourceRequest::UIResourceCreate; 1200 request.type = UIResourceRequest::UIResourceCreate;
1186 request.id = uid; 1201 request.id = uid;
1187 request.bitmap = iter->second->GetBitmap(uid, resource_lost); 1202 request.bitmap = iter->second->GetBitmap(uid, resource_lost);
1188 DCHECK(request.bitmap.get()); 1203 DCHECK(request.bitmap.get());
1189 ui_resource_request_queue_.push_back(request); 1204 ui_resource_request_queue_.push_back(request);
1190 } 1205 }
1191 } 1206 }
1192 1207
1193 } // namespace cc 1208 } // namespace cc
OLDNEW
« 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