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

Unified Diff: media/base/ranges.h

Issue 10581050: Ensure media's buffered ranges always have a range that includes currentTime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | « media/base/pipeline_unittest.cc ('k') | media/base/ranges.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/ranges.h
diff --git a/media/base/ranges.h b/media/base/ranges.h
index 1117ae58b8db86321df815f07f1646d996f3a299..82bf7a074742681cebafa997543fbaf4b16bc085 100644
--- a/media/base/ranges.h
+++ b/media/base/ranges.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/logging.h"
+#include "base/time.h"
#include "media/base/media_export.h"
namespace media {
@@ -41,6 +42,9 @@ class Ranges {
Ranges<T> IntersectionWith(const Ranges<T>& other);
private:
+ // Wrapper around DCHECK_LT allowing comparisons of operator<<'able T's.
+ void DCheckLT(const T& lhs, const T& rhs) const;
+
// Disjoint, in increasing order of start.
std::vector<std::pair<T, T> > ranges_;
};
@@ -54,7 +58,7 @@ size_t Ranges<T>::Add(T start, T end) {
if (start == end) // Nothing to be done with empty ranges.
return ranges_.size();
- DCHECK(start < end);
+ DCheckLT(start, end);
size_t i;
// Walk along the array of ranges until |start| is no longer larger than the
// current interval's end.
@@ -99,6 +103,15 @@ size_t Ranges<T>::Add(T start, T end) {
return ranges_.size();
}
+template<>
+void Ranges<base::TimeDelta>::DCheckLT(const base::TimeDelta& lhs,
+ const base::TimeDelta& rhs) const;
+
+template<class T>
+void Ranges<T>::DCheckLT(const T& lhs, const T& rhs) const {
+ DCHECK_LT(lhs, rhs);
+}
+
template<class T>
size_t Ranges<T>::size() const {
return ranges_.size();
« no previous file with comments | « media/base/pipeline_unittest.cc ('k') | media/base/ranges.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698