Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html

Issue 2617843002: Introducing a perf test for canvas.toBlob() JPEG case (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src = "../resources/runner.js"></script>
5 <script>
6 var canvas_idle = null;
7 var isDone = false;
8
9 function createCanvas4k(canvas_id) {
10 var myCanvas = document.createElement("canvas");
11 myCanvas.id = canvas_id;
12 myCanvas.width = 4000;
13 myCanvas.height = 4000;
14 myCanvas.getContext("2d").fillStyle = "rgba(0, 255, 0, 0.5)";
15 myCanvas.getContext("2d").fillRect(0, 0, myCanvas.width, myCanvas.height);
16 return myCanvas;
17 }
18
19 function invokeToBlobJpg(myCanvas) {
20 var startTime = PerfTestRunner.now();
21 myCanvas.toBlob(function(blob){
22 PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
23 if (!isDone) {
24 PerfTestRunner.gc();
25 runTest(myCanvas);
26 }
27 }, "image/jpeg");
28 }
29
30 function runTest(myCanvas) {
31 invokeToBlobJpg(myCanvas);
32 }
33
34 window.onload = function () {
35 canvas_idle = createCanvas4k("canvas_idle");
36 PerfTestRunner.prepareToMeasureValuesAsync({
37 unit: 'ms',
38 done: function () {
39 isDone = true;
40 },
41 description: "Measures performance of canvas."
42 });
43 runTest(canvas_idle);
44 };
45 </script>
46 </body>
47 </html>
48
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698