Bug 107762

Summary: HTMLDocumentParser should hold the HTMLToken using an OwnPtr
Product: WebKit Reporter: Adam Barth <abarth>
Component: New BugsAssignee: Adam Barth <abarth>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, tonyg, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 108159    
Bug Blocks: 107753    
Attachments:
Description Flags
Patch
none
Patch for landing none

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!