diff options
author | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 23:18:41 +0000 |
---|---|---|
committer | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-13 23:18:41 +0000 |
commit | 25489c008bfa5935e8e1e4a9093d47a0489d36ae (patch) | |
tree | ec4d5bd707072b01e23a5cf4023756221fc611c1 /cc/resources | |
parent | 248f1ce53a70ba2f22fb9be69dc692819a1abe22 (diff) | |
download | chromium_src-25489c008bfa5935e8e1e4a9093d47a0489d36ae.zip chromium_src-25489c008bfa5935e8e1e4a9093d47a0489d36ae.tar.gz chromium_src-25489c008bfa5935e8e1e4a9093d47a0489d36ae.tar.bz2 |
CC/GPU: Add a soft limit to the compositor.
On low-end devices (and increasingly high-end) we want to
reduce memory as much as possible for normal content yet
not cause calamitous fallbacks such as raster-on-demand
or flickering.
This adds a hard memory limit in addition to the soft limit.
The hard limit will be used only to avoid calamitous behavior.
Limits are the same for this patch and will be tweaked in
future patches.
BUG=339144
NOTRY=true
No-try since this is cc-only, cc_unittests pass, and the errors are not related.
Review URL: https://codereview.chromium.org/140673009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251180 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/resources')
-rw-r--r-- | cc/resources/tile_manager.cc | 59 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 4 | ||||
-rw-r--r-- | cc/resources/tile_manager_perftest.cc | 3 | ||||
-rw-r--r-- | cc/resources/tile_manager_unittest.cc | 162 | ||||
-rw-r--r-- | cc/resources/tile_priority.cc | 3 | ||||
-rw-r--r-- | cc/resources/tile_priority.h | 17 |
6 files changed, 169 insertions, 79 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index cd9adfa..3cc5377 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -461,8 +461,10 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { if (state != global_state_) { global_state_ = state; prioritized_tiles_dirty_ = true; + // Soft limit is used for resource pool such that + // memory returns to soft limit after going over. resource_pool_->SetResourceUsageLimits( - global_state_.memory_limit_in_bytes, + global_state_.soft_memory_limit_in_bytes, global_state_.unused_memory_limit_in_bytes, global_state_.num_resources_limit); } @@ -598,21 +600,30 @@ void TileManager::AssignGpuMemoryToTiles( all_tiles_required_for_activation_have_memory_ = true; // Cast to prevent overflow. - int64 bytes_available = + int64 soft_bytes_available = static_cast<int64>(bytes_releasable_) + - static_cast<int64>(global_state_.memory_limit_in_bytes) - + static_cast<int64>(global_state_.soft_memory_limit_in_bytes) - + static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); + int64 hard_bytes_available = + static_cast<int64>(bytes_releasable_) + + static_cast<int64>(global_state_.hard_memory_limit_in_bytes) - static_cast<int64>(resource_pool_->acquired_memory_usage_bytes()); int resources_available = resources_releasable_ + global_state_.num_resources_limit - resource_pool_->acquired_resource_count(); - - size_t bytes_allocatable = std::max(static_cast<int64>(0), bytes_available); + size_t soft_bytes_allocatable = + std::max(static_cast<int64>(0), soft_bytes_available); + size_t hard_bytes_allocatable = + std::max(static_cast<int64>(0), hard_bytes_available); size_t resources_allocatable = std::max(0, resources_available); size_t bytes_that_exceeded_memory_budget = 0; - size_t bytes_left = bytes_allocatable; + size_t soft_bytes_left = soft_bytes_allocatable; + size_t hard_bytes_left = hard_bytes_allocatable; + size_t resources_left = resources_allocatable; - bool oomed = false; + bool oomed_soft = false; + bool oomed_hard = false; // Memory we assign to raster tasks now will be deducted from our memory // in future iterations if priorities change. By assigning at most half @@ -644,8 +655,11 @@ void TileManager::AssignGpuMemoryToTiles( continue; } - size_t bytes_if_allocated = BytesConsumedIfAllocated(tile); - size_t raster_bytes_if_rastered = raster_bytes + bytes_if_allocated; + const bool tile_uses_hard_limit = mts.bin <= NOW_BIN; + const size_t bytes_if_allocated = BytesConsumedIfAllocated(tile); + const size_t raster_bytes_if_rastered = raster_bytes + bytes_if_allocated; + const size_t tile_bytes_left = + (tile_uses_hard_limit) ? hard_bytes_left : soft_bytes_left; size_t tile_bytes = 0; size_t tile_resources = 0; @@ -671,7 +685,7 @@ void TileManager::AssignGpuMemoryToTiles( } // Tile is OOM. - if (tile_bytes > bytes_left || tile_resources > resources_left) { + if (tile_bytes > tile_bytes_left || tile_resources > resources_left) { FreeResourcesForTile(tile); // This tile was already on screen and now its resources have been @@ -680,12 +694,16 @@ void TileManager::AssignGpuMemoryToTiles( if (mts.visible_and_ready_to_draw && use_rasterize_on_demand_) tile_version.set_rasterize_on_demand(); - oomed = true; - bytes_that_exceeded_memory_budget += tile_bytes; + oomed_soft = true; + if (tile_uses_hard_limit) { + oomed_hard = true; + bytes_that_exceeded_memory_budget += tile_bytes; + } } else { - bytes_left -= tile_bytes; resources_left -= tile_resources; - + hard_bytes_left -= tile_bytes; + soft_bytes_left = + (soft_bytes_left > tile_bytes) ? soft_bytes_left - tile_bytes : 0; if (tile_version.resource_) continue; } @@ -700,7 +718,7 @@ void TileManager::AssignGpuMemoryToTiles( // 1. Tile size should not impact raster priority. // 2. Tiles with existing raster task could otherwise incorrectly // be added as they are not affected by |bytes_allocatable|. - if (oomed || raster_bytes_if_rastered > max_raster_bytes) { + if (oomed_soft || raster_bytes_if_rastered > max_raster_bytes) { all_tiles_that_need_to_be_rasterized_have_memory_ = false; if (tile->required_for_activation()) all_tiles_required_for_activation_have_memory_ = false; @@ -712,22 +730,23 @@ void TileManager::AssignGpuMemoryToTiles( tiles_that_need_to_be_rasterized->push_back(tile); } - ever_exceeded_memory_budget_ |= bytes_that_exceeded_memory_budget > 0; + // OOM reporting uses hard-limit, soft-OOM is normal depending on limit. + ever_exceeded_memory_budget_ |= oomed_hard; if (ever_exceeded_memory_budget_) { TRACE_COUNTER_ID2("cc", "over_memory_budget", this, "budget", - global_state_.memory_limit_in_bytes, + global_state_.hard_memory_limit_in_bytes, "over", bytes_that_exceeded_memory_budget); } memory_stats_from_last_assign_.total_budget_in_bytes = - global_state_.memory_limit_in_bytes; + global_state_.hard_memory_limit_in_bytes; memory_stats_from_last_assign_.bytes_allocated = - bytes_allocatable - bytes_left; + hard_bytes_allocatable - hard_bytes_left; memory_stats_from_last_assign_.bytes_unreleasable = - bytes_allocatable - bytes_releasable_; + hard_bytes_allocatable - bytes_releasable_; memory_stats_from_last_assign_.bytes_over = bytes_that_exceeded_memory_budget; } diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 5122952..9e376a3 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -106,11 +106,13 @@ class CC_EXPORT TileManager : public RasterWorkerPoolClient, void SetGlobalStateForTesting( const GlobalStateThatImpactsTilePriority& state) { + // Soft limit is used for resource pool such that + // memory returns to soft limit after going over. if (state != global_state_) { global_state_ = state; prioritized_tiles_dirty_ = true; resource_pool_->SetResourceUsageLimits( - global_state_.memory_limit_in_bytes, + global_state_.soft_memory_limit_in_bytes, global_state_.unused_memory_limit_in_bytes, global_state_.num_resources_limit); } diff --git a/cc/resources/tile_manager_perftest.cc b/cc/resources/tile_manager_perftest.cc index 14ff13e..d8a5033 100644 --- a/cc/resources/tile_manager_perftest.cc +++ b/cc/resources/tile_manager_perftest.cc @@ -52,9 +52,10 @@ class TileManagerPerfTest : public testing::Test { GlobalStateThatImpactsTilePriority GlobalStateForTest() { GlobalStateThatImpactsTilePriority state; gfx::Size tile_size = settings_.default_tile_size; - state.memory_limit_in_bytes = + state.soft_memory_limit_in_bytes = 10000u * 4u * static_cast<size_t>(tile_size.width() * tile_size.height()); + state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; state.num_resources_limit = 10000; state.memory_limit_policy = ALLOW_ANYTHING; state.tree_priority = SMOOTHNESS_TAKES_PRIORITY; diff --git a/cc/resources/tile_manager_unittest.cc b/cc/resources/tile_manager_unittest.cc index 083ff8f..70260e3 100644 --- a/cc/resources/tile_manager_unittest.cc +++ b/cc/resources/tile_manager_unittest.cc @@ -21,7 +21,7 @@ class TileManagerTest : public testing::TestWithParam<bool>, TileManagerTest() : memory_limit_policy_(ALLOW_ANYTHING), - max_memory_tiles_(0), + max_tiles_(0), ready_to_activate_(false) {} void Initialize(int max_tiles, @@ -37,39 +37,31 @@ class TileManagerTest : public testing::TestWithParam<bool>, this, resource_provider_.get(), allow_on_demand_raster)); memory_limit_policy_ = memory_limit_policy; - max_memory_tiles_ = max_tiles; + max_tiles_ = max_tiles; + picture_pile_ = FakePicturePileImpl::CreatePile(); + + SetTreePriority(tree_priority); + } + + void SetTreePriority(TreePriority tree_priority) { GlobalStateThatImpactsTilePriority state; gfx::Size tile_size = settings_.default_tile_size; - // The parametrization specifies whether the max tile limit should - // be applied to RAM or to tile limit. - if (GetParam()) { - state.memory_limit_in_bytes = - max_tiles * 4 * tile_size.width() * tile_size.height(); + if (UsingMemoryLimit()) { + state.soft_memory_limit_in_bytes = + max_tiles_ * 4 * tile_size.width() * tile_size.height(); state.num_resources_limit = 100; } else { - state.memory_limit_in_bytes = 100 * 1000 * 1000; - state.num_resources_limit = max_tiles; + state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; + state.num_resources_limit = max_tiles_; } - state.unused_memory_limit_in_bytes = state.memory_limit_in_bytes; - state.memory_limit_policy = memory_limit_policy; + state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; + state.unused_memory_limit_in_bytes = state.soft_memory_limit_in_bytes; + state.memory_limit_policy = memory_limit_policy_; state.tree_priority = tree_priority; global_state_ = state; tile_manager_->SetGlobalStateForTesting(state); - picture_pile_ = FakePicturePileImpl::CreatePile(); - } - - void SetTreePriority(TreePriority tree_priority) { - GlobalStateThatImpactsTilePriority state; - gfx::Size tile_size = settings_.default_tile_size; - state.memory_limit_in_bytes = - max_memory_tiles_ * 4 * tile_size.width() * tile_size.height(); - state.unused_memory_limit_in_bytes = state.memory_limit_in_bytes; - state.memory_limit_policy = memory_limit_policy_; - state.num_resources_limit = 100; - state.tree_priority = tree_priority; - global_state_ = state; } virtual void TearDown() OVERRIDE { @@ -134,6 +126,11 @@ class TileManagerTest : public testing::TestWithParam<bool>, bool ready_to_activate() const { return ready_to_activate_; } + // The parametrization specifies whether the max tile limit should + // be applied to memory or resources. + bool UsingResourceLimit() { return !GetParam(); } + bool UsingMemoryLimit() { return GetParam(); } + protected: GlobalStateThatImpactsTilePriority global_state_; @@ -145,7 +142,7 @@ class TileManagerTest : public testing::TestWithParam<bool>, scoped_ptr<FakeOutputSurface> output_surface_; scoped_ptr<ResourceProvider> resource_provider_; TileMemoryLimitPolicy memory_limit_policy_; - int max_memory_tiles_; + int max_tiles_; bool ready_to_activate_; }; @@ -236,14 +233,14 @@ TEST_P(TileManagerTest, PartialOOMMemoryToPending) { // 5 tiles on active tree eventually bin, 5 tiles on pending tree that are // required for activation, but only enough memory for 8 tiles. The result // is all pending tree tiles get memory, and 3 of the active tree tiles - // get memory. + // get memory. None of these tiles is needed to avoid calimity (flickering or + // raster-on-demand) so the soft memory limit is used. Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); TileVector active_tree_tiles = CreateTiles(5, TilePriorityForEventualBin(), TilePriority()); TileVector pending_tree_tiles = CreateTiles(5, TilePriority(), TilePriorityRequiredForActivation()); - tile_manager()->AssignMemoryToTiles(global_state_); EXPECT_EQ(5, AssignedMemoryCount(active_tree_tiles)); @@ -260,6 +257,8 @@ TEST_P(TileManagerTest, PartialOOMMemoryToActive) { // 5 tiles on active tree eventually bin, 5 tiles on pending tree now bin, // but only enough memory for 8 tiles. The result is all active tree tiles // get memory, and 3 of the pending tree tiles get memory. + // The pending tiles are not needed to avoid calimity (flickering or + // raster-on-demand) and the active tiles fit, so the soft limit is used. Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); TileVector active_tree_tiles = @@ -274,16 +273,16 @@ TEST_P(TileManagerTest, PartialOOMMemoryToActive) { } TEST_P(TileManagerTest, TotalOOMMemoryToPending) { - // 5 tiles on active tree eventually bin, 5 tiles on pending tree that are - // required for activation, but only enough memory for 4 tiles. The result + // 10 tiles on active tree eventually bin, 10 tiles on pending tree that are + // required for activation, but only enough tiles for 4 tiles. The result // is 4 pending tree tiles get memory, and none of the active tree tiles // get memory. Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); TileVector active_tree_tiles = - CreateTiles(5, TilePriorityForEventualBin(), TilePriority()); + CreateTiles(10, TilePriorityForEventualBin(), TilePriority()); TileVector pending_tree_tiles = - CreateTiles(5, TilePriority(), TilePriorityRequiredForActivation()); + CreateTiles(10, TilePriority(), TilePriorityRequiredForActivation()); tile_manager()->AssignMemoryToTiles(global_state_); @@ -293,21 +292,28 @@ TEST_P(TileManagerTest, TotalOOMMemoryToPending) { SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); + if (UsingResourceLimit()) { + EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); + } else { + // Pending tiles are now required to avoid calimity (flickering or + // raster-on-demand). Hard-limit is used and double the tiles fit. + EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles)); + } } TEST_P(TileManagerTest, TotalOOMActiveSoonMemoryToPending) { - // 5 tiles on active tree soon bin, 5 tiles on pending tree that are - // required for activation, but only enough memory for 4 tiles. The result + // 10 tiles on active tree soon bin, 10 tiles on pending tree that are + // required for activation, but only enough tiles for 4 tiles. The result // is 4 pending tree tiles get memory, and none of the active tree tiles // get memory. Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); TileVector active_tree_tiles = - CreateTiles(5, TilePriorityForSoonBin(), TilePriority()); + CreateTiles(10, TilePriorityForSoonBin(), TilePriority()); TileVector pending_tree_tiles = - CreateTiles(5, TilePriority(), TilePriorityRequiredForActivation()); + CreateTiles(10, TilePriority(), TilePriorityRequiredForActivation()); tile_manager()->AssignMemoryToTiles(global_state_); @@ -317,25 +323,78 @@ TEST_P(TileManagerTest, TotalOOMActiveSoonMemoryToPending) { SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); - EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); + if (UsingResourceLimit()) { + EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(4, AssignedMemoryCount(pending_tree_tiles)); + } else { + // Pending tiles are now required to avoid calimity (flickering or + // raster-on-demand). Hard-limit is used and double the tiles fit. + EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(8, AssignedMemoryCount(pending_tree_tiles)); + } } TEST_P(TileManagerTest, TotalOOMMemoryToActive) { - // 5 tiles on active tree eventually bin, 5 tiles on pending tree now bin, - // but only enough memory for 4 tiles. The result is 5 active tree tiles + // 10 tiles on active tree eventually bin, 10 tiles on pending tree now bin, + // but only enough memory for 4 tiles. The result is 4 active tree tiles // get memory, and none of the pending tree tiles get memory. Initialize(4, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); TileVector active_tree_tiles = - CreateTiles(5, TilePriorityForNowBin(), TilePriority()); + CreateTiles(10, TilePriorityForNowBin(), TilePriority()); TileVector pending_tree_tiles = - CreateTiles(5, TilePriority(), TilePriorityForNowBin()); + CreateTiles(10, TilePriority(), TilePriorityForNowBin()); tile_manager()->AssignMemoryToTiles(global_state_); - EXPECT_EQ(4, AssignedMemoryCount(active_tree_tiles)); + if (UsingResourceLimit()) { + EXPECT_EQ(4, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); + } else { + // Active tiles are required to avoid calimity (flickering or + // raster-on-demand). Hard-limit is used and double the tiles fit. + EXPECT_EQ(8, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); + } +} + +TEST_P(TileManagerTest, TotalOOMMemoryToNewContent) { + // 10 tiles on active tree now bin, 10 tiles on pending tree now bin, + // but only enough memory for 8 tiles. Any tile missing would cause + // a calamity (flickering or raster-on-demand). Depending on mode, + // we should use varying amounts of the higher hard memory limit. + if (UsingResourceLimit()) + return; + + Initialize(8, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); + TileVector active_tree_tiles = + CreateTiles(10, TilePriorityForNowBin(), TilePriority()); + TileVector pending_tree_tiles = + CreateTiles(10, TilePriority(), TilePriorityForNowBin()); + + // Active tiles are required to avoid calimity. The hard-limit is used and all + // active-tiles fit. No pending tiles are needed to avoid calamity so only 10 + // tiles total are used. + tile_manager()->AssignMemoryToTiles(global_state_); + EXPECT_EQ(10, AssignedMemoryCount(active_tree_tiles)); EXPECT_EQ(0, AssignedMemoryCount(pending_tree_tiles)); + + // Even the hard-limit won't save us now. All tiles are required to avoid + // a clamity but we only have 16. The tiles will be distribted randomly + // given they are identical, in practice depending on their screen location. + SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); + tile_manager()->AssignMemoryToTiles(global_state_); + EXPECT_EQ(16, + AssignedMemoryCount(active_tree_tiles) + + AssignedMemoryCount(pending_tree_tiles)); + + // The pending tree is now more important. Active tiles will take higher + // priority if they are ready-to-draw in practice. Importantly though, + // pending tiles also utilize the hard-limit. + SetTreePriority(NEW_CONTENT_TAKES_PRIORITY); + tile_manager()->AssignMemoryToTiles(global_state_); + EXPECT_EQ(0, AssignedMemoryCount(active_tree_tiles)); + EXPECT_EQ(10, AssignedMemoryCount(pending_tree_tiles)); } TEST_P(TileManagerTest, RasterAsLCD) { @@ -483,9 +542,14 @@ TEST_P(TileManagerTest, TextReRasterAsNoLCD) { } TEST_P(TileManagerTest, RespectMemoryLimit) { + if (UsingResourceLimit()) + return; + Initialize(5, ALLOW_ANYTHING, SMOOTHNESS_TAKES_PRIORITY); + + // We use double the tiles since the hard-limit is double. TileVector large_tiles = - CreateTiles(5, TilePriorityForNowBin(), TilePriority()); + CreateTiles(10, TilePriorityForNowBin(), TilePriority()); size_t memory_required_bytes; size_t memory_nice_to_have_bytes; @@ -498,7 +562,7 @@ TEST_P(TileManagerTest, RespectMemoryLimit) { &memory_allocated_bytes, &memory_used_bytes); // Allocated bytes should never be more than the memory limit. - EXPECT_LE(memory_allocated_bytes, global_state_.memory_limit_in_bytes); + EXPECT_LE(memory_allocated_bytes, global_state_.hard_memory_limit_in_bytes); // Finish raster of large tiles. tile_manager()->UpdateVisibleTiles(); @@ -508,10 +572,10 @@ TEST_P(TileManagerTest, RespectMemoryLimit) { large_tiles.clear(); // Create a new set of tiles using a different size. These tiles - // can use the memory currently assigned to the lerge tiles but + // can use the memory currently assigned to the large tiles but // they can't use the same resources as the size doesn't match. TileVector small_tiles = CreateTilesWithSize( - 5, TilePriorityForNowBin(), TilePriority(), gfx::Size(128, 128)); + 10, TilePriorityForNowBin(), TilePriority(), gfx::Size(128, 128)); tile_manager()->AssignMemoryToTiles(global_state_); tile_manager()->GetMemoryStats(&memory_required_bytes, @@ -519,7 +583,7 @@ TEST_P(TileManagerTest, RespectMemoryLimit) { &memory_allocated_bytes, &memory_used_bytes); // Allocated bytes should never be more than the memory limit. - EXPECT_LE(memory_allocated_bytes, global_state_.memory_limit_in_bytes); + EXPECT_LE(memory_allocated_bytes, global_state_.hard_memory_limit_in_bytes); } TEST_P(TileManagerTest, AllowRasterizeOnDemand) { diff --git a/cc/resources/tile_priority.cc b/cc/resources/tile_priority.cc index b0e0c9f..9e81d6c 100644 --- a/cc/resources/tile_priority.cc +++ b/cc/resources/tile_priority.cc @@ -104,7 +104,8 @@ scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const { scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); state->Set("memory_limit_policy", TileMemoryLimitPolicyAsValue(memory_limit_policy).release()); - state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes); + state->SetInteger("soft_memory_limit_in_bytes", soft_memory_limit_in_bytes); + state->SetInteger("hard_memory_limit_in_bytes", hard_memory_limit_in_bytes); state->SetInteger("unused_memory_limit_in_bytes", unused_memory_limit_in_bytes); state->SetInteger("num_resources_limit", num_resources_limit); diff --git a/cc/resources/tile_priority.h b/cc/resources/tile_priority.h index 421bfc9..49d9d79 100644 --- a/cc/resources/tile_priority.h +++ b/cc/resources/tile_priority.h @@ -138,25 +138,28 @@ class GlobalStateThatImpactsTilePriority { public: GlobalStateThatImpactsTilePriority() : memory_limit_policy(ALLOW_NOTHING), - memory_limit_in_bytes(0), + soft_memory_limit_in_bytes(0), + hard_memory_limit_in_bytes(0), unused_memory_limit_in_bytes(0), num_resources_limit(0), tree_priority(SAME_PRIORITY_FOR_BOTH_TREES) {} TileMemoryLimitPolicy memory_limit_policy; - size_t memory_limit_in_bytes; + size_t soft_memory_limit_in_bytes; + size_t hard_memory_limit_in_bytes; size_t unused_memory_limit_in_bytes; size_t num_resources_limit; TreePriority tree_priority; bool operator==(const GlobalStateThatImpactsTilePriority& other) const { - return memory_limit_policy == other.memory_limit_policy - && memory_limit_in_bytes == other.memory_limit_in_bytes - && unused_memory_limit_in_bytes == other.unused_memory_limit_in_bytes - && num_resources_limit == other.num_resources_limit - && tree_priority == other.tree_priority; + return memory_limit_policy == other.memory_limit_policy && + soft_memory_limit_in_bytes == other.soft_memory_limit_in_bytes && + hard_memory_limit_in_bytes == other.hard_memory_limit_in_bytes && + unused_memory_limit_in_bytes == other.unused_memory_limit_in_bytes && + num_resources_limit == other.num_resources_limit && + tree_priority == other.tree_priority; } bool operator!=(const GlobalStateThatImpactsTilePriority& other) const { return !(*this == other); |