|
|
Created:
3 years, 8 months ago by David Trainor- moved to gerrit Modified:
3 years, 8 months ago CC:
chromium-reviews, David Trainor- moved to gerrit, agrieve+watch_chromium.org Target Ref:
refs/heads/master Project:
chromium Visibility:
Public. |
DescriptionMove downloads Uri query to not run on UI thread
Make the DownloadBroadcastReceiver call goAsync when opening the
download. This is because the receiver needs to query the
DownloadManager to build the Uri, which should not run on the UI thread.
BUG=709567
Patch Set 1 #
Total comments: 4
Patch Set 2 : Added exception try catch #
Total comments: 1
Depends on Patchset: Messages
Total messages: 14 (5 generated)
dtrainor@chromium.org changed reviewers: + nyquist@chromium.org, qinmin@chromium.org
ptal thanks!
lgtm
https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java (right): https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java:87: task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); This could throw exceptions. If goAsync() is called and an exception is thrown, not sure whether the system will clean up its state about the BroadcastReceiver.
https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java (right): https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java:87: task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); On 2017/04/10 16:23:23, qinmin wrote: > This could throw exceptions. If goAsync() is called and an exception is thrown, > not sure whether the system will clean up its state about the BroadcastReceiver. executeOnExecutor() or the internal content? I'm happy to add a try/finally to the onPostExecute if necessary.
https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java (right): https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java:87: task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); On 2017/04/11 01:13:15, David Trainor-ping if over 24h wrote: > On 2017/04/10 16:23:23, qinmin wrote: > > This could throw exceptions. If goAsync() is called and an exception is > thrown, > > not sure whether the system will clean up its state about the > BroadcastReceiver. > > executeOnExecutor() or the internal content? I'm happy to add a try/finally to > the onPostExecute if necessary. executeOnExecutor() could throw RejectedExecutionException.
https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... File chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java (right): https://codereview.chromium.org/2805533007/diff/1/chrome/android/java/src/org... chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java:87: task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); On 2017/04/11 06:18:58, qinmin wrote: > On 2017/04/11 01:13:15, David Trainor-ping if over 24h wrote: > > On 2017/04/10 16:23:23, qinmin wrote: > > > This could throw exceptions. If goAsync() is called and an exception is > > thrown, > > > not sure whether the system will clean up its state about the > > BroadcastReceiver. > > > > executeOnExecutor() or the internal content? I'm happy to add a try/finally > to > > the onPostExecute if necessary. > > executeOnExecutor() could throw RejectedExecutionException. Ah nice catch. Sigh the documentation doesn't mention that... only that it can throw an IllegalStateException if the async task is running, which wouldn't apply here.
The CQ bit was checked by dtrainor@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
ptal. Added try catch.
lgtm
Still lgtm :-) https://codereview.chromium.org/2805533007/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java (right): https://codereview.chromium.org/2805533007/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java:61: final long id = ids[0]; Any reason why we're not doing this conditionally anymore? (i.e. in the onPostExecute I guess). I was just wondering. I'm fine either way. |