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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) | 88 void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
* timer) |
89 { | 89 { |
90 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); | 90 ASSERT_UNUSED(timer, timer == &m_continueNextChunkTimer); |
91 m_parser->resumeParsingAfterYield(); | 91 m_parser->resumeParsingAfterYield(); |
92 } | 92 } |
93 | 93 |
94 void HTMLParserScheduler::scheduleForResume() | 94 void HTMLParserScheduler::scheduleForResume() |
95 { | 95 { |
| 96 // FIXME: Currently Timers use the SharedTimer queue, so scheduling |
| 97 // a 0ms timer here may cause the parser to resume again before |
| 98 // returning to the Chromium MessageLoop, thus starving other tasks |
| 99 // in the MessageLoop. This will be fixed by moving Blink's Timer |
| 100 // class ontop of postTask, but until then we're probably missing |
| 101 // frames with this implementation. |
96 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); | 102 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); |
97 } | 103 } |
98 | 104 |
99 void HTMLParserScheduler::suspend() | 105 void HTMLParserScheduler::suspend() |
100 { | 106 { |
101 ASSERT(!m_isSuspendedWithActiveTimer); | 107 ASSERT(!m_isSuspendedWithActiveTimer); |
102 if (!m_continueNextChunkTimer.isActive()) | 108 if (!m_continueNextChunkTimer.isActive()) |
103 return; | 109 return; |
104 m_isSuspendedWithActiveTimer = true; | 110 m_isSuspendedWithActiveTimer = true; |
105 m_continueNextChunkTimer.stop(); | 111 m_continueNextChunkTimer.stop(); |
106 } | 112 } |
107 | 113 |
108 void HTMLParserScheduler::resume() | 114 void HTMLParserScheduler::resume() |
109 { | 115 { |
110 ASSERT(!m_continueNextChunkTimer.isActive()); | 116 ASSERT(!m_continueNextChunkTimer.isActive()); |
111 if (!m_isSuspendedWithActiveTimer) | 117 if (!m_isSuspendedWithActiveTimer) |
112 return; | 118 return; |
113 m_isSuspendedWithActiveTimer = false; | 119 m_isSuspendedWithActiveTimer = false; |
114 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); | 120 m_continueNextChunkTimer.startOneShot(0, FROM_HERE); |
115 } | 121 } |
116 | 122 |
117 } | 123 } |
OLD | NEW |