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 25 matching lines...) Expand all Loading... |
36 #include "core/html/parser/BackgroundHTMLParser.h" | 36 #include "core/html/parser/BackgroundHTMLParser.h" |
37 #include "core/html/parser/HTMLParserScheduler.h" | 37 #include "core/html/parser/HTMLParserScheduler.h" |
38 #include "core/html/parser/HTMLParserThread.h" | 38 #include "core/html/parser/HTMLParserThread.h" |
39 #include "core/html/parser/HTMLScriptRunner.h" | 39 #include "core/html/parser/HTMLScriptRunner.h" |
40 #include "core/html/parser/HTMLTreeBuilder.h" | 40 #include "core/html/parser/HTMLTreeBuilder.h" |
41 #include "core/inspector/InspectorInstrumentation.h" | 41 #include "core/inspector/InspectorInstrumentation.h" |
42 #include "core/inspector/InspectorTraceEvents.h" | 42 #include "core/inspector/InspectorTraceEvents.h" |
43 #include "core/loader/DocumentLoader.h" | 43 #include "core/loader/DocumentLoader.h" |
44 #include "platform/SharedBuffer.h" | 44 #include "platform/SharedBuffer.h" |
45 #include "platform/TraceEvent.h" | 45 #include "platform/TraceEvent.h" |
| 46 #include "platform/scheduler/Scheduler.h" |
46 #include "public/platform/WebThreadedDataReceiver.h" | 47 #include "public/platform/WebThreadedDataReceiver.h" |
47 #include "wtf/Functional.h" | 48 #include "wtf/Functional.h" |
48 | 49 |
49 namespace blink { | 50 namespace blink { |
50 | 51 |
51 using namespace HTMLNames; | 52 using namespace HTMLNames; |
52 | 53 |
53 // This is a direct transcription of step 4 from: | 54 // This is a direct transcription of step 4 from: |
54 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag
ment-case | 55 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag
ment-case |
55 static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem
ent, bool reportErrors, const HTMLParserOptions& options) | 56 static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem
ent, bool reportErrors, const HTMLParserOptions& options) |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 | 530 |
530 double startTime = currentTime(); | 531 double startTime = currentTime(); |
531 | 532 |
532 while (!m_speculations.isEmpty()) { | 533 while (!m_speculations.isEmpty()) { |
533 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); | 534 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); |
534 | 535 |
535 // Always check isStopped first as m_document may be null. | 536 // Always check isStopped first as m_document may be null. |
536 if (isStopped() || isWaitingForScripts()) | 537 if (isStopped() || isWaitingForScripts()) |
537 break; | 538 break; |
538 | 539 |
539 if (currentTime() - startTime > parserTimeLimit && !m_speculations.isEmp
ty()) { | 540 if ((Scheduler::shared()->shouldYieldForHighPriorityWork() || currentTim
e() - startTime > parserTimeLimit) && !m_speculations.isEmpty()) { |
540 m_parserScheduler->scheduleForResume(); | 541 m_parserScheduler->scheduleForResume(); |
541 break; | 542 break; |
542 } | 543 } |
543 } | 544 } |
544 | 545 |
545 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); | 546 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); |
546 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 547 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
547 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); | 548 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); |
548 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 549 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); |
549 } | 550 } |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1075 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1075 { | 1076 { |
1076 ASSERT(decoder); | 1077 ASSERT(decoder); |
1077 DecodedDataDocumentParser::setDecoder(decoder); | 1078 DecodedDataDocumentParser::setDecoder(decoder); |
1078 | 1079 |
1079 if (m_haveBackgroundParser) | 1080 if (m_haveBackgroundParser) |
1080 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1081 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1081 } | 1082 } |
1082 | 1083 |
1083 } | 1084 } |
OLD | NEW |