Repository navigation
Conversation
Eight exports of the class were stubs: the two copy constructors, the base destructor, the copy assignment, canDecodeType, supportedTypes, addSupportedTypes and supportsContainerType. They follow MIMETypeCache.cpp of the 11.x sources. - supportedTypes creates the set on first use and lets the subclass fill it through initializeCache. - supportsContainerType asks the subclass (available, unsupported, static) through the virtual table before it looks in the set. - canDecodeType answers from its cache when it can; otherwise it parses the type, checks the container and the codecs, asks the subclass for extended types, and caches the answer. The set and the cache are WTF hash tables with ASCIICaseInsensitiveHash keys, laid out so that the caller's own code can read them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…pe-cache # Conflicts: # core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
Progress report (d795f93 → dd8a034)📈 System libraries: 45.84% (+0.02%, +8 implemented functions) ✅ 8 implemented
Changed libraries (implemented exports)
|
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against ccc1dedcdf:
- Conventions:
tools/check_conventions.pypassed. - Build:
nkwebkit_mimetypecache_testsbuilt cleanly. - CTest (
nkwebkit_mimetypecache):1/1 Test #4950: nkwebkit_mimetypecache ........... Passed 0.01 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,core/libs/prx/libSceNKWebKit/src/MIMETypeCache.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified ABI struct layouts and static_asserts in MIMETypeCacheAbi.hpp against WebKit 11.x layout (40 bytes, proper vtable offsets and optional boolean flag packing).
- Verified WTF hash table metadata layout and memory management (fastZeroedMalloc/fastFree with metadata prefixes and triangular probing).
- Verified error handling in MIMETypeCache.cpp (null argument checks throwing std::invalid_argument, matching repo conventions).
- Verified MIMETypeCache copy assignment and copy constructor ref-counting (refCount += 2 per WTF::StringImpl conventions) and safe self-assignment handling.
- Verified MIMETypeCache gaps documentation fragment in docs/dev/debt/changes/feat-nkwebkit-mime-type-cache.md conforming to technical debt requirements.
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
Reviewed head ccc1dedcdf2c9e9c20d3eed3d3e268b23d29151e against main. I did not run commands or tests. The reader used was repo_read.py.
Results
| Check | Result | Note |
|---|---|---|
| Code review | passed | Changed implementation and interfaces inspected |
| Tests | not run | Author reports Windows test runs; not independently verified |
| Console behavior | not run | No console module was inspected |
Findings
Blocking
None identified in the code inspected.
Non-blocking
- Consider adding a focused test for exceptions during allocation or cache population.
supportedTypesandaddSupportedTypesset the optional's engaged flag before the cache is fully populated (MIMETypeCache.cpp:390-410); failure partway through allocation could leave a partially initialized cache.
Not verified
- Full text of
Export.cppandInventoryExports.hppwas excluded by the review bundle; only relevant diff hunks were inspected through the reader. - No tests, builds, console module, or hardware behavior were run or verified. The reported Windows runs and negative controls are author-supplied.
- Files read:
description.md,commits.md,manifest.json,diff.patch;MIMETypeCache.cpp,MIMETypeCacheAbi.hpp,MIMETypeCacheExports.hpp,Export.cpp, andInventoryExports.hppat the pinned head. Files reviewed in the manifest:Export.cpp,InventoryExports.hpp,MIMETypeCacheExports.hpp,libSceNKWebKit.hpp,MIMETypeCache.cpp,MIMETypeCacheAbi.hpp,tests/MIMETypeCache.cpp, andfeat-nkwebkit-mime-type-cache.md. The latter three included files besides those named above were not read in full;Export.cppandInventoryExports.hppwere not read in full.
To get this to a good state
Nothing is required. Optional: test and document behavior if cache allocation fails partway through initialization.
…tub in the forwarding test
…pe-cache # Conflicts: # core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp
PrivacyOnion
left a comment
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against de641bba2f:
- Conventions:
tools/check_conventions.pypassed. - Build:
nkwebkit_forwarding_tests,nkwebkit_mimetypecache_testsbuilt cleanly. - CTest (
nkwebkit_forwarding,nkwebkit_mimetypecache):1/2 Test #4885: nkwebkit_forwarding .............. Passed 0.01 sec 2/2 Test #4950: nkwebkit_mimetypecache ........... Passed 0.01 sec 100% tests passed, 0 tests failed out of 2 - Negative control: with
core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/MIMETypeCache.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass. - Code reading:
- Verified in MIMETypeCacheAbi.hpp that struct layout (40 bytes), optional table packing, and MIMETypeCacheVtable slot ordering and offsets match WebKit 11.x specifications via static_assert checks.
- Verified in MIMETypeCache.cpp that WTF open-addressed hash table mechanics (triangular probing, metadata header indexing at negative offsets, load factor expansion thresholds, and fastZeroedMalloc/fastFree layout) are correctly implemented.
- Verified that WTF::StringImpl reference counting conventions (refCount += 2 on table addition and WTF::Release on bucket clearance) and self-assignment safety via copy-and-swap semantics in ZN7WebCore13MIMETypeCacheaSERKS0 avoid memory leaks and use-after-free bugs.
- Verified that all exported functions (ZN7WebCore13MIMETypeCacheC1ERKS0, C2ERKS0_, D2Ev, aSERKS0_, canDecodeType, supportedTypes, addSupportedTypes, supportsContainerType) rigorously validate pointer arguments against nullptr and throw std::invalid_argument per repository conventions.
- Verified in Export.cpp and InventoryExports.hpp that all 8 implemented stubs were properly excised without leaving duplicate declarations, and technical debt and known gaps were properly documented in docs/dev/debt/changes/feat-nkwebkit-mime-type-cache.md conforming to AGENTS.md.
Looks Good To Me
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — no blocking findings
Nothing blocks this change; the implementation has focused coverage and its known source and ABI limitations are recorded in the debt entry.
What I ran
No commands or tests were run. I reviewed head de641bba2fe208fe893978e1a030d69ffea713a5 from the prepared bundle and used repo_read.py to inspect changed source and tests.
Results
| Check | Result | Note |
|---|---|---|
| Source and ABI review | passed | Core logic and declarations inspected |
| Test execution | not run | Results in the description are author reported |
| Console behavior | not run | No console module was reviewed |
Findings
Blocking
None.
Non-blocking
None.
Not verified
No tests or builds were run in this review, so reported Windows and mutation-test results were not independently confirmed. Console behavior and the ABI/layout assumptions derived from the 11.x sources were not verified against a console module. Export.cpp and InventoryExports.hpp were excluded from full-text review because they were too large for the bundle; their relevant diff hunks were inspected. The remaining changed files were read: MIMETypeCacheExports.hpp, libSceNKWebKit.hpp, MIMETypeCache.cpp, MIMETypeCacheAbi.hpp, Forwarding.cpp, MIMETypeCache.cpp (test), and feat-nkwebkit-mime-type-cache.md.
To get this to a good state
Nothing is required.
|
The This branch touches neither the kernel library nor that test, and de641bb only merges |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The reviewed implementation and its added tests show no verified blocking defect; the author-reported checks were not run during this review.
What I ran
Reviewed head dd8a034bcae6a91ccb567f3b114b3f4b1ef82f56. No commands or tests were run. Read the prepared description, commit list, manifest, diff, all added lines in the included changed files, and the full changed source and test files. The full text of Export.cpp and InventoryExports.hpp was excluded from the review folder; their changed hunks were inspected in the diff.
Results
| Check | Result | Note |
|---|---|---|
| Code review | passed | No verified blocking defect |
| Tests and prechecks | not run | Results in description are author-reported |
| Console behavior | not run | No module inspected |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The tests, prechecks, and mutation runs described by the author were not independently run. Console behavior and the reported module-derived layout and virtual-table facts were not independently confirmed. The full contents of Export.cpp and InventoryExports.hpp were not read; the changed hunks were inspected in diff.patch.
Files read: description.md, commits.md, manifest.json, diff.patch, README.md, MIMETypeCacheExports.hpp, libSceNKWebKit.hpp, MIMETypeCache.cpp, MIMETypeCacheAbi.hpp, Forwarding.cpp, tests/MIMETypeCache.cpp, and feat-nkwebkit-mime-type-cache.md. Excluded from full-text review: Export.cpp and InventoryExports.hpp (too large for the review folder). No changed file was excluded from the changed-hunk review.
To get this to a good state
Nothing is required.
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
What
WebCore::MIMETypeCache(11.x inventory) had eight stubs left inlibSceNKWebKit: the two copy constructors, the base destructorD2(D1already jumps to it), the copy assignment,canDecodeType,supportedTypes,addSupportedTypesandsupportsContainerType. This implements them fromSource/WebCore/platform/graphics/MIMETypeCache.cppof the 11.x sources (neonmodder123/PS5-WebKit-11.x@80f77e94). The default constructors,D0andisEmptyare left to #23482 and #23757, which translate them from the module.supportedTypescreates the set on first use and calls the subclass'sinitializeCacheon it, through the virtual table.addSupportedTypescreates the set if needed and adds each type, ignoring ASCII case.supportsContainerTypeasks the object, through the virtual table, whether it is available, whether the type is unsupported and whether it is a static type, and only then looks in the set.canDecodeTypeanswers from its cache when it can. Otherwise it builds aContentType, checks the container, returns "maybe" when there are no codecs, "supported" foraudio/mpegwith the single codecmp3, and otherwise asks the subclass'scanDecodeExtendedType; the answer is cached, including "not supported" for an unavailable cache. The cache key ignores ASCII case, as in the source, so two strings that differ only by case share an answer.Layout. A subclass in the caller fills the set inline, so both tables are real WTF hash tables: four
unsignedof metadata before the buckets (deleted count, key count, size mask, size), buckets of oneStringImpl*for the set and of aStringImpl*with a one-byte result for the cache, null for an empty bucket and -1 for a deleted one, triangular probing, growth at 3/4 load up to 1024 buckets and 1/2 above, and the table size of a copy computed asHashTable's copy constructor does. The hash isASCIICaseInsensitiveHash(StringHasherover the lower-cased code units, top 8 bits masked). The object is 40 bytes: the virtual table pointer, then for eachstd::optionalthe table pointer followed by the engaged flag (8 and 16, 24 and 32); the virtual table has the header's nine slots. Two module facts support this, both read from open translations and not by me: #23757'sisEmptytests the flag at+0x10, loads the table at+0x8and reads the key count attable - 0xc, and #23482's virtual table, rebuilt from the module, has the same nine slots in the same order, with a function that returns zero and an empty function at the two places where this port has its baseisStaticContainerTypeandinitializeCache. The table algorithm is the oneWtfHashMapString.cppalready has onmainforHashMap<String, String>.Recorded in the debt entry: the port's base virtual table still has the
D0stub in its deleting slot and its own base versions ofisStaticContainerTypeandinitializeCache(they are not exported); a nullStringinaddSupportedTypesthrowsstd::invalid_argumentwhere the source hashes a null pointer; the codec list is read throughContentType::parameter,ContentType::codecsnot being exported.Tested
Windows 11, MinGW GCC 15.2. Not tested on a console.
nkwebkit_mimetypecachetest. A model of the table written in the test, with the hash taken from theStringImplhash already onmainapplied to the lower-cased key, is compared bucket by bucket with the real table: after each of 40 additions (through three growths), at seven points of 1500 additions (around the 3/4 and 1/2 thresholds, up to 4096 buckets), and for copies of 5, 6, 40, 900 and 1500 keys (16, 16, 128, 4096 and 4096 buckets). A subclass built in the test with its own virtual table counts every virtual call: the set filled once throughinitializeCache, the order of the checks insupportsContainerType, and forcanDecodeTypethe cache hits, the codecs (none,mp3,mp3with spaces or commas around it,MP3, two codecs,mp3in another container), an unavailable cache and the cached values. Also: the base class through the port's virtual table, reference counts of the keys across additions, copies, assignment and destruction, assignment from an empty, an absent and the same object, deleted buckets (found past, reused, skipped by a copy, not released, cleared by a rehash in place), and the null arguments.MIMETypeCache.cpp, each rebuilt and run on its own; all 65 make the test fail. They cover the hash (case not folded, four steps of the mixing removed), key equality, the three load rules, the table (no mask, keys not released, deleted buckets released, compared, rehashed, copied or not reused, the counts not kept, a sparse table doubled instead of rebuilt, a duplicate added again), the size of a copy (each of its three rules), the empty string, the codec list (empty entries, trimming on each side, the separator), two swapped virtual table slots, the copies (tables shared with the source, flags forced, no virtual table), the destructor and the assignment (each table kept, a null result),supportedTypesandaddSupportedTypes(the subclass not asked, the flag not set, a null string added), every check ofsupportsContainerType, andcanDecodeType(an empty type cached, the cache not read or not written, the container not checked, each part of themp3rule, the subclass not asked). The first pass left four survivors. Three were gaps in the test, now filled: the size of a copy when the load rule and the eager rule disagree (a copy of 900 keys), and trimming a codec on each side next to a comma. One was a badly chosen mutation, replaced: it swapped two slots that both return false in the base class. Not covered: masking the top 8 bits of the hash and replacing a zero hash, which cannot change a bucket index below 16 million buckets.python tools/check_conventions.py --base origin/main,python tools/debt_fold.py --checkandpython core/libs/tests/test_public_headers.py --audit-onlypass.Not verified. I read no console module. The behaviour comes from the 11.x sources and the layouts from their headers; the two module facts above come from other contributors' translations.
Overlap (
python tools/pr_overlap.py --branch feat/nkwebkit-mime-type-cache):overlap check failed closed: it cannot settle 206 open pull requests that shareExport.cpp,InventoryExports.hpporlibSceNKWebKit.hppwith this branch.git diff <merge base> <head>, added and removed lines only). 200 have no line withMIMETypeCache.canDecodeTypeandsupportedTypesby name and does not define them.isEmpty.D0as a call toD2followed byfastFree. They call theD2this pull request provides and do not define it (their test has its own stand-in for it).mainas of 441fa65; the test was built and run on the base before that merge.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)