Closed Bug 1357741 Opened 4 years ago Closed 4 years ago

make nsCertOverrideService's locking more efficient

Categories

(Core :: Security: PSM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

nsCertOverrideService uses a ReentrantMonitor to protect its inner
state.  However, there's no way for nsCertOverrideService's methods to
be re-entered when calling outside code.  The use of ReentrantMonitor
appears to be compensating for an unclear division of locking
responsibilities, by enabling every method to simply lock the
ReentrantMonitor upon entrance without care for who might have locked it
beforehand.

Using Mutex is cheaper than ReentrantMonitor, and also forces us to
make explicit who's required to do locking, and who needs to do work
with the lock held.
Comment on attachment 8859581 [details] [diff] [review]
make nsCertOverrideService's locking more efficient

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

LGTM - thanks for writing this.

::: security/manager/ssl/nsCertOverrideService.h
@@ +159,5 @@
>  
>  protected:
>      ~nsCertOverrideService();
>  
> +    mozilla::Mutex mutex;

nit: maybe let's call this mMutex to be consistent with the other member variables
Attachment #8859581 - Flags: review?(dkeeler) → review+
Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8228b51bee64
make nsCertOverrideService's locking more efficient; r=keeler
https://hg.mozilla.org/mozilla-central/rev/8228b51bee64
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
You need to log in before you can comment on or make changes to this bug.