Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3876)

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/crash/MinidumpUploadRetry.java

Issue 1206673003: Merge java_staging/src into java/src. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/crash/MinidumpUploadRetry.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/crash/MinidumpUploadRetry.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/crash/MinidumpUploadRetry.java
deleted file mode 100644
index 3e8a4a477c4563b51300b822ccd393353a55bab6..0000000000000000000000000000000000000000
--- a/chrome/android/java_staging/src/org/chromium/chrome/browser/crash/MinidumpUploadRetry.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.crash;
-
-import android.content.Context;
-import android.os.Handler;
-
-import org.chromium.base.annotations.SuppressFBWarnings;
-import org.chromium.chrome.browser.util.NonThreadSafe;
-import org.chromium.net.ConnectionType;
-import org.chromium.net.NetworkChangeNotifier;
-
-/**
- * This class listens to network changes and determine when it would good to
- * retry uploading minidumps.
- */
-class MinidumpUploadRetry implements NetworkChangeNotifier.ConnectionTypeObserver {
- private final Context mContext;
- private static MinidumpUploadRetry sSingleton = null;
-
- private static class Scheduler implements Runnable {
- private static NonThreadSafe sThreadCheck;
- private final Context mContext;
-
- private Scheduler(Context context) {
- this.mContext = context;
- }
-
- @Override
- public void run() {
- if (sThreadCheck == null) {
- sThreadCheck = new NonThreadSafe();
- }
- // Make sure this is called on the same thread all the time.
- assert sThreadCheck.calledOnValidThread();
- if (!NetworkChangeNotifier.isInitialized()) {
- return;
- }
- if (sSingleton == null) {
- sSingleton = new MinidumpUploadRetry(mContext);
- }
- }
- }
-
- /**
- * Schedule a retry. If there is already one schedule, this is NO-OP.
- */
- static void scheduleRetry(Context context) {
- // NetworkChangeNotifier is not thread safe. We will post to UI thread
- // instead since that's where it fires off notification changes.
- new Handler(context.getMainLooper()).post(new Scheduler(context));
- }
-
- private MinidumpUploadRetry(Context context) {
- this.mContext = context;
- NetworkChangeNotifier.addConnectionTypeObserver(this);
- }
-
- @SuppressFBWarnings("ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
- @Override
- public void onConnectionTypeChanged(int connectionType) {
- // Look for "favorable" connections. Note that we never
- // know what the user's crash upload preference is until
- // the time when we are actually uploading.
- if (connectionType == ConnectionType.CONNECTION_NONE) {
- return;
- }
- MinidumpUploadService.tryUploadAllCrashDumps(mContext);
- NetworkChangeNotifier.removeConnectionTypeObserver(this);
- sSingleton = null;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698