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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 return m_treeBuilder->isParsingFragment(); | 252 return m_treeBuilder->isParsingFragment(); |
253 } | 253 } |
254 | 254 |
255 bool HTMLDocumentParser::processingData() const | 255 bool HTMLDocumentParser::processingData() const |
256 { | 256 { |
257 return isScheduledForResume() || inPumpSession() || m_haveBackgroundParser; | 257 return isScheduledForResume() || inPumpSession() || m_haveBackgroundParser; |
258 } | 258 } |
259 | 259 |
260 void HTMLDocumentParser::pumpTokenizerIfPossible() | 260 void HTMLDocumentParser::pumpTokenizerIfPossible() |
261 { | 261 { |
262 if (isStopped()) | 262 if (isStopped() || isWaitingForScripts()) |
263 return; | 263 return; |
264 if (isWaitingForScripts()) | |
265 return; | |
266 | |
267 // Once a resume is scheduled, HTMLParserScheduler controls when we next pum
p. | |
268 if (isScheduledForResume()) { | |
269 return; | |
270 } | |
271 | 264 |
272 pumpTokenizer(); | 265 pumpTokenizer(); |
273 } | 266 } |
274 | 267 |
275 bool HTMLDocumentParser::isScheduledForResume() const | 268 bool HTMLDocumentParser::isScheduledForResume() const |
276 { | 269 { |
277 return m_parserScheduler && m_parserScheduler->isScheduledForResume(); | 270 return m_parserScheduler && m_parserScheduler->isScheduledForResume(); |
278 } | 271 } |
279 | 272 |
280 // Used by HTMLParserScheduler | 273 // Used by HTMLParserScheduler |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 { | 550 { |
558 ASSERT(document); | 551 ASSERT(document); |
559 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(*document); | 552 RefPtr<MediaValues> mediaValues = MediaValuesCached::create(*document); |
560 ASSERT(mediaValues->isSafeToSendToAnotherThread()); | 553 ASSERT(mediaValues->isSafeToSendToAnotherThread()); |
561 return mediaValues; | 554 return mediaValues; |
562 } | 555 } |
563 | 556 |
564 void HTMLDocumentParser::pumpTokenizer() | 557 void HTMLDocumentParser::pumpTokenizer() |
565 { | 558 { |
566 ASSERT(!isStopped()); | 559 ASSERT(!isStopped()); |
567 ASSERT(!isScheduledForResume()); | |
568 #if !ENABLE(OILPAN) | 560 #if !ENABLE(OILPAN) |
569 // ASSERT that this object is both attached to the Document and protected. | 561 // ASSERT that this object is both attached to the Document and protected. |
570 ASSERT(refCount() >= 2); | 562 ASSERT(refCount() >= 2); |
571 #endif | 563 #endif |
572 ASSERT(m_tokenizer); | 564 ASSERT(m_tokenizer); |
573 ASSERT(m_token); | 565 ASSERT(m_token); |
574 | 566 |
575 PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession()); | 567 PumpSession session(m_pumpSessionNestingLevel, contextForParsingSession()); |
576 | 568 |
577 // We tell the InspectorInstrumentation about every pump, even if we | 569 // We tell the InspectorInstrumentation about every pump, even if we |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1045 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1054 { | 1046 { |
1055 ASSERT(decoder); | 1047 ASSERT(decoder); |
1056 DecodedDataDocumentParser::setDecoder(decoder); | 1048 DecodedDataDocumentParser::setDecoder(decoder); |
1057 | 1049 |
1058 if (m_haveBackgroundParser) | 1050 if (m_haveBackgroundParser) |
1059 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1051 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1060 } | 1052 } |
1061 | 1053 |
1062 } | 1054 } |
OLD | NEW |