| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) | 89 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) |
| 90 { | 90 { |
| 91 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); | 91 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); |
| 92 m_parser->resumeParsingAfterYield(); | 92 m_parser->resumeParsingAfterYield(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void HTMLParserScheduler::scheduleForResume() | 95 void HTMLParserScheduler::scheduleForResume() |
| 96 { | 96 { |
| 97 ASSERT(!m_isSuspendedWithActiveTimer); |
| 97 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); | 98 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); |
| 98 } | 99 } |
| 99 | 100 |
| 100 void HTMLParserScheduler::suspend() | 101 void HTMLParserScheduler::suspend() |
| 101 { | 102 { |
| 102 ASSERT(!m_isSuspendedWithActiveTimer); | 103 ASSERT(!m_isSuspendedWithActiveTimer); |
| 103 if (!m_continueNextChunkTimer.isActive()) | 104 if (!m_continueNextChunkTimer.isActive()) |
| 104 return; | 105 return; |
| 105 m_isSuspendedWithActiveTimer = true; | 106 m_isSuspendedWithActiveTimer = true; |
| 106 m_continueNextChunkTimer.stop(); | 107 m_continueNextChunkTimer.stop(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 130 bool HTMLParserScheduler::yieldIfNeeded(const SpeculationsPumpSession& session) | 131 bool HTMLParserScheduler::yieldIfNeeded(const SpeculationsPumpSession& session) |
| 131 { | 132 { |
| 132 if (shouldYield(session)) { | 133 if (shouldYield(session)) { |
| 133 scheduleForResume(); | 134 scheduleForResume(); |
| 134 return true; | 135 return true; |
| 135 } | 136 } |
| 136 | 137 |
| 137 return false; | 138 return false; |
| 138 } | 139 } |
| 139 | 140 |
| 141 void HTMLParserScheduler::forceResumeAfterYield() |
| 142 { |
| 143 ASSERT(!m_continueNextChunkTimer.isActive()); |
| 144 m_isSuspendedWithActiveTimer = true; |
| 140 } | 145 } |
| 146 |
| 147 } |
| OLD | NEW |