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

Issue 1257253004: [HTMLCanvasElement.toBlob] Default callback version without scheduler (Closed)

Created:
5 years, 4 months ago by xlai (Olivia)
Modified:
5 years, 3 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

The toBlob method in HTMLCanvasElement has been implemented. Changes include: (1) HTMLCanvasElement: The toBlob function is implemented in a similar fashion as the existing toDataURL function, taking in parameters like mimeType and qualityArgument. It has an additional argument FileCallback which accepts user-defined callback function. (2) ImageDataBuffer: encodeImage is made public. (3) File: A new create factory method is added to allow HTMLCanvasElement to create a new File object using the blob data. File object is a subtype of Blob object; it has two additional attributes -- name, last modification time -- as compared to Blob. We use empty string and current time to fill in these two attributes; FF creates the latter attribute in the same way. (4) FileCallback: Moved from module/ to core/. BUG=67587 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=201327

Patch Set 1 #

Patch Set 2 : Adding a small layout test called canvas-toBlob-defaultpng for the toBlob function of canvas element #

Patch Set 3 : Basic Callback version of toBlob function of HTMLCanvasElement Implemented #

Total comments: 29

Patch Set 4 : Modifications Based on Feedback from Patch Set 3 #

Patch Set 5 : Modifications based on feedback from Patch Set 3 including layout tests #

Patch Set 6 : Modifications based on feedback from Patch Set 3 including Layout Tests and Rebaseline of Mac and Win #

Total comments: 27

Patch Set 7 : Changes based on second code reviews #

Patch Set 8 : Changes based on second code reviews 2 #

Total comments: 9

Patch Set 9 : Modified default layout test after discussion #

Patch Set 10 : Removed unnecesary rebaseline #

Total comments: 2

Patch Set 11 : Merge with origin master #

Patch Set 12 : A small change from thread safe bind to common bind based on Kinuko's review #

Total comments: 19
Unified diffs Side-by-side diffs Delta from patch set Stats (+266 lines, -91 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html View 1 2 3 4 5 6 1 chunk +45 lines, -0 lines 1 comment Download
A + LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype-expected.txt View 1 2 3 4 5 6 1 chunk +4 lines, -4 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html View 1 2 3 4 5 6 7 8 1 chunk +31 lines, -0 lines 2 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-defaultpng-expected.txt View 1 2 3 4 5 6 7 8 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-jpeg-maximum-quality.html View 1 2 3 4 1 chunk +29 lines, -0 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-jpeg-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/fast/canvas/canvas-toBlob-jpeg-maximum-quality-expected.txt View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-jpeg-medium-quality.html View 1 2 3 4 1 chunk +29 lines, -0 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-jpeg-medium-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/fast/canvas/canvas-toBlob-jpeg-medium-quality-expected.txt View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
A LayoutTests/fast/canvas/canvas-toBlob-webp-maximum-quality.html View 1 2 3 4 1 chunk +29 lines, -0 lines 1 comment Download
A LayoutTests/fast/canvas/canvas-toBlob-webp-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/fast/canvas/canvas-toBlob-webp-maximum-quality-expected.txt View 1 2 3 4 0 chunks +-1 lines, --1 lines 0 comments Download
M LayoutTests/http/tests/security/canvas-read-blocked-by-setting.html View 1 2 3 4 5 6 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-toBlob-jpeg-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-toBlob-jpeg-medium-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A LayoutTests/virtual/display_list_2d_canvas/fast/canvas/canvas-toBlob-webp-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-jpeg-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-jpeg-maximum-quality-expected.txt View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
A LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-jpeg-medium-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-jpeg-medium-quality-expected.txt View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
A LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-webp-maximum-quality-expected.png View 1 2 3 4 5 Binary file 0 comments Download
A + LayoutTests/virtual/gpu/fast/canvas/canvas-toBlob-webp-maximum-quality-expected.txt View 1 2 3 4 5 0 chunks +-1 lines, --1 lines 0 comments Download
M LayoutTests/webexposed/element-instance-property-listing-expected.txt View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M LayoutTests/webexposed/global-interface-listing-expected.txt View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -0 lines 0 comments Download
M Source/core/fileapi/File.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/fileapi/File.cpp View 1 2 3 4 5 6 3 chunks +14 lines, -1 line 4 comments Download
A + Source/core/fileapi/FileCallback.h View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
A + Source/core/fileapi/FileCallback.idl View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M Source/core/html/HTMLCanvasElement.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +4 lines, -0 lines 2 comments Download
M Source/core/html/HTMLCanvasElement.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +37 lines, -0 lines 4 comments Download
M Source/core/html/HTMLCanvasElement.idl View 1 2 3 4 5 6 2 chunks +4 lines, -1 line 2 comments Download
M Source/modules/filesystem/DOMFileSystem.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
D Source/modules/filesystem/FileCallback.h View 1 2 3 1 chunk +0 lines, -49 lines 0 comments Download
D Source/modules/filesystem/FileCallback.idl View 1 2 3 1 chunk +0 lines, -33 lines 0 comments Download
M Source/modules/filesystem/FileEntry.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/FileSystemCallbacks.cpp View 1 2 3 2 chunks +1 line, -1 line 0 comments Download
M Source/modules/filesystem/InspectorFileSystemAgent.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +1 line, -1 line 1 comment Download
M Source/modules/modules.gypi View 1 2 3 4 5 6 7 8 9 10 2 chunks +0 lines, -2 lines 0 comments Download
M Source/platform/graphics/ImageBuffer.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -0 lines 0 comments Download
M Source/platform/graphics/ImageBuffer.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -5 lines 2 comments Download

Messages

Total messages: 51 (21 generated)
Justin Novosad
https://codereview.chromium.org/1257253004/diff/40001/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html File LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html (right): https://codereview.chromium.org/1257253004/diff/40001/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html#newcode7 LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html:7: canvas = document.createElement("canvas"); var canvas https://codereview.chromium.org/1257253004/diff/40001/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html#newcode13 LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html:13: var newImg ...
5 years, 4 months ago (2015-08-13 21:03:40 UTC) #2
Justin Novosad
This is really on the right track. Good work.
5 years, 4 months ago (2015-08-13 21:04:11 UTC) #3
Justin Novosad
Forgot to mention. Please respect the maximum line length of 72 chars in the description. ...
5 years, 4 months ago (2015-08-13 21:07:20 UTC) #4
xlai (Olivia)
This is an implementation of toBlob function at HTML canvas element. It is the default ...
5 years, 4 months ago (2015-08-20 19:46:44 UTC) #8
Justin Novosad
The duplicate set of baselines in platform/linux should be removed. I think they are stale. ...
5 years, 4 months ago (2015-08-20 20:38:43 UTC) #9
xlai (Olivia)
Some of my responses to the review feedbacks. https://codereview.chromium.org/1257253004/diff/140001/LayoutTests/TestExpectations File LayoutTests/TestExpectations (right): https://codereview.chromium.org/1257253004/diff/140001/LayoutTests/TestExpectations#newcode753 LayoutTests/TestExpectations:753: crbug.com/67587 ...
5 years, 4 months ago (2015-08-20 21:36:29 UTC) #10
Justin Novosad
On 2015/08/20 21:36:29, Olivia wrote: > On 2015/08/20 20:38:42, Justin Novosad wrote: > > These ...
5 years, 4 months ago (2015-08-21 15:31:21 UTC) #11
xlai (Olivia)
Please review only the last patch set. Thanks! https://codereview.chromium.org/1257253004/diff/180001/LayoutTests/TestExpectations File LayoutTests/TestExpectations (right): https://codereview.chromium.org/1257253004/diff/180001/LayoutTests/TestExpectations#newcode756 LayoutTests/TestExpectations:756: crbug.com/67587 ...
5 years, 4 months ago (2015-08-21 18:40:06 UTC) #12
Justin Novosad
https://codereview.chromium.org/1257253004/diff/180001/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html File LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html (right): https://codereview.chromium.org/1257253004/diff/180001/LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html#newcode5 LayoutTests/fast/canvas/canvas-toBlob-defaultpng.html:5: testRunner.dumpAsTextWithPixelResults(); This should not be a pixel test. We ...
5 years, 4 months ago (2015-08-21 18:53:44 UTC) #13
acterhd
I made compatible patch. https://codereview.chromium.org/1294973005/ - Added alpha channel support - Used lossy compression
5 years, 4 months ago (2015-08-21 19:53:03 UTC) #15
xlai (Olivia)
Modified the default layout test (from pixel test back to text test again) based on ...
5 years, 4 months ago (2015-08-24 19:21:23 UTC) #17
kinuko
Sorry for slow review. LGTM for the changes related to FileCallback. Could you also add ...
5 years, 4 months ago (2015-08-26 06:28:31 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/220001
5 years, 3 months ago (2015-08-26 14:19:15 UTC) #21
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_compile_dbg_32_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_32_ng/builds/89797) ios_dbg_simulator_ninja on ...
5 years, 3 months ago (2015-08-26 14:21:00 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/240001
5 years, 3 months ago (2015-08-26 17:00:39 UTC) #25
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/104734)
5 years, 3 months ago (2015-08-26 17:22:49 UTC) #27
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/240001
5 years, 3 months ago (2015-08-26 19:21:42 UTC) #29
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-08-26 20:14:46 UTC) #31
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/260001
5 years, 3 months ago (2015-08-27 15:56:23 UTC) #33
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/99500)
5 years, 3 months ago (2015-08-27 17:00:05 UTC) #35
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/260001
5 years, 3 months ago (2015-08-27 17:19:11 UTC) #37
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 3 months ago (2015-08-27 18:17:09 UTC) #39
xlai (Olivia)
Stephen, Right now the last patch set passed all dry run on 2015-08-27 18:17:09 UTC ...
5 years, 3 months ago (2015-08-27 18:41:50 UTC) #40
Stephen White
LGTM. Nits can be fixed or ignored, at your discretion. https://codereview.chromium.org/1257253004/diff/260001/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html File LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html (right): https://codereview.chromium.org/1257253004/diff/260001/LayoutTests/fast/canvas/canvas-toBlob-case-insensitive-mimetype.html#newcode35 ...
5 years, 3 months ago (2015-08-27 19:10:47 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1257253004/260001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1257253004/260001
5 years, 3 months ago (2015-08-27 19:19:19 UTC) #45
commit-bot: I haz the power
Committed patchset #12 (id:260001) as https://src.chromium.org/viewvc/blink?view=rev&revision=201327
5 years, 3 months ago (2015-08-27 19:24:37 UTC) #46
Noel Gordon
I did not see at test for using toBlob from a webgl canvas. Could you ...
5 years, 3 months ago (2015-08-28 08:53:47 UTC) #48
xlai (Olivia)
Hi Noel, Right now, toBlob is still marked as an experimental feature; and I work ...
5 years, 3 months ago (2015-08-28 19:54:19 UTC) #49
Noel Gordon
On 2015/08/28 19:54:19, Olivia wrote: > Hi Noel, > > Right now, toBlob is still ...
5 years, 3 months ago (2015-09-01 07:47:19 UTC) #50
Noel Gordon
5 years, 3 months ago (2015-09-01 07:50:15 UTC) #51
Message was sent while issue was closed.
I'm fine with the rest, thanks for your explanations.

Powered by Google App Engine
This is Rietveld 408576698