Bug 107762 - HTMLDocumentParser should hold the HTMLToken using an OwnPtr
Summary: HTMLDocumentParser should hold the HTMLToken using an OwnPtr
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: Adam Barth
URL:
Keywords:
Depends on: 108159
Blocks: 107753
  Show dependency treegraph
 
Reported: 2013-01-23 17:03 PST by Adam Barth
Modified: 2013-01-29 12:48 PST (History)
3 users (show)

See Also:


Attachments
Patch (10.41 KB, patch)
2013-01-23 17:04 PST, Adam Barth
no flags Details | Formatted Diff | Diff
Patch for landing (10.60 KB, patch)
2013-01-28 23:41 PST, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Barth 2013-01-23 17:03:53 PST
HTMLDocumentParser should hold the HTMLToken using an OwnPtr
Comment 1 Adam Barth 2013-01-23 17:04:38 PST
Created attachment 184358 [details]
Patch
Comment 2 Eric Seidel (no email) 2013-01-23 17:10:03 PST
Comment on attachment 184358 [details]
Patch

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

This ends up being one more malloc for innerHTML.  I'm not sure if we'll end up noticing for perf or not.

> Source/WebCore/html/parser/HTMLDocumentParser.cpp:341
>          if (!isParsingFragment())

We could just grab a const reference to the token at the top of this loop.  The token being able to change is a background-parser thing.

in your setToken() method that you write you should probably ASSERT that we're not in the middle of a parsing session.
Comment 3 Adam Barth 2013-01-28 23:40:48 PST
I just added an inline helper function to make the code more readable.
Comment 4 Adam Barth 2013-01-28 23:41:02 PST
Created attachment 185174 [details]
Patch for landing
Comment 5 WebKit Review Bot 2013-01-29 00:03:12 PST
Comment on attachment 185174 [details]
Patch for landing

Clearing flags on attachment: 185174

Committed r141070: <http://trac.webkit.org/changeset/141070>
Comment 6 WebKit Review Bot 2013-01-29 00:03:15 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Darin Adler 2013-01-29 09:54:37 PST
Comment on attachment 185174 [details]
Patch for landing

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

> Source/WebCore/html/parser/BackgroundHTMLParser.cpp:157
> +    while (m_tokenizer->nextToken(m_input, *m_token.get())) {

Should not need the get() call here, because the * operator should work on an OwnPtr.

> Source/WebCore/html/parser/HTMLDocumentParser.h:157
> +    HTMLToken& token() { return *m_token.get(); }

Ditto.
Comment 8 Adam Barth 2013-01-29 12:48:46 PST
Oh, I didn't know that.  Thanks!