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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-toDataURL-race-imageEncoder-webp.html

Issue 1355333005: Implement Asynchronous image encoding for Canvas.toBlob (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change async func to static so no need worry if canvas instance does not live long enough Created 5 years, 3 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
Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-toDataURL-race-imageEncoder-webp.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-toDataURL-race-imageEncoder-webp.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-toDataURL-race-imageEncoder-webp.html
new file mode 100644
index 0000000000000000000000000000000000000000..13ceaeac5980e0e17ac470474ad779678e28205c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toBlob-toDataURL-race-imageEncoder-webp.html
@@ -0,0 +1,21 @@
+<script src = "../../resources/js-test.js"></script>
+<script src = "./script-tests/canvas-toBlob-toDataURL-race.js"></script>
+<script type = 'text/javascript'>
+description("Verifies if WEBP image encoding on main thread (toDataURL) conflicts with image encoding on async thread (toBlob)");
+
+//Fire a bunch of toBlob operations of canvas to keep the async thread busy
+var j = 0; // due to async nature of toBlob we need a separate counter
+for (var i = 0; i < numToBlobCalls; i++)
+{
+ canvas.toBlob(function(blob) {
+ url = URL.createObjectURL(blob);
+ testImages[j++].src = url;
+ }, "image/webp", 1.0);
+}
+
+//Then file a bunch of toDataURL operation on main thread, so both threads now compete for image encoding
+for (var i = numToBlobCalls; i < (numToDataURLCalls + numToBlobCalls); i++)
+{
+ testImages[i].src = canvas.toDataURL("image/webp", 1.0);
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698