| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) | 95 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) |
| 96 { | 96 { |
| 97 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); | 97 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); |
| 98 m_parser->resumeParsingAfterYield(); | 98 m_parser->resumeParsingAfterYield(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void HTMLParserScheduler::scheduleForResume() | 101 void HTMLParserScheduler::scheduleForResume() |
| 102 { | 102 { |
| 103 ASSERT(!m_isSuspendedWithActiveTimer); |
| 103 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); | 104 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); |
| 104 } | 105 } |
| 105 | 106 |
| 106 void HTMLParserScheduler::suspend() | 107 void HTMLParserScheduler::suspend() |
| 107 { | 108 { |
| 108 ASSERT(!m_isSuspendedWithActiveTimer); | 109 ASSERT(!m_isSuspendedWithActiveTimer); |
| 109 if (!m_continueNextChunkTimer.isActive()) | 110 if (!m_continueNextChunkTimer.isActive()) |
| 110 return; | 111 return; |
| 111 m_isSuspendedWithActiveTimer = true; | 112 m_isSuspendedWithActiveTimer = true; |
| 112 m_continueNextChunkTimer.stop(); | 113 m_continueNextChunkTimer.stop(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 bool HTMLParserScheduler::yieldIfNeeded(const SpeculationsPumpSession& session,
bool startingScript) | 149 bool HTMLParserScheduler::yieldIfNeeded(const SpeculationsPumpSession& session,
bool startingScript) |
| 149 { | 150 { |
| 150 if (shouldYield(session, startingScript)) { | 151 if (shouldYield(session, startingScript)) { |
| 151 scheduleForResume(); | 152 scheduleForResume(); |
| 152 return true; | 153 return true; |
| 153 } | 154 } |
| 154 | 155 |
| 155 return false; | 156 return false; |
| 156 } | 157 } |
| 157 | 158 |
| 159 void HTMLParserScheduler::forceResumeAfterYield() |
| 160 { |
| 161 ASSERT(!m_continueNextChunkTimer.isActive()); |
| 162 m_isSuspendedWithActiveTimer = true; |
| 158 } | 163 } |
| 164 |
| 165 } |
| OLD | NEW |