Closed Bug 380475 Opened 18 years ago Closed 17 years ago

[FIX]Make getting URIs from principals a little faster

Categories

(Core :: Security: CAPS, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha6

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: perf, regression)

Attachments

(1 file)

Attached patch Proposed patch (deleted) — Splinter Review
Bug 339822 missed the main spot where we set URIs on principals. And in fact, GetURI _is_ on one of the security check critical paths... The patch implements some of the things that bug talks about, as well as hitting the remaining points where mCodebase is modified.
Attachment #264573 - Flags: superreview?(cbiesinger)
Attachment #264573 - Flags: review?(dveditz)
Blocks: 380471
Blocks: 375470
Comment on attachment 264573 [details] [diff] [review] Proposed patch mCodebaseImmutable is to avoid the overhead from calling GetMutable every time?
Attachment #264573 - Flags: superreview?(cbiesinger) → superreview+
Yep, exactly. And the QI overhead.
Comment on attachment 264573 [details] [diff] [review] Proposed patch > nsPrincipal::GetURI(nsIURI** aURI) > { > if (!mCodebase) { > *aURI = nsnull; > return NS_OK; > } > >+ if (mCodebaseImmutable) { >+ NS_ADDREF(*aURI = mCodebase); >+ return NS_OK; >+ } If you're doing this for perf reasons would it make more sense to check the faster mCodebaseImmutable first, since practically all principals have a codebase? You could combine the checks into a single if (mCodebaseImmutable || !mCodebase) Though maybe nsCOMPtr's aren't so bad in optimized builds and the single extra check isn't going to hurt. r=dveditz
Attachment #264573 - Flags: review?(dveditz) → review+
Good idea. Switched the order of those checks, and checked in.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: