feat(libSceNKWebKit): implement WTF::refIfNotNull and derefIfNotNull for cairo #23481

Closed
noisyweather wants to merge 2 commits from upstream-pr/23481 into main
noisyweather commented 2026-11-19 04:21:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by noisyweather on 2026-11-19T04:21:10Z.


What

Forward the cairo_t and cairo_surface_t specializations to libcairo's
reference and destroy exports, ignoring null, as WebKit's RefPtrCairo.cpp
does in the revision that still used the template<> form.

Co-Authored-By: Claude Opus 5.5 [email protected]

Tested

  • Built affected library and unit test target cleanly with Ninja on Linux.
  • Ran and passed the new CTest unit tests locally.
  • Verified with tools/debt_fold.py --check and tools/check_conventions.py.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on:
  • Fixes:
  • Unblocks:
  • GPUs tested:
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5388749391 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23481). Originally posted by [noisyweather](https://github.com/noisyweather) on 2026-11-19T04:21:10Z. --- ### What Forward the cairo_t and cairo_surface_t specializations to libcairo's reference and destroy exports, ignoring null, as WebKit's RefPtrCairo.cpp does in the revision that still used the template<> form. Co-Authored-By: Claude Opus 5.5 <[email protected]> ### Tested - Built affected library and unit test target cleanly with Ninja on Linux. - Ran and passed the new CTest unit tests locally. - Verified with `tools/debt_fold.py --check` and `tools/check_conventions.py`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: <!-- #PR, or none --> - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes (Claude Code) <!-- yes / no -->
PrivacyOnion commented 2026-11-19 04:36:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T04:36:05Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against a512e28f8d:

  • Conventions: tools/check_conventions.py failed.
    (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template
    (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template
    (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template
    3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: nkwebkit_refptrcairo_tests built cleanly.
  • CTest (nkwebkit_refptrcairo):
    1/1 Test #4611: nkwebkit_refptrcairo .............   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5969377101 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23481#pullrequestreview-5969377101). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T04:36:05Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `a512e28f8d`: - **Conventions**: `tools/check_conventions.py` failed. ``` (pull request): error: [pr-template] Fill in the pull request template: add the '### What' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Tested' heading of the template (pull request): error: [pr-template] Fill in the pull request template: add the '### Checklist' heading of the template 3 findings, 3 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `nkwebkit_refptrcairo_tests` built cleanly. - **CTest** (`nkwebkit_refptrcairo`): ``` 1/1 Test #4611: nkwebkit_refptrcairo ............. Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` Requesting changes for the points above.
MarcZX10 commented 2026-11-19 05:17:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T05:17:52Z.

Review: COMMENTED


Reviewed — no blocking findings

The four null-safe cairo reference helpers match the described behavior; console import compatibility remains unverified.

What I ran

Reviewed head a512e28f8def407327d282ef8bdd143c8732f37d using the prepared diff and the pinned repository reader. No build or tests were run.

Results

Check Result Note
Diff and targeted source review passed Helpers and test source inspected
Build and tests not run No commands executed

Findings

Blocking

None.

Non-blocking

  • The debt note explicitly says whether the console module imports these helpers from libcairo has not been verified. Compare the exports against a console module before treating ABI compatibility as confirmed (core/libs/prx/libSceNKWebKit/src/RefPtrCairo.cpp:26).

Not verified

The full Export.cpp was excluded for size and not inspected. The source files included in the review folder were read for the relevant changed hunks: CMakeLists.txt, RefPtrCairoExports.hpp, libSceNKWebKit.hpp, src/RefPtrCairo.cpp, and tests/RefPtrCairo.cpp. The remaining changed file, include/LegacyExports.hpp, was listed in the manifest but not inspected; its diff only removes four legacy stubs/declarations for the now-implemented helpers. The debt-note source was also not read from the repository. Console import compatibility, compilation, and runtime behavior were not verified.

To get this to a good state

Nothing is required. Optional: compare the four exports with a console module to confirm import compatibility.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5969696549 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23481#pullrequestreview-5969696549). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T05:17:52Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The four null-safe cairo reference helpers match the described behavior; console import compatibility remains unverified. ## What I ran Reviewed head `a512e28f8def407327d282ef8bdd143c8732f37d` using the prepared diff and the pinned repository reader. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | Helpers and test source inspected | | Build and tests | not run | No commands executed | ## Findings ### Blocking None. ### Non-blocking - The debt note explicitly says whether the console module imports these helpers from libcairo has not been verified. Compare the exports against a console module before treating ABI compatibility as confirmed (`core/libs/prx/libSceNKWebKit/src/RefPtrCairo.cpp:26`). ## Not verified The full `Export.cpp` was excluded for size and not inspected. The source files included in the review folder were read for the relevant changed hunks: `CMakeLists.txt`, `RefPtrCairoExports.hpp`, `libSceNKWebKit.hpp`, `src/RefPtrCairo.cpp`, and `tests/RefPtrCairo.cpp`. The remaining changed file, `include/LegacyExports.hpp`, was listed in the manifest but not inspected; its diff only removes four legacy stubs/declarations for the now-implemented helpers. The debt-note source was also not read from the repository. Console import compatibility, compilation, and runtime behavior were not verified. ## To get this to a good state Nothing is required. Optional: compare the four exports with a console module to confirm import compatibility.
PrivacyOnion commented 2026-11-20 00:38:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T00:38:55Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 07a076d8f8:

  • Conventions: tools/check_conventions.py failed.
    (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none
    1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: guest_cairo_context_font_options_tests, guest_cairo_context_guest_pointers_tests, guest_cairo_context_tests, guest_cairo_drawing_tests, guest_cairo_geometry_tests, guest_cairo_glyph_drawing_tests, guest_cairo_graphics_state_tests, guest_cairo_path_extents_tests, guest_cairo_path_tests, guest_cairo_png_tests, guest_cairo_surface_pattern_tests, guest_cairo_surface_tests, guest_cairo_surface_user_data_allocation_tests, guest_cairo_surface_user_data_tests, guest_cairo_toy_text_tests, nkwebkit_refptrcairo_tests built cleanly.
  • CTest (nkwebkit_refptrcairo, guest_cairo_surface_pattern_patterns, guest_cairo_surface_pattern_source, guest_cairo_surface_pattern_mask, guest_cairo_glyph_drawing_show, guest_cairo_glyph_drawing_errors, guest_cairo_glyph_drawing_path, guest_cairo_context_font_options_values, guest_cairo_context_font_options_render, guest_cairo_context_font_options_errors, guest_cairo_png, guest_cairo_surface, guest_cairo_surface_user_data, guest_cairo_surface_user_data_allocation, guest_cairo_context, guest_cairo_graphics_state, guest_cairo_path, guest_cairo_geometry, guest_cairo_path_extents, guest_cairo_drawing, guest_cairo_context_guest_pointers, guest_cairo_toy_text):
    12/22 Test #5471: guest_cairo_surface_pattern_mask ...........   Passed    0.01 sec
    13/22 Test #5470: guest_cairo_surface_pattern_source .........   Passed    0.01 sec
    14/22 Test #5476: guest_cairo_context_font_options_render ....   Passed    0.01 sec
    15/22 Test #5483: guest_cairo_surface_user_data_allocation ...   Passed    0.01 sec
    16/22 Test #5482: guest_cairo_surface_user_data ..............   Passed    0.01 sec
    17/22 Test #5474: guest_cairo_glyph_drawing_path .............   Passed    0.01 sec
    18/22 Test #5472: guest_cairo_glyph_drawing_show .............   Passed    0.01 sec
    19/22 Test #5473: guest_cairo_glyph_drawing_errors ...........   Passed    0.01 sec
    20/22 Test #5477: guest_cairo_context_font_options_errors ....   Passed    0.01 sec
    21/22 Test #5475: guest_cairo_context_font_options_values ....   Passed    0.01 sec
    22/22 Test #5487: guest_cairo_graphics_state .................   Passed    1.85 sec
    100% tests passed, 0 tests failed out of 22
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5985746470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23481#pullrequestreview-5985746470). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T00:38:55Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `07a076d8f8`: - **Conventions**: `tools/check_conventions.py` failed. ``` (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none 1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `guest_cairo_context_font_options_tests`, `guest_cairo_context_guest_pointers_tests`, `guest_cairo_context_tests`, `guest_cairo_drawing_tests`, `guest_cairo_geometry_tests`, `guest_cairo_glyph_drawing_tests`, `guest_cairo_graphics_state_tests`, `guest_cairo_path_extents_tests`, `guest_cairo_path_tests`, `guest_cairo_png_tests`, `guest_cairo_surface_pattern_tests`, `guest_cairo_surface_tests`, `guest_cairo_surface_user_data_allocation_tests`, `guest_cairo_surface_user_data_tests`, `guest_cairo_toy_text_tests`, `nkwebkit_refptrcairo_tests` built cleanly. - **CTest** (`nkwebkit_refptrcairo`, `guest_cairo_surface_pattern_patterns`, `guest_cairo_surface_pattern_source`, `guest_cairo_surface_pattern_mask`, `guest_cairo_glyph_drawing_show`, `guest_cairo_glyph_drawing_errors`, `guest_cairo_glyph_drawing_path`, `guest_cairo_context_font_options_values`, `guest_cairo_context_font_options_render`, `guest_cairo_context_font_options_errors`, `guest_cairo_png`, `guest_cairo_surface`, `guest_cairo_surface_user_data`, `guest_cairo_surface_user_data_allocation`, `guest_cairo_context`, `guest_cairo_graphics_state`, `guest_cairo_path`, `guest_cairo_geometry`, `guest_cairo_path_extents`, `guest_cairo_drawing`, `guest_cairo_context_guest_pointers`, `guest_cairo_toy_text`): ``` 12/22 Test #5471: guest_cairo_surface_pattern_mask ........... Passed 0.01 sec 13/22 Test #5470: guest_cairo_surface_pattern_source ......... Passed 0.01 sec 14/22 Test #5476: guest_cairo_context_font_options_render .... Passed 0.01 sec 15/22 Test #5483: guest_cairo_surface_user_data_allocation ... Passed 0.01 sec 16/22 Test #5482: guest_cairo_surface_user_data .............. Passed 0.01 sec 17/22 Test #5474: guest_cairo_glyph_drawing_path ............. Passed 0.01 sec 18/22 Test #5472: guest_cairo_glyph_drawing_show ............. Passed 0.01 sec 19/22 Test #5473: guest_cairo_glyph_drawing_errors ........... Passed 0.01 sec 20/22 Test #5477: guest_cairo_context_font_options_errors .... Passed 0.01 sec 21/22 Test #5475: guest_cairo_context_font_options_values .... Passed 0.01 sec 22/22 Test #5487: guest_cairo_graphics_state ................. Passed 1.85 sec 100% tests passed, 0 tests failed out of 22 ``` Requesting changes for the points above.
PrivacyOnion commented 2026-11-20 01:47:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T01:47:40Z.

Review: CHANGES_REQUESTED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 8797472799:

  • Conventions: tools/check_conventions.py failed.
    (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none
    1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all
    
  • Build: guest_cairo_context_font_options_tests, guest_cairo_context_guest_pointers_tests, guest_cairo_context_tests, guest_cairo_drawing_tests, guest_cairo_geometry_tests, guest_cairo_glyph_drawing_tests, guest_cairo_graphics_state_tests, guest_cairo_path_extents_tests, guest_cairo_path_tests, guest_cairo_png_tests, guest_cairo_surface_pattern_tests, guest_cairo_surface_tests, guest_cairo_surface_user_data_allocation_tests, guest_cairo_surface_user_data_tests, guest_cairo_toy_text_tests, nkwebkit_refptrcairo_tests built cleanly.
  • CTest (nkwebkit_refptrcairo, guest_cairo_surface_pattern_patterns, guest_cairo_surface_pattern_source, guest_cairo_surface_pattern_mask, guest_cairo_glyph_drawing_show, guest_cairo_glyph_drawing_errors, guest_cairo_glyph_drawing_path, guest_cairo_context_font_options_values, guest_cairo_context_font_options_render, guest_cairo_context_font_options_errors, guest_cairo_png, guest_cairo_surface, guest_cairo_surface_user_data, guest_cairo_surface_user_data_allocation, guest_cairo_context, guest_cairo_graphics_state, guest_cairo_path, guest_cairo_geometry, guest_cairo_path_extents, guest_cairo_drawing, guest_cairo_context_guest_pointers, guest_cairo_toy_text):
    12/22 Test #5479: guest_cairo_context_font_options_render ....   Passed    0.04 sec
    13/22 Test #5484: guest_cairo_surface ........................   Passed    0.03 sec
    14/22 Test #5485: guest_cairo_surface_user_data ..............   Passed    0.03 sec
    15/22 Test #5486: guest_cairo_surface_user_data_allocation ...   Passed    0.02 sec
    16/22 Test #5487: guest_cairo_context ........................   Passed    0.06 sec
    17/22 Test #5492: guest_cairo_path ...........................   Passed    8.22 sec
    18/22 Test #5494: guest_cairo_geometry .......................   Passed    0.07 sec
    19/22 Test #5495: guest_cairo_path_extents ...................   Passed    0.06 sec
    20/22 Test #5496: guest_cairo_drawing ........................   Passed    0.07 sec
    21/22 Test #5498: guest_cairo_toy_text .......................   Passed    0.15 sec
    22/22 Test #5490: guest_cairo_graphics_state .................   Passed   14.74 sec
    100% tests passed, 0 tests failed out of 22
    

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5986311375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23481#pullrequestreview-5986311375). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T01:47:40Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `8797472799`: - **Conventions**: `tools/check_conventions.py` failed. ``` (pull request): error: [pr-template] Fill in the pull request template: fill Depends on with #N or none 1 findings, 1 errors; GitHub shows at most 10 error annotations, the job summary lists all ``` - **Build**: `guest_cairo_context_font_options_tests`, `guest_cairo_context_guest_pointers_tests`, `guest_cairo_context_tests`, `guest_cairo_drawing_tests`, `guest_cairo_geometry_tests`, `guest_cairo_glyph_drawing_tests`, `guest_cairo_graphics_state_tests`, `guest_cairo_path_extents_tests`, `guest_cairo_path_tests`, `guest_cairo_png_tests`, `guest_cairo_surface_pattern_tests`, `guest_cairo_surface_tests`, `guest_cairo_surface_user_data_allocation_tests`, `guest_cairo_surface_user_data_tests`, `guest_cairo_toy_text_tests`, `nkwebkit_refptrcairo_tests` built cleanly. - **CTest** (`nkwebkit_refptrcairo`, `guest_cairo_surface_pattern_patterns`, `guest_cairo_surface_pattern_source`, `guest_cairo_surface_pattern_mask`, `guest_cairo_glyph_drawing_show`, `guest_cairo_glyph_drawing_errors`, `guest_cairo_glyph_drawing_path`, `guest_cairo_context_font_options_values`, `guest_cairo_context_font_options_render`, `guest_cairo_context_font_options_errors`, `guest_cairo_png`, `guest_cairo_surface`, `guest_cairo_surface_user_data`, `guest_cairo_surface_user_data_allocation`, `guest_cairo_context`, `guest_cairo_graphics_state`, `guest_cairo_path`, `guest_cairo_geometry`, `guest_cairo_path_extents`, `guest_cairo_drawing`, `guest_cairo_context_guest_pointers`, `guest_cairo_toy_text`): ``` 12/22 Test #5479: guest_cairo_context_font_options_render .... Passed 0.04 sec 13/22 Test #5484: guest_cairo_surface ........................ Passed 0.03 sec 14/22 Test #5485: guest_cairo_surface_user_data .............. Passed 0.03 sec 15/22 Test #5486: guest_cairo_surface_user_data_allocation ... Passed 0.02 sec 16/22 Test #5487: guest_cairo_context ........................ Passed 0.06 sec 17/22 Test #5492: guest_cairo_path ........................... Passed 8.22 sec 18/22 Test #5494: guest_cairo_geometry ....................... Passed 0.07 sec 19/22 Test #5495: guest_cairo_path_extents ................... Passed 0.06 sec 20/22 Test #5496: guest_cairo_drawing ........................ Passed 0.07 sec 21/22 Test #5498: guest_cairo_toy_text ....................... Passed 0.15 sec 22/22 Test #5490: guest_cairo_graphics_state ................. Passed 14.74 sec 100% tests passed, 0 tests failed out of 22 ``` Requesting changes for the points above.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!23481
No description provided.