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.android_webview.crash; | 5 package org.chromium.android_webview.crash; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.net.ConnectivityManager; | 8 import android.net.ConnectivityManager; |
9 import android.net.NetworkInfo; | 9 import android.net.NetworkInfo; |
10 import android.webkit.ValueCallback; | 10 import android.webkit.ValueCallback; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 mWorkerThread = new Thread(new UploadRunnable(uploadsFinishedCallback), "mWorkerThread"); | 195 mWorkerThread = new Thread(new UploadRunnable(uploadsFinishedCallback), "mWorkerThread"); |
196 setCancelUpload(false); | 196 setCancelUpload(false); |
197 | 197 |
198 createPlatformServiceBridge().queryMetricsSetting(new ValueCallback<Bool ean>() { | 198 createPlatformServiceBridge().queryMetricsSetting(new ValueCallback<Bool ean>() { |
199 public void onReceiveValue(Boolean enabled) { | 199 public void onReceiveValue(Boolean enabled) { |
200 // This callback should be received on the main thread (e.g. mWo rkerThread | 200 // This callback should be received on the main thread (e.g. mWo rkerThread |
201 // is not thread-safe). | 201 // is not thread-safe). |
202 ThreadUtils.assertOnUiThread(); | 202 ThreadUtils.assertOnUiThread(); |
203 | 203 |
204 mPermittedByUser = enabled; | 204 mPermittedByUser = enabled; |
205 // Our job might have been cancelled by now - make sure we honou r this. | 205 // Start our job even if it might have been cancelled already - we want to try to |
206 if (!getCancelUpload()) { | 206 // make some progress whenever we start a job. |
Ilya Sherman
2017/02/11 01:00:47
This is a bit unclear to me -- are we simply ignor
gsennton
2017/02/13 10:46:55
We are indeed ignoring the initial cancellation he
Ilya Sherman
2017/02/13 22:28:15
Could we simply swap steps 5 and 6, thereby gettin
gsennton
2017/02/14 16:49:41
So the deal is this:
When you schedule a new JobSc
Ilya Sherman
2017/02/15 00:21:05
Okay, I see, I think I understand. I think it wou
gsennton
2017/02/15 10:26:58
Done (ptal).
| |
207 mWorkerThread.start(); | 207 mWorkerThread.start(); |
208 } | |
209 } | 208 } |
210 }); | 209 }); |
211 } | 210 } |
212 | 211 |
212 @VisibleForTesting | |
213 public void joinWorkerThreadForTesting() throws InterruptedException { | |
214 mWorkerThread.join(); | |
215 } | |
216 | |
213 /** | 217 /** |
214 * @return whether to reschedule the uploads. | 218 * @return whether to reschedule the uploads. |
215 */ | 219 */ |
216 @Override | 220 @Override |
217 public boolean cancelUploads() { | 221 public boolean cancelUploads() { |
218 setCancelUpload(true); | 222 setCancelUpload(true); |
219 | 223 |
220 // Reschedule if there are still minidumps to upload. | 224 // Reschedule if there are still minidumps to upload. |
221 return mFileManager.getAllMinidumpFiles(MAX_UPLOAD_TRIES_ALLOWED).length > 0; | 225 return mFileManager.getAllMinidumpFiles(MAX_UPLOAD_TRIES_ALLOWED).length > 0; |
222 } | 226 } |
223 } | 227 } |
OLD | NEW |