| 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; | |
| 8 import android.os.AsyncTask; | 7 import android.os.AsyncTask; |
| 9 import android.os.FileObserver; | 8 import android.os.FileObserver; |
| 10 | 9 |
| 11 import org.chromium.base.ContextUtils; | 10 import org.chromium.base.ContextUtils; |
| 12 import org.chromium.components.minidump_uploader.CrashFileManager; | 11 import org.chromium.components.minidump_uploader.CrashFileManager; |
| 13 | 12 |
| 14 import java.io.File; | 13 import java.io.File; |
| 15 | 14 |
| 16 /** | 15 /** |
| 17 * The FileObserver that monitors the minidump directory for new crash records. | 16 * The FileObserver that monitors the minidump directory for new crash records. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 /** | 34 /** |
| 36 * When a minidump is detected, extract and append a logcat to it, then uplo
ad it to the crash | 35 * When a minidump is detected, extract and append a logcat to it, then uplo
ad it to the crash |
| 37 * server. | 36 * server. |
| 38 */ | 37 */ |
| 39 @Override | 38 @Override |
| 40 public void onEvent(int event, String path) { | 39 public void onEvent(int event, String path) { |
| 41 // This is executed on a thread dedicated to FileObserver. | 40 // This is executed on a thread dedicated to FileObserver. |
| 42 if (CrashFileManager.isMinidumpMIMEFirstTry(path)) { | 41 if (CrashFileManager.isMinidumpMIMEFirstTry(path)) { |
| 43 // Note that the logcat extraction might fail. This is ok; in that c
ase, the minidump | 42 // Note that the logcat extraction might fail. This is ok; in that c
ase, the minidump |
| 44 // will be found and uploaded upon the next browser launch. | 43 // will be found and uploaded upon the next browser launch. |
| 45 Context context = ContextUtils.getApplicationContext(); | |
| 46 File minidump = mFileManager.getCrashFile(path); | 44 File minidump = mFileManager.getCrashFile(path); |
| 47 AsyncTask.THREAD_POOL_EXECUTOR.execute(new LogcatExtractionRunnable(
context, minidump)); | 45 AsyncTask.THREAD_POOL_EXECUTOR.execute(new LogcatExtractionRunnable(
minidump)); |
| 48 } | 46 } |
| 49 } | 47 } |
| 50 } | 48 } |
| OLD | NEW |