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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // This preload call is redundant, but we plan to change treebuilding to | 358 chunk->preloads.clear(); // We don't need to preload because we're going to
parse immediately. |
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); | |
365 m_speculations.append(chunk); | 359 m_speculations.append(chunk); |
366 pumpPendingSpeculations(); | 360 pumpPendingSpeculations(); |
367 } | 361 } |
368 | 362 |
369 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) | 363 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume
ntEncodingData& data) |
370 { | 364 { |
371 document()->setEncodingData(data); | 365 document()->setEncodingData(data); |
372 } | 366 } |
373 | 367 |
374 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) | 368 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1056 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1063 { | 1057 { |
1064 ASSERT(decoder); | 1058 ASSERT(decoder); |
1065 DecodedDataDocumentParser::setDecoder(decoder); | 1059 DecodedDataDocumentParser::setDecoder(decoder); |
1066 | 1060 |
1067 if (m_haveBackgroundParser) | 1061 if (m_haveBackgroundParser) |
1068 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1062 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1069 } | 1063 } |
1070 | 1064 |
1071 } | 1065 } |
OLD | NEW |