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.components.minidump_uploader; | 5 package org.chromium.components.minidump_uploader; |
6 | 6 |
7 import android.support.annotation.Nullable; | 7 import android.support.annotation.Nullable; |
8 | 8 |
9 import org.chromium.base.Log; | 9 import org.chromium.base.Log; |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
(...skipping 11 matching lines...) Expand all Loading... | |
22 import java.util.HashSet; | 22 import java.util.HashSet; |
23 import java.util.List; | 23 import java.util.List; |
24 import java.util.NoSuchElementException; | 24 import java.util.NoSuchElementException; |
25 import java.util.Scanner; | 25 import java.util.Scanner; |
26 import java.util.Set; | 26 import java.util.Set; |
27 import java.util.UUID; | 27 import java.util.UUID; |
28 import java.util.concurrent.TimeUnit; | 28 import java.util.concurrent.TimeUnit; |
29 import java.util.regex.Pattern; | 29 import java.util.regex.Pattern; |
30 | 30 |
31 /** | 31 /** |
32 * Responsible for the Crash Report directory. It routinely scans the directory | 32 * The CrashFileManager is responsible for managing the "Crash Reports" director y containing |
33 * for new Minidump files and takes appropriate actions by either uploading new | 33 * minidump files and shepherding them through a state machine represented by th e file names. Note |
34 * crash dumps or deleting old ones. | 34 * that some of the steps are optional: |
35 * 1. foo.dmp is a minidump file, written to the directory by Breakpad. | |
36 * (2) foo.dmpNNNNN is a minidump file, where NNNNN is the PID (process id) of t he crashing | |
37 * process. This step is optional -- that is, a minidump could fail to have its PID included in | |
38 * the filename. Notably, Webview-generated minidumps do not include PIDs. | |
gsennton
2017/03/20 17:18:02
I think PIDs are included for renderer-crashes for
Ilya Sherman
2017/03/20 18:14:54
Done.
| |
39 * (3) foo.dmpNNNNN.try0 is a minidump file with recent logcat output attached t o it. This step is | |
40 * optional -- that is, logcat output might fail to be extracted for the min idump. Notably, | |
41 * Webview-generated minidumps do not include logcat output. | |
42 * 4. foo.dmpNNNNN.tryM for M > 0 is a minidump file that's been attempted to b e uploaded to the | |
43 * crash server, but for which M upload attempts have failed. | |
44 * 5. foo.up, foo.upNNNNN, or foo.upNNNNN.tryM are all valid possible names for a successfully | |
45 * uploaded file. | |
46 * 6. foo.skipped, foo.skippedNNNNN, or foo.skippedNNNNN.tryM are all valid pos sible names for a | |
47 * file whose upload was skipped. An upload may be skipped, for example, if the user has not | |
48 * consented to uploading crash reports. These files are marked as skipped r ather than deleted | |
49 * immediately to allow the user to manually initiate an upload. | |
50 * 7. foo.forced, foo.forcedNNNNN, or foo.forcedNNNNN.tryM are all valid possib le names for a file | |
51 * that the user has manually requested to upload. | |
52 * 8. foo.tmp is a temporary file. Notably, the Webview crash directory uses tm p files while | |
gsennton
2017/03/20 17:18:02
Note that the tmp-files we use in WebView are stor
Ilya Sherman
2017/03/20 18:14:54
Done.
| |
53 * copying over minidumps from individual Webview-using apps. | |
35 */ | 54 */ |
36 public class CrashFileManager { | 55 public class CrashFileManager { |
37 private static final String TAG = "CrashFileManager"; | 56 private static final String TAG = "CrashFileManager"; |
38 | 57 |
39 /** | 58 /** |
40 * The name of the crash directory. | 59 * The name of the crash directory. |
41 */ | 60 */ |
42 public static final String CRASH_DUMP_DIR = "Crash Reports"; | 61 public static final String CRASH_DUMP_DIR = "Crash Reports"; |
43 | 62 |
44 // This should mirror the C++ CrashUploadList::kReporterLogFilename variable . | 63 // This should mirror the C++ CrashUploadList::kReporterLogFilename variable . |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 /** | 593 /** |
575 * Create a temporary file to store a minidump in before renaming it with a real minidump name. | 594 * Create a temporary file to store a minidump in before renaming it with a real minidump name. |
576 * @return a new temporary file with prefix {@param prefix} stored in the di rectory | 595 * @return a new temporary file with prefix {@param prefix} stored in the di rectory |
577 * {@param directory}. | 596 * {@param directory}. |
578 * | 597 * |
579 */ | 598 */ |
580 private static File createMinidumpTmpFile(File directory) throws IOException { | 599 private static File createMinidumpTmpFile(File directory) throws IOException { |
581 return File.createTempFile("webview_minidump", TMP_SUFFIX, directory); | 600 return File.createTempFile("webview_minidump", TMP_SUFFIX, directory); |
582 } | 601 } |
583 } | 602 } |
OLD | NEW |