Bug 1550092 part 3. Stop using [array] in stopFrameTimeRecording. r=farre
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 10 May 2019 09:29:17 +0000
changeset 532275 6142569db7dee2e535e6a058532ba9d254284d3c
parent 532274 4dfa19d72c18aaf806e88c01b830ef23955edcb3
child 532276 60707b6f61599879a67f8b83081aa18eae6ae2a9
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [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 3. Stop using [array] in stopFrameTimeRecording. r=farre Differential Revision: https://phabricator.services.mozilla.com/D30443
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
testing/talos/talos/tests/tart/addon/content/tart.js
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -2226,38 +2226,24 @@ nsDOMWindowUtils::StartFrameTimeRecordin
   bufferSize = std::max(bufferSize, kRecordingMinSize);
   *startIndex = mgr->StartFrameTimeRecording(bufferSize);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::StopFrameTimeRecording(uint32_t startIndex,
-                                         uint32_t* frameCount,
-                                         float** frameIntervals) {
-  NS_ENSURE_ARG_POINTER(frameCount);
-  NS_ENSURE_ARG_POINTER(frameIntervals);
-
+                                         nsTArray<float>& frameIntervals) {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) return NS_ERROR_FAILURE;
 
   LayerManager* mgr = widget->GetLayerManager();
   if (!mgr) return NS_ERROR_FAILURE;
 
-  nsTArray<float> tmpFrameIntervals;
-  mgr->StopFrameTimeRecording(startIndex, tmpFrameIntervals);
-  *frameCount = tmpFrameIntervals.Length();
-
-  *frameIntervals = (float*)moz_xmalloc(*frameCount * sizeof(float));
-
-  /* copy over the frame intervals and paint times into the arrays we just
-   * allocated */
-  for (uint32_t i = 0; i < *frameCount; i++) {
-    (*frameIntervals)[i] = tmpFrameIntervals[i];
-  }
+  mgr->StopFrameTimeRecording(startIndex, frameIntervals);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds) {
   // Before we advance the time, we should trigger any animations that are
   // waiting to start. This is because there are many tests that call this
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1344,23 +1344,20 @@ interface nsIDOMWindowUtils : nsISupport
    */
 
   /**
    * Returns a handle which represents current recording start position.
    */
   void startFrameTimeRecording([retval] out unsigned long startIndex);
 
   /**
-   * Returns number of recorded frames since startIndex was issued,
-   *   and allocates+populates 2 arraye with the recorded data.
-   * - Allocation is infallible. Should be released even if size is 0.
+   * Returns array of frame intervals since the time when the given startIndex
+   * was handed out from startFrameTimeRecording.
    */
-  void stopFrameTimeRecording(in unsigned long startIndex,
-                             [optional] out unsigned long frameCount,
-                             [retval, array, size_is(frameCount)] out float frameIntervals);
+  Array<float> stopFrameTimeRecording(in unsigned long startIndex);
 
   /**
    * The DPI of the display
    */
   readonly attribute float displayDPI;
 
   /**
    * Return this window's frame element.
--- a/testing/talos/talos/tests/tart/addon/content/tart.js
+++ b/testing/talos/talos/tests/tart/addon/content/tart.js
@@ -242,19 +242,18 @@ Tart.prototype = {
       recordingAbsoluteDuration =  window.performance.now() - startRecordTimestamp;
       if (self._config.controlProfiler) {
         if (isReportResult)
           Profiler.pause(name);
       } else {
         Profiler.mark("End: " + (isReportResult ? name : "[warmup]"), true);
       }
       if (self.USE_RECORDING_API) {
-        var paints = {};
         return window.windowUtils
-                     .stopFrameTimeRecording(recordingHandle, paints);
+                     .stopFrameTimeRecording(recordingHandle);
       }
 
       _abortRecording = true;
       return _recording.slice(0); // clone
     }
 
 
     function addResult(intervals) {