OLD | NEW |
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 m_preloader->takeAndPreload(chunk->preloads); | 351 m_preloader->takeAndPreload(chunk->preloads); |
352 m_speculations.append(chunk); | 352 m_speculations.append(chunk); |
353 return; | 353 return; |
354 } | 354 } |
355 | 355 |
356 // processParsedChunkFromBackgroundParser can cause this parser to be detach
ed from the Document, | 356 // processParsedChunkFromBackgroundParser can cause this parser to be detach
ed from the Document, |
357 // but we need to ensure it isn't deleted yet. | 357 // but we need to ensure it isn't deleted yet. |
358 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); | 358 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); |
359 | 359 |
360 ASSERT(m_speculations.isEmpty()); | 360 ASSERT(m_speculations.isEmpty()); |
361 // This preload call is redundant, but we plan to change treebuilding to | 361 chunk->preloads.clear(); // We don't need to preload because we're going to
parse immediately. |
362 // always operate asynchronously after a message-loop round trip after deliv
ery | |
363 // to the main thread, thus we'll always use the preloader. Before making | |
364 // that change, we're sending all chunks through the preloader right | |
365 // before treebuilding (changes 15 layout tests). | |
366 // https://codereview.chromium.org/258013009/ | |
367 m_preloader->takeAndPreload(chunk->preloads); | |
368 m_speculations.append(chunk); | 362 m_speculations.append(chunk); |
369 pumpPendingSpeculations(); | 363 pumpPendingSpeculations(); |
370 } | 364 } |
371 | 365 |
372 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) | 366 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) |
373 { | 367 { |
374 document()->setEncodingData(data); | 368 document()->setEncodingData(data); |
375 } | 369 } |
376 | 370 |
377 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) | 371 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1059 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1066 { | 1060 { |
1067 ASSERT(decoder); | 1061 ASSERT(decoder); |
1068 DecodedDataDocumentParser::setDecoder(decoder); | 1062 DecodedDataDocumentParser::setDecoder(decoder); |
1069 | 1063 |
1070 if (m_haveBackgroundParser) | 1064 if (m_haveBackgroundParser) |
1071 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1065 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1072 } | 1066 } |
1073 | 1067 |
1074 } | 1068 } |
OLD | NEW |