Bug 1550092 part 2. Stop using [array] in numberOfAssignedPaintedLayers. r=farre
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 10 May 2019 09:09:25 +0000
changeset 473457 4dfa19d72c18aaf806e88c01b830ef23955edcb3
parent 473456 043e58831ea8caac3c0d0a8ab19d2f3b892a122f
child 473458 6142569db7dee2e535e6a058532ba9d254284d3c
push id35998
push userrmaries@mozilla.com
push dateSat, 11 May 2019 09:44:50 +0000
treeherdermozilla-central@1be22e2d35d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfarre
bugs1550092
milestone68.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 1550092 part 2. Stop using [array] in numberOfAssignedPaintedLayers. r=farre Differential Revision: https://phabricator.services.mozilla.com/D30442
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
layout/tools/reftest/reftest-content.js
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2784,26 +2784,21 @@ nsDOMWindowUtils::IsPartOfOpaqueLayer(El
     *aResult = paintedLayer->IsOpaque();
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::NumberOfAssignedPaintedLayers(Element** aElements,
-                                                uint32_t aCount,
-                                                uint32_t* aResult) {
-  if (!aElements) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
+nsDOMWindowUtils::NumberOfAssignedPaintedLayers(
+    const nsTArray<RefPtr<Element>>& aElements, uint32_t* aResult) {
   nsTHashtable<nsPtrHashKey<PaintedLayer>> layers;
-  for (uint32_t i = 0; i < aCount; i++) {
-    nsIFrame* frame = aElements[i]->GetPrimaryFrame();
+  for (Element* element : aElements) {
+    nsIFrame* frame = element->GetPrimaryFrame();
     if (!frame) {
       return NS_ERROR_FAILURE;
     }
 
     PaintedLayer* layer =
         FrameLayerBuilder::GetDebugSingleOldLayerForFrame<PaintedLayer>(frame);
     if (!layer) {
       return NS_ERROR_FAILURE;
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1508,18 +1508,17 @@ interface nsIDOMWindowUtils : nsISupport
   boolean isPartOfOpaqueLayer(in Element aElement);
 
   /**
    * Count the number of different PaintedLayers that the supplied elements have
    * been assigned to in the last paint. Throws an exception if any of the
    * elements doesn't have a primary frame, or if that frame's display items are
    * assigned to any other layers than just a single PaintedLayer per element.
    */
-  unsigned long numberOfAssignedPaintedLayers([array, size_is(count)] in Element aElements,
-                                              in uint32_t count);
+  unsigned long numberOfAssignedPaintedLayers(in Array<Element> aElements);
 
   /**
    * Get internal id of the stored blob, file or file handle.
    */
   [implicit_jscontext] long long getFileId(in jsval aFile);
 
   /**
    * Get internal file path of the stored file or file handle.
--- a/layout/tools/reftest/reftest-content.js
+++ b/layout/tools/reftest/reftest-content.js
@@ -935,31 +935,31 @@ function CheckLayerAssertions(contentRoo
     }
     var layerNameToElementsMap = getAssignedLayerMap(contentRootElement);
     var oneOfEach = [];
     // Check that elements with the same reftest-assigned-layer share the same PaintedLayer.
     for (var layerName in layerNameToElementsMap) {
         try {
             var elements = layerNameToElementsMap[layerName];
             oneOfEach.push(elements[0]);
-            var numberOfLayers = windowUtils().numberOfAssignedPaintedLayers(elements, elements.length);
+            var numberOfLayers = windowUtils().numberOfAssignedPaintedLayers(elements);
             if (numberOfLayers !== 1) {
                 SendFailedAssignedLayer('these elements are assigned to ' + numberOfLayers +
                                         ' different layers, instead of sharing just one layer: ' +
                                         elements.map(elementDescription).join(', '));
             }
         } catch (e) {
             SendFailedAssignedLayer('got an exception while checking whether these elements share a layer: ' +
                                     elements.map(elementDescription).join(', '));
         }
     }
     // Check that elements with different reftest-assigned-layer are assigned to different PaintedLayers.
     if (oneOfEach.length > 0) {
         try {
-            var numberOfLayers = windowUtils().numberOfAssignedPaintedLayers(oneOfEach, oneOfEach.length);
+            var numberOfLayers = windowUtils().numberOfAssignedPaintedLayers(oneOfEach);
             if (numberOfLayers !== oneOfEach.length) {
                 SendFailedAssignedLayer('these elements are assigned to ' + numberOfLayers +
                                         ' different layers, instead of having none in common (expected ' +
                                         oneOfEach.length + ' different layers): ' +
                                         oneOfEach.map(elementDescription).join(', '));
             }
         } catch (e) {
             SendFailedAssignedLayer('got an exception while checking whether these elements are assigned to different layers: ' +