Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/BackgroundHTMLParser.cpp

Issue 1772853002: Block the HTML parser on external stylesheets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified parser blocking logic Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { 253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) {
254 sendTokensToMainThread(); 254 sendTokensToMainThread();
255 m_startingScript = true; 255 m_startingScript = true;
256 } 256 }
257 257
258 m_pendingTokens->append(token); 258 m_pendingTokens->append(token);
259 } 259 }
260 260
261 m_token->clear(); 261 m_token->clear();
262 262
263 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd || m_pendingTo kens->size() >= m_pendingTokenLimit) { 263 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd
264 || simulatedToken == HTMLTreeBuilderSimulator::StyleEnd
265 || simulatedToken == HTMLTreeBuilderSimulator::LinkToken
266 || m_pendingTokens->size() >= m_pendingTokenLimit) {
264 sendTokensToMainThread(); 267 sendTokensToMainThread();
265 // If we're far ahead of the main thread, yield for a bit to avoid c onsuming too much memory. 268 // If we're far ahead of the main thread, yield for a bit to avoid c onsuming too much memory.
266 if (m_input.totalCheckpointTokenCount() > m_outstandingTokenLimit) 269 if (m_input.totalCheckpointTokenCount() > m_outstandingTokenLimit)
267 break; 270 break;
268 } 271 }
269 } 272 }
270 } 273 }
271 274
272 void BackgroundHTMLParser::sendTokensToMainThread() 275 void BackgroundHTMLParser::sendTokensToMainThread()
273 { 276 {
(...skipping 21 matching lines...) Expand all
295 if (isEmpty) { 298 if (isEmpty) {
296 m_loadingTaskRunner->postTask( 299 m_loadingTaskRunner->postTask(
297 BLINK_FROM_HERE, 300 BLINK_FROM_HERE,
298 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow CrossThreadAccess(m_parser))); 301 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow CrossThreadAccess(m_parser)));
299 } 302 }
300 303
301 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); 304 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream);
302 } 305 }
303 306
304 } // namespace blink 307 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698