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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html
diff --git a/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html b/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html
new file mode 100644
index 0000000000000000000000000000000000000000..42376d40e8b7e57aa6b0a7b3ac5d2bdac384bf20
--- /dev/null
+++ b/third_party/WebKit/PerformanceTests/Canvas/toBlob_duration_jpeg.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src = "../resources/runner.js"></script>
+<script>
+var canvas_idle = null;
+var isDone = false;
+
+function createCanvas4k(canvas_id) {
+ var myCanvas = document.createElement("canvas");
+ myCanvas.id = canvas_id;
+ myCanvas.width = 4000;
+ myCanvas.height = 4000;
+ myCanvas.getContext("2d").fillStyle = "rgba(0, 255, 0, 0.5)";
+ myCanvas.getContext("2d").fillRect(0, 0, myCanvas.width, myCanvas.height);
+ return myCanvas;
+}
+
+function invokeToBlobJpg(myCanvas) {
+ var startTime = PerfTestRunner.now();
+ myCanvas.toBlob(function(blob){
+ PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
+ if (!isDone) {
+ PerfTestRunner.gc();
+ runTest(myCanvas);
+ }
+ }, "image/jpeg");
+}
+
+function runTest(myCanvas) {
+ invokeToBlobJpg(myCanvas);
+}
+
+window.onload = function () {
+ canvas_idle = createCanvas4k("canvas_idle");
+ PerfTestRunner.prepareToMeasureValuesAsync({
+ unit: 'ms',
+ done: function () {
+ isDone = true;
+ },
+ description: "Measures performance of canvas."
+ });
+ runTest(canvas_idle);
+};
+</script>
+</body>
+</html>
+
« 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