feat(libSceNKWebKit): implement SharedBuffer data views, comparison and file loading #22674
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22674"
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 RiverWhy on 2026-11-18T01:30:47Z.
What
Stacked on #20326 (its head is merged in as the first commit; the second commit is this change). Implements 16
WebCore::SharedBufferexports (3.20) that #20326 leaves throwing:Ref<DataSegment>&&, size_tconstructor (C1/C2), the copy constructor (C1/C2), the destructor (D1/D2),operator=,dataandsize.getSomeData,operator==,operator!=andtoHexString.createWithContentsOfFileandcreateFromReadingFile.hintMemoryNotNeededSoon, which is empty upstream when!USE(CF).Source: SharedBuffer.cpp@73a35b43, SharedBuffer.h and SharedBufferPOSIX.cpp, the revision #20326 uses.
Details:
SharedBufferDataViewis 16 bytes:m_positionWithinSegment, then theRef<DataSegment>.getSomeDatareturns it by hidden pointer and takes a segment reference; theRef&&constructor takes over the caller's reference and nulls it.operator==walks segments the way upstream does, including the shortcut for shared segments (copy()shares them).toHexStringcombines the buffer into one segment (it reads throughdata()) and writes uppercase digits, the default ofhexin HexNumber.h.createWithContentsOfFilemaps the file with the existingMappedFileDataexport and stores a mapped-file segment; when mapping fails it callscreateFromReadingFile, which reads withopen/fstat/readand returns null for an empty path, a missing file or a short read.RELEASE_ASSERT(position < m_size)ingetSomeDatathrowsstd::out_of_range; a file overUINT_MAXbytes throwsstd::length_error; null objects throwstd::invalid_argument.SharedBuffer(MappedFileData&&)constructors (they build the pinned revision'sFragmentedSharedBufferlayout) anddecoder.tryCreateArrayBufferstill needsJSC::ArrayBuffer.Debt: a new fragment,
docs/dev/debt/changes/feat-nkwebkit-shared-buffer-views-and-files.md, and #20326's "remaining exports" bullet now lists only what is still unimplemented. None of the 16 have inventory rows.Overlap:
pr_overlap.py --namesfinds no open PR with these exports.Tested
Linux Mint 22.3. New
nkwebkit_sharedbufferviewstest:getSomeDataat every position of a three-segment buffer: segment, offset, bytes and reference counts, and the past-the-end throw;Ref, copy, assignment (including self-assignment), destruction, and a view outlivingclear();toHexStringon empty and multi-segment buffers (00AB7F10FF);The full build succeeds, and all 133 NKWebKit tests pass, including #20326's
nkwebkit_sharedbuffer.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T01:38:28Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
76354ab05c:tools/check_conventions.pypassed.nkwebkit_sharedbuffer_tests,nkwebkit_sharedbufferviews_testsbuilt cleanly.nkwebkit_sharedbuffer,nkwebkit_sharedbufferviews):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp,core/libs/prx/libSceNKWebKit/src/SharedBuffer.cpp,core/libs/prx/libSceNKWebKit/src/SharedBufferViews.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T01:54:15Z.
Review: COMMENTED
Reviewed — comments
The review found one non-blocking file-read reliability issue; several changed files were not fully inspected, so a formal approval is not justified.
What I ran
Inspected the prepared diff and selected files at head
76354ab05cbaf8d19b01158a4143adfc0e93226eusing the review reader. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/SharedBufferViews.cpp:146: Ifread()is interrupted and returns-1withEINTR, the loop exits and the loader returns null even though the file may be readable. Retry interrupted reads so transient signals do not turn a successful file load into a reported failure. Pinned sourceNot verified
No build or tests were run. The full text of
core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/InventoryExports.hpp, andcore/libs/prx/libSceNKWebKit/tests/SharedBuffer.cppwas not read. The remaining review-folder changed files were inspected, includingSharedBuffer.cpp,SharedBufferAbi.hpp,SharedBufferViews.cpp,SharedBufferViews.cpptests, both SharedBuffer export headers,libSceNKWebKit.hpp, and the two debt change records.LegacyExports.hpphad no added lines; only its opening lines were read. No files were excluded by diff rules according to the prepared listing.To get this to a good state
Nothing is required. Optional: retry
read()onEINTRin the file-loading loop.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T14:08:45Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected SharedBuffer implementation has no verified blocking defect; a complete approval is not justified because two oversized changed files and build integration were not verified.
What I ran
Reviewed head
cb78b2c20bfce32982b396af4901b43f7957ab7a. Read the prepared diff, changed-file manifest, implementation and ABI declarations, tests, and targeted file-system helpers throughrepo_read.py. No build or tests were run.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppandcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppwere excluded as too large for the review folder and were not read. Build/test registration was not verified. The reported Linux Mint build and 133 passing tests are author-reported; they were not run in this review.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-30T03:51:59Z.
Review: COMMENTED
Architecture findings (1)
Advisory architecture findings (1)
a6f865b4-4ca9-49a3-90ce-b21b439f7630Reviewing files that changed from the base of the PR and between
aecfbf79b1andbbf2211713.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/SharedBufferExports.hppcore/libs/prx/libSceNKWebKit/include/SharedBufferViewExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/SharedBuffer.cppcore/libs/prx/libSceNKWebKit/src/SharedBufferAbi.hppcore/libs/prx/libSceNKWebKit/src/SharedBufferViews.cppcore/libs/prx/libSceNKWebKit/tests/SharedBuffer.cppcore/libs/prx/libSceNKWebKit/tests/SharedBufferViews.cppdocs/dev/debt/changes/feat-nkwebkit-shared-buffer-views-and-files.mddocs/dev/debt/changes/feat-webcore-shared-buffer.mdLimit details: You’ve used all 10 included reviews currently available.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-30T05:53:01Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed change implements the described SharedBuffer exports at
bbf2211713f3259ae2611987bf3d5773d8313d6a; no concrete defect was confirmed in the inspected implementation, though the full review and tests were not completed.What I ran
No build or tests were run. I inspected the prepared diff and traced the file representation and mapped-file helpers with
repo_read.py.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
None.
Not verified
The full review was not completed: only targeted ranges of
SharedBuffer.cpp,SharedBufferViews.cpp,WtfString.cpp,WtfSystem.cpp, andWtf.cppwere read.Export.cppwas excluded by the review-folder size rule; other changed files, including test implementations and ABI declarations, were not fully read. The author-reported Linux Mint build and 133 test results were not independently run or confirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T12:59:01Z.
Review: COMMENTED
Built the branch’s changed sources and ran SharedBuffer and SharedBufferViews on Linux against the existing runtime libraries. The test run passed and covered the buffer data views, comparisons, and file-loading cases.
AI-assisted: yes.
Pull request closed