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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 m_preloader->takeAndPreload(chunk->preloads); | 346 m_preloader->takeAndPreload(chunk->preloads); |
347 m_speculations.append(chunk); | 347 m_speculations.append(chunk); |
348 return; | 348 return; |
349 } | 349 } |
350 | 350 |
351 // processParsedChunkFromBackgroundParser can cause this parser to be detach ed from the Document, | 351 // processParsedChunkFromBackgroundParser can cause this parser to be detach ed from the Document, |
352 // but we need to ensure it isn't deleted yet. | 352 // but we need to ensure it isn't deleted yet. |
353 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); | 353 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); |
354 | 354 |
355 ASSERT(m_speculations.isEmpty()); | 355 ASSERT(m_speculations.isEmpty()); |
356 chunk->preloads.clear(); // We don't need to preload because we're going to parse immediately. | 356 // This preload call is redundant, but we plan to change treebuilding to |
357 // always operate asynchronously after a message-loop round trip after deliv ery | |
358 // to the main thread, thus we'll always use the preloader. Before making | |
359 // that change, we're sending all chunks through the preloader right | |
360 // before treebuilding (changes 15 layout tests). | |
361 // https://codereview.chromium.org/258013009/ | |
362 m_preloader->takeAndPreload(chunk->preloads); | |
357 m_speculations.append(chunk); | 363 m_speculations.append(chunk); |
tonyg
2014/05/29 23:27:25
These two lines are now identical to the other cod
| |
358 pumpPendingSpeculations(); | 364 pumpPendingSpeculations(); |
359 } | 365 } |
360 | 366 |
361 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume ntEncodingData& data) | 367 void HTMLDocumentParser::didReceiveEncodingDataFromBackgroundParser(const Docume ntEncodingData& data) |
362 { | 368 { |
363 document()->setEncodingData(data); | 369 document()->setEncodingData(data); |
364 } | 370 } |
365 | 371 |
366 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) | 372 void HTMLDocumentParser::validateSpeculations(PassOwnPtr<ParsedChunk> chunk) |
367 { | 373 { |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1068 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1074 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1069 { | 1075 { |
1070 ASSERT(decoder); | 1076 ASSERT(decoder); |
1071 DecodedDataDocumentParser::setDecoder(decoder); | 1077 DecodedDataDocumentParser::setDecoder(decoder); |
1072 | 1078 |
1073 if (m_haveBackgroundParser) | 1079 if (m_haveBackgroundParser) |
1074 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); | 1080 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); |
1075 } | 1081 } |
1076 | 1082 |
1077 } | 1083 } |
OLD | NEW |