Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 298863010: Oilpan: have PendingScripts trace their script elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Trace HTMLScriptRunnerHost from HTMLScriptRunner Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
166 HTMLScriptRunnerHost::trace(visitor);
165 } 167 }
166 168
167 void HTMLDocumentParser::pinToMainThread() 169 void HTMLDocumentParser::pinToMainThread()
168 { 170 {
169 ASSERT(!m_haveBackgroundParser); 171 ASSERT(!m_haveBackgroundParser);
170 ASSERT(!m_isPinnedToMainThread); 172 ASSERT(!m_isPinnedToMainThread);
171 m_isPinnedToMainThread = true; 173 m_isPinnedToMainThread = true;
172 if (!m_tokenizer) { 174 if (!m_tokenizer) {
173 ASSERT(!m_token); 175 ASSERT(!m_token);
174 m_token = adoptPtr(new HTMLToken); 176 m_token = adoptPtr(new HTMLToken);
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); 949 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this);
948 pumpPendingSpeculations(); 950 pumpPendingSpeculations();
949 return; 951 return;
950 } 952 }
951 953
952 m_insertionPreloadScanner.clear(); 954 m_insertionPreloadScanner.clear();
953 pumpTokenizerIfPossible(AllowYield); 955 pumpTokenizerIfPossible(AllowYield);
954 endIfDelayed(); 956 endIfDelayed();
955 } 957 }
956 958
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() 959 void HTMLDocumentParser::appendCurrentInputStreamToPreloadScannerAndScan()
972 { 960 {
973 ASSERT(m_preloadScanner); 961 ASSERT(m_preloadScanner);
974 m_preloadScanner->appendToEnd(m_input.current()); 962 m_preloadScanner->appendToEnd(m_input.current());
975 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); 963 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
976 } 964 }
977 965
978 void HTMLDocumentParser::notifyFinished(Resource* cachedResource) 966 void HTMLDocumentParser::notifyScriptLoaded(Resource* cachedResource)
979 { 967 {
980 // pumpTokenizer can cause this parser to be detached from the Document, 968 // pumpTokenizer can cause this parser to be detached from the Document,
981 // but we need to ensure it isn't deleted yet. 969 // but we need to ensure it isn't deleted yet.
982 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this); 970 RefPtrWillBeRawPtr<HTMLDocumentParser> protect(this);
983 971
984 ASSERT(m_scriptRunner); 972 ASSERT(m_scriptRunner);
985 ASSERT(!isExecutingScript()); 973 ASSERT(!isExecutingScript());
986 if (isStopping()) { 974 if (isStopping()) {
987 attemptToRunDeferredScriptsAndEnd(); 975 attemptToRunDeferredScriptsAndEnd();
988 return; 976 return;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1056 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1069 { 1057 {
1070 ASSERT(decoder); 1058 ASSERT(decoder);
1071 DecodedDataDocumentParser::setDecoder(decoder); 1059 DecodedDataDocumentParser::setDecoder(decoder);
1072 1060
1073 if (m_haveBackgroundParser) 1061 if (m_haveBackgroundParser)
1074 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1062 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1075 } 1063 }
1076 1064
1077 } 1065 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLDocumentParser.h ('k') | Source/core/html/parser/HTMLScriptRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698