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 @SuppressLint("StaticFieldLeak") |
23 private static MinidumpUploadRetry sSingleton; | 25 private static MinidumpUploadRetry sSingleton; |
24 | 26 |
25 private static class Scheduler implements Runnable { | 27 private static class Scheduler implements Runnable { |
26 private static NonThreadSafe sThreadCheck; | 28 private static NonThreadSafe sThreadCheck; |
27 private final Context mContext; | 29 private final Context mContext; |
28 private final CrashReportingPermissionManager mPermissionManager; | 30 private final CrashReportingPermissionManager mPermissionManager; |
29 | 31 |
30 private Scheduler(Context context, CrashReportingPermissionManager permi
ssionManager) { | 32 private Scheduler(Context context, CrashReportingPermissionManager permi
ssionManager) { |
31 this.mContext = context; | 33 this.mContext = context; |
32 mPermissionManager = permissionManager; | 34 mPermissionManager = permissionManager; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return; | 74 return; |
73 } | 75 } |
74 if (!mPermissionManager.isNetworkAvailableForCrashUploads()) { | 76 if (!mPermissionManager.isNetworkAvailableForCrashUploads()) { |
75 return; | 77 return; |
76 } | 78 } |
77 MinidumpUploadService.tryUploadAllCrashDumps(); | 79 MinidumpUploadService.tryUploadAllCrashDumps(); |
78 NetworkChangeNotifier.removeConnectionTypeObserver(this); | 80 NetworkChangeNotifier.removeConnectionTypeObserver(this); |
79 sSingleton = null; | 81 sSingleton = null; |
80 } | 82 } |
81 } | 83 } |
OLD | NEW |