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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // ResourceClient | 65 // ResourceClient |
66 void notifyFinished(Resource*) override; | 66 void notifyFinished(Resource*) override; |
67 String debugName() const override { return "HTMLScriptRunner"; } | 67 String debugName() const override { return "HTMLScriptRunner"; } |
68 | 68 |
69 DECLARE_TRACE(); | 69 DECLARE_TRACE(); |
70 | 70 |
71 private: | 71 private: |
72 HTMLScriptRunner(Document*, HTMLScriptRunnerHost*); | 72 HTMLScriptRunner(Document*, HTMLScriptRunnerHost*); |
73 | 73 |
74 void executeParsingBlockingScript(); | 74 void executeParsingBlockingScript(); |
75 void executePendingScriptAndDispatchEvent(PendingScript&, PendingScript::Typ
e); | 75 void executePendingScriptAndDispatchEvent(PendingScript*, PendingScript::Typ
e); |
76 void executeParsingBlockingScripts(); | 76 void executeParsingBlockingScripts(); |
77 | 77 |
78 void requestParsingBlockingScript(Element*); | 78 void requestParsingBlockingScript(Element*); |
79 void requestDeferredScript(Element*); | 79 void requestDeferredScript(Element*); |
80 bool requestPendingScript(PendingScript&, Element*) const; | 80 bool requestPendingScript(PendingScript*, Element*) const; |
81 | 81 |
82 void runScript(Element*, const TextPosition& scriptStartPosition); | 82 void runScript(Element*, const TextPosition& scriptStartPosition); |
83 | 83 |
84 bool isPendingScriptReady(const PendingScript&); | 84 bool isPendingScriptReady(const PendingScript*); |
85 | 85 |
86 void stopWatchingResourceForLoad(Resource*); | 86 void stopWatchingResourceForLoad(Resource*); |
87 | 87 |
88 RawPtrWillBeMember<Document> m_document; | 88 RawPtrWillBeMember<Document> m_document; |
89 RawPtrWillBeMember<HTMLScriptRunnerHost> m_host; | 89 RawPtrWillBeMember<HTMLScriptRunnerHost> m_host; |
90 PendingScript m_parserBlockingScript; | 90 OwnPtrWillBeMember<PendingScript> m_parserBlockingScript; |
91 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-w
ill-execute-when-the-document-has-finished-parsing | 91 // http://www.whatwg.org/specs/web-apps/current-work/#list-of-scripts-that-w
ill-execute-when-the-document-has-finished-parsing |
92 WillBeHeapDeque<PendingScript> m_scriptsToExecuteAfterParsing; | 92 WillBeHeapDeque<OwnPtrWillBeMember<PendingScript>> m_scriptsToExecuteAfterPa
rsing; |
93 unsigned m_scriptNestingLevel; | 93 unsigned m_scriptNestingLevel; |
94 | 94 |
95 // We only want stylesheet loads to trigger script execution if script | 95 // We only want stylesheet loads to trigger script execution if script |
96 // execution is currently stopped due to stylesheet loads, otherwise we'd | 96 // execution is currently stopped due to stylesheet loads, otherwise we'd |
97 // cause nested script execution when parsing <style> tags since </style> | 97 // cause nested script execution when parsing <style> tags since </style> |
98 // tags can cause Document to call executeScriptsWaitingForResources. | 98 // tags can cause Document to call executeScriptsWaitingForResources. |
99 bool m_hasScriptsWaitingForResources; | 99 bool m_hasScriptsWaitingForResources; |
100 | 100 |
101 // For tracking the times between script load and compilation, we need to | 101 // For tracking the times between script load and compilation, we need to |
102 // know whether a parser blocking script was loaded previously, or whether | 102 // know whether a parser blocking script was loaded previously, or whether |
103 // it's really loaded when requested. | 103 // it's really loaded when requested. |
104 bool m_parserBlockingScriptAlreadyLoaded; | 104 bool m_parserBlockingScriptAlreadyLoaded; |
105 }; | 105 }; |
106 | 106 |
107 } | 107 } |
108 | 108 |
109 #endif | 109 #endif |
OLD | NEW |