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

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

Issue 2784353002: Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Fix tests Created 3 years, 8 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/LogcatExtractionRunnable.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java b/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java
index b94b652edc0d7c831fac29dc94d99e78d309600e..363b671dc3f0d90ad69a9d7de50f2255e5503890 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnable.java
@@ -4,10 +4,10 @@
package org.chromium.chrome.browser.crash;
-import android.content.Context;
import android.os.Build;
import android.util.Patterns;
+import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.components.minidump_uploader.CrashFileManager;
@@ -109,22 +109,20 @@ public class LogcatExtractionRunnable implements Runnable {
"dalvik.", "java.", "javax.", "org.apache.", "org.json.", "org.w3c.dom.", "org.xml.",
"org.xmlpull."};
- private final Context mContext;
private final File mMinidumpFile;
/**
- * @param context The application context for accessing the cache directory and firing intents.
* @param minidump The minidump file that needs logcat output to be attached.
*/
- public LogcatExtractionRunnable(Context context, File minidump) {
- mContext = context;
+ public LogcatExtractionRunnable(File minidump) {
mMinidumpFile = minidump;
}
@Override
public void run() {
Log.i(TAG, "Trying to extract logcat for minidump %s.", mMinidumpFile.getName());
- CrashFileManager fileManager = new CrashFileManager(mContext.getCacheDir());
+ CrashFileManager fileManager =
+ new CrashFileManager(ContextUtils.getApplicationContext().getCacheDir());
File fileToUpload = mMinidumpFile;
try {
List<String> logcat = getElidedLogcat();
@@ -137,10 +135,10 @@ public class LogcatExtractionRunnable implements Runnable {
// Regardless of success, initiate the upload. That way, even if there are errors augmenting
// the minidump with logcat data, the service can still upload the unaugmented minidump.
if (MinidumpUploadService.shouldUseJobSchedulerForUploads()) {
- MinidumpUploadService.scheduleUploadJob(mContext);
+ MinidumpUploadService.scheduleUploadJob();
} else {
try {
- MinidumpUploadService.tryUploadCrashDump(mContext, fileToUpload);
+ MinidumpUploadService.tryUploadCrashDump(fileToUpload);
} catch (SecurityException e) {
// For KitKat and below, there was a framework bug which causes us to not be able to
// find our own crash uploading service. Ignore a SecurityException here on older

Powered by Google App Engine
This is Rietveld 408576698