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

Unified Diff: media/blink/url_index.cc

Issue 2910553002: fully cache small audio/video (Closed)
Patch Set: tests fixed and 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
« media/blink/multibuffer_data_source.cc ('K') | « 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..7a95b70c74c0ffc01129ba03ffa269b037a0ce89 100644
--- a/media/blink/url_index.cc
+++ b/media/blink/url_index.cc
@@ -149,10 +149,17 @@ void UrlData::OnEmpty() {
scoped_refptr<UrlData>(this)));
}
-bool UrlData::Valid() const {
+bool UrlData::FullyCached() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ if (length_ == kPositionNotSpecified)
+ return false;
+ return (multibuffer()->FindNextUnavailable(0) << kBlockSizeShift) >= length_;
DaleCurtis 2017/05/26 16:43:57 Needs an explanation.
hubbe 2017/05/26 17:39:45 Done.
+}
+
+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)
« media/blink/multibuffer_data_source.cc ('K') | « media/blink/url_index.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698