summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/PerformanceTests
diff options
context:
space:
mode:
authorxidachen <xidachen@chromium.org>2015-10-13 11:04:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-13 18:06:54 +0000
commit9f0bb323d1b080be08797b13fa77e2d6153c5800 (patch)
treefdd1ad5861b33e5e8e704d3e7d941c87b5e47688 /third_party/WebKit/PerformanceTests
parent05de1bf9a63050c88054dd0991a1f47234c2884f (diff)
downloadchromium_src-9f0bb323d1b080be08797b13fa77e2d6153c5800.zip
chromium_src-9f0bb323d1b080be08797b13fa77e2d6153c5800.tar.gz
chromium_src-9f0bb323d1b080be08797b13fa77e2d6153c5800.tar.bz2
Adding performance benchmark for creating imagebitmap from imagedata
BUG=538253 CQ_EXTRA_TRYBOTS=tryserver.chromium.perf:linux_perf_bisect;tryserver.chromium.perf:mac_10_10_perf_bisect;tryserver.chromium.perf:win_perf_bisect;tryserver.chromium.perf:android_nexus5_perf_bisect Review URL: https://codereview.chromium.org/1387933002 Cr-Commit-Position: refs/heads/master@{#353785}
Diffstat (limited to 'third_party/WebKit/PerformanceTests')
-rw-r--r--third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html36
1 files changed, 36 insertions, 0 deletions
diff --git a/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html b/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html
new file mode 100644
index 0000000..940ac0a
--- /dev/null
+++ b/third_party/WebKit/PerformanceTests/Canvas/createImageBitmapFromImageData.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/runner.js"></script>
+<script>
+var imgHeight = 1024;
+var imgWidth = 1024;
+var canvas = document.createElement("canvas");
+canvas.width = imgWidth;
+canvas.height = imgHeight;
+var context = canvas.getContext('2d');
+var image = context.createImageData(imgWidth, imgHeight);
+
+function rand(range) {
+ return Math.floor(Math.random() * range);
+}
+
+function initializeImageData() {
+ for(var i = 0; i < image.data.length; i++)
+ image.data[i] = rand(256);
+}
+
+function imageBitmapFromImageData() {
+ /*The return Promise is not retained because this test
+ is meant to only measure the immediate run time of
+ createImageBitmap from an ImageData, which is known
+ to be implemented in a way that does all the work
+ synchronously, even though the API is technically async.*/
+ createImageBitmap(image, 0, 0, imgWidth, imgHeight);
+}
+
+initializeImageData();
+PerfTestRunner.measureRunsPerSecond({run: imageBitmapFromImageData, description: "This bench test checks the speed on creating ImageBitmap from ImageData(1024x1024)."});
+</script>
+</body>
+</html>