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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ASSERT(!m_haveBackgroundParser); | 154 ASSERT(!m_haveBackgroundParser); |
155 // FIXME: We should be able to ASSERT(m_speculations.isEmpty()), | 155 // FIXME: We should be able to ASSERT(m_speculations.isEmpty()), |
156 // but there are cases where that's not true currently. For example, | 156 // but there are cases where that's not true currently. For example, |
157 // we we're told to stop parsing before we've consumed all the input. | 157 // we we're told to stop parsing before we've consumed all the input. |
158 #endif | 158 #endif |
159 } | 159 } |
160 | 160 |
161 void HTMLDocumentParser::trace(Visitor* visitor) | 161 void HTMLDocumentParser::trace(Visitor* visitor) |
162 { | 162 { |
163 visitor->trace(m_treeBuilder); | 163 visitor->trace(m_treeBuilder); |
| 164 visitor->trace(m_scriptRunner); |
164 ScriptableDocumentParser::trace(visitor); | 165 ScriptableDocumentParser::trace(visitor); |
165 } | 166 } |
166 | 167 |
167 void HTMLDocumentParser::pinToMainThread() | 168 void HTMLDocumentParser::pinToMainThread() |
168 { | 169 { |
169 ASSERT(!m_haveBackgroundParser); | 170 ASSERT(!m_haveBackgroundParser); |
170 ASSERT(!m_isPinnedToMainThread); | 171 ASSERT(!m_isPinnedToMainThread); |
171 m_isPinnedToMainThread = true; | 172 m_isPinnedToMainThread = true; |
172 if (!m_tokenizer) { | 173 if (!m_tokenizer) { |
173 ASSERT(!m_token); | 174 ASSERT(!m_token); |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); | 948 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); |
948 pumpPendingSpeculations(); | 949 pumpPendingSpeculations(); |
949 return; | 950 return; |
950 } | 951 } |
951 | 952 |
952 m_insertionPreloadScanner.clear(); | 953 m_insertionPreloadScanner.clear(); |
953 pumpTokenizerIfPossible(AllowYield); | 954 pumpTokenizerIfPossible(AllowYield); |
954 endIfDelayed(); | 955 endIfDelayed(); |
955 } | 956 } |
956 | 957 |
957 void HTMLDocumentParser::watchForLoad(Resource* resource) | |
958 { | |
959 ASSERT(!resource->isLoaded()); | |
960 // addClient would call notifyFinished if the load were complete. | |
961 // Callers do not expect to be re-entered from this call, so they should | |
962 // not an already-loaded Resource. | |
963 resource->addClient(this); | |
964 } | |
965 | |
966 void HTMLDocumentParser::stopWatchingForLoad(Resource* resource) | |
967 { | |
968 resource->removeClient(this); | |
969 } | |
970 | |
971 void HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan() | 958 void HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan() |
972 { | 959 { |
973 ASSERT(m_preloadScanner); | 960 ASSERT(m_preloadScanner); |
974 m_preloadScanner->appendToEnd(m_input.current()); | 961 m_preloadScanner->appendToEnd(m_input.current()); |
975 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); | 962 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); |
976 } | 963 } |
977 | 964 |
978 void HTMLDocumentParser::notifyFinished(Resource* cachedResource) | 965 void HTMLDocumentParser::notifyScriptLoaded(Resource* cachedResource) |
979 { | 966 { |
980 // pumpTokenizer can cause this parser to be detached from the Document, | 967 // pumpTokenizer can cause this parser to be detached from the Document, |
981 // but we need to ensure it isn't deleted yet. | 968 // but we need to ensure it isn't deleted yet. |
982 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); | 969 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); |
983 | 970 |
984 ASSERT(m_scriptRunner); | 971 ASSERT(m_scriptRunner); |
985 ASSERT(!isExecutingScript()); | 972 ASSERT(!isExecutingScript()); |
986 if (isStopping()) { | 973 if (isStopping()) { |
987 attemptToRunDeferredScriptsAndEnd(); | 974 attemptToRunDeferredScriptsAndEnd(); |
988 return; | 975 return; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1055 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1069 { | 1056 { |
1070 ASSERT(decoder); | 1057 ASSERT(decoder); |
1071 DecodedDataDocumentParser::setDecoder(decoder); | 1058 DecodedDataDocumentParser::setDecoder(decoder); |
1072 | 1059 |
1073 if (m_haveBackgroundParser) | 1060 if (m_haveBackgroundParser) |
1074 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1061 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1075 } | 1062 } |
1076 | 1063 |
1077 } | 1064 } |
OLD | NEW |