RESOLVED FIXED 110517
Make BackgroundHTMLParser rewind the preload scanner instead of clear it
https://bugs.webkit.org/show_bug.cgi?id=110517
Summary Make BackgroundHTMLParser rewind the preload scanner instead of clear it
Tony Gentilcore
Reported 2013-02-21 15:02:09 PST
Make BackgroundHTMLParser rewind the preload scanner instead of clear it
Attachments
Patch (8.94 KB, patch)
2013-02-21 15:04 PST, Tony Gentilcore
no flags
Tony Gentilcore
Comment 1 2013-02-21 15:04:48 PST
Tony Gentilcore
Comment 2 2013-02-21 15:06:25 PST
Comment on attachment 189607 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=189607&action=review > Source/WebCore/html/parser/HTMLPreloadScanner.cpp:285 > + m_cssScanner.reset(); It looks like it is safe to just reset the CSSPreloadScanner instead of restoring any of its members, but I'm not 100% sure about this part.
Adam Barth
Comment 3 2013-02-21 15:08:58 PST
Comment on attachment 189607 [details] Patch Great! Does this have any effect on the top25 benchmark? (Just curious---not a requirement for landing.)
Adam Barth
Comment 4 2013-02-21 15:09:57 PST
Yes. There's no way to document.write in the middle of a <style> element.
Eric Seidel (no email)
Comment 5 2013-02-21 15:10:04 PST
Comment on attachment 189607 [details] Patch Should this just be a state struct? And we have one single checkpoint object? Which has one of each state struct? The preload scanner just has an m_state member for all its state?
Tony Gentilcore
Comment 6 2013-02-21 15:13:20 PST
(In reply to comment #5) > (From update of attachment 189607 [details]) > Should this just be a state struct? And we have one single checkpoint object? Which has one of each state struct? The preload scanner just has an m_state member for all its state? I don't quite see where you are going. Can you please explain a bit more?
Tony Gentilcore
Comment 7 2013-02-21 15:14:30 PST
(In reply to comment #3) > (From update of attachment 189607 [details]) > Great! Does this have any effect on the top25 benchmark? (Just curious---not a requirement for landing.) I didn't run it, but it sure seems like we would have missed some preload scanning opportunities before.
Eric Seidel (no email)
Comment 8 2013-02-21 15:24:24 PST
class PreloadScanner { struct State { bool inStyle; int templateCount; ... } private: PreloadScannerState m_state; } class CheckPoint { TokenizerState tokenizerState; PreloadScannerState preloadScannerState; }
Tony Gentilcore
Comment 9 2013-02-21 15:28:10 PST
(In reply to comment #8) > class PreloadScanner { > struct State { > bool inStyle; > int templateCount; > ... > } > > private: > PreloadScannerState m_state; > } > > class CheckPoint { > TokenizerState tokenizerState; > PreloadScannerState preloadScannerState; > } Sure, I'll rework this
Eric Seidel (no email)
Comment 10 2013-02-21 15:31:54 PST
My review comment was more a question than anything. :) You should use your discretion of course and do whatever you think reads best.
Tony Gentilcore
Comment 11 2013-02-21 15:32:15 PST
(In reply to comment #9) > (In reply to comment #8) > > class PreloadScanner { > > struct State { > > bool inStyle; > > int templateCount; > > ... > > } > > > > private: > > PreloadScannerState m_state; > > } > > > > class CheckPoint { > > TokenizerState tokenizerState; > > PreloadScannerState preloadScannerState; > > } > > Sure, I'll rework this On second thought, BackgroundHTMLInputStream's rewindTo() is a bit more involved than just copying a single state object. I'm not sure it lends itself well to this approach. I also think it is a bit awkward for the preload scanner code to have to do m_state.inStyle everywhere instead of just m_inStyle. WDYT?
Adam Barth
Comment 12 2013-02-21 15:50:49 PST
I don't think it's a big deal either way.
Eric Seidel (no email)
Comment 13 2013-02-21 15:51:13 PST
I'm not sure it matters much either way. Just felt a bit odd at first sight to have 2 separate Checkpoint objects.
WebKit Review Bot
Comment 14 2013-02-21 16:23:17 PST
Comment on attachment 189607 [details] Patch Clearing flags on attachment: 189607 Committed r143661: <http://trac.webkit.org/changeset/143661>
WebKit Review Bot
Comment 15 2013-02-21 16:23:21 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.