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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 void evaluateAndPreloadScriptForDocumentWrite(const String& source); | 182 void evaluateAndPreloadScriptForDocumentWrite(const String& source); |
183 | 183 |
184 // Temporary enum for the ParseHTMLOnMainThread experiment. This is used to | 184 // Temporary enum for the ParseHTMLOnMainThread experiment. This is used to |
185 // annotate whether a given task should post a task or not on the main | 185 // annotate whether a given task should post a task or not on the main |
186 // thread if the lookahead parser is living on the main thread. | 186 // thread if the lookahead parser is living on the main thread. |
187 enum LookaheadParserTaskSynchrony { | 187 enum LookaheadParserTaskSynchrony { |
188 Synchronous, | 188 Synchronous, |
189 Asynchronous, | 189 Asynchronous, |
190 }; | 190 }; |
191 | 191 |
192 // Setting |sync| to true will just call the closure. Note, this method is | 192 // Setting |synchronyPolicy| to Synchronous will just call the function |
193 // completely temporary as we need to maintain both threading | 193 // with the given parameters. Note, this method is completely temporary |
194 // implementations until the ParseHTMLOnMainThread experiment finishes. | 194 // as we need to maintain both threading implementations until the |
195 void postTaskToLookaheadParser(std::unique_ptr<CrossThreadClosure>, Lookahea
dParserTaskSynchrony = Asynchronous); | 195 // ParseHTMLOnMainThread experiment finishes. |
| 196 template <typename FunctionType, typename... Ps> |
| 197 void postTaskToLookaheadParser(LookaheadParserTaskSynchrony synchronyPolicy,
FunctionType, Ps&&... parameters); |
196 | 198 |
197 HTMLToken& token() { return *m_token; } | 199 HTMLToken& token() { return *m_token; } |
198 | 200 |
199 HTMLParserOptions m_options; | 201 HTMLParserOptions m_options; |
200 HTMLInputStream m_input; | 202 HTMLInputStream m_input; |
201 | 203 |
202 std::unique_ptr<HTMLToken> m_token; | 204 std::unique_ptr<HTMLToken> m_token; |
203 std::unique_ptr<HTMLTokenizer> m_tokenizer; | 205 std::unique_ptr<HTMLTokenizer> m_tokenizer; |
204 Member<HTMLScriptRunner> m_scriptRunner; | 206 Member<HTMLScriptRunner> m_scriptRunner; |
205 Member<HTMLTreeBuilder> m_treeBuilder; | 207 Member<HTMLTreeBuilder> m_treeBuilder; |
(...skipping 24 matching lines...) Expand all Loading... |
230 bool m_tasksWereSuspended; | 232 bool m_tasksWereSuspended; |
231 unsigned m_pumpSessionNestingLevel; | 233 unsigned m_pumpSessionNestingLevel; |
232 unsigned m_pumpSpeculationsSessionNestingLevel; | 234 unsigned m_pumpSpeculationsSessionNestingLevel; |
233 bool m_isParsingAtLineNumber; | 235 bool m_isParsingAtLineNumber; |
234 bool m_triedLoadingLinkHeaders; | 236 bool m_triedLoadingLinkHeaders; |
235 }; | 237 }; |
236 | 238 |
237 } // namespace blink | 239 } // namespace blink |
238 | 240 |
239 #endif | 241 #endif |
OLD | NEW |