|
|
Description[Downloads UI] Batch delete selected items
Batch delete selected items in one AsyncTask rather than kicking
off a new AsyncTask for each file that needs to be deleted. This
moves the responsibility for deleting files associated with
download items from DownloadItemWrapper to DownloadManagerUi.
Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks
that can be queued. If we queue too many AsyncTasks (e.g. 200
items are selected for deletion) an exception will be thrown.
BUG=643811
Committed: https://crrev.com/99e93701687fb2619a57e3ab8b3ef3621b21480e
Cr-Commit-Position: refs/heads/master@{#417612}
Patch Set 1 #Patch Set 2 : [Downloads UI] Batch delete selected items #
Total comments: 2
Patch Set 3 : Return a boolean from #remove() #
Total comments: 3
Patch Set 4 : foreach #
Messages
Total messages: 32 (19 generated)
The CQ bit was checked by twellington@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...
Description was changed from ========== [Downloads UI] Batch delete selected items Batch delete selected items on one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from the DownloadItemWrapper to DownloadManagerUi. Android's thread pool has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 ========== to ========== [Downloads UI] Batch delete selected items Batch delete selected items in one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from DownloadItemWrapper to DownloadManagerUi. Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 ==========
The CQ bit was checked by twellington@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...
twellington@chromium.org changed reviewers: + dfalcantara@chromium.org
ptal
https://codereview.chromium.org/2305123002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.java (right): https://codereview.chromium.org/2305123002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.java:212: public boolean fileDeletedOnRemove() { Should remove() just return a boolean?
The CQ bit was checked by twellington@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...
https://codereview.chromium.org/2305123002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.java (right): https://codereview.chromium.org/2305123002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.java:212: public boolean fileDeletedOnRemove() { On 2016/09/02 23:55:46, dfalcantara wrote: > Should remove() just return a boolean? Done.
lgtm
twellington@chromium.org changed reviewers: + nyquist@chromium.org
+nyquist@ for FileUtils.java
https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... File base/android/java/src/org/chromium/base/FileUtils.java (right): https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... base/android/java/src/org/chromium/base/FileUtils.java:47: for (int i = 0; i < files.size(); i++) { Could you just do for (File currentFile : files) { ... } here? I don't see what using an old-school for-loop buys us here. A bad case would be if it's a LinkedList, the get(i) call below is an O(N) operation. Also, at that point maybe just |file| as the variable name?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... File base/android/java/src/org/chromium/base/FileUtils.java (right): https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... base/android/java/src/org/chromium/base/FileUtils.java:47: for (int i = 0; i < files.size(); i++) { On 2016/09/03 00:37:18, nyquist wrote: > Could you just do for (File currentFile : files) { ... } here? I don't see what > using an old-school for-loop buys us here. A bad case would be if it's a > LinkedList, the get(i) call below is an O(N) operation. > > Also, at that point maybe just |file| as the variable name? For ArrayLists a regular loop saves allocation of an iterator which makes it better than a for each loop. Since this is a generic interface, however, I agree that for each is the way to go. I'll change it.
The CQ bit was checked by twellington@chromium.org to run a CQ dry run
https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... File base/android/java/src/org/chromium/base/FileUtils.java (right): https://codereview.chromium.org/2305123002/diff/40001/base/android/java/src/o... base/android/java/src/org/chromium/base/FileUtils.java:47: for (int i = 0; i < files.size(); i++) { On 2016/09/03 01:21:22, Theresa Wellington wrote: > On 2016/09/03 00:37:18, nyquist wrote: > > Could you just do for (File currentFile : files) { ... } here? I don't see > what > > using an old-school for-loop buys us here. A bad case would be if it's a > > LinkedList, the get(i) call below is an O(N) operation. > > > > Also, at that point maybe just |file| as the variable name? > > For ArrayLists a regular loop saves allocation of an iterator which makes it > better than a for each loop. Since this is a generic interface, however, I agree > that for each is the way to go. I'll change it. Done.
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.
nyquist@ - ptal
base lgtm
The CQ bit was checked by twellington@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from dfalcantara@chromium.org Link to the patchset: https://codereview.chromium.org/2305123002/#ps60001 (title: "foreach")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== [Downloads UI] Batch delete selected items Batch delete selected items in one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from DownloadItemWrapper to DownloadManagerUi. Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 ========== to ========== [Downloads UI] Batch delete selected items Batch delete selected items in one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from DownloadItemWrapper to DownloadManagerUi. Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 ==========
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== [Downloads UI] Batch delete selected items Batch delete selected items in one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from DownloadItemWrapper to DownloadManagerUi. Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 ========== to ========== [Downloads UI] Batch delete selected items Batch delete selected items in one AsyncTask rather than kicking off a new AsyncTask for each file that needs to be deleted. This moves the responsibility for deleting files associated with download items from DownloadItemWrapper to DownloadManagerUi. Android's THREAD_POOL_EXECUTOR has a finite number of AsyncTasks that can be queued. If we queue too many AsyncTasks (e.g. 200 items are selected for deletion) an exception will be thrown. BUG=643811 Committed: https://crrev.com/99e93701687fb2619a57e3ab8b3ef3621b21480e Cr-Commit-Position: refs/heads/master@{#417612} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/99e93701687fb2619a57e3ab8b3ef3621b21480e Cr-Commit-Position: refs/heads/master@{#417612} |