Skip to content

Commit

Permalink
MOE automated commit.
Browse files Browse the repository at this point in the history
Deprecates DiskLruCachWrapper.get().
  • Loading branch information
sjudd committed Nov 13, 2017
1 parent 4334d6a commit 1cfc4af
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
7 changes: 6 additions & 1 deletion instrumentation/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bumptech.glide.instrumentation.test">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application>
<application android:label="GlideTest">
<uses-library android:name="android.test.runner" />
</application>

<instrumentation android:targetPackage="com.bumptech.glide.instrumentation"
android:name="com.google.android.apps.common.testing.testrunner.Google3InstrumentationTestRunner"
android:label="Glide Emulator Tests" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
tearDownGlide();
base.evaluate();
tearDownGlide();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public DiskCache build() {
return null;
}

return DiskLruCacheWrapper.get(cacheDir, diskCacheSize);
return DiskLruCacheWrapper.create(cacheDir, diskCacheSize);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ public class DiskLruCacheWrapper implements DiskCache {
* @param directory The directory for the disk cache
* @param maxSize The max size for the disk cache
* @return The new disk cache with the given arguments, or the current cache if one already exists
*
* @deprecated Use {@link #create(File, long)} to create a new cache with the specified arguments.
*/
@Deprecated
public static synchronized DiskCache get(File directory, long maxSize) {
// TODO calling twice with different arguments makes it return the cache for the same
// directory, it's public!
Expand All @@ -48,6 +51,17 @@ public static synchronized DiskCache get(File directory, long maxSize) {
return wrapper;
}

/**
* Create a new DiskCache in the given directory with a specified max size.
*
* @param directory The directory for the disk cache
* @param maxSize The max size for the disk cache
* @return The new disk cache with the given arguments
*/
public static DiskCache create(File directory, long maxSize) {
return new DiskLruCacheWrapper(directory, maxSize);
}

protected DiskLruCacheWrapper(File directory, long maxSize) {
this.directory = directory;
this.maxSize = maxSize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bumptech.glide.util;

import android.support.annotation.Nullable;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
Expand Down

0 comments on commit 1cfc4af

Please sign in to comment.