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.annotation.SuppressLint; | |
| 7 import android.content.Context; | 8 import android.content.Context; |
| 8 import android.os.Handler; | 9 import android.os.Handler; |
| 9 | 10 |
| 10 import org.chromium.base.NonThreadSafe; | 11 import org.chromium.base.NonThreadSafe; |
| 11 import org.chromium.base.annotations.SuppressFBWarnings; | 12 import org.chromium.base.annotations.SuppressFBWarnings; |
| 12 import org.chromium.components.minidump_uploader.util.CrashReportingPermissionMa nager; | 13 import org.chromium.components.minidump_uploader.util.CrashReportingPermissionMa nager; |
| 13 import org.chromium.net.ConnectionType; | 14 import org.chromium.net.ConnectionType; |
| 14 import org.chromium.net.NetworkChangeNotifier; | 15 import org.chromium.net.NetworkChangeNotifier; |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * This class listens to network changes and determine when it would good to | 18 * This class listens to network changes and determine when it would good to |
| 18 * retry uploading minidumps. | 19 * retry uploading minidumps. |
| 19 */ | 20 */ |
| 20 class MinidumpUploadRetry implements NetworkChangeNotifier.ConnectionTypeObserve r { | 21 class MinidumpUploadRetry implements NetworkChangeNotifier.ConnectionTypeObserve r { |
| 21 private final Context mContext; | 22 private final Context mContext; |
| 22 private final CrashReportingPermissionManager mPermissionManager; | 23 private final CrashReportingPermissionManager mPermissionManager; |
| 24 // TODO(crbug.com/635567): Fix this properly. | |
|
Ted C
2017/04/27 19:02:47
remove
F
2017/04/28 18:25:14
Done.
| |
| 25 @SuppressLint("StaticFieldLeak") | |
| 23 private static MinidumpUploadRetry sSingleton; | 26 private static MinidumpUploadRetry sSingleton; |
| 24 | 27 |
| 25 private static class Scheduler implements Runnable { | 28 private static class Scheduler implements Runnable { |
| 26 private static NonThreadSafe sThreadCheck; | 29 private static NonThreadSafe sThreadCheck; |
| 27 private final Context mContext; | 30 private final Context mContext; |
| 28 private final CrashReportingPermissionManager mPermissionManager; | 31 private final CrashReportingPermissionManager mPermissionManager; |
| 29 | 32 |
| 30 private Scheduler(Context context, CrashReportingPermissionManager permi ssionManager) { | 33 private Scheduler(Context context, CrashReportingPermissionManager permi ssionManager) { |
| 31 this.mContext = context; | 34 this.mContext = context; |
| 32 mPermissionManager = permissionManager; | 35 mPermissionManager = permissionManager; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 return; | 75 return; |
| 73 } | 76 } |
| 74 if (!mPermissionManager.isNetworkAvailableForCrashUploads()) { | 77 if (!mPermissionManager.isNetworkAvailableForCrashUploads()) { |
| 75 return; | 78 return; |
| 76 } | 79 } |
| 77 MinidumpUploadService.tryUploadAllCrashDumps(); | 80 MinidumpUploadService.tryUploadAllCrashDumps(); |
| 78 NetworkChangeNotifier.removeConnectionTypeObserver(this); | 81 NetworkChangeNotifier.removeConnectionTypeObserver(this); |
| 79 sSingleton = null; | 82 sSingleton = null; |
| 80 } | 83 } |
| 81 } | 84 } |
| OLD | NEW |