Repository navigation
feat(libSceNKWebKit): implement refIfNotNull and derefIfNotNull for cairo - #19105
KernelPanicNT wants to merge 4 commits into
Conversation
…airo The cairo_t and cairo_surface_t specializations of WTF::refIfNotNull and derefIfNotNull ignore a null pointer and otherwise call cairo_reference, cairo_destroy, cairo_surface_reference or cairo_surface_destroy, as WebKit c55364d53f97 RefPtrCairo.cpp does. libSceNKWebKit now links the tree's libcairo so the objects keep one reference count.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
Progress report (85f73c1 → f9b5255)📈 System libraries: 42.9% (+0.02%, +4 implemented functions) ✅ 4 implemented
Changed libraries (implemented exports)
|
|
Source check of head
Minor: the new AI-assisted: yes. |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this; the points below are optional. Head ea997d6894dc, base main.
What I ran
- Read the description, commits, manifest and the diff of the head.
- Checked the cairo calls in the new code against the libcairo headers in the tree (
include/Context.hpp,include/Surface.hpp). - Searched the tree for every remaining use of the four removed names.
- Checked the test loop in
CMakeLists.txt. - No build and no test run in this review.
Results
| Check | Result | Note |
|---|---|---|
| Diff read against the description | passed | All hunks read |
| cairo API used by the new code | passed | Signatures match the libcairo headers |
| Leftover references to the removed names | passed | Only the new files and the new test |
| Test registration in CMake | passed | refptrcairo links libcairo |
Build and ctest |
not run | No build in this review |
| Author-reported tests and tools | not run | ctest, negative control, progress.py, check_conventions.py are the author's results |
Findings
Blocking
None.
Non-blocking
None.
Not verified
- Full text of
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. - Runtime behaviour of
cairo_reference,cairo_destroyand the surface reference counts in libcairo. The test that checks it was not run here. - The NIDs in the description and the export table they feed were not checked against a console module. The debt entry says this too.
- The author's
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:
- Read the full text of the three large files above before any formal approval.
- Note in the debt entry which libcairo build the reference counts were checked against.
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)