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

Unified Diff: media/blink/interval_map.h

Issue 1420883004: Multibuffer reader implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_cache
Patch Set: iterator fix + speed up random tests 3x Created 5 years, 1 month 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 | « media/blink/BUILD.gn ('k') | media/blink/media_blink.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/interval_map.h
diff --git a/media/blink/interval_map.h b/media/blink/interval_map.h
index e11a03ceef7abbba90dc105f6dcce49ca1da212e..74cdca71cf2dbf8c71309b3ccc1a0ca8fd9c2355 100644
--- a/media/blink/interval_map.h
+++ b/media/blink/interval_map.h
@@ -124,8 +124,6 @@ class IntervalMapConstIterator {
// Needed to make the following construct work:
// for (const auto& interval_value_pair : interval_map)
- // Note however that this will skip the "end" interval, which
- // is usually ok since it generally has the default value.
std::pair<Interval<KeyType>, ValueType> operator*() const {
return std::make_pair(interval(), value());
}
@@ -182,8 +180,7 @@ class IntervalMap {
// Increase [from..to) by |how_much|.
void IncrementInterval(KeyType from, KeyType to, ValueType how_much) {
- DCHECK_GT(to, from);
- if (how_much == 0)
+ if (to <= from || how_much == 0)
return;
typename MapType::iterator a = MakeEntry(from);
typename MapType::iterator b = MakeEntry(to);
@@ -197,7 +194,8 @@ class IntervalMap {
// Set [from..to) to |how_much|.
void SetInterval(KeyType from, KeyType to, ValueType how_much) {
- DCHECK_GT(to, from);
+ if (to <= from)
+ return;
typename MapType::iterator a = MakeEntry(from);
typename MapType::iterator b = MakeEntry(to);
a->second = how_much;
« no previous file with comments | « media/blink/BUILD.gn ('k') | media/blink/media_blink.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698