| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 // Surprisingly, isScheduledForResume() may be set here as a result of | 566 // Surprisingly, isScheduledForResume() may be set here as a result of |
| 567 // processParsedChunkFromBackgroundParser running arbitrary javascript | 567 // processParsedChunkFromBackgroundParser running arbitrary javascript |
| 568 // which invokes nested event loops. (e.g. inspector breakpoints) | 568 // which invokes nested event loops. (e.g. inspector breakpoints) |
| 569 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) | 569 if (!isParsing() || isWaitingForScripts() || isScheduledForResume()) |
| 570 break; | 570 break; |
| 571 | 571 |
| 572 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) | 572 if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session
, m_speculations.first()->startingScript)) |
| 573 break; | 573 break; |
| 574 } | 574 } |
| 575 | 575 |
| 576 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); | 576 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endData", InspectorParseHtmlEvent::endData(lineNumber().zeroBasedInt() - 1)); |
| 577 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 577 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void HTMLDocumentParser::forcePlaintextForTextDocument() | 580 void HTMLDocumentParser::forcePlaintextForTextDocument() |
| 581 { | 581 { |
| 582 if (shouldUseThreading()) { | 582 if (shouldUseThreading()) { |
| 583 // This method is called before any data is appended, so we have to star
t | 583 // This method is called before any data is appended, so we have to star
t |
| 584 // the background parser ourselves. | 584 // the background parser ourselves. |
| 585 if (!m_haveBackgroundParser) | 585 if (!m_haveBackgroundParser) |
| 586 startBackgroundParser(); | 586 startBackgroundParser(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // adding paranoia if for speculative crash fix for crbug.com/465478 | 670 // adding paranoia if for speculative crash fix for crbug.com/465478 |
| 671 if (m_preloader) { | 671 if (m_preloader) { |
| 672 if (!m_preloadScanner) { | 672 if (!m_preloadScanner) { |
| 673 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, do
cument()->url(), createMediaValues(document()))); | 673 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, do
cument()->url(), createMediaValues(document()))); |
| 674 m_preloadScanner->appendToEnd(m_input.current()); | 674 m_preloadScanner->appendToEnd(m_input.current()); |
| 675 } | 675 } |
| 676 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); | 676 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL
()); |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", m_input.current().currentLine().zeroBasedInt()); | 680 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endData", InspectorParseHtmlEvent::endData(m_input.current().currentLine().ze
roBasedInt() - 1)); |
| 681 } | 681 } |
| 682 | 682 |
| 683 void HTMLDocumentParser::constructTreeFromHTMLToken() | 683 void HTMLDocumentParser::constructTreeFromHTMLToken() |
| 684 { | 684 { |
| 685 AtomicHTMLToken atomicToken(token()); | 685 AtomicHTMLToken atomicToken(token()); |
| 686 | 686 |
| 687 // We clear the m_token in case constructTreeFromAtomicToken | 687 // We clear the m_token in case constructTreeFromAtomicToken |
| 688 // synchronously re-enters the parser. We don't clear the token immedately | 688 // synchronously re-enters the parser. We don't clear the token immedately |
| 689 // for Character tokens because the AtomicHTMLToken avoids copying the | 689 // for Character tokens because the AtomicHTMLToken avoids copying the |
| 690 // characters by keeping a pointer to the underlying buffer in the | 690 // characters by keeping a pointer to the underlying buffer in the |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1109 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1110 { | 1110 { |
| 1111 ASSERT(decoder); | 1111 ASSERT(decoder); |
| 1112 DecodedDataDocumentParser::setDecoder(decoder); | 1112 DecodedDataDocumentParser::setDecoder(decoder); |
| 1113 | 1113 |
| 1114 if (m_haveBackgroundParser) | 1114 if (m_haveBackgroundParser) |
| 1115 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); | 1115 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); |
| 1116 } | 1116 } |
| 1117 | 1117 |
| 1118 } | 1118 } |
| OLD | NEW |