Bug 1374333 - Use TalosContentProfiler to fix profiling in glvideo tests. r?rwood draft
authorMike Conley <mconley@mozilla.com>
Tue, 11 Jul 2017 17:29:41 -0400
changeset 610833 40a5ea92819b1753fcc7a5d05d66658760a46e05
parent 610832 64cadf0d1d5234f8ce9357fe2be49493565ded5e
child 610834 f316d6d6cec3689cc1c3240cac2aae9b3372f945
push id69002
push usermconley@mozilla.com
push dateTue, 18 Jul 2017 19:11:35 +0000
reviewersrwood
bugs1374333
milestone56.0a1
Bug 1374333 - Use TalosContentProfiler to fix profiling in glvideo tests. r?rwood MozReview-Commit-ID: EUNQG3Jhyp0
testing/talos/talos/tests/webgl/benchmarks/video/video_upload.html
--- a/testing/talos/talos/tests/webgl/benchmarks/video/video_upload.html
+++ b/testing/talos/talos/tests/webgl/benchmarks/video/video_upload.html
@@ -1,44 +1,49 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this file,
    - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
 <html>
 <head>
 <script src="chrome://talos-powers-content/content/TalosPowersContent.js"></script>
+<script type="text/javascript" src="chrome://talos-powers-content/content/TalosContentProfiler.js"></script>
 <script language="javascript" type="text/javascript">
 const kTotalTicks = 100;
 var start;
 var gl = document.createElement("canvas").getContext("webgl");
 gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
 var video;
 video = document.createElement("video");
 video.src = "../../../video/clips/testsrc.1080p.60fps.mp4";
 video.addEventListener("playing", playingListener, true); // loadstart?
 video.loop = true;
 
 function init() {
   TalosPowersContent.focus(content_focused);
 }
 
 function content_focused() {
-  video.play();
+  TalosContentProfiler.resume("glvideo start", true).then(() => {
+    video.play();
+  });
 }
 
 function playingListener() {
   video.removeEventListener("playing", playingListener, true);
   start = performance.now();
   tick();
 }
 
 var tickCount = 0;
 function tick() {
   if (tickCount >= kTotalTicks) {
     var elapsed = performance.now() - start;
-    reportResult(elapsed, kTotalTicks);
+    TalosContentProfiler.pause("glvideo end", true).then(() => {
+      reportResult(elapsed, kTotalTicks);
+    });
     return;
   }
 
   gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
   ++tickCount;
 
   window.setTimeout(tick, 0);
 }