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

Unified Diff: cc/resources/resource_pool.cc

Issue 2744063002: Revert of cc::ResourcePool - Re-use larger resources for smaller requests (Closed)
Patch Set: Created 3 years, 9 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/resources/resource_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_pool.cc
diff --git a/cc/resources/resource_pool.cc b/cc/resources/resource_pool.cc
index 50eef3c4a2b86c4d978ead8a925ce4bce2344921..c2003758c4ba65ef0348e1988699c79f41dfb1b6 100644
--- a/cc/resources/resource_pool.cc
+++ b/cc/resources/resource_pool.cc
@@ -24,35 +24,8 @@
using base::trace_event::MemoryDumpLevelOfDetail;
namespace cc {
-namespace {
-bool ResourceMeetsSizeRequirements(const gfx::Size& requested_size,
- const gfx::Size& actual_size) {
- const float kReuseThreshold = 2.0f;
-
- // Allocating new resources is expensive, and we'd like to re-use our
- // existing ones within reason. Allow a larger resource to be used for a
- // smaller request.
- if (actual_size.width() < requested_size.width() ||
- actual_size.height() < requested_size.height())
- return false;
-
- // GetArea will crash on overflow, however all sizes in use are tile sizes.
- // These are capped at ResourceProvider::max_texture_size(), and will not
- // overflow.
- float actual_area = actual_size.GetArea();
- float requested_area = requested_size.GetArea();
- // Don't use a resource that is more than |kReuseThreshold| times the
- // requested pixel area, as we want to free unnecessarily large resources.
- if (actual_area / requested_area > kReuseThreshold)
- return false;
-
- return true;
-}
-
-} // namespace
-
base::TimeDelta ResourcePool::kDefaultExpirationDelay =
- base::TimeDelta::FromSeconds(5);
+ base::TimeDelta::FromSeconds(1);
void ResourcePool::PoolResource::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd,
@@ -146,7 +119,7 @@
if (resource->format() != format)
continue;
- if (!ResourceMeetsSizeRequirements(size, resource->size()))
+ if (resource->size() != size)
continue;
if (resource->color_space() != color_space)
continue;
« no previous file with comments | « no previous file | cc/resources/resource_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698