Closed Bug 1798459 Opened 2 years ago Closed 2 years ago

Streamline WritableFileStream implementation

Categories

(Core :: DOM: File, task, P2)

task

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: janv, Assigned: janv)

References

Details

Attachments

(28 files, 2 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Some parts of the WritableFileStream implementation are based on an older SyncAccessHandle implementation. Actually, OPFS implementation has changed a bit overall. We need to bring WritableFileStream up to date.

This bug will also cover some WritableFileStream bugs fixes and cleanup.

Keywords: leave-open

Having protected members in a final class doesn't make sense.

Depends on D160910

Attachment #9301313 - Attachment description: Bug 1798459 - StreamAlgorithms to the cpp file and rename it to WritableFileStreamUnderlyingSinkAlgorithms; r=#dom-storage → Bug 1798459 - Move StreamAlgorithms to the cpp file and rename it to WritableFileStreamUnderlyingSinkAlgorithms; r=#dom-storage
Blocks: 1769057
No longer blocks: OPFS
Attachment #9301324 - Attachment is obsolete: true
Attachment #9301325 - Attachment description: Bug 1798459 - Fix dom/fs/parent and dom/fs/test/gtest/parent to build in hybrid/non-unified mode; r=#dom-storage → Bug 1798459 - Share origin metadata between TestFileSystemDataManager.cpp and TestFileSystemDataManagerVersion001.cpp; r=#dom-storage

This patch also moves a similar call for SyncAccessHandle.

Depends on D161171

WritableFileStream can be enabled on the main thread only when bug 1798513 gets fixed.

Depends on D161274

Attachment #9301976 - Attachment description: Bug 1798459 - Support writes with length less than 2GB for now; r=#dom-storage → Bug 1798459 - Support writes with length less than 2GB for now r=#dom-storage
Attachment #9301976 - Attachment description: Bug 1798459 - Support writes with length less than 2GB for now r=#dom-storage → Bug 1798459 - Support writes with length less than 2GB for now; r=#dom-storage

Shared locks can't be used without copy-on-open and replace-on-close support.

Depends on D161274

Depends on D161539

There are no other callers anymore.

Attachment #9302154 - Attachment description: Bug 1798459 - Reduce code duplication in FileSystemWritableFileStream.cpp; r=#dom-storage → Bug 1798459 - Reduce code duplication and data copying in FileSystemWritableFileStream.cpp; r=#dom-storage
Attachment #9302439 - Attachment description: Bug 1798459 - Move TrunFile to FileSystemWritableFileStream.cpp; r=#dom-storage → Bug 1798459 - Move TruncFile to FileSystemWritableFileStream.cpp; r=#dom-storage
Keywords: leave-open
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f768630d046c Move StreamAlgorithms to the cpp file and rename it to WritableFileStreamUnderlyingSinkAlgorithms; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/da1781f32050 Remove unused FileSystemWritableFileStream::mRequestHandler; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/21d087d3ca5d Add FileSystemWritableFileStream::mManager to cycle collection; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/f92f19dc1a9f Remove dead code related to blobs; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/db0c3d15084b Clean up FileSystemWritableFileStream construction code; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/5bfb07498c30 Separate out FileSystemWritableFileStream::Close and IsClosed which are not part of the WebIDL interface; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/8c6510e97a9c Make FileSystemWritableFileStream::DoSeek a private method; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/e3740924348f Synchronize the order of WebIDL methods between the h and cpp file; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/7e8b4f40c31d Move FileSystemWritableFileStream::ClearActor to the correct place; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/3ed207332879 Clean up FileSystemWritableFileStream member variables; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/cc31ee7652a8 Share origin metadata between TestFileSystemDataManager.cpp and TestFileSystemDataManagerVersion001.cpp; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/9f4f237f33bb Remove unnecessary include directives; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/326b8b13aca3 Fix TestFileSystemDatabaseManagerVersion001 perma gtest failure; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/985f88adbc8e Use a dedicated close message for closing writable file streams; r=dom-storage-reviewers,jesup,jari https://hg.mozilla.org/integration/autoland/rev/4f07a77a4abd Remove dead code related to now removed mTaskQueue; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/5e9ca1b1c95c Support writes with length less than 2GB for now; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/0f197d402d63 Close parent side file handles to unlock child side. r=dom-storage-reviewers,janv https://hg.mozilla.org/integration/autoland/rev/1a86d4746c65 Run test_writableFileStream.js in the mochitest context and in the main thread xpcshell context; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/7d2ffb13d1cc Add a shutdown check to FileSystemRequestHandler::GetWritable; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/243631cf4913 Call SetStream on actor only when FileSystemWritableFileStream was successfully created; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/d9b3c17a5549 Switch WritableFileStream to exclusive locks; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/3b1eaafa31d2 Clean up IPDL changes; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/b68c63983ae7 Null check actor before sending the close message; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/b371599177b6 Move autoUnlock.release() to correct place; r=dom-storage-reviewers,jstutte https://hg.mozilla.org/integration/autoland/rev/179d6204b3bb Reduce code duplication and data copying in FileSystemWritableFileStream.cpp; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/83b1e1b3c168 Move TruncFile to FileSystemWritableFileStream.cpp; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/89c3a814819c Disable WritableFileStream on the main thread; r=dom-storage-reviewers,jesup
Attachment #9302674 - Attachment description: Bug 1798459 - Reset seek position after file extension by truncate. r=#dom-storage → Bug 1798459 - Restore seek position after truncate on Windows. r=#dom-storage
Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/86ecad8aadd4 Move StreamAlgorithms to the cpp file and rename it to WritableFileStreamUnderlyingSinkAlgorithms; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/cd8399747baa Remove unused FileSystemWritableFileStream::mRequestHandler; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/f76d3f9a70ff Add FileSystemWritableFileStream::mManager to cycle collection; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/a2b17e11f763 Remove dead code related to blobs; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/43334f1adcfc Clean up FileSystemWritableFileStream construction code; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/8909f236b89a Separate out FileSystemWritableFileStream::Close and IsClosed which are not part of the WebIDL interface; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/09d161716d5b Make FileSystemWritableFileStream::DoSeek a private method; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/096b076e4164 Synchronize the order of WebIDL methods between the h and cpp file; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/8a062cb0dbb6 Move FileSystemWritableFileStream::ClearActor to the correct place; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/1ea3643ba7bc Clean up FileSystemWritableFileStream member variables; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/8f1aa390cdf6 Share origin metadata between TestFileSystemDataManager.cpp and TestFileSystemDataManagerVersion001.cpp; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/da811fc519cf Remove unnecessary include directives; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/09b9a623d1ca Fix TestFileSystemDatabaseManagerVersion001 perma gtest failure; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/a030bc5bdd55 Use a dedicated close message for closing writable file streams; r=dom-storage-reviewers,jesup,jari https://hg.mozilla.org/integration/autoland/rev/6fe657e916d7 Remove dead code related to now removed mTaskQueue; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/ad5ac806f30f Support writes with length less than 2GB for now; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/c4622058ea12 Close parent side file handles to unlock child side. r=dom-storage-reviewers,janv https://hg.mozilla.org/integration/autoland/rev/6e11fb0b4a90 Run test_writableFileStream.js in the mochitest context and in the main thread xpcshell context; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/8e1a8864f3bf Add a shutdown check to FileSystemRequestHandler::GetWritable; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/1f130aa6b2c8 Call SetStream on actor only when FileSystemWritableFileStream was successfully created; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/82e9af33502d Switch WritableFileStream to exclusive locks; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/541a5807abed Clean up IPDL changes; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/345e9946ae68 Null check actor before sending the close message; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/2fc83f8aebc5 Move autoUnlock.release() to correct place; r=dom-storage-reviewers,jstutte https://hg.mozilla.org/integration/autoland/rev/05fe0dbea21a Reduce code duplication and data copying in FileSystemWritableFileStream.cpp; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/a1f6ec76a0c8 Move TruncFile to FileSystemWritableFileStream.cpp; r=dom-storage-reviewers,jesup https://hg.mozilla.org/integration/autoland/rev/cc1d0692cbd0 Restore seek position after truncate on Windows. r=dom-storage-reviewers,janv https://hg.mozilla.org/integration/autoland/rev/4313a4577ade Disable WritableFileStream on the main thread; r=dom-storage-reviewers,jesup

https://hg.mozilla.org/mozilla-central/rev/86ecad8aadd4
https://hg.mozilla.org/mozilla-central/rev/cd8399747baa
https://hg.mozilla.org/mozilla-central/rev/f76d3f9a70ff
https://hg.mozilla.org/mozilla-central/rev/a2b17e11f763
https://hg.mozilla.org/mozilla-central/rev/43334f1adcfc
https://hg.mozilla.org/mozilla-central/rev/8909f236b89a
https://hg.mozilla.org/mozilla-central/rev/09d161716d5b
https://hg.mozilla.org/mozilla-central/rev/096b076e4164
https://hg.mozilla.org/mozilla-central/rev/8a062cb0dbb6
https://hg.mozilla.org/mozilla-central/rev/1ea3643ba7bc
https://hg.mozilla.org/mozilla-central/rev/8f1aa390cdf6
https://hg.mozilla.org/mozilla-central/rev/da811fc519cf
https://hg.mozilla.org/mozilla-central/rev/09b9a623d1ca
https://hg.mozilla.org/mozilla-central/rev/a030bc5bdd55
https://hg.mozilla.org/mozilla-central/rev/6fe657e916d7
https://hg.mozilla.org/mozilla-central/rev/ad5ac806f30f
https://hg.mozilla.org/mozilla-central/rev/c4622058ea12
https://hg.mozilla.org/mozilla-central/rev/6e11fb0b4a90
https://hg.mozilla.org/mozilla-central/rev/8e1a8864f3bf
https://hg.mozilla.org/mozilla-central/rev/1f130aa6b2c8
https://hg.mozilla.org/mozilla-central/rev/82e9af33502d
https://hg.mozilla.org/mozilla-central/rev/541a5807abed
https://hg.mozilla.org/mozilla-central/rev/345e9946ae68
https://hg.mozilla.org/mozilla-central/rev/2fc83f8aebc5
https://hg.mozilla.org/mozilla-central/rev/05fe0dbea21a
https://hg.mozilla.org/mozilla-central/rev/a1f6ec76a0c8
https://hg.mozilla.org/mozilla-central/rev/cc1d0692cbd0
https://hg.mozilla.org/mozilla-central/rev/4313a4577ade

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch

A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)

Regressions: 1801388
Regressions: 1801417
Regressions: 1802279

Comment on attachment 9303937 [details]
Bug 1798459 - Re-enable writable stream and its tests on main thread. r=#dom-storage

Revision D162319 was moved to bug 1802279. Setting attachment 9303937 [details] to obsolete.

Attachment #9303937 - Attachment is obsolete: true
Regressions: 1807198

Landed successfully in the end.

Flags: needinfo?(jvarga)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: