Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.app.IntentService; | 7 import android.app.IntentService; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.content.Intent; | 9 import android.content.Intent; |
| 10 import android.support.annotation.StringDef; | 10 import android.support.annotation.StringDef; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 String logfileName = intent.getStringExtra(UPLOAD_LOG_KEY); | 234 String logfileName = intent.getStringExtra(UPLOAD_LOG_KEY); |
| 235 File logfile = new File(logfileName); | 235 File logfile = new File(logfileName); |
| 236 | 236 |
| 237 // Try to upload minidump | 237 // Try to upload minidump |
| 238 MinidumpUploadCallable minidumpUploadCallable = | 238 MinidumpUploadCallable minidumpUploadCallable = |
| 239 createMinidumpUploadCallable(minidumpFile, logfile); | 239 createMinidumpUploadCallable(minidumpFile, logfile); |
| 240 @MinidumpUploadCallable.MinidumpUploadStatus int uploadStatus = | 240 @MinidumpUploadCallable.MinidumpUploadStatus int uploadStatus = |
| 241 minidumpUploadCallable.call(); | 241 minidumpUploadCallable.call(); |
| 242 | 242 |
| 243 if (uploadStatus == MinidumpUploadCallable.UPLOAD_SUCCESS) { | 243 if (uploadStatus == MinidumpUploadCallable.UPLOAD_SUCCESS) { |
| 244 CrashFileManager.markUploadSuccess(minidumpFile); | |
| 244 // Only update UMA stats if an intended and successful upload. | 245 // Only update UMA stats if an intended and successful upload. |
|
Ilya Sherman
2016/10/31 19:48:13
I'm a bit confused by this comment. Do you know w
gsennton
2016/10/31 19:54:30
IIUC we only have UMA stats for successful uploads
| |
| 245 incrementCrashSuccessUploadCount(getNewNameAfterSuccessfulUpload(min idumpFileName)); | 246 incrementCrashSuccessUploadCount(getNewNameAfterSuccessfulUpload(min idumpFileName)); |
| 247 } else if (uploadStatus == MinidumpUploadCallable.UPLOAD_USER_DISABLED | |
| 248 || uploadStatus == MinidumpUploadCallable.UPLOAD_DISABLED_BY_SAM PLING) { | |
| 249 Log.i(TAG, "Marking minidump as skipped for cleanup to prevent futur e uploads."); | |
| 250 CrashFileManager.markUploadSkipped(minidumpFile); | |
| 246 } else if (uploadStatus == MinidumpUploadCallable.UPLOAD_FAILURE) { | 251 } else if (uploadStatus == MinidumpUploadCallable.UPLOAD_FAILURE) { |
| 247 // Unable to upload minidump. Incrementing try number and restarting . | 252 // Unable to upload minidump. Incrementing try number and restarting . |
| 248 | 253 |
| 249 // Only create another attempt if we have successfully renamed | 254 // Only create another attempt if we have successfully renamed |
| 250 // the file. | 255 // the file. |
| 251 String newName = CrashFileManager.tryIncrementAttemptNumber(minidump File); | 256 String newName = CrashFileManager.tryIncrementAttemptNumber(minidump File); |
| 252 if (newName != null) { | 257 if (newName != null) { |
| 253 if (++tries < MAX_TRIES_ALLOWED) { | 258 if (++tries < MAX_TRIES_ALLOWED) { |
| 254 // TODO(nyquist): Do this as an exponential backoff. | 259 // TODO(nyquist): Do this as an exponential backoff. |
| 255 MinidumpUploadRetry.scheduleRetry(getApplicationContext()); | 260 MinidumpUploadRetry.scheduleRetry(getApplicationContext()); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 | 402 |
| 398 // This method is intended to be used for manually triggering an attempt to upload an | 403 // This method is intended to be used for manually triggering an attempt to upload an |
| 399 // already existing crash dump. Such a crash dump should already have ha d a chance to attach | 404 // already existing crash dump. Such a crash dump should already have ha d a chance to attach |
| 400 // the logcat to the minidump. Moreover, it's almost certainly too late to try to extract | 405 // the logcat to the minidump. Moreover, it's almost certainly too late to try to extract |
| 401 // the logcat now, since typically some time has passed between the cras h and the user's | 406 // the logcat now, since typically some time has passed between the cras h and the user's |
| 402 // manual upload attempt. | 407 // manual upload attempt. |
| 403 uploadIntent.putExtra(FINISHED_LOGCAT_EXTRACTION_KEY, true); | 408 uploadIntent.putExtra(FINISHED_LOGCAT_EXTRACTION_KEY, true); |
| 404 startService(uploadIntent); | 409 startService(uploadIntent); |
| 405 } | 410 } |
| 406 } | 411 } |
| OLD | NEW |