Closed
Bug 409390
Opened 17 years ago
Closed 16 years ago
Avoid nsCOMPtr's and some code in nsDocument::FlushPendingNotifications() when possible.
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.9beta4
People
(Reporter: jst, Assigned: bent.mozilla)
References
Details
(Keywords: perf)
Attachments
(1 file, 1 obsolete file)
6.21 KB,
patch
|
bzbarsky
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
nsDocument::FlushPendingNotifications() has code to notify the parent document etc when flushing layout (aType > Flush_ContentAndNotify), but that code is a no-op when mParentDocument is null and should then be avoided. Also, as the comment in the code says, a lot of that code can be replaced with using mParentDocument directly. See attached patch.
Reporter | ||
Comment 2•17 years ago
|
||
Ben agreed to look into this, reassigning.
Assignee: jst → bent.mozilla
Assignee | ||
Comment 3•17 years ago
|
||
This look ok?
Attachment #296618 -
Flags: superreview?
Attachment #296618 -
Flags: review?(jst)
Assignee | ||
Updated•17 years ago
|
Attachment #296618 -
Flags: superreview? → superreview?(bzbarsky)
Comment 4•17 years ago
|
||
Hmm. Why is the SyncParentSubDocMap call needed? Also, the assert in FlushPendingNotifications looks wrong; it's possible to have a subdocument have a null mParentDocument but still have a docshell which has a parent. In those cases we don't want to be flushing the parent docshell...
Comment 5•17 years ago
|
||
Comment on attachment 296618 [details] [diff] [review] Patch, v1 sr- pending answers to my questions
Attachment #296618 -
Flags: superreview?(bzbarsky) → superreview-
Reporter | ||
Comment 6•17 years ago
|
||
(In reply to comment #4) > Hmm. Why is the SyncParentSubDocMap call needed? I don't know for a fact that it is, but when Ben and I went through this code that was the one place where mDocument was set and it wasn't obvious that the map would be updated in this case. If you're saying it's not needed, then we'll just not add this. > Also, the assert in FlushPendingNotifications looks wrong; it's possible to > have a subdocument have a null mParentDocument but still have a docshell which > has a parent. In those cases we don't want to be flushing the parent > docshell... Uh? I don't understand what case that would be, but if you say so (and you know this stuff way better than I do, so I'm not going to argue with you)...
Comment 7•17 years ago
|
||
> If you're saying it's not needed, then we'll just not add this. No, I was just wondering what cases it was needed in. I'll look to see what the effect is of having or not having it here. > Uh? I don't understand what case that would be, During paint suppression, we've set the new doc in the subdoc map (so the old one has a null mParentDocument), but not called Show() on the new viewer, so the old viewer hasn't gotten a Destroy(), so its document still has the old container... It's a mess. :(
Comment 8•17 years ago
|
||
OK, looks like the only places where LoadStart() is called in our code on a document viewer with a null mDocument, the container of the document viewer is still null, so SyncParentSubDocMap is effectively a no-op. I'd say we shouldn't add it here, and instead document the call order here and in the IDL. Or we could add it (it's not a super-expensive no-op), and file a bug to clean up the document viewer mess.
Assignee | ||
Comment 9•16 years ago
|
||
Ok, this patch loses the unnecessary call and the assertion.
Attachment #296618 -
Attachment is obsolete: true
Attachment #301317 -
Flags: review?(bzbarsky)
Attachment #296618 -
Flags: review?(jst)
Comment 10•16 years ago
|
||
Comment on attachment 301317 [details] [diff] [review] Patch, v2 r=bzbarsky
Attachment #301317 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Updated•16 years ago
|
Attachment #301317 -
Flags: superreview?(jst)
Updated•16 years ago
|
Target Milestone: mozilla1.9beta3 → mozilla1.9beta4
Version: unspecified → Trunk
Reporter | ||
Comment 11•16 years ago
|
||
Comment on attachment 301317 [details] [diff] [review] Patch, v2 - In nsDocument::DispatchContentLoadedEvents(): + nsIDocument* parent = mParentDocument; + while (parent) { + parent = parent->GetParentDocument(); It might be worth while to make parent an nsCOMPtr here as dispatching these events could in theory kill a document, which could leave parent dangling here next time through. bz, if you know for a fact that that can't happen, then please speak up. sr=jst with that.
Attachment #301317 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 12•16 years ago
|
||
Comment on attachment 301317 [details] [diff] [review] Patch, v2 This patch avoids some needless QI action and simplifies the code a bit.
Attachment #301317 -
Flags: approval1.9?
Assignee | ||
Comment 13•16 years ago
|
||
Comment on attachment 301317 [details] [diff] [review] Patch, v2 Oh, nm, blocking+ already.
Attachment #301317 -
Flags: approval1.9?
Comment 14•16 years ago
|
||
Yeah, making that a strong ref sounds like a good idea.
Assignee | ||
Comment 15•16 years ago
|
||
Fixed, used a nsCOMPtr.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•