OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 m_sourceTracker.end(m_input.current(), m_tokenizer.get(), *m_token); | 249 m_sourceTracker.end(m_input.current(), m_tokenizer.get(), *m_token); |
250 | 250 |
251 { | 251 { |
252 TextPosition position = TextPosition(m_input.current().currentLine(), | 252 TextPosition position = TextPosition(m_input.current().currentLine(), |
253 m_input.current().currentColumn()); | 253 m_input.current().currentColumn()); |
254 | 254 |
255 if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor->filterToken( | 255 if (std::unique_ptr<XSSInfo> xssInfo = m_xssAuditor->filterToken( |
256 FilterTokenRequest(*m_token, m_sourceTracker, | 256 FilterTokenRequest(*m_token, m_sourceTracker, |
257 m_tokenizer->shouldAllowCDATA()))) { | 257 m_tokenizer->shouldAllowCDATA()))) { |
258 xssInfo->m_textPosition = position; | 258 xssInfo->m_textPosition = position; |
259 m_pendingXSSInfos.append(std::move(xssInfo)); | 259 m_pendingXSSInfos.push_back(std::move(xssInfo)); |
260 } | 260 } |
261 | 261 |
262 CompactHTMLToken token(m_token.get(), position); | 262 CompactHTMLToken token(m_token.get(), position); |
263 | 263 |
264 bool shouldEvaluateForDocumentWrite = false; | 264 bool shouldEvaluateForDocumentWrite = false; |
265 bool isCSPMetaTag = false; | 265 bool isCSPMetaTag = false; |
266 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads, | 266 m_preloadScanner->scan(token, m_input.current(), m_pendingPreloads, |
267 &m_viewportDescription, &isCSPMetaTag, | 267 &m_viewportDescription, &isCSPMetaTag, |
268 &shouldEvaluateForDocumentWrite); | 268 &shouldEvaluateForDocumentWrite); |
269 | 269 |
270 simulatedToken = | 270 simulatedToken = |
271 m_treeBuilderSimulator.simulate(token, m_tokenizer.get()); | 271 m_treeBuilderSimulator.simulate(token, m_tokenizer.get()); |
272 | 272 |
273 // Break chunks before a script tag is inserted and flag the chunk as | 273 // Break chunks before a script tag is inserted and flag the chunk as |
274 // starting a script so the main parser can decide if it should yield | 274 // starting a script so the main parser can decide if it should yield |
275 // before processing the chunk. | 275 // before processing the chunk. |
276 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { | 276 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { |
277 shouldNotifyMainThread |= queueChunkForMainThread(); | 277 shouldNotifyMainThread |= queueChunkForMainThread(); |
278 m_startingScript = true; | 278 m_startingScript = true; |
279 } | 279 } |
280 | 280 |
281 m_pendingTokens->append(token); | 281 m_pendingTokens->push_back(token); |
282 if (isCSPMetaTag) { | 282 if (isCSPMetaTag) { |
283 m_pendingCSPMetaTokenIndex = m_pendingTokens->size() - 1; | 283 m_pendingCSPMetaTokenIndex = m_pendingTokens->size() - 1; |
284 } | 284 } |
285 if (shouldEvaluateForDocumentWrite) { | 285 if (shouldEvaluateForDocumentWrite) { |
286 m_likelyDocumentWriteScriptIndices.append(m_pendingTokens->size() - 1); | 286 m_likelyDocumentWriteScriptIndices.push_back(m_pendingTokens->size() - |
| 287 1); |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 m_token->clear(); | 291 m_token->clear(); |
291 | 292 |
292 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd || | 293 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd || |
293 m_pendingTokens->size() >= m_pendingTokenLimit) { | 294 m_pendingTokens->size() >= m_pendingTokenLimit) { |
294 shouldNotifyMainThread |= queueChunkForMainThread(); | 295 shouldNotifyMainThread |= queueChunkForMainThread(); |
295 // If we're far ahead of the main thread, yield for a bit to avoid | 296 // If we're far ahead of the main thread, yield for a bit to avoid |
296 // consuming too much memory. | 297 // consuming too much memory. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 if (isMainThread()) { | 377 if (isMainThread()) { |
377 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); | 378 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); |
378 } else { | 379 } else { |
379 m_loadingTaskRunner->postTask( | 380 m_loadingTaskRunner->postTask( |
380 BLINK_FROM_HERE, | 381 BLINK_FROM_HERE, |
381 crossThreadBind(function, std::forward<Ps>(parameters)...)); | 382 crossThreadBind(function, std::forward<Ps>(parameters)...)); |
382 } | 383 } |
383 } | 384 } |
384 | 385 |
385 } // namespace blink | 386 } // namespace blink |
OLD | NEW |