diff options
author | mimee <mimee@google.com> | 2015-09-04 15:54:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-04 22:55:21 +0000 |
commit | 76a40f98082e9cc63416bf1722eb2dabc65880f5 (patch) | |
tree | 43c1f60cdea41c4265dc369cb4d7bd9f788eb640 | |
parent | 4cb4f9e34ce164b995e2ee942aebd03e583c1dd0 (diff) | |
download | chromium_src-76a40f98082e9cc63416bf1722eb2dabc65880f5.zip chromium_src-76a40f98082e9cc63416bf1722eb2dabc65880f5.tar.gz chromium_src-76a40f98082e9cc63416bf1722eb2dabc65880f5.tar.bz2 |
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}
TBR=yfriedman@google.com,wnwen@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=508615
Review URL: https://codereview.chromium.org/1328043002
Cr-Commit-Position: refs/heads/master@{#347518}
-rw-r--r-- | base/android/java/src/org/chromium/base/PathUtils.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/base/android/java/src/org/chromium/base/PathUtils.java b/base/android/java/src/org/chromium/base/PathUtils.java index 05697e2..8d676fa 100644 --- a/base/android/java/src/org/chromium/base/PathUtils.java +++ b/base/android/java/src/org/chromium/base/PathUtils.java @@ -23,8 +23,7 @@ public abstract class PathUtils { private static final int DATA_DIRECTORY = 0; private static final int DATABASE_DIRECTORY = 1; private static final int CACHE_DIRECTORY = 2; - private static final int DOWNLOADS_DIRECTORY = 3; - private static final int NUM_DIRECTORIES = 4; + private static final int NUM_DIRECTORIES = 3; private static AsyncTask<String, Void, String[]> sDirPathFetchTask; private static File sThumbnailDirectory; @@ -50,10 +49,7 @@ public abstract class PathUtils { paths[DATABASE_DIRECTORY] = appContext.getDatabasePath("foo").getParent(); // TODO(wnwen): Find a way to avoid calling this function in renderer process. if (appContext.getCacheDir() != null) { - // These paths are only available in the browser process. paths[CACHE_DIRECTORY] = appContext.getCacheDir().getPath(); - paths[DOWNLOADS_DIRECTORY] = Environment.getExternalStoragePublicDirectory( - Environment.DIRECTORY_DOWNLOADS).getPath(); } return paths; } @@ -119,8 +115,8 @@ public abstract class PathUtils { @SuppressWarnings("unused") @CalledByNative private static String getDownloadsDirectory(Context appContext) { - assert sDirPathFetchTask != null : "setDataDirectorySuffix must be called first."; - return getDirectoryPath(DOWNLOADS_DIRECTORY); + return Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS).getPath(); } /** |