Bug 101619 - Skip frame owner disconnect when there's no frames
Summary: Skip frame owner disconnect when there's no frames
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords:
Depends on:
Blocks: 102350
  Show dependency treegraph
 
Reported: 2012-11-08 09:51 PST by Elliott Sprehn
Modified: 2012-11-15 01:15 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.93 KB, patch)
2012-11-08 09:56 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff
Patch (2.01 KB, patch)
2012-11-08 10:59 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2012-11-08 09:51:04 PST
Skip frame owner disconnect when there's no frames
Comment 1 Elliott Sprehn 2012-11-08 09:56:58 PST
Created attachment 173059 [details]
Patch
Comment 2 Ojan Vafai 2012-11-08 09:59:01 PST
Comment on attachment 173059 [details]
Patch

Looks great! I'm curious to see if we'll see benefit on any of the perf tests.
Comment 3 Elliott Sprehn 2012-11-08 10:01:04 PST
(In reply to comment #2)
> (From update of attachment 173059 [details])
> Looks great! I'm curious to see if we'll see benefit on any of the perf tests.

Yeah. Complicated pages seem to always have frames on them though, even the Review Patch page has an iframe for the comment form!
Comment 4 Adam Barth 2012-11-08 10:41:25 PST
Comment on attachment 173059 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=173059&action=review

> Source/WebCore/dom/ContainerNodeAlgorithms.h:280
> +        // If we know there's no frames to disconnect then don't bother traversing
> +        // the tree looking for them.
> +        Page* page = root->document()->page();
> +        if (page && !page->subframeCount())
> +            return;

Why do we need to do this on a per-page basis?  Isn't it enough to know that the current document has no subframes?
Comment 5 Ojan Vafai 2012-11-08 10:44:36 PST
Comment on attachment 173059 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=173059&action=review

>> Source/WebCore/dom/ContainerNodeAlgorithms.h:280
>> +            return;
> 
> Why do we need to do this on a per-page basis?  Isn't it enough to know that the current document has no subframes?

Page is what has the data at the moment. Long-term plan is to add a count of frames in the subtree to NodeRareData and only do this traversal if the subtree has any frames.
Comment 6 Elliott Sprehn 2012-11-08 10:49:14 PST
(In reply to comment #4)
> (From update of attachment 173059 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=173059&action=review
> 
> > Source/WebCore/dom/ContainerNodeAlgorithms.h:280
> > +        // If we know there's no frames to disconnect then don't bother traversing
> > +        // the tree looking for them.
> > +        Page* page = root->document()->page();
> > +        if (page && !page->subframeCount())
> > +            return;
> 
> Why do we need to do this on a per-page basis?  Isn't it enough to know that the current document has no subframes?

Yeah it is, but we don't track that currently. This is the first step in a longer road to optimization.
Comment 7 Elliott Sprehn 2012-11-08 10:50:47 PST
(In reply to comment #6)
> (In reply to comment #4)
> ...
> > Why do we need to do this on a per-page basis?  Isn't it enough to know that the current document has no subframes?
> 
> Yeah it is, but we don't track that currently. This is the first step in a longer road to optimization.

Actually, maybe I can just use document()->frame()->tree()->firstChild() to detect if there's subframes?
Comment 8 Elliott Sprehn 2012-11-08 10:59:34 PST
Created attachment 173073 [details]
Patch

Use the frame tree instead.
Comment 9 Adam Barth 2012-11-08 11:12:02 PST
Comment on attachment 173073 [details]
Patch

LGTM
Comment 10 Ojan Vafai 2012-11-08 11:21:09 PST
Clever! I like it.
Comment 11 Alexey Proskuryakov 2012-11-08 12:37:36 PST
How will this affect frames that are in shadow trees?
Comment 12 WebKit Review Bot 2012-11-08 12:37:53 PST
Comment on attachment 173073 [details]
Patch

Clearing flags on attachment: 173073

Committed r133933: <http://trac.webkit.org/changeset/133933>
Comment 13 WebKit Review Bot 2012-11-08 12:37:57 PST
All reviewed patches have been landed.  Closing bug.
Comment 14 Adam Barth 2012-11-08 12:40:02 PST
> How will this affect frames that are in shadow trees?

Are those not added to the FrameTree?
Comment 15 Adam Barth 2012-11-08 12:42:51 PST
It looks like they are added to the FrameTree, but they're skipped over in the "scoped" versions of these functions by testing Frame::inScope
Comment 16 Adam Barth 2012-11-08 12:43:56 PST
@esprehn: Can you add a test for this case?
Comment 17 Elliott Sprehn 2012-11-08 13:28:40 PST
(In reply to comment #16)
> @esprehn: Can you add a test for this case?

Sure.