Bug 1425437 - Improve view batching when dropping/pasting to tags, use the actual bookmarks count, not the count of transactions. r=mak
authorMark Banner <standard8@mozilla.com>
Wed, 08 Nov 2017 15:32:51 +0000
changeset 396550 6ab3ab7f0aa9b188b18a8e297bdee7aee8756872
parent 396549 2ad057a99aaebbe26e311f74a9de24b45f241b78
child 396551 bb8aa824b37b9dcec1319a92ed75d99f54fd00fc
push id57036
push usermbanner@mozilla.com
push dateFri, 15 Dec 2017 16:05:12 +0000
treeherderautoland@6ab3ab7f0aa9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1425437
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1425437 - Improve view batching when dropping/pasting to tags, use the actual bookmarks count, not the count of transactions. r=mak MozReview-Commit-ID: B6Bt8bHhh3e
browser/components/places/content/controller.js
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1815,21 +1815,24 @@ function getResultForBatching(viewOrElem
  * @param {Object} insertionPoint The requested point for insertion.
  * @param {Boolean} doCopy Set to true to copy the items, false will move them
  *                         if possible.
  * @return {Array} Returns an empty array when the insertion point is a tag, else
  *                 returns an array of copied or moved guids.
  */
 async function handleTransferItems(items, insertionPoint, doCopy, view) {
   let transactions;
+  let itemsCount;
   if (insertionPoint.isTag) {
     let urls = items.filter(item => "uri" in item).map(item => item.uri);
+    itemsCount = urls.length;
     transactions = [PlacesTransactions.Tag({ urls, tag: insertionPoint.tagName })];
   } else {
     let insertionIndex = await insertionPoint.getIndex();
+    itemsCount = items.length;
     transactions = await getTransactionsForTransferItems(
       items, insertionIndex, insertionPoint.guid, doCopy);
   }
 
   // Check if we actually have something to add, if we don't it probably wasn't
   // valid, or it was moving to the same location, so just ignore it.
   if (!transactions.length) {
     return [];
@@ -1848,20 +1851,19 @@ async function handleTransferItems(items
         let guid = await transaction.transact();
         if (guid) {
           guidsToSelect.push(guid);
         }
       }
     };
   }
 
-  await PlacesUIUtils.batchUpdatesForNode(resultForBatching,
-    transactions.length, async () => {
-      await PlacesTransactions.batch(batchingItem);
-    });
+  await PlacesUIUtils.batchUpdatesForNode(resultForBatching, itemsCount, async () => {
+    await PlacesTransactions.batch(batchingItem);
+  });
 
   return guidsToSelect;
 }
 
 /**
  * Processes a set of transfer items and returns transactions to insert or
  * move them.
  *