| 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 26 matching lines...) Expand all Loading... |
| 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 "platform/scheduler/Scheduler.h" |
| 47 #include "public/platform/Platform.h" |
| 48 #include "public/platform/WebScheduler.h" |
| 47 #include "public/platform/WebThreadedDataReceiver.h" | 49 #include "public/platform/WebThreadedDataReceiver.h" |
| 48 #include "wtf/Functional.h" | 50 #include "wtf/Functional.h" |
| 49 | 51 |
| 50 namespace blink { | 52 namespace blink { |
| 51 | 53 |
| 52 using namespace HTMLNames; | 54 using namespace HTMLNames; |
| 53 | 55 |
| 54 // This is a direct transcription of step 4 from: | 56 // This is a direct transcription of step 4 from: |
| 55 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag
ment-case | 57 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#frag
ment-case |
| 56 static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem
ent, bool reportErrors, const HTMLParserOptions& options) | 58 static HTMLTokenizer::State tokenizerStateForContextElement(Element* contextElem
ent, bool reportErrors, const HTMLParserOptions& options) |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 511 |
| 510 double startTime = currentTime(); | 512 double startTime = currentTime(); |
| 511 | 513 |
| 512 while (!m_speculations.isEmpty()) { | 514 while (!m_speculations.isEmpty()) { |
| 513 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); | 515 processParsedChunkFromBackgroundParser(m_speculations.takeFirst()); |
| 514 | 516 |
| 515 // Always check isStopped first as m_document may be null. | 517 // Always check isStopped first as m_document may be null. |
| 516 if (isStopped() || isWaitingForScripts()) | 518 if (isStopped() || isWaitingForScripts()) |
| 517 break; | 519 break; |
| 518 | 520 |
| 519 if ((Scheduler::shared()->shouldYieldForHighPriorityWork() || currentTim
e() - startTime > parserTimeLimit) && !m_speculations.isEmpty()) { | 521 if (((Platform::current()->scheduler() && Platform::current()->scheduler
()->shouldYieldForHighPriorityWork()) || currentTime() - startTime > parserTimeL
imit) && !m_speculations.isEmpty()) { |
| 520 m_parserScheduler->scheduleForResume(); | 522 m_parserScheduler->scheduleForResume(); |
| 521 break; | 523 break; |
| 522 } | 524 } |
| 523 } | 525 } |
| 524 | 526 |
| 525 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); | 527 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML"
, "endLine", lineNumber().zeroBasedInt()); |
| 526 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 528 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 527 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); | 529 InspectorInstrumentation::didWriteHTML(cookie, lineNumber().zeroBasedInt()); |
| 528 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 530 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); |
| 529 } | 531 } |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1049 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
| 1048 { | 1050 { |
| 1049 ASSERT(decoder); | 1051 ASSERT(decoder); |
| 1050 DecodedDataDocumentParser::setDecoder(decoder); | 1052 DecodedDataDocumentParser::setDecoder(decoder); |
| 1051 | 1053 |
| 1052 if (m_haveBackgroundParser) | 1054 if (m_haveBackgroundParser) |
| 1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1055 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 } | 1058 } |
| OLD | NEW |