Closed Bug 1514908 Opened 7 years ago Closed 7 years ago

Make WorkerRef take an rvalue reference to its callback

Categories

(Core :: DOM: Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: mrbkap, Assigned: mrbkap)

Details

Attachments

(1 file)

StrongWorkerRef::Create and WeakWorkerRef::Create currently take a const reference to the callback and copy it around. Given that pretty much all of the closures passed to these functions capture RefPtrs to atomically refcounted objects, it seems worth the effort to reduce the number of copies. We can do that with rvalue references and std::move.
By taking an rvalue reference and using std::move more aggressively, we can avoid at least two copies of these closures, which avoids a bit of atomic refcounting.
Priority: -- → P2
Pushed by mrbkap@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3359ea05f0ee Reduce deep copies of the closures passed to this function. r=baku
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: