OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1446 ResourceId local_id = it->second; | 1446 ResourceId local_id = it->second; |
1447 DCHECK(!resources_[local_id].marked_for_deletion); | 1447 DCHECK(!resources_[local_id].marked_for_deletion); |
1448 child_info.in_use_resources.insert(local_id); | 1448 child_info.in_use_resources.insert(local_id); |
1449 } | 1449 } |
1450 | 1450 |
1451 ResourceIdArray unused; | 1451 ResourceIdArray unused; |
1452 for (ResourceIdMap::iterator it = child_info.child_to_parent_map.begin(); | 1452 for (ResourceIdMap::iterator it = child_info.child_to_parent_map.begin(); |
1453 it != child_info.child_to_parent_map.end(); | 1453 it != child_info.child_to_parent_map.end(); |
1454 ++it) { | 1454 ++it) { |
1455 ResourceId local_id = it->second; | 1455 ResourceId local_id = it->second; |
1456 // Hold onto resources that still have read locks on them. | |
1457 if (GetResource(local_id)->lock_for_read_count > 0) | |
1458 child_info.in_use_resources.insert(local_id); | |
piman
2014/03/27 00:12:37
I'm not sure if it's the best way to do this, in p
| |
1459 | |
1456 bool resource_is_in_use = child_info.in_use_resources.count(local_id) > 0; | 1460 bool resource_is_in_use = child_info.in_use_resources.count(local_id) > 0; |
1457 if (!resource_is_in_use) | 1461 if (!resource_is_in_use) |
1458 unused.push_back(local_id); | 1462 unused.push_back(local_id); |
1459 } | 1463 } |
1460 DeleteAndReturnUnusedResourcesToChild(child_it, Normal, unused); | 1464 DeleteAndReturnUnusedResourcesToChild(child_it, Normal, unused); |
1461 } | 1465 } |
1462 | 1466 |
1463 // static | 1467 // static |
1464 bool ResourceProvider::CompareResourceMapIteratorsByChildId( | 1468 bool ResourceProvider::CompareResourceMapIteratorsByChildId( |
1465 const std::pair<ReturnedResource, ResourceMap::iterator>& a, | 1469 const std::pair<ReturnedResource, ResourceMap::iterator>& a, |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2215 ContextProvider* context_provider = output_surface_->context_provider(); | 2219 ContextProvider* context_provider = output_surface_->context_provider(); |
2216 return context_provider ? context_provider->ContextGL() : NULL; | 2220 return context_provider ? context_provider->ContextGL() : NULL; |
2217 } | 2221 } |
2218 | 2222 |
2219 class GrContext* ResourceProvider::GrContext() const { | 2223 class GrContext* ResourceProvider::GrContext() const { |
2220 ContextProvider* context_provider = output_surface_->context_provider(); | 2224 ContextProvider* context_provider = output_surface_->context_provider(); |
2221 return context_provider ? context_provider->GrContext() : NULL; | 2225 return context_provider ? context_provider->GrContext() : NULL; |
2222 } | 2226 } |
2223 | 2227 |
2224 } // namespace cc | 2228 } // namespace cc |
OLD | NEW |