RESOLVED FIXED 180239
[CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
https://bugs.webkit.org/show_bug.cgi?id=180239
Summary [CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
Zan Dobersek
Reported 2017-12-01 01:13:28 PST
[CoordGraphics] Introduce Nicosia::PaintingContext, add Cairo implementation
Attachments
Patch (25.86 KB, patch)
2017-12-01 02:00 PST, Zan Dobersek
no flags
Patch (25.32 KB, patch)
2017-12-02 02:07 PST, Zan Dobersek
no flags
Archive of layout-test-results from ews121 for ios-simulator-wk2 (2.12 MB, application/zip)
2017-12-02 03:30 PST, EWS Watchlist
no flags
Patch (25.32 KB, patch)
2017-12-05 00:10 PST, Zan Dobersek
no flags
Patch for landing (25.45 KB, patch)
2017-12-06 03:26 PST, Zan Dobersek
no flags
Zan Dobersek
Comment 1 2017-12-01 02:00:19 PST
Zan Dobersek
Comment 2 2017-12-02 02:07:55 PST
EWS Watchlist
Comment 3 2017-12-02 03:30:56 PST
Comment on attachment 328226 [details] Patch Attachment 328226 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/5465541 New failing tests: js/mozilla/eval/exhaustive-fun-normalcaller-direct-normalcode.html
EWS Watchlist
Comment 4 2017-12-02 03:30:58 PST
Created attachment 328227 [details] Archive of layout-test-results from ews121 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews121 Port: ios-simulator-wk2 Platform: Mac OS X 10.12.6
Michael Catanzaro
Comment 5 2017-12-04 04:50:55 PST
Comment on attachment 328226 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328226&action=review > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.h:49 > + PaintingContextCairo(Buffer&); Mark it as explicit.
Zan Dobersek
Comment 6 2017-12-05 00:10:15 PST
Created attachment 328443 [details] Patch Still up for review.
Alex Christensen
Comment 7 2017-12-05 15:40:41 PST
Why was the name Nicosia chosen?
Michael Catanzaro
Comment 8 2017-12-05 17:21:12 PST
Comment on attachment 328443 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328443&action=review I appreciate the high-quality commit message. As usual. > Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp:48 > + if (!tryFastZeroedMalloc(checkedArea.unsafeGet()).getValue(bufferData)) > + return; Should it really be fallible? If rendering is going to be broken, wouldn't it be better to crash? > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.h:45 > + static void paint(Buffer& buffer, const T& functor) Consider naming it paintFunctor, that might be slightly more clear. > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:46 > + // Balanced by the deref in the s_bufferKey user data destroy callback. > + buffer.ref(); You can't use a Ref<Buffer> for this because you're not allowed to capture anything in the lambda, right? OK then. > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:60 > +#ifndef NDEBUG #if !ASSERT_DISABLED > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:81 > + m_graphicsContext = nullptr; > + m_platformContext = nullptr; > + m_cr = nullptr; > + m_surface = nullptr; I like that you ensured they're destroyed in the reverse order that they're declared in the class. I'm tempted to suggest putting this entire block in an #if !ASSERT_DISABLED statement, for clarity. Up to you. The risk is that adding more objects to the class could then result in a different order of destruction depending on if assertions are enabled, so probably not worth changing.... > Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.h:56 > + RefPtr<cairo_t> m_cr; m_cr is not a very good name... maybe m_cairo? Not that that's much better....
Michael Catanzaro
Comment 9 2017-12-05 17:22:08 PST
(In reply to Alex Christensen from comment #7) > Why was the name Nicosia chosen? I'll let Zan answer this. But it's not finalized... naming things is hard.
Zan Dobersek
Comment 10 2017-12-06 03:19:35 PST
Comment on attachment 328443 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=328443&action=review >> Source/WebCore/platform/graphics/nicosia/NicosiaBuffer.cpp:48 >> + return; > > Should it really be fallible? If rendering is going to be broken, wouldn't it be better to crash? To be decided. It's possible to avoid painting if the necessary memory isn't available for allocation, and it would avoid crashes in memory-intensive scenarios, but in exchange for incomplete display of the Web content. >> Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:46 >> + buffer.ref(); > > You can't use a Ref<Buffer> for this because you're not allowed to capture anything in the lambda, right? OK then. It's not possible to capture anything in the lambda because then that lambda can't be converted to the cairo_destroy_func_t type, which is just a function pointer.
Zan Dobersek
Comment 11 2017-12-06 03:26:10 PST
(In reply to Alex Christensen from comment #7) > Why was the name Nicosia chosen? Nicosia's the capital of Cyprus, so it's a play on Cairo being the capital of Egypt. It doesn't play that well because Cairo is a whole 2D graphics library, and this is just an abstraction layer. So it could probably use a better name.
Zan Dobersek
Comment 12 2017-12-06 03:26:29 PST
Created attachment 328562 [details] Patch for landing
Zan Dobersek
Comment 13 2017-12-06 03:46:53 PST
Comment on attachment 328562 [details] Patch for landing Clearing flags on attachment: 328562 Committed r225573: <https://trac.webkit.org/changeset/225573>
Zan Dobersek
Comment 14 2017-12-06 03:46:57 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 15 2017-12-06 16:26:49 PST
Michael Catanzaro
Comment 16 2017-12-06 16:41:12 PST
(In reply to Zan Dobersek from comment #10) > To be decided. It's possible to avoid painting if the necessary memory isn't > available for allocation, and it would avoid crashes in memory-intensive > scenarios, but in exchange for incomplete display of the Web content. Keep in mind that GLib (g_malloc) does not support fallible allocations. If we fail an allocation here, WebKit will be crashing sooner rather than later regardless.
Note You need to log in before you can comment on or make changes to this bug.