feat(libSceNKWebKit): implement the WebCore::TrackPrivateBase default getters #19147

Closed
c1b3r-p3d1a wants to merge 1 commit from upstream-pr/19147 into main
c1b3r-p3d1a commented 2026-11-12 21:44:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by c1b3r-p3d1a on 2026-11-12T21:44:55Z.


What

Implements the id, label, language and startTimeVariance exports of WebCore::TrackPrivateBase in the new src/TrackPrivateBase.cpp. They are the default virtual bodies in the pinned PS5 TrackPrivateBase.h: the first three return emptyAtom(), the last a copy of MediaTime::zeroTime().

emptyAtom() holds WebKit's static s_emptyAtomString. This library's static empty string has the same shape: a static reference count and the 8-bit, atom and reported-cost flags (hashAndFlags & 0xff == 28). So the getters return it with a reference added, as AtomString (WtfValueExports.hpp). The time comes from the existing MediaTime::zeroTime(). Both types are returned through the hidden result pointer. The bodies never read the object, so a null object is accepted.

Left throwing, as the debt entry says: the constructor, destructors, willBeRemoved and the allocation operators, which need the module's vtables or the client's virtual willRemove. The removed placeholders lower the count in the "Additional callable exports" debt entry from 5961 to 5957.

Unverified: nothing was compared with a console module.

Tested

Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), Release.

  • New nkwebkit_trackprivatebase: constructs each result in a poisoned buffer through the hidden result pointer and checks that the atom getters return the library's static empty string (atom and 8-bit flags set) with exactly one reference added and released on destruction, that startTimeVariance returns a separate copy with value 0, scale 1 and the valid flag at their offsets, and that a null or poisoned object is neither read nor written. It fails with each of 8 mutations: a throwing stub in each export, a null atom, a leaked extra reference, and returning invalidTime or positiveInfiniteTime.
  • Disassembly of the built .prx: each export writes its result through rdi (an 8-byte string pointer, or the 8 + 4 + 1 bytes of MediaTime) and returns that pointer in rax.
  • Rebased on main 59f3a64cf6: all 137 nkwebkit and public_headers tests pass; python tools/check_conventions.py --base origin/main passes.
  • On Windows a rebuilt libSceNKWebKit.prx is not copied over the one staged in build/tests (#17895), so I copied it there before each run.
  • Not run: the full suite, Linux, a console.

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
  • 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Note: like every PR that removes NKWebKit inventory placeholders, this changes the count line in docs/dev/debt/libSceNKWebKit.md; I will rebase and recompute it whenever another such PR merges first.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5285727640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19147). Originally posted by [c1b3r-p3d1a](https://github.com/c1b3r-p3d1a) on 2026-11-12T21:44:55Z. --- ### What Implements the `id`, `label`, `language` and `startTimeVariance` exports of `WebCore::TrackPrivateBase` in the new `src/TrackPrivateBase.cpp`. They are the default virtual bodies in the pinned [PS5 TrackPrivateBase.h](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/TrackPrivateBase.h#L53-L61): the first three return `emptyAtom()`, the last a copy of `MediaTime::zeroTime()`. `emptyAtom()` holds WebKit's static `s_emptyAtomString`. This library's static empty string has the same shape: a static reference count and the 8-bit, atom and reported-cost flags (`hashAndFlags & 0xff == 28`). So the getters return it with a reference added, as `AtomString` (`WtfValueExports.hpp`). The time comes from the existing `MediaTime::zeroTime()`. Both types are returned through the hidden result pointer. The bodies never read the object, so a null object is accepted. Left throwing, as the debt entry says: the constructor, destructors, `willBeRemoved` and the allocation operators, which need the module's vtables or the client's virtual `willRemove`. The removed placeholders lower the count in the "Additional callable exports" debt entry from 5961 to 5957. Unverified: nothing was compared with a console module. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), Release. - New `nkwebkit_trackprivatebase`: constructs each result in a poisoned buffer through the hidden result pointer and checks that the atom getters return the library's static empty string (atom and 8-bit flags set) with exactly one reference added and released on destruction, that `startTimeVariance` returns a separate copy with value 0, scale 1 and the valid flag at their offsets, and that a null or poisoned object is neither read nor written. It fails with each of 8 mutations: a throwing stub in each export, a null atom, a leaked extra reference, and returning `invalidTime` or `positiveInfiniteTime`. - Disassembly of the built `.prx`: each export writes its result through `rdi` (an 8-byte string pointer, or the 8 + 4 + 1 bytes of `MediaTime`) and returns that pointer in `rax`. - Rebased on `main` `59f3a64cf6`: all 137 `nkwebkit` and `public_headers` tests pass; `python tools/check_conventions.py --base origin/main` passes. - On Windows a rebuilt `libSceNKWebKit.prx` is not copied over the one staged in `build/tests` (#17895), so I copied it there before each run. - Not run: the full suite, Linux, a console. ### 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) - [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 --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> 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 --> n/a - [x] AI-assisted: <!-- yes / no --> yes Note: like every PR that removes NKWebKit inventory placeholders, this changes the count line in `docs/dev/debt/libSceNKWebKit.md`; I will rebase and recompute it whenever another such PR merges first.
PrivacyOnion commented 2026-11-12 21:54:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T21:54:21Z.

Review: CHANGES_REQUESTED


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

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: nkwebkit_trackprivatebase_tests built cleanly.
  • CTest (nkwebkit_trackprivatebase):
    1/1 Test #3839: nkwebkit_trackprivatebase ........   Passed    0.02 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified mangled symbols (_ZNK7WebCore16TrackPrivateBase2idEv, _ZNK7WebCore16TrackPrivateBase5labelEv, _ZNK7WebCore16TrackPrivateBase8languageEv, _ZNK7WebCore16TrackPrivateBase17startTimeVarianceEv) in core/libs/prx/libSceNKWebKit/include/TrackPrivateBaseExports.hpp and core/libs/prx/libSceNKWebKit/src/TrackPrivateBase.cpp match the Itanium C++ ABI and removed declarations in Export.cpp and InventoryExports.hpp.
    • Verified return mechanism: confirmed AtomString and MediaTime use the System V AMD64 ABI hidden return buffer pointer passed via RDI with RAX returning the result address, matching both GCC and Clang behavior for types with non-trivial copy/destruction.
    • Verified EmptyAtom() in TrackPrivateBase.cpp returns an AtomString wrapping EmptyStringImpl(), correctly incrementing and releasing references on the immortal static empty string without leaking or double-freeing.
    • Verified startTimeVariance in TrackPrivateBase.cpp invokes _ZN3WTF9MediaTime8zeroTimeEv() and returns an independent copy with m_timeValue = 0, m_timeScale = 1, and flag Valid.
    • Verified null safety: verified that id, label, language, and startTimeVariance never dereference the 'self' pointer and safely return the default atom or zero time when self is null.
    • Verified LP64/LLP64 portability: confirmed APS5_VABI is consistently specified on all four prototypes in TrackPrivateBaseExports.hpp and definitions in TrackPrivateBase.cpp.
    • Verified technical debt accounting in docs/dev/debt/libSceNKWebKit.md: inventory placeholder count correctly decremented from 5961 to 5957.
  • Concerns:
    • core/libs/prx/libSceNKWebKit/src/TrackPrivateBase.cpp:1-27: Lines 1-27 contain comments in code (a derivation comment '// Derived from...' followed by a 26-line copyright notice block '/* Copyright (C) 2012-2017 Apple Inc... */'), violating the strict AGENTS.md rule: 'No comments in code, except #endif and namespace ends.'

Requesting changes for the points above.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5882609044 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19147#pullrequestreview-5882609044). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-12T21:54:21Z. **Review:** CHANGES_REQUESTED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `6cee9fe17a`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `nkwebkit_trackprivatebase_tests` built cleanly. - **CTest** (`nkwebkit_trackprivatebase`): ``` 1/1 Test #3839: nkwebkit_trackprivatebase ........ Passed 0.02 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified mangled symbols (_ZNK7WebCore16TrackPrivateBase2idEv, _ZNK7WebCore16TrackPrivateBase5labelEv, _ZNK7WebCore16TrackPrivateBase8languageEv, _ZNK7WebCore16TrackPrivateBase17startTimeVarianceEv) in core/libs/prx/libSceNKWebKit/include/TrackPrivateBaseExports.hpp and core/libs/prx/libSceNKWebKit/src/TrackPrivateBase.cpp match the Itanium C++ ABI and removed declarations in Export.cpp and InventoryExports.hpp. - Verified return mechanism: confirmed AtomString and MediaTime use the System V AMD64 ABI hidden return buffer pointer passed via RDI with RAX returning the result address, matching both GCC and Clang behavior for types with non-trivial copy/destruction. - Verified EmptyAtom() in TrackPrivateBase.cpp returns an AtomString wrapping EmptyStringImpl(), correctly incrementing and releasing references on the immortal static empty string without leaking or double-freeing. - Verified startTimeVariance in TrackPrivateBase.cpp invokes _ZN3WTF9MediaTime8zeroTimeEv() and returns an independent copy with m_timeValue = 0, m_timeScale = 1, and flag Valid. - Verified null safety: verified that id, label, language, and startTimeVariance never dereference the 'self' pointer and safely return the default atom or zero time when self is null. - Verified LP64/LLP64 portability: confirmed APS5_VABI is consistently specified on all four prototypes in TrackPrivateBaseExports.hpp and definitions in TrackPrivateBase.cpp. - Verified technical debt accounting in docs/dev/debt/libSceNKWebKit.md: inventory placeholder count correctly decremented from 5961 to 5957. - **Concerns**: - core/libs/prx/libSceNKWebKit/src/TrackPrivateBase.cpp:1-27: Lines 1-27 contain comments in code (a derivation comment '// Derived from...' followed by a 26-line copyright notice block '/* Copyright (C) 2012-2017 Apple Inc... */'), violating the strict AGENTS.md rule: 'No comments in code, except #endif and namespace ends.' 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!19147
No description provided.