Closed Bug 976367 Opened 6 years ago Closed 6 years ago

Use AutoArray in MutationObserver to reduce small allocations

Categories

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

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: smaug, Assigned: smaug)

References

Details

Attachments

(1 file)

patch coming
Attached patch patchSplinter Review
This helps in cases when we need to deal with just a few mutation observers.
Attachment #8381035 - Flags: review?(continuation)
Comment on attachment 8381035 [details] [diff] [review]
patch

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

::: content/base/src/nsDOMMutationObserver.h
@@ +440,5 @@
>  
>    uint64_t                                           mId;
>  
>    static uint64_t                                    sCount;
> +  static nsAutoTArray<nsRefPtr<nsDOMMutationObserver>, 4>* sScheduledMutationObservers;

A StaticAutoPtr would be a little nicer for both of these, but this was like this before your patch so it is ok.
Attachment #8381035 - Flags: review?(continuation) → review+
Nathan, I think you were saying that doing new nsAutoTArray is bad or something?  Anyways, here's an example of why it is getting added, because Olli is trying to avoid extra allocations.  I don't recall exactly why it was bad, or maybe I'm just confused altogether.
https://hg.mozilla.org/mozilla-central/rev/8df08e8c4107
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.