| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // | 48 // |
| 49 // If a script blocks parsing, this class is responsible for holding it, and | 49 // If a script blocks parsing, this class is responsible for holding it, and |
| 50 // executing it when required. | 50 // executing it when required. |
| 51 // | 51 // |
| 52 // An HTMLParserScriptRunner is owned by its host, an HTMLDocumentParser. | 52 // An HTMLParserScriptRunner is owned by its host, an HTMLDocumentParser. |
| 53 class HTMLParserScriptRunner final | 53 class HTMLParserScriptRunner final |
| 54 : public GarbageCollectedFinalized<HTMLParserScriptRunner>, | 54 : public GarbageCollectedFinalized<HTMLParserScriptRunner>, |
| 55 private PendingScriptClient { | 55 private PendingScriptClient { |
| 56 WTF_MAKE_NONCOPYABLE(HTMLParserScriptRunner); | 56 WTF_MAKE_NONCOPYABLE(HTMLParserScriptRunner); |
| 57 USING_GARBAGE_COLLECTED_MIXIN(HTMLParserScriptRunner); | 57 USING_GARBAGE_COLLECTED_MIXIN(HTMLParserScriptRunner); |
| 58 USING_PRE_FINALIZER(HTMLParserScriptRunner, Detach); | |
| 59 | 58 |
| 60 public: | 59 public: |
| 61 static HTMLParserScriptRunner* Create(HTMLParserReentryPermit* reentry_permit, | 60 static HTMLParserScriptRunner* Create(HTMLParserReentryPermit* reentry_permit, |
| 62 Document* document, | 61 Document* document, |
| 63 HTMLParserScriptRunnerHost* host) { | 62 HTMLParserScriptRunnerHost* host) { |
| 64 return new HTMLParserScriptRunner(reentry_permit, document, host); | 63 return new HTMLParserScriptRunner(reentry_permit, document, host); |
| 65 } | 64 } |
| 66 ~HTMLParserScriptRunner(); | 65 ~HTMLParserScriptRunner(); |
| 67 | 66 |
| 68 // Prepares this object to be destroyed. Invoked when the parser is detached, | 67 // Invoked when the parser is detached. |
| 69 // or failing that, as a pre-finalizer. | 68 // |
| 69 // We don't need to call Detach() as a prefinalizer, because PendingScripts |
| 70 // are Dispose()d in PendingScripts' prefinalizers. |
| 70 void Detach(); | 71 void Detach(); |
| 71 | 72 |
| 72 // Processes the passed in script and any pending scripts if possible. | 73 // Processes the passed in script and any pending scripts if possible. |
| 73 // This does not necessarily run the script immediately. For instance, | 74 // This does not necessarily run the script immediately. For instance, |
| 74 // execution may not happen until the script loads from the network, or after | 75 // execution may not happen until the script loads from the network, or after |
| 75 // the document finishes parsing. | 76 // the document finishes parsing. |
| 76 void ProcessScriptElement(Element*, | 77 void ProcessScriptElement(Element*, |
| 77 const TextPosition& script_start_position); | 78 const TextPosition& script_start_position); |
| 78 | 79 |
| 79 // Invoked when the parsing-blocking script resource has loaded, to execute | 80 // Invoked when the parsing-blocking script resource has loaded, to execute |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // https://html.spec.whatwg.org/#pending-parsing-blocking-script | 131 // https://html.spec.whatwg.org/#pending-parsing-blocking-script |
| 131 Member<PendingScript> parser_blocking_script_; | 132 Member<PendingScript> parser_blocking_script_; |
| 132 | 133 |
| 133 // https://html.spec.whatwg.org/#list-of-scripts-that-will-execute-when-the-do
cument-has-finished-parsing | 134 // https://html.spec.whatwg.org/#list-of-scripts-that-will-execute-when-the-do
cument-has-finished-parsing |
| 134 HeapDeque<Member<PendingScript>> scripts_to_execute_after_parsing_; | 135 HeapDeque<Member<PendingScript>> scripts_to_execute_after_parsing_; |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 } // namespace blink | 138 } // namespace blink |
| 138 | 139 |
| 139 #endif | 140 #endif |
| OLD | NEW |