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

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 302063002: Always preload all tokens before parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix another flaky tests Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 m_preloader->takeAndPreload(chunk->preloads); 348 m_preloader->takeAndPreload(chunk->preloads);
349 m_speculations.append(chunk); 349 m_speculations.append(chunk);
350 return; 350 return;
351 } 351 }
352 352
353 // processParsedChunkFromBackgroundParser can cause this parser to be detach ed from the Document, 353 // processParsedChunkFromBackgroundParser can cause this parser to be detach ed from the Document,
354 // but we need to ensure it isn't deleted yet. 354 // but we need to ensure it isn't deleted yet.
355 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); 355 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this);
356 356
357 ASSERT(m_speculations.isEmpty()); 357 ASSERT(m_speculations.isEmpty());
358 chunk->preloads.clear(); // We don't need to preload because we're going to parse immediately. 358 // This preload call is redundant, but we plan to change treebuilding to
359 // always operate asynchronously after a message-loop round trip after deliv ery
360 // to the main thread, thus we'll always use the preloader. Before making
361 // that change, we're sending all chunks through the preloader right
362 // before treebuilding (changes 15 layout tests).
363 // https://codereview.chromium.org/258013009/
364 m_preloader->takeAndPreload(chunk->preloads);
359 m_speculations.append(chunk); 365 m_speculations.append(chunk);
360 pumpPendingSpeculations(); 366 pumpPendingSpeculations();
361 } 367 }
362 368
363 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume ntEncodingData& data) 369 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume ntEncodingData& data)
364 { 370 {
365 document()->setEncodingData(data); 371 document()->setEncodingData(data);
366 } 372 }
367 373
368 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) 374 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk)
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1062 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1057 { 1063 {
1058 ASSERT(decoder); 1064 ASSERT(decoder);
1059 DecodedDataDocumentParser::setDecoder(decoder); 1065 DecodedDataDocumentParser::setDecoder(decoder);
1060 1066
1061 if (m_haveBackgroundParser) 1067 if (m_haveBackgroundParser)
1062 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1068 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1063 } 1069 }
1064 1070
1065 } 1071 }
OLDNEW
« no previous file with comments | « Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698