Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
feb4cce2
authored
Aug 26, 2020
by
bachinger
Committed by
Oliver Woodman
Aug 27, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Enable nullness test for CachedContent/CachedContentIndex
PiperOrigin-RevId: 328551668
parent
94cff6ba
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
27 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContent.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContent.java
View file @
feb4cce2
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
upstream
.
cache
;
package
com
.
google
.
android
.
exoplayer2
.
upstream
.
cache
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkArgument
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkArgument
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkNotNull
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkState
;
import
static
com
.
google
.
android
.
exoplayer2
.
util
.
Assertions
.
checkState
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
max
;
import
static
java
.
lang
.
Math
.
min
;
import
static
java
.
lang
.
Math
.
min
;
...
@@ -219,9 +220,9 @@ import java.util.TreeSet;
...
@@ -219,9 +220,9 @@ import java.util.TreeSet;
public
SimpleCacheSpan
setLastTouchTimestamp
(
public
SimpleCacheSpan
setLastTouchTimestamp
(
SimpleCacheSpan
cacheSpan
,
long
lastTouchTimestamp
,
boolean
updateFile
)
{
SimpleCacheSpan
cacheSpan
,
long
lastTouchTimestamp
,
boolean
updateFile
)
{
checkState
(
cachedSpans
.
remove
(
cacheSpan
));
checkState
(
cachedSpans
.
remove
(
cacheSpan
));
File
file
=
c
acheSpan
.
file
;
File
file
=
c
heckNotNull
(
cacheSpan
.
file
)
;
if
(
updateFile
)
{
if
(
updateFile
)
{
File
directory
=
file
.
getParentFile
(
);
File
directory
=
checkNotNull
(
file
.
getParentFile
()
);
long
position
=
cacheSpan
.
position
;
long
position
=
cacheSpan
.
position
;
File
newFile
=
SimpleCacheSpan
.
getCacheFile
(
directory
,
id
,
position
,
lastTouchTimestamp
);
File
newFile
=
SimpleCacheSpan
.
getCacheFile
(
directory
,
id
,
position
,
lastTouchTimestamp
);
if
(
file
.
renameTo
(
newFile
))
{
if
(
file
.
renameTo
(
newFile
))
{
...
@@ -244,7 +245,9 @@ import java.util.TreeSet;
...
@@ -244,7 +245,9 @@ import java.util.TreeSet;
/** Removes the given span from cache. */
/** Removes the given span from cache. */
public
boolean
removeSpan
(
CacheSpan
span
)
{
public
boolean
removeSpan
(
CacheSpan
span
)
{
if
(
cachedSpans
.
remove
(
span
))
{
if
(
cachedSpans
.
remove
(
span
))
{
span
.
file
.
delete
();
if
(
span
.
file
!=
null
)
{
span
.
file
.
delete
();
}
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
View file @
feb4cce2
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment