| 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 28 matching lines...) Expand all Loading... |
| 39 #include "core/html/parser/HTMLParserThread.h" | 39 #include "core/html/parser/HTMLParserThread.h" |
| 40 #include "core/html/parser/HTMLTreeBuilder.h" | 40 #include "core/html/parser/HTMLTreeBuilder.h" |
| 41 #include "core/inspector/InspectorTraceEvents.h" | 41 #include "core/inspector/InspectorTraceEvents.h" |
| 42 #include "platform/SharedBuffer.h" | 42 #include "platform/SharedBuffer.h" |
| 43 #include "platform/TraceEvent.h" | 43 #include "platform/TraceEvent.h" |
| 44 #include "wtf/Functional.h" | 44 #include "wtf/Functional.h" |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) | 48 HTMLDocumentParser::HTMLDocumentParser(HTMLDocument& document, bool reportErrors
) |
| 49 : DecodedDataDocumentParser(document) | 49 : DocumentParser(document) |
| 50 , m_options(&document) | 50 , m_options(&document) |
| 51 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, reportErrors, m_opt
ions)) | 51 , m_treeBuilder(HTMLTreeBuilder::create(this, &document, reportErrors, m_opt
ions)) |
| 52 , m_parserScheduler(HTMLParserScheduler::create(this)) | 52 , m_parserScheduler(HTMLParserScheduler::create(this)) |
| 53 , m_weakFactory(this) | 53 , m_weakFactory(this) |
| 54 , m_isFragment(false) | 54 , m_isFragment(false) |
| 55 , m_endWasDelayed(false) | 55 , m_endWasDelayed(false) |
| 56 , m_haveBackgroundParser(false) | 56 , m_haveBackgroundParser(false) |
| 57 , m_pumpSessionNestingLevel(0) | 57 , m_pumpSessionNestingLevel(0) |
| 58 { | 58 { |
| 59 ASSERT(shouldUseThreading()); | 59 ASSERT(shouldUseThreading()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 HTMLDocumentParser::~HTMLDocumentParser() | 62 HTMLDocumentParser::~HTMLDocumentParser() |
| 63 { | 63 { |
| 64 #if ENABLE(OILPAN) | 64 #if ENABLE(OILPAN) |
| 65 if (m_haveBackgroundParser) | 65 if (m_haveBackgroundParser) |
| 66 stopBackgroundParser(); | 66 stopBackgroundParser(); |
| 67 // In Oilpan, HTMLDocumentParser can die together with Document, and | 67 // In Oilpan, HTMLDocumentParser can die together with Document, and |
| 68 // detach() is not called in this case. | 68 // detach() is not called in this case. |
| 69 #else | 69 #else |
| 70 ASSERT(!m_parserScheduler); | 70 ASSERT(!m_parserScheduler); |
| 71 ASSERT(!m_pumpSessionNestingLevel); | 71 ASSERT(!m_pumpSessionNestingLevel); |
| 72 ASSERT(!m_haveBackgroundParser); | 72 ASSERT(!m_haveBackgroundParser); |
| 73 // FIXME: We should be able to ASSERT(m_speculations.isEmpty()), | 73 // FIXME: We should be able to ASSERT(m_speculations.isEmpty()), |
| 74 // but there are cases where that's not true currently. For example, | 74 // but there are cases where that's not true currently. For example, |
| 75 // we we're told to stop parsing before we've consumed all the input. | 75 // we we're told to stop parsing before we've consumed all the input. |
| 76 #endif | 76 #endif |
| 77 } | 77 } |
| 78 | 78 |
| 79 void HTMLDocumentParser::trace(Visitor* visitor) | |
| 80 { | |
| 81 visitor->trace(m_treeBuilder); | |
| 82 DecodedDataDocumentParser::trace(visitor); | |
| 83 } | |
| 84 | |
| 85 void HTMLDocumentParser::parse(mojo::ScopedDataPipeConsumerHandle source) | 79 void HTMLDocumentParser::parse(mojo::ScopedDataPipeConsumerHandle source) |
| 86 { | 80 { |
| 87 ASSERT(!isStopped()); | 81 ASSERT(!isStopped()); |
| 88 ASSERT(shouldUseThreading()); | 82 ASSERT(shouldUseThreading()); |
| 89 ASSERT(!m_haveBackgroundParser); | 83 ASSERT(!m_haveBackgroundParser); |
| 90 m_haveBackgroundParser = true; | 84 m_haveBackgroundParser = true; |
| 91 | 85 |
| 92 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); | 86 OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new Background
HTMLParser::Configuration); |
| 93 config->options = m_options; | 87 config->options = m_options; |
| 94 config->source = source.Pass(); | 88 config->source = source.Pass(); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 { | 433 { |
| 440 if (!m_scriptRunner.hasPendingScripts()) | 434 if (!m_scriptRunner.hasPendingScripts()) |
| 441 return; | 435 return; |
| 442 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); | 436 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); |
| 443 m_scriptRunner.executePendingScripts(); | 437 m_scriptRunner.executePendingScripts(); |
| 444 if (!isWaitingForScripts()) | 438 if (!isWaitingForScripts()) |
| 445 resumeParsingAfterScriptExecution(); | 439 resumeParsingAfterScriptExecution(); |
| 446 } | 440 } |
| 447 | 441 |
| 448 } | 442 } |
| OLD | NEW |