OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.crash; | 5 package org.chromium.chrome.browser.crash; |
6 | 6 |
| 7 import android.content.Context; |
7 import android.os.AsyncTask; | 8 import android.os.AsyncTask; |
8 import android.os.FileObserver; | 9 import android.os.FileObserver; |
9 | 10 |
10 import org.chromium.base.ContextUtils; | 11 import org.chromium.base.ContextUtils; |
11 import org.chromium.components.minidump_uploader.CrashFileManager; | 12 import org.chromium.components.minidump_uploader.CrashFileManager; |
12 | 13 |
13 import java.io.File; | 14 import java.io.File; |
14 | 15 |
15 /** | 16 /** |
16 * The FileObserver that monitors the minidump directory for new crash records. | 17 * The FileObserver that monitors the minidump directory for new crash records. |
(...skipping 17 matching lines...) Expand all Loading... |
34 /** | 35 /** |
35 * When a minidump is detected, extract and append a logcat to it, then uplo
ad it to the crash | 36 * When a minidump is detected, extract and append a logcat to it, then uplo
ad it to the crash |
36 * server. | 37 * server. |
37 */ | 38 */ |
38 @Override | 39 @Override |
39 public void onEvent(int event, String path) { | 40 public void onEvent(int event, String path) { |
40 // This is executed on a thread dedicated to FileObserver. | 41 // This is executed on a thread dedicated to FileObserver. |
41 if (CrashFileManager.isMinidumpMIMEFirstTry(path)) { | 42 if (CrashFileManager.isMinidumpMIMEFirstTry(path)) { |
42 // Note that the logcat extraction might fail. This is ok; in that c
ase, the minidump | 43 // Note that the logcat extraction might fail. This is ok; in that c
ase, the minidump |
43 // will be found and uploaded upon the next browser launch. | 44 // will be found and uploaded upon the next browser launch. |
| 45 Context context = ContextUtils.getApplicationContext(); |
44 File minidump = mFileManager.getCrashFile(path); | 46 File minidump = mFileManager.getCrashFile(path); |
45 AsyncTask.THREAD_POOL_EXECUTOR.execute(new LogcatExtractionRunnable(
minidump)); | 47 AsyncTask.THREAD_POOL_EXECUTOR.execute(new LogcatExtractionRunnable(
context, minidump)); |
46 } | 48 } |
47 } | 49 } |
48 } | 50 } |
OLD | NEW |