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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 { | 74 { |
75 return adoptPtr(new HTMLParserScheduler(parser)); | 75 return adoptPtr(new HTMLParserScheduler(parser)); |
76 } | 76 } |
77 ~HTMLParserScheduler(); | 77 ~HTMLParserScheduler(); |
78 | 78 |
79 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_continueNextChunkTimer.isActive(); } | 79 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m
_continueNextChunkTimer.isActive(); } |
80 | 80 |
81 void scheduleForResume(); | 81 void scheduleForResume(); |
82 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); | 82 bool yieldIfNeeded(const SpeculationsPumpSession&, bool startingScript); |
83 | 83 |
| 84 /** |
| 85 * Can only be called if this scheduler is suspended. If this is called, |
| 86 * then after the scheduler is resumed by calling resume(), this call |
| 87 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to |
| 88 * signal this scheduler that the background html parser sent chunks to |
| 89 * HTMLDocumentParser while it was suspended. |
| 90 */ |
| 91 void forceResumeAfterYield(); |
| 92 |
84 void suspend(); | 93 void suspend(); |
85 void resume(); | 94 void resume(); |
86 | 95 |
87 private: | 96 private: |
88 explicit HTMLParserScheduler(HTMLDocumentParser*); | 97 explicit HTMLParserScheduler(HTMLDocumentParser*); |
89 | 98 |
90 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; | 99 bool shouldYield(const SpeculationsPumpSession&, bool startingScript) const; |
91 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); | 100 void continueNextChunkTimerFired(Timer<HTMLParserScheduler>*); |
92 | 101 |
93 HTMLDocumentParser* m_parser; | 102 HTMLDocumentParser* m_parser; |
94 | 103 |
95 Timer<HTMLParserScheduler> m_continueNextChunkTimer; | 104 Timer<HTMLParserScheduler> m_continueNextChunkTimer; |
96 bool m_isSuspendedWithActiveTimer; | 105 bool m_isSuspendedWithActiveTimer; |
97 }; | 106 }; |
98 | 107 |
99 } | 108 } |
100 | 109 |
101 #endif | 110 #endif |
OLD | NEW |