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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool reportErrors = false; // For now document fragment parsing never report
s errors. | 105 bool reportErrors = false; // For now document fragment parsing never report
s errors. |
106 m_tokenizer->setState(tokenizerStateForContextElement(contextElement, report
Errors, m_options)); | 106 m_tokenizer->setState(tokenizerStateForContextElement(contextElement, report
Errors, m_options)); |
107 m_xssAuditor.initForFragment(); | 107 m_xssAuditor.initForFragment(); |
108 } | 108 } |
109 | 109 |
110 HTMLDocumentParser::HTMLDocumentParser(Document& document, ParserContentPolicy c
ontentPolicy, ParserSynchronizationPolicy syncPolicy) | 110 HTMLDocumentParser::HTMLDocumentParser(Document& document, ParserContentPolicy c
ontentPolicy, ParserSynchronizationPolicy syncPolicy) |
111 : ScriptableDocumentParser(document, contentPolicy) | 111 : ScriptableDocumentParser(document, contentPolicy) |
112 , m_options(&document) | 112 , m_options(&document) |
113 , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken)
: nullptr) | 113 , m_token(syncPolicy == ForceSynchronousParsing ? wrapUnique(new HTMLToken)
: nullptr) |
114 , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(
m_options) : nullptr) | 114 , m_tokenizer(syncPolicy == ForceSynchronousParsing ? HTMLTokenizer::create(
m_options) : nullptr) |
115 , m_loadingTaskRunner(wrapUnique(TaskRunnerHelper::getLoadingTaskRunner(&doc
ument)->clone())) | 115 , m_loadingTaskRunner(TaskRunnerHelper::getLoadingTaskRunner(&document)->clo
ne()) |
116 , m_parserScheduler(syncPolicy == AllowAsynchronousParsing ? HTMLParserSched
uler::create(this, m_loadingTaskRunner.get()) : nullptr) | 116 , m_parserScheduler(syncPolicy == AllowAsynchronousParsing ? HTMLParserSched
uler::create(this, m_loadingTaskRunner.get()) : nullptr) |
117 , m_xssAuditorDelegate(&document) | 117 , m_xssAuditorDelegate(&document) |
118 , m_weakFactory(this) | 118 , m_weakFactory(this) |
119 , m_preloader(HTMLResourcePreloader::create(document)) | 119 , m_preloader(HTMLResourcePreloader::create(document)) |
120 , m_parsedChunkQueue(ParsedChunkQueue::create()) | 120 , m_parsedChunkQueue(ParsedChunkQueue::create()) |
121 , m_evaluator(DocumentWriteEvaluator::create(document)) | 121 , m_evaluator(DocumentWriteEvaluator::create(document)) |
122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) | 122 , m_shouldUseThreading(syncPolicy == AllowAsynchronousParsing) |
123 , m_endWasDelayed(false) | 123 , m_endWasDelayed(false) |
124 , m_haveBackgroundParser(false) | 124 , m_haveBackgroundParser(false) |
125 , m_tasksWereSuspended(false) | 125 , m_tasksWereSuspended(false) |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 740 |
741 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); | 741 ASSERT(config->xssAuditor->isSafeToSendToAnotherThread()); |
742 postTaskToLookaheadParser( | 742 postTaskToLookaheadParser( |
743 Synchronous, | 743 Synchronous, |
744 &BackgroundHTMLParser::start, | 744 &BackgroundHTMLParser::start, |
745 reference.release(), | 745 reference.release(), |
746 passed(std::move(config)), | 746 passed(std::move(config)), |
747 document()->url(), | 747 document()->url(), |
748 passed(CachedDocumentParameters::create(document())), | 748 passed(CachedDocumentParameters::create(document())), |
749 MediaValuesCached::MediaValuesCachedData(*document()), | 749 MediaValuesCached::MediaValuesCachedData(*document()), |
750 passed(wrapUnique(m_loadingTaskRunner->clone()))); | 750 passed(m_loadingTaskRunner->clone())); |
751 } | 751 } |
752 | 752 |
753 void HTMLDocumentParser::stopBackgroundParser() | 753 void HTMLDocumentParser::stopBackgroundParser() |
754 { | 754 { |
755 ASSERT(shouldUseThreading()); | 755 ASSERT(shouldUseThreading()); |
756 ASSERT(m_haveBackgroundParser); | 756 ASSERT(m_haveBackgroundParser); |
757 m_haveBackgroundParser = false; | 757 m_haveBackgroundParser = false; |
758 | 758 |
759 // Make this sync, as lsan triggers on some unittests if the task runner is | 759 // Make this sync, as lsan triggers on some unittests if the task runner is |
760 // used. Note that these lifetimes will be much more concrete if | 760 // used. Note that these lifetimes will be much more concrete if |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); | 1150 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); |
1151 return; | 1151 return; |
1152 case Asynchronous: | 1152 case Asynchronous: |
1153 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); | 1153 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std::
forward<Ps>(parameters)...)); |
1154 return; | 1154 return; |
1155 } | 1155 } |
1156 NOTREACHED(); | 1156 NOTREACHED(); |
1157 } | 1157 } |
1158 | 1158 |
1159 } // namespace blink | 1159 } // namespace blink |
OLD | NEW |