Closed Bug 1318228 Opened 9 years ago Closed 9 years ago

NewRunnable storage default should be StoreCopyPassByConstLRef

Categories

(Core :: XPCOM, defect)

49 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

When doing something like `NewRunnableMethod<T>`, the default storage for most types is StoreCopyPassByValue: http://searchfox.org/mozilla-central/rev/efcb1644e49c36445e75d89b434fdf4c84832c84/xpcom/glue/nsThreadUtils.h#740 That is, we keep a copy of the T object in the runnable (good), but then we actually give another copy to the runnable function every time it is run, which seems quite expensive! Instead we should default to StoreCopyPassByConstLRef, which give a const-reference of the runnable copy. From there, the function could itself make a copy if it wanted to. (Thanks to Nathan for reminding me about this.)
Assignee: nobody → gsquelart
Comment on attachment 8811912 [details] Bug 1318228 - Replace nsAutoPtr with UniquePtr in GMPCDMProxy - https://reviewboard.mozilla.org/r/93814/#review93972
Attachment #8811912 - Flags: review?(cpearce) → review+
Comment on attachment 8811912 [details] Bug 1318228 - Replace nsAutoPtr with UniquePtr in GMPCDMProxy - https://reviewboard.mozilla.org/r/93814/#review93974 ::: dom/media/gmp/GMPCDMProxy.h:122 (Diff revision 1) > friend class gmp_InitDoneCallback; > friend class gmp_InitGetGMPDecryptorCallback; > > struct InitData { > uint32_t mPromiseId; > nsString mOrigin; In the commit message: s/GMPCMDProxy/GMPCDMProxy/ I make this typo all the time.
Comment on attachment 8811913 [details] Bug 1318228 - Replace nsAutoPtr with UniquePtr in MediaDrmCDMProxy - https://reviewboard.mozilla.org/r/93816/#review93976
Attachment #8811913 - Flags: review?(cpearce) → review+
Comment on attachment 8811911 [details] Bug 1318228 - NewRunnable defaults to StoreCopyPassByConstLRef - https://reviewboard.mozilla.org/r/93812/#review94326 This ought to be totally safe.
Attachment #8811911 - Flags: review?(nfroyd) → review+
Pushed by gsquelart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4b01174ea634 NewRunnable defaults to StoreCopyPassByConstLRef - r=froydnj https://hg.mozilla.org/integration/autoland/rev/ace53fd3af96 Replace nsAutoPtr with UniquePtr in GMPCDMProxy - r=cpearce https://hg.mozilla.org/integration/autoland/rev/8b9935e92099 Replace nsAutoPtr with UniquePtr in MediaDrmCDMProxy - r=cpearce
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: