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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 RefPtr<WebTaskRunner> loading_task_runner) { | 71 RefPtr<WebTaskRunner> loading_task_runner) { |
72 return new HTMLParserScheduler(parser, std::move(loading_task_runner)); | 72 return new HTMLParserScheduler(parser, std::move(loading_task_runner)); |
73 } | 73 } |
74 ~HTMLParserScheduler(); | 74 ~HTMLParserScheduler(); |
75 | 75 |
76 bool IsScheduledForResume() const; | 76 bool IsScheduledForResume() const; |
77 void ScheduleForResume(); | 77 void ScheduleForResume(); |
78 bool YieldIfNeeded(const SpeculationsPumpSession&, bool starting_script); | 78 bool YieldIfNeeded(const SpeculationsPumpSession&, bool starting_script); |
79 | 79 |
80 /** | 80 /** |
81 * Can only be called if this scheduler is suspended. If this is called, | 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 | 82 * then after the scheduler is resumed by calling resume(), this call |
83 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to | 83 * ensures that HTMLDocumentParser::resumeAfterYield will be called. Used to |
84 * signal this scheduler that the background html parser sent chunks to | 84 * signal this scheduler that the background html parser sent chunks to |
85 * HTMLDocumentParser while it was suspended. | 85 * HTMLDocumentParser while it was suspended. |
86 */ | 86 */ |
87 void ForceResumeAfterYield(); | 87 void ForceResumeAfterYield(); |
88 | 88 |
89 void Suspend(); | 89 void Suspend(); |
90 void Resume(); | 90 void Resume(); |
91 | 91 |
92 void Detach(); // Clear active tasks if any. | 92 void Detach(); // Clear active tasks if any. |
93 | 93 |
94 DECLARE_TRACE(); | 94 DECLARE_TRACE(); |
95 | 95 |
96 private: | 96 private: |
97 HTMLParserScheduler(HTMLDocumentParser*, RefPtr<WebTaskRunner>); | 97 HTMLParserScheduler(HTMLDocumentParser*, RefPtr<WebTaskRunner>); |
98 | 98 |
99 bool ShouldYield(const SpeculationsPumpSession&, bool starting_script) const; | 99 bool ShouldYield(const SpeculationsPumpSession&, bool starting_script) const; |
100 void ContinueParsing(); | 100 void ContinueParsing(); |
101 | 101 |
102 Member<HTMLDocumentParser> parser_; | 102 Member<HTMLDocumentParser> parser_; |
103 RefPtr<WebTaskRunner> loading_task_runner_; | 103 RefPtr<WebTaskRunner> loading_task_runner_; |
104 | 104 |
105 TaskHandle cancellable_continue_parse_task_handle_; | 105 TaskHandle cancellable_continue_parse_task_handle_; |
106 bool is_suspended_with_active_timer_; | 106 bool is_suspended_with_active_timer_; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |