Closed Bug 916632 Opened 11 years ago Closed 10 years ago

Add a simple scoped pointer type ScopedPtr that is independent of MFBT

Categories

(Core :: Security: PSM, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: briansmith, Assigned: briansmith)

References

()

Details

Attachments

(3 files, 1 obsolete file)

Attached patch ScopedPtr.patch (obsolete) — Splinter Review
In the absence of std::unique_ptr being available on all platforms, and in order to allow insanity::pkix and CertVerifier to be built independently of Gecko, we need a scoped pointer type like boost::scoped_ptr.

I hope to eventually/soon replace the use of MFBT's Scoped.h in ScopedNSSTypes.h with usage of this ScopedPtr class, if my upcoming attempt to get unique_ptr working on all platforms fails.

Camilo, you've already reviewed these patches, but please give them a once-over to see if there are any style nits or whatnot that need to be addressed.
Attachment #805091 - Flags: review?(cviecco)
Attachment #805091 - Attachment is obsolete: true
Attachment #805091 - Flags: review?(cviecco)
Attachment #805094 - Flags: review?(cviecco)
Brian, I notice these are in the insanity namespace, do you want this?
(In reply to Camilo Viecco (:cviecco) from comment #3)
> Brian, I notice these are in the insanity namespace, do you want this?

Yes. Do you think they should go into another namespace?
Yes, if the goal is to make them generic (which seems to be implied by the name of the bug)
(In reply to Camilo Viecco (:cviecco) from comment #5)
> Yes, if the goal is to make them generic (which seems to be implied by the
> name of the bug)

I think the current namespace (insanity::pkix) is OK. That's what it has always been and the important thing is that insanity::pkix is self-contained.
Comment on attachment 805094 [details] [diff] [review]
Part 1: Add ScopedPtr

Review of attachment 805094 [details] [diff] [review]:
-----------------------------------------------------------------

Style r+, funcionality (when not using protected members) r- for clarity in comments.

::: include/insanity/ScopedPtr.h
@@ +48,5 @@
> +
> +protected:
> +  T* mValue;
> +
> +  ScopedPtr(const ScopedPtr&) /*delete*/;

The delete comment is not clear.
Attachment #805094 - Flags: review?(cviecco) → review-
Attachment #805092 - Flags: review?(cviecco) → review+
Also, is the location of the files what you want. Not scoping them to security?
Comment on attachment 805094 [details] [diff] [review]
Part 1: Add ScopedPtr

The /*delete*/ comments refer to the new C++03 feature described here:
http://en.wikipedia.org/wiki/C%2B%2B11#Explicitly_defaulted_and_deleted_special_member_functions

Unfortunately, not all of our compilers support that mechanism yet, so I had to use a comment instead. I put these in the private section of the class because that is the standard way of prohibiting copying/assignment prior to the introduction to the new C++03 feature.

If you'd like, I can write the comment as /* = delete */. If so, please let me know when you r+ the patch and I will make that change before checking in.

Note that the posted patches are against a repo rooted in security/insanity. When I check them in, they will be in the mozilla-central repo in the correct place.
Attachment #805094 - Flags: review- → review?
Comment on attachment 805094 [details] [diff] [review]
Part 1: Add ScopedPtr

Review of attachment 805094 [details] [diff] [review]:
-----------------------------------------------------------------

Issue with dirs addressed via irc.
Attachment #805094 - Flags: review? → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: