feat(libSceNKWebKit): implement refIfNotNull and derefIfNotNull for cairo #19105
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19105"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by KernelPanicNT on 2026-11-12T19:43:23Z.
What
Implements the four cairo specializations of
WTF::refIfNotNullandWTF::derefIfNotNullinlibSceNKWebKit. They threw throughNotImplemented_nid_no_patchamong the older callable exports.WTF::refIfNotNull<_cairo>(_cairo*)HHnnPwUh7oMcairo_referenceWTF::derefIfNotNull<_cairo>(_cairo*)arCP3jQ+Jbocairo_destroyWTF::refIfNotNull<_cairo_surface>(_cairo_surface*)bZYKXT+p6Rwcairo_surface_referenceWTF::derefIfNotNull<_cairo_surface>(_cairo_surface*)2kDZb3V0F5gcairo_surface_destroysrc/RefPtrCairo.cppandinclude/RefPtrCairoExports.hpp. Each function returns at once for a null pointer and otherwise forwards to the tree'slibcairoimplementation of that call, as WebKit'sRefPtrCairo.cppdoes.core/libs/prx/libSceNKWebKit/CMakeLists.txtaddslibcairoto libSceNKWebKit's private link libraries. This is the same prx-to-prx link thatlibSceFreeTypeOptOl->libSceFreeType,libSceFontGs->libSceFontand libSceNKWebKit's ownlibSceJsc/libSceIculinks use. No symbol is defined in both libraries. Acairo_torcairo_surface_tthat a title gets fromlibcairotherefore keeps a single reference count when WebKit code refs or derefs it here. The only test that calls cairo directly (nkwebkit_refptrcairo) also linkslibcairo, following the existingwtf->libkernelcase in the same loop.include/LegacyExports.hppandExport.cpp. The older-export counts are left as they are (the debt file keeps historical inventory counts). A new entry records that the result is not compared with a console module and that the objects must come from the tree'slibcairo.Source of the behaviour
c55364d53f97RefPtrCairo.cpp#L28-L50:if (LIKELY(ptr)) cairo_reference(ptr);,cairo_destroy,cairo_surface_reference,cairo_surface_destroy. This is the only source; the reference counting itself is the existinglibcairocode (Context.cpp,Surface.cpp).Tested
Linux x86-64 (Ubuntu 24.04, GCC 14), on
main09ab49de9649. The newnkwebkit_refptrcairotest tracks each object's lifetime with acairo_surface_set_user_datadestroy callback:refIfNotNullsurvivescairo_surface_destroyand is released by the matchingderefIfNotNull.cairo_createkeeps its target alive throughrefIfNotNullandcairo_destroy, andderefIfNotNullreleases it and its target.Results:
ctest -R '^(nkwebkit_(refptrcairo|noops)|guest_nkwebkit_dates)$'passed in 2 of 2 runs.NotImplemented_nid_no_patch,nkwebkit_refptrcairoaborts and the other two still pass.tools/progress.py --compare: +4 implemented.tools/check_conventions.py --base origin/mainpasses.Not tested on Windows, on a device or with a title.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T10:31:04Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional. Head
ea997d6894dc, basemain.What I ran
include/Context.hpp,include/Surface.hpp).CMakeLists.txt.Results
refptrcairolinkslibcairoctestctest, negative control,progress.py,check_conventions.pyare the author's resultsFindings
Blocking
None.
Non-blocking
None.
Not verified
Export.cpp,include/LegacyExports.hppanddocs/dev/debt/libSceNKWebKit.mdwas not read. Only their changed hunks were read, plus a search for the removed names. Those hunks are removals and one added debt entry.cairo_reference,cairo_destroyand the surface reference counts in libcairo. The test that checks it was not run here.ctestruns, the negative control and thetools/progress.pyandtools/check_conventions.pyresults are author-reported and were not run here.To get this to a good state
Nothing is required.
Optional:
Pull request closed