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

Unified Diff: media/blink/url_index.cc

Issue 2910553002: fully cache small audio/video (Closed)
Patch Set: comment added Created 3 years, 7 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/blink/url_index.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/url_index.cc
diff --git a/media/blink/url_index.cc b/media/blink/url_index.cc
index f255cb19f686e21499392dfa6e5d6528e74c83fa..21babb7f8e1e4e628b37db1a191926e94c12fd99 100644
--- a/media/blink/url_index.cc
+++ b/media/blink/url_index.cc
@@ -149,10 +149,19 @@ void UrlData::OnEmpty() {
scoped_refptr<UrlData>(this)));
}
-bool UrlData::Valid() const {
+bool UrlData::FullyCached() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (length_ == kPositionNotSpecified)
+ return false;
+ // Check that the first unavailable block in the cache is after the
+ // end of the file.
+ return (multibuffer()->FindNextUnavailable(0) << kBlockSizeShift) >= length_;
+}
+
+bool UrlData::Valid() {
DCHECK(thread_checker_.CalledOnValidThread());
base::Time now = base::Time::Now();
- if (!range_supported_)
+ if (!range_supported_ && !FullyCached())
return false;
// When ranges are not supported, we cannot re-use cached data.
if (valid_until_ > now)
« no previous file with comments | « media/blink/url_index.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698