RESOLVED INVALID 122960
MainThreadTask class variants should use std::unique_ptr
https://bugs.webkit.org/show_bug.cgi?id=122960
Summary MainThreadTask class variants should use std::unique_ptr
Zan Dobersek
Reported 2013-10-17 06:01:40 PDT
MainThreadTask class variants should use std::unique_ptr
Attachments
Patch (13.44 KB, patch)
2013-10-17 06:10 PDT, Zan Dobersek
andersca: review-
Zan Dobersek
Comment 1 2013-10-17 06:10:14 PDT
Anders Carlsson
Comment 2 2013-10-17 07:02:01 PDT
Comment on attachment 214451 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=214451&action=review Instead of using std::unique_ptr<MainThreadTask>(new MainThreadTask(...) you can just use std::make_unique<MainThreadTask>(...). > Source/WebCore/platform/MainThreadTask.h:487 > - typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6, > - typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create( > - method, > - CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2), > - CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4), > - CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6), > - CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8)).leakPtr()); > + typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6, > + typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create( > + method, > + CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2), > + CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4), > + CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6), > + CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8)).release()); I don't think there's any point in re-indenting this.
Zan Dobersek
Comment 3 2013-10-17 08:54:37 PDT
(In reply to comment #2) > (From update of attachment 214451 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=214451&action=review > > Instead of using std::unique_ptr<MainThreadTask>(new MainThreadTask(...) you can just use std::make_unique<MainThreadTask>(...). > That would require for the constructor to be public. If I (can?) make the constructor public, the static create() methods could be abandoned and std::make_unique<MainThreadTask>() could be used directly. The constructor could be kept private if std::make_unique is listed as a friend in the class' definitions. I tried that already, but couldn't set up a properly templatized friend declaration for it to work.
Darin Adler
Comment 4 2014-04-07 13:32:27 PDT
(In reply to comment #3) > That would require for the constructor to be public. Yes, I think that’s a fine thing to do. Another option is to use “friend” for this. We have done both in the past. Either is fine depending on your preferences.
Darin Adler
Comment 5 2015-04-20 10:00:30 PDT
This class has been removed, so we no longer need to do this.
Note You need to log in before you can comment on or make changes to this bug.