Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 32879e4

Browse files
author
Daniel Sievers
committed
Revert of Pre-cache downloads directory path in PathUtils. (patchset #1 id:1 of https://codereview.chromium.org/1281273003/ )
Reason for revert: Revert because it breaks new beta. See https://code.google.com/p/chromium/issues/detail?id=528377 Original issue's description: > Pre-cache downloads directory path in PathUtils. > > When Chrome tabs are swiped away and user starts Chrome again, > their default downloads directory is requested. This causes a > StrictMode policy violation since it results in a ~60ms disk > read. Thus by adding this call to the initial AsyncTask we > save that time when the directory is requested by native. > > This must only be called in the browser process as the sandbox > processes do not need to make the call nor can they make the > call(results in NPE). > > BUG=508615 > > Committed: https://crrev.com/4a7568dffab924d3710a68949dca0717bdad3352 > Cr-Commit-Position: refs/heads/master@{#342672} [email protected], [email protected] [email protected], [email protected], [email protected] NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=508615 Review URL: https://codereview.chromium.org/1328043002 Cr-Commit-Position: refs/heads/master@{#347518} Review URL: https://codereview.chromium.org/1315443012 . Cr-Commit-Position: refs/branch-heads/2490@{#186} Cr-Branched-From: 7790a35-refs/heads/master@{#344925}
1 parent de4836c commit 32879e4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

base/android/java/src/org/chromium/base/PathUtils.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ public abstract class PathUtils {
2323
private static final int DATA_DIRECTORY = 0;
2424
private static final int DATABASE_DIRECTORY = 1;
2525
private static final int CACHE_DIRECTORY = 2;
26-
private static final int DOWNLOADS_DIRECTORY = 3;
27-
private static final int NUM_DIRECTORIES = 4;
26+
private static final int NUM_DIRECTORIES = 3;
2827
private static AsyncTask<String, Void, String[]> sDirPathFetchTask;
2928

3029
private static File sThumbnailDirectory;
@@ -50,10 +49,7 @@ protected String[] doInBackground(String... dataDirectorySuffix) {
5049
paths[DATABASE_DIRECTORY] = appContext.getDatabasePath("foo").getParent();
5150
// TODO(wnwen): Find a way to avoid calling this function in renderer process.
5251
if (appContext.getCacheDir() != null) {
53-
// These paths are only available in the browser process.
5452
paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath();
55-
paths[DOWNLOADS_DIRECTORY] = Environment.getExternalStoragePublicDirectory(
56-
Environment.DIRECTORY_DOWNLOADS).getPath();
5753
}
5854
return paths;
5955
}
@@ -119,8 +115,8 @@ public static String getThumbnailCacheDirectoryPath(Context appContext) {
119115
@SuppressWarnings("unused")
120116
@CalledByNative
121117
private static String getDownloadsDirectory(Context appContext) {
122-
assert sDirPathFetchTask != null : "setDataDirectorySuffix must be called first.";
123-
return getDirectoryPath(DOWNLOADS_DIRECTORY);
118+
return Environment.getExternalStoragePublicDirectory(
119+
Environment.DIRECTORY_DOWNLOADS).getPath();
124120
}
125121

126122
/**

0 commit comments

Comments
 (0)