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