Changeset 143661 in webkit
- Timestamp:
- Feb 21, 2013 4:21:33 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143658 r143661 1 2013-02-21 Tony Gentilcore <tonyg@chromium.org> 2 3 Make BackgroundHTMLParser rewind the preload scanner instead of clear it 4 https://bugs.webkit.org/show_bug.cgi?id=110517 5 6 Reviewed by Adam Barth. 7 8 No new tests becuase no new functionality. 9 10 * html/parser/BackgroundHTMLParser.cpp: 11 (WebCore::BackgroundHTMLParser::resumeFrom): 12 (WebCore::BackgroundHTMLParser::pumpTokenizer): 13 (WebCore::BackgroundHTMLParser::sendTokensToMainThread): 14 * html/parser/BackgroundHTMLParser.h: 15 (Checkpoint): 16 * html/parser/HTMLDocumentParser.cpp: 17 (WebCore::HTMLDocumentParser::didFailSpeculation): 18 * html/parser/HTMLDocumentParser.h: 19 (ParsedChunk): 20 * html/parser/HTMLPreloadScanner.cpp: 21 (WebCore::TokenPreloadScanner::createCheckpoint): 22 (WebCore): 23 (WebCore::TokenPreloadScanner::rewindTo): 24 * html/parser/HTMLPreloadScanner.h: 25 (WebCore): 26 (TokenPreloadScanner): 27 (WebCore::TokenPreloadScanner::Checkpoint::Checkpoint): 28 (Checkpoint): 29 1 30 2013-02-21 Sheriff Bot <webkit.review.bot@gmail.com> 2 31 -
trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp
r143649 r143661 140 140 m_tokenizer = checkpoint->tokenizer.release(); 141 141 m_input.rewindTo(checkpoint->inputCheckpoint, checkpoint->unparsedInput); 142 m_preloadScanner .clear(); // FIXME: We should rewind the preload scanner rather than clearing it.142 m_preloadScanner->rewindTo(checkpoint->preloadScannerCheckpoint); 143 143 pumpTokenizer(); 144 144 } … … 235 235 token.setXSSInfo(xssInfo.release()); 236 236 237 if (m_preloadScanner) 238 m_preloadScanner->scan(token, m_pendingPreloads); 237 m_preloadScanner->scan(token, m_pendingPreloads); 239 238 240 239 m_pendingTokens->append(token); … … 263 262 chunk->tokens = m_pendingTokens.release(); 264 263 chunk->preloads.swap(m_pendingPreloads); 265 chunk->checkpoint = m_input.createCheckpoint(); 264 chunk->inputCheckpoint = m_input.createCheckpoint(); 265 chunk->preloadScannerCheckpoint = m_preloadScanner->createCheckpoint(); 266 266 callOnMainThread(bind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser, m_parser, chunk.release())); 267 267 -
trunk/Source/WebCore/html/parser/BackgroundHTMLParser.h
r143051 r143661 68 68 OwnPtr<HTMLTokenizer> tokenizer; 69 69 HTMLInputCheckpoint inputCheckpoint; 70 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; 70 71 String unparsedInput; 71 72 }; -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r143407 r143661 316 316 checkpoint->token = token; 317 317 checkpoint->tokenizer = tokenizer; 318 checkpoint->inputCheckpoint = m_currentChunk->checkpoint; 318 checkpoint->inputCheckpoint = m_currentChunk->inputCheckpoint; 319 checkpoint->preloadScannerCheckpoint = m_currentChunk->preloadScannerCheckpoint; 319 320 checkpoint->unparsedInput = m_input.current().toString().isolatedCopy(); 320 321 m_input.current().clear(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r143051 r143661 90 90 OwnPtr<CompactHTMLTokenStream> tokens; 91 91 PreloadRequestStream preloads; 92 HTMLInputCheckpoint checkpoint; 92 HTMLInputCheckpoint inputCheckpoint; 93 TokenPreloadScannerCheckpoint preloadScannerCheckpoint; 93 94 }; 94 95 void didReceiveParsedChunkFromBackgroundParser(PassOwnPtr<ParsedChunk>); -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp
r143415 r143661 263 263 } 264 264 265 TokenPreloadScannerCheckpoint TokenPreloadScanner::createCheckpoint() 266 { 267 TokenPreloadScannerCheckpoint checkpoint = m_checkpoints.size(); 268 m_checkpoints.append(Checkpoint(m_predictedBaseElementURL, m_inStyle 269 #if ENABLE(TEMPLATE_ELEMENT) 270 , m_templateCount 271 #endif 272 )); 273 return checkpoint; 274 } 275 276 void TokenPreloadScanner::rewindTo(TokenPreloadScannerCheckpoint checkpointIndex) 277 { 278 ASSERT(checkpointIndex < m_checkpoints.size()); // If this ASSERT fires, checkpointIndex is invalid. 279 const Checkpoint& checkpoint = m_checkpoints[checkpointIndex]; 280 m_predictedBaseElementURL = checkpoint.predictedBaseElementURL; 281 m_inStyle = checkpoint.inStyle; 282 #if ENABLE(TEMPLATE_ELEMENT) 283 m_templateCount = checkpoint.templateCount; 284 #endif 285 m_cssScanner.reset(); 286 287 // FIXME: We should be able to actively invalidate all the outstanding checkpoints 288 // by clearing m_checkpoints, but that causes fast/tokenizer/write-before-load.html 289 // to hit the ASSERT at the beginning of this function. 290 } 291 265 292 void TokenPreloadScanner::scan(const HTMLToken& token, Vector<OwnPtr<PreloadRequest> >& requests) 266 293 { -
trunk/Source/WebCore/html/parser/HTMLPreloadScanner.h
r143415 r143661 32 32 #include "HTMLToken.h" 33 33 #include "SegmentedString.h" 34 #include <wtf/Vector.h> 34 35 35 36 namespace WebCore { 37 38 typedef size_t TokenPreloadScannerCheckpoint; 36 39 37 40 class HTMLParserOptions; … … 51 54 52 55 void setPredictedBaseElementURL(const KURL& url) { m_predictedBaseElementURL = url; } 56 57 // A TokenPreloadScannerCheckpoint is valid until the next call to rewindTo, 58 // at which point all outstanding checkpoints are invalidated. 59 TokenPreloadScannerCheckpoint createCheckpoint(); 60 void rewindTo(TokenPreloadScannerCheckpoint); 53 61 54 62 bool isSafeToSendToAnotherThread() … … 86 94 void updatePredictedBaseURL(const Token&); 87 95 96 struct Checkpoint { 97 Checkpoint(const KURL& predictedBaseElementURL, bool inStyle 98 #if ENABLE(TEMPLATE_ELEMENT) 99 , size_t templateCount 100 #endif 101 ) 102 : predictedBaseElementURL(predictedBaseElementURL) 103 , inStyle(inStyle) 104 #if ENABLE(TEMPLATE_ELEMENT) 105 , templateCount(templateCount) 106 #endif 107 { 108 } 109 110 KURL predictedBaseElementURL; 111 bool inStyle; 112 #if ENABLE(TEMPLATE_ELEMENT) 113 size_t templateCount; 114 #endif 115 }; 116 88 117 CSSPreloadScanner m_cssScanner; 89 KURL m_documentURL;118 const KURL m_documentURL; 90 119 KURL m_predictedBaseElementURL; 91 120 bool m_inStyle; … … 94 123 size_t m_templateCount; 95 124 #endif 125 126 Vector<Checkpoint> m_checkpoints; 96 127 }; 97 128
Note: See TracChangeset
for help on using the changeset viewer.