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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java

Issue 513173002: Fix strict mode violation in Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix some more warnings Created 6 years, 4 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
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwAssets.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java b/content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java
index 81a188c2ddaf1a70b0ab5e0e2f648d9fd4fd78ab..beacbdbc607993ab5d680624ecf279445d4190ad 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ResourceExtractor.java
@@ -53,12 +53,13 @@ public class ResourceExtractor {
@Override
protected Void doInBackground(Void... unused) {
- if (!mOutputDir.exists() && !mOutputDir.mkdirs()) {
+ final File outputDir = getOutputDir();
+ if (!outputDir.exists() && !outputDir.mkdirs()) {
Log.e(LOGTAG, "Unable to create pak resources directory!");
return null;
}
- String timestampFile = checkPakTimestamp();
+ String timestampFile = checkPakTimestamp(outputDir);
if (timestampFile != null) {
deleteFiles();
}
@@ -73,7 +74,7 @@ public class ResourceExtractor {
&& filenames.size() >= sMandatoryPaks.length) {
boolean filesPresent = true;
for (String file : filenames) {
- if (!new File(mOutputDir, file).exists()) {
+ if (!new File(outputDir, file).exists()) {
filesPresent = false;
break;
}
@@ -112,7 +113,7 @@ public class ResourceExtractor {
continue;
}
boolean isICUData = file.equals(ICU_DATA_FILENAME);
- File output = new File(isICUData ? mAppDataDir : mOutputDir, file);
+ File output = new File(isICUData ? getAppDataDir() : outputDir, file);
if (output.exists()) {
continue;
}
@@ -170,7 +171,7 @@ public class ResourceExtractor {
if (timestampFile != null) {
try {
- new File(mOutputDir, timestampFile).createNewFile();
+ new File(outputDir, timestampFile).createNewFile();
} catch (IOException e) {
// Worst case we don't write a timestamp, so we'll re-extract the resource
// paks next start up.
@@ -190,7 +191,7 @@ public class ResourceExtractor {
// Note that we do this to avoid adding a BroadcastReceiver on
// android.content.Intent#ACTION_PACKAGE_CHANGED as that causes process churn
// on (re)installation of *all* APK files.
- private String checkPakTimestamp() {
+ private String checkPakTimestamp(File outputDir) {
final String TIMESTAMP_PREFIX = "pak_timestamp-";
PackageManager pm = mContext.getPackageManager();
PackageInfo pi = null;
@@ -207,7 +208,7 @@ public class ResourceExtractor {
String expectedTimestamp = TIMESTAMP_PREFIX + pi.versionCode + "-" + pi.lastUpdateTime;
- String[] timestamps = mOutputDir.list(new FilenameFilter() {
+ String[] timestamps = outputDir.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith(TIMESTAMP_PREFIX);
@@ -231,8 +232,6 @@ public class ResourceExtractor {
private final Context mContext;
private ExtractTask mExtractTask;
- private final File mAppDataDir;
- private final File mOutputDir;
private static ResourceExtractor sInstance;
@@ -272,8 +271,6 @@ public class ResourceExtractor {
private ResourceExtractor(Context context) {
mContext = context.getApplicationContext();
- mAppDataDir = getAppDataDir();
- mOutputDir = getOutputDir();
}
public void waitForCompletion() {
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwAssets.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698