Closed Bug 1362910 Opened 2 years ago Closed 2 years ago

Support move-only types for MozPromise

Categories

(Core :: XPCOM, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(3 files)

It would be quite useful to support move-only types when IsExclusive [1] is true for there is at most only one consumer and it is safe to move the ResolveOrRejectValue stored in the promise.

[1] http://searchfox.org/mozilla-central/rev/8b70b0a5038ef9472fe7c53e04a70c978bb06aed/xpcom/threads/MozPromise.h#130
Depends on: 1362912
Depends on: 1363676
Attachment #8866665 - Flags: review?(gsquelart)
Attachment #8866666 - Flags: review?(gsquelart)
Attachment #8866667 - Flags: review?(gsquelart)
Assignee: nobody → jwwang
Priority: -- → P1
Comment on attachment 8866665 [details]
Bug 1362910. P1 - enable move when IsExclusive is true.

https://reviewboard.mozilla.org/r/138272/#review141466
Attachment #8866665 - Flags: review?(gsquelart) → review+
Comment on attachment 8866666 [details]
Bug 1362910. P2 - fix callers.

https://reviewboard.mozilla.org/r/138274/#review141470
Attachment #8866666 - Flags: review?(gsquelart) → review+
Comment on attachment 8866667 [details]
Bug 1362910. P3 - add a gtest to test move-only types with MozPromise.

https://reviewboard.mozilla.org/r/138276/#review141478

::: dom/media/gtest/TestMozPromise.cpp:340
(Diff revision 1)
> +      EXPECT_FALSE(aVal.IsNothing());
> +      EXPECT_TRUE(aVal.IsResolve());
> +      EXPECT_FALSE(aVal.IsReject());
> +      EXPECT_EQ(87, *aVal.ResolveValue());
> +
> +      // Move() shouldn't change the resovle/reject state of aVal.

resovle -> resolve
Attachment #8866667 - Flags: review?(gsquelart) → review+
Thanks for the review!
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b3e212b01bec
P1 - enable move when IsExclusive is true. r=gerald
https://hg.mozilla.org/integration/autoland/rev/f3590d95b1a6
P2 - fix callers. r=gerald
https://hg.mozilla.org/integration/autoland/rev/a9520acf01ad
P3 - add a gtest to test move-only types with MozPromise. r=gerald
You need to log in before you can comment on or make changes to this bug.