Closed Bug 597368 Opened 14 years ago Closed 14 years ago

nsScriptLoader should use nsRefPtr to hold nsScriptLoadRequest

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla2.0b7

People

(Reporter: hsivonen, Assigned: hsivonen)

References

Details

Attachments

(1 file)

nsScriptLoader should use nsRefPtr to hold nsScriptLoadRequest. It's currently using nsCOMPtr and nsCOMArray.
Assignee: nobody → hsivonen
Status: NEW → ASSIGNED
Attachment #476220 - Flags: review?(jonas)
Comment on attachment 476220 [details] [diff] [review]
Make nsScriptLoader use nsRefPtr/nsTArray for holding nsScriptLoadRequest

>+  while (mEnabled && i < mAsyncRequests.Length()) {
>     if (!mAsyncRequests[i]->mLoading) {
>-      request = mAsyncRequests[i];
>-      mAsyncRequests.RemoveObjectAt(i);
>+      request.swap(mAsyncRequests[i]);
>+      mAsyncRequests.RemoveElementAt(i);
>       ProcessRequest(request);
>       continue;
>     }
>     ++i;
>   }

This is somewhat odd since you're actually swapping in the old requests into the array before you remove it. I think it works, but it would IMHO be more understandable to do

request = mAsyncRequests[i].forget();

Same in the loop below.

r=me with that fixed.

Thanks for doing this cleanup.
Attachment #476220 - Flags: review?(jonas) → review+
Comment on attachment 476220 [details] [diff] [review]
Make nsScriptLoader use nsRefPtr/nsTArray for holding nsScriptLoadRequest

Requesting approval: This is low-risk cleanup. Taking this on the branch would make branch maintanance easier if we end up having to patch nsScriptLoader.
Attachment #476220 - Flags: approval2.0?
Attachment #476220 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/aacd84d91b66
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Target Milestone: mozilla2.0b8 → mozilla2.0b7
Depends on: 737754
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: