| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 | 524 |
| 525 // FIXME: Pass in current input length. | 525 // FIXME: Pass in current input length. |
| 526 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM
L", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zer
oBasedInt())); | 526 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM
L", "beginData", InspectorParseHtmlEvent::beginData(document(), lineNumber().zer
oBasedInt())); |
| 527 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 527 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 528 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteH
TML(document(), lineNumber().zeroBasedInt()); | 528 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteH
TML(document(), lineNumber().zeroBasedInt()); |
| 529 | 529 |
| 530 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel, conte
xtForParsingSession()); | 530 SpeculationsPumpSession session(m_pumpSpeculationsSessionNestingLevel, conte
xtForParsingSession()); |
| 531 while (!m_speculations.isEmpty()) { | 531 while (!m_speculations.isEmpty()) { |
| 532 ASSERT(!isScheduledForResume()); | 532 ASSERT(!isScheduledForResume()); |
| 533 |
| 534 if (m_parserScheduler->yieldIfNeeded(session, m_speculations.first()->st
artingScript)) |
| 535 break; |
| 536 |
| 533 size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_spec
ulations.takeFirst()); | 537 size_t elementTokenCount = processParsedChunkFromBackgroundParser(m_spec
ulations.takeFirst()); |
| 534 session.addedElementTokens(elementTokenCount); | 538 session.addedElementTokens(elementTokenCount); |
| 535 | 539 |
| 536 // Always check isParsing first as m_document may be null. | 540 // Always check isParsing first as m_document may be null. |
| 537 // Surprisingly, isScheduledForResume() may be set here as a result of | 541 // Surprisingly, isScheduledForResume() may be set here as a result of |
| 538 // processParsedChunkFromBackgroundParser running arbitrary javascript | 542 // processParsedChunkFromBackgroundParser running arbitrary javascript |
| 539 // which invokes nested event loops. (e.g. inspector breakpoints) | 543 // which invokes nested event loops. (e.g. inspector breakpoints) |
| 540 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) | 544 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) |
| 541 break; | 545 break; |
| 542 | |
| 543 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) | |
| 544 break; | |
| 545 } | 546 } |
| 546 | 547 |
| 547 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); | 548 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); |
| 548 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 549 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 549 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); | 550 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); |
| 550 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 551 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); |
| 551 } | 552 } |
| 552 | 553 |
| 553 void HTMLDocumentParser::forcePlaintextForTextDocument() | 554 void HTMLDocumentParser::forcePlaintextForTextDocument() |
| 554 { | 555 { |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1080 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1080 { | 1081 { |
| 1081 ASSERT(decoder); | 1082 ASSERT(decoder); |
| 1082 DecodedDataDocumentParser::setDecoder(decoder); | 1083 DecodedDataDocumentParser::setDecoder(decoder); |
| 1083 | 1084 |
| 1084 if (m_haveBackgroundParser) | 1085 if (m_haveBackgroundParser) |
| 1085 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1086 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
| 1086 } | 1087 } |
| 1087 | 1088 |
| 1088 } | 1089 } |
| OLD | NEW |