IOUtils::ReadUTF8 and IOUTils::WriteAtomicUTF8 should use UTF8String instead of DOMString
Categories
(Toolkit Graveyard :: OS.File, enhancement, P3)
Tracking
(firefox86 fixed)
Tracking | Status | |
---|---|---|
firefox86 | --- | fixed |
People
(Reporter: beth, Assigned: beth)
Details
Attachments
(3 files)
This will save us from performing copies when encoding to and from utf8.
Assignee | ||
Comment 1•5 years ago
|
||
Instead of accepting a DOMString (ie, a UTF16 string) and manually converting
it to UTF-8, we can instead accept a UTF8String from JS, which saves us
manually doing conversions and (and may save an additional conversion if the
JSString* is an ASCII string).
Depends on D99002
Assignee | ||
Comment 2•5 years ago
|
||
Previously, in both Read and ReadUTF8, we were doing copies where we did not
need to. Read allocated an nsTArray and passed that to JS, which performed a
copy of its contents to create a Uint8Array. ReadUTF8, on the other hand, would
take that nsTArray, convert it into ns nsString (1 copy), and then pass it to
JS for it to recreate the string (2 copies).
Now, we allocate our string and array buffers up front in JS' memory pools
directly and use the JS API to create the strings and arrays ourselves (instead
of relying on Promise::MaybeResolve() to do a copying conversion). Read now
performs 0 copies in the best case (if the file is not compressed) and ReadUTF8
also does 0 copies in the best case (if the file is not compressed and the
string is ASCII). In the worst case, Read performs a single extra allocation
(to decompress the file) and ReadUTF8 performs 2 (to decompress the file and to
convert a UTF-8 string to either a Latin1 string or a UTF-16 string).
Depends on D99003
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D99004
Comment 5•5 years ago
|
||
Backed out for causing xpc/mochitest failures.
Backout link: https://hg.mozilla.org/integration/autoland/rev/f50c3348905856d9213c507b74aedac4af106b34
Failure log xpc: https://treeherder.mozilla.org/logviewer?job_id=326689354&repo=autoland&lineNumber=3806
Failure log mochitest: https://treeherder.mozilla.org/logviewer?job_id=326693006&repo=autoland&lineNumber=16641
Failure log mochitest without e10s: https://treeherder.mozilla.org/logviewer?job_id=326692496&repo=autoland&lineNumber=121320
"INFO - TEST-START | toolkit/components/crashes/tests/xpcshell/test_crash_store.js
[task 2021-01-14T14:51:34.591Z] 14:51:34 WARNING - TEST-UNEXPECTED-FAIL | toolkit/components/crashes/tests/xpcshell/test_crash_store.js | xpcshell return code: 0
[task 2021-01-14T14:51:34.592Z] 14:51:34 INFO - TEST-INFO took 235ms
[task 2021-01-14T14:51:34.592Z] 14:51:34 INFO - >>>>>>>
[task 2021-01-14T14:51:34.593Z] 14:51:34 INFO - PID 22147 | Couldn't convert chrome URL: chrome://branding/locale/brand.properties
[task 2021-01-14T14:51:34.593Z] 14:51:34 INFO - PID 22147 | [Parent 22147, Main Thread] WARNING: Couldn't get the user appdata directory. Crash events may not be produced.: file /builds/worker/checkouts/gecko/toolkit/crashreporter/nsExceptionHandler.cpp:2916
[task 2021-01-14T14:51:34.593Z] 14:51:34 INFO - (xpcshell/head.js) | test MAIN run_test pending (1)
[task 2021-01-14T14:51:34.594Z] 14:51:34 INFO - (xpcshell/head.js) | test run_next_test 0 pending (2)
[task 2021-01-14T14:51:34.594Z] 14:51:34 INFO - (xpcshell/head.js) | test MAIN run_test finished (2)
[task 2021-01-14T14:51:34.594Z] 14:51:34 INFO - running event loop
[task 2021-01-14T14:51:34.594Z] 14:51:34 INFO - PID 22147 | [Parent 22147, Main Thread] WARNING: Could not get the program name for a cubeb stream.: 'NS_SUCCEEDED(rv)', file /builds/worker/checkouts/gecko/dom/media/CubebUtils.cpp:387
[task 2021-01-14T14:51:34.595Z] 14:51:34 INFO - toolkit/components/crashes/tests/xpcshell/test_crash_store.js | Starting test_constructor
[task 2021-01-14T14:51:34.595Z] 14:51:34 INFO - (xpcshell/head.js) | test test_constructor pending (2)
[task 2021-01-14T14:51:34.595Z] 14:51:34 INFO - TEST-PASS | toolkit/components/crashes/tests/xpcshell/test_crash_store.js | test_constructor - [test_constructor : 54] true == true"
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
Backed out for mochitest crashes on IOUtils.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/773314003c52b89f3cb750c12a1e1fc6a9969b87
Log link: https://treeherder.mozilla.org/logviewer?job_id=326752317&repo=autoland&lineNumber=6822
Assignee | ||
Updated•5 years ago
|
Comment 9•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/337fac3d0b12
https://hg.mozilla.org/mozilla-central/rev/b9c8927ff527
https://hg.mozilla.org/mozilla-central/rev/ae066b1ae1d1
Updated•2 years ago
|
Description
•