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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java

Issue 2394763004: Componentize parts of minidump uploading for use from WebView. (Closed)
Patch Set: Rebase Created 4 years, 2 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
Index: chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java b/chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java
index 55a8956cce099c31499f3e32aa461fac225b62c7..3a6311816c4ad28b9ac4fcf040bf077b01b88f85 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/crash/CrashFileManager.java
@@ -34,8 +34,7 @@ public class CrashFileManager {
@VisibleForTesting
static final String CRASH_DUMP_LOGFILE = "uploads.log";
- private static final Pattern MINIDUMP_FIRST_TRY_PATTERN =
- Pattern.compile("\\.dmp([0-9]*)$\\z");
+ private static final Pattern MINIDUMP_FIRST_TRY_PATTERN = Pattern.compile("\\.dmp([0-9]*)$\\z");
private static final Pattern MINIDUMP_MIME_FIRST_TRY_PATTERN =
Pattern.compile("\\.dmp([0-9]+)$\\z");
@@ -76,7 +75,7 @@ public class CrashFileManager {
* @return Comparator for prioritizing the more recently modified file
*/
@VisibleForTesting
- protected static final Comparator<File> sFileComparator = new Comparator<File>() {
+ protected static final Comparator<File> sFileComparator = new Comparator<File>() {
@Override
public int compare(File lhs, File rhs) {
if (lhs.lastModified() == rhs.lastModified()) {
@@ -172,8 +171,7 @@ public class CrashFileManager {
// To avoid out of bound exceptions
if (tryIndex < filename.length()) {
// We don't try more than 3 times.
- String numTriesString = filename.substring(
- tryIndex, tryIndex + 1);
+ String numTriesString = filename.substring(tryIndex, tryIndex + 1);
try {
return Integer.parseInt(numTriesString);
} catch (NumberFormatException ignored) {
@@ -226,13 +224,17 @@ public class CrashFileManager {
}
private final File mCacheDir;
+ /**
+ * The number of times we will try to upload a crash.
+ */
+ @VisibleForTesting
+ public static final int MAX_TRIES_ALLOWED = 3;
Ilya Sherman 2016/10/07 07:08:39 This concept seems more appropriate for the minidu
gsennton 2016/10/07 09:58:13 Alright, so I chatted a bit with Toby (tobiasjs@)
public CrashFileManager(File cacheDir) {
if (cacheDir == null) {
throw new NullPointerException("Specified context cannot be null.");
} else if (!cacheDir.isDirectory()) {
- throw new IllegalArgumentException(cacheDir.getAbsolutePath()
- + " is not a directory.");
+ throw new IllegalArgumentException(cacheDir.getAbsolutePath() + " is not a directory.");
}
mCacheDir = cacheDir;
}
@@ -309,7 +311,7 @@ public class CrashFileManager {
public boolean accept(File dir, String filename) {
Matcher match = pattern.matcher(filename);
int tries = readAttemptNumber(filename);
- return match.find() && tries < MinidumpUploadService.MAX_TRIES_ALLOWED;
+ return match.find() && tries < MAX_TRIES_ALLOWED;
}
});
return minidumps;
@@ -345,8 +347,7 @@ public class CrashFileManager {
if (f.delete()) {
f = new File(getCrashDirectory(), name);
} else {
- Log.w(TAG, "Unable to delete previous logfile"
- + f.getAbsolutePath());
+ Log.w(TAG, "Unable to delete previous logfile" + f.getAbsolutePath());
}
}
return f;

Powered by Google App Engine
This is Rietveld 408576698