Avoid unnecessary refcount traffic when appending DOMRect & PaintRequest to array-of-RefPtrs
Categories
(Core :: DOM: UI Events & Focus Handling, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox128 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(1 file)
I noticed some cases where were appending a RefPtr
by raw pointer to a nsTArray<RefPtr<...>>
, and incurring an extra unnecessary AddRef/Release dance as a result. Filing this bug to clean that up to reduce refcount traffic. Patch incoming.
Assignee | ||
Comment 1•8 months ago
|
||
For these objects, we have an Append(Foo*) method which is just a
wrapper-function that appends to a nsTArray<RefPtr<Foo.>>
. As it happens,
every callsite is passing in a local RefPtr variable that's no longer needed
after the call to Append.
It's slightly more performant to use move-semantics to directly transfer
ownership of the existing reference from the local variable to the array,
rather than having the reference count take one step forward and then one step
back, as we were doing before this patch.
Comment 3•8 months ago
|
||
bugherder |
Description
•