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

Unified Diff: media/blink/multibuffer.cc

Issue 2363953003: multibuffer: Evict lower blocks first after inserting multiple blocks
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/blink/multibuffer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/multibuffer.cc
diff --git a/media/blink/multibuffer.cc b/media/blink/multibuffer.cc
index c17d80c81aa6eef5565d7ed04b201792935c7407..a59ac5e854232277ecbaf4c153ed0413fd0159d9 100644
--- a/media/blink/multibuffer.cc
+++ b/media/blink/multibuffer.cc
@@ -460,8 +460,6 @@ void MultiBuffer::PinRange(const BlockId& from,
// Iterate over all the modified ranges and check if any of them have
// transitioned in or out of the unlocked state. If so, we iterate over
// all buffers in that range and add/remove them from the LRU as approperiate.
- // We iterate *backwards* through the ranges, with the idea that data in a
- // continous range should be freed from the end first.
if (data_.empty())
return;
@@ -479,16 +477,16 @@ void MultiBuffer::PinRange(const BlockId& from,
// For each range that has transitioned to/from a pinned state,
// we iterate over the corresponding ranges in |present_| to find
// the blocks that are actually in the multibuffer.
- for (auto present_block_range = present_.find(transition_range.end - 1);
- present_block_range != present_.begin(); --present_block_range) {
+ for (auto present_block_range = present_.find(transition_range.begin);
+ present_block_range != present_.end(); ++present_block_range) {
if (!present_block_range.value())
continue;
Interval<BlockId> present_transitioned_range =
transition_range.Intersect(present_block_range.interval());
if (present_transitioned_range.Empty())
break;
- for (BlockId block = present_transitioned_range.end - 1;
- block >= present_transitioned_range.begin; --block) {
+ for (BlockId block = present_transitioned_range.begin;
+ block < present_transitioned_range.end; ++block) {
DCHECK_GE(block, 0);
DCHECK(data_.find(block) != data_.end());
if (pin) {
« no previous file with comments | « no previous file | media/blink/multibuffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698