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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { | 253 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptStart) { |
254 sendTokensToMainThread(); | 254 sendTokensToMainThread(); |
255 m_startingScript = true; | 255 m_startingScript = true; |
256 } | 256 } |
257 | 257 |
258 m_pendingTokens->append(token); | 258 m_pendingTokens->append(token); |
259 } | 259 } |
260 | 260 |
261 m_token->clear(); | 261 m_token->clear(); |
262 | 262 |
263 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd || m_pendingTo
kens->size() >= m_pendingTokenLimit) { | 263 if (simulatedToken == HTMLTreeBuilderSimulator::ScriptEnd |
| 264 || simulatedToken == HTMLTreeBuilderSimulator::StyleEnd |
| 265 || simulatedToken == HTMLTreeBuilderSimulator::LinkToken |
| 266 || m_pendingTokens->size() >= m_pendingTokenLimit) { |
264 sendTokensToMainThread(); | 267 sendTokensToMainThread(); |
265 // If we're far ahead of the main thread, yield for a bit to avoid c
onsuming too much memory. | 268 // If we're far ahead of the main thread, yield for a bit to avoid c
onsuming too much memory. |
266 if (m_input.totalCheckpointTokenCount() > m_outstandingTokenLimit) | 269 if (m_input.totalCheckpointTokenCount() > m_outstandingTokenLimit) |
267 break; | 270 break; |
268 } | 271 } |
269 } | 272 } |
270 } | 273 } |
271 | 274 |
272 void BackgroundHTMLParser::sendTokensToMainThread() | 275 void BackgroundHTMLParser::sendTokensToMainThread() |
273 { | 276 { |
(...skipping 21 matching lines...) Expand all Loading... |
295 if (isEmpty) { | 298 if (isEmpty) { |
296 m_loadingTaskRunner->postTask( | 299 m_loadingTaskRunner->postTask( |
297 BLINK_FROM_HERE, | 300 BLINK_FROM_HERE, |
298 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow
CrossThreadAccess(m_parser))); | 301 threadSafeBind(&HTMLDocumentParser::notifyPendingParsedChunks, Allow
CrossThreadAccess(m_parser))); |
299 } | 302 } |
300 | 303 |
301 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); | 304 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); |
302 } | 305 } |
303 | 306 |
304 } // namespace blink | 307 } // namespace blink |
OLD | NEW |