Remove nsAutoPtr usage from dom/xslt/
Categories
(Core :: XSLT, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox77 | --- | fixed |
People
(Reporter: erahm, Assigned: erahm)
References
Details
Attachments
(8 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
This bug will track replacing usage of nsAutoPtr
with UniquePtr
in the xslt/ directory. See bug 1610067, comment 0 for more details.
nsAutoPtr
is extensively used in xslt so it might make sense to take an iterative approach along the lines of:
- Remove unnecessary includes
- Convert anything that uses the copy ctor to use a move ctor, update any params that copy to use r-value instead
- Convert anything that uses implicit conversion to use an explict
get
call - Swap over to
UniquePtr
- Replace declarations
- Replace assignment with
MakeUnique
/WrapUnique
- Replace
forget
withrelease
Assignee | ||
Comment 1•4 years ago
|
||
This adds a void**
version fo getter_Transfers
that is needed by the last remaining nsAutoPtr user in XSLT.
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
Assignee | ||
Comment 3•4 years ago
|
||
Assignee | ||
Comment 4•4 years ago
|
||
The first part of a larger conceptual change to switch XSLT over to UniquePtr
. This part just replaces the nsAutoPtr
includes.
Assignee | ||
Comment 5•4 years ago
|
||
This is essentially:
find dom/xslt -type f -n '*.h' | xargs sed -i -e 's/nsAutoPtr</mozilla::UniquePtr</g'
find dom/xslt -type f -n '*.cpp' | xargs sed -i -e 's/nsAutoPtr</UniquePtr</g'
Assignee | ||
Comment 6•4 years ago
|
||
UniquePtr
uses a release
method instead of forget
.
Assignee | ||
Comment 7•4 years ago
|
||
UniquePtr
doesn't provide access to the address of the raw pointer. This swaps out usage of StartAssignment
to just point to the containers themselves.
Assignee | ||
Comment 8•4 years ago
|
||
UniquePtr
doesn't allow assignment from raw pointers so we update callsites appropriately:
- Assignment from
new
is mapped toMakeUnique
- Assignment from pointer params or factory functions ware wrapped with
WrapUnique
- Assignment from
release
calls are switched tostd::move
Additionally standalone release calls are piped into mozilla::Unused
to stifle warnings and document that dropping the pointer is intentional.
Assignee | ||
Comment 9•4 years ago
|
||
Patches are up, this does more or less the bare minimum to convert over to UniquePtr
. I broke up part 4 into conceptual changes to make it easier to review, particularly the search and replace parts. There could be some follow up to clean things up further, but is probably outside the scope of this bug. A few things I noted:
- We could convert a bunch of
release
calls to moves, but that would require changing interfaces to take aUniquePtr
as a param - The ownership model around
txOwningArray
is pretty odd and makes us jump through a few hoops - Factory functions such as
txXPathNativeNode::createXPathNode
could probably just returnUniquePtr
directly rather than having to be wrapped withWrapUnique
Comment 10•4 years ago
|
||
Pushed by erahm@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c7e617493865 Part 1: Add a void** version of UniquePtr getter_Transfers. r=KrisWright https://hg.mozilla.org/integration/autoland/rev/d3bb0783c264 Part 2: Remove unused nsAutoPtr includes. r=peterv https://hg.mozilla.org/integration/autoland/rev/9b8aa31b447d Part 3: Convert implicit conversion to explicit. r=peterv https://hg.mozilla.org/integration/autoland/rev/6665f5b6adb1 Part 4a: Swap out nsAutoPtr includes. r=peterv https://hg.mozilla.org/integration/autoland/rev/73442956e2ba Part 4b: Swap out nsAutoPtr type for UniquePtr. r=peterv https://hg.mozilla.org/integration/autoland/rev/35ca121fe7ee Part 4c: Swap out `forget` calls with `release`. r=peterv https://hg.mozilla.org/integration/autoland/rev/bfbcc3e804f3 Part 4d: Replace `StartAssignment` usage. r=peterv https://hg.mozilla.org/integration/autoland/rev/30cc2aa44812 Part 4e: Handle assignment to `UniquePtr` properly and silence warnings from `release` calls. r=peterv
Comment 11•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c7e617493865
https://hg.mozilla.org/mozilla-central/rev/d3bb0783c264
https://hg.mozilla.org/mozilla-central/rev/9b8aa31b447d
https://hg.mozilla.org/mozilla-central/rev/6665f5b6adb1
https://hg.mozilla.org/mozilla-central/rev/73442956e2ba
https://hg.mozilla.org/mozilla-central/rev/35ca121fe7ee
https://hg.mozilla.org/mozilla-central/rev/bfbcc3e804f3
https://hg.mozilla.org/mozilla-central/rev/30cc2aa44812
Description
•