Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.h

Issue 1569273004: Move ResourceOwner on to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win_chromium_compile_dbg_ng is the worst Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef HTMLScriptRunner_h 26 #ifndef HTMLScriptRunner_h
27 #define HTMLScriptRunner_h 27 #define HTMLScriptRunner_h
28 28
29 #include "bindings/core/v8/ScriptStreamer.h"
29 #include "core/dom/PendingScript.h" 30 #include "core/dom/PendingScript.h"
30 #include "core/fetch/ResourceClient.h" 31 #include "core/fetch/ResourceClient.h"
31 #include "platform/heap/Handle.h" 32 #include "platform/heap/Handle.h"
32 #include "wtf/Deque.h" 33 #include "wtf/Deque.h"
33 #include "wtf/PassRefPtr.h" 34 #include "wtf/PassRefPtr.h"
34 #include "wtf/text/TextPosition.h" 35 #include "wtf/text/TextPosition.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class Resource; 39 class Resource;
39 class Document; 40 class Document;
40 class Element; 41 class Element;
41 class HTMLScriptRunnerHost; 42 class HTMLScriptRunnerHost;
42 43
43 class HTMLScriptRunner final : public NoBaseWillBeGarbageCollectedFinalized<HTML ScriptRunner>, private ScriptResourceClient { 44 class HTMLScriptRunner final : public NoBaseWillBeGarbageCollectedFinalized<HTML ScriptRunner>, private ScriptResourceClient {
44 WTF_MAKE_NONCOPYABLE(HTMLScriptRunner); USING_FAST_MALLOC_WILL_BE_REMOVED(HT MLScriptRunner); 45 WTF_MAKE_NONCOPYABLE(HTMLScriptRunner); USING_FAST_MALLOC_WILL_BE_REMOVED(HT MLScriptRunner);
46 WILL_BE_USING_PRE_FINALIZER(HTMLScriptRunner, detach);
45 public: 47 public:
46 static PassOwnPtrWillBeRawPtr<HTMLScriptRunner> create(Document* document, H TMLScriptRunnerHost* host) 48 static PassOwnPtrWillBeRawPtr<HTMLScriptRunner> create(Document* document, H TMLScriptRunnerHost* host)
47 { 49 {
48 return adoptPtrWillBeNoop(new HTMLScriptRunner(document, host)); 50 return adoptPtrWillBeNoop(new HTMLScriptRunner(document, host));
49 } 51 }
50 ~HTMLScriptRunner(); 52 ~HTMLScriptRunner();
51 53
52 void detach(); 54 void detach();
53 55
54 // Processes the passed in script and any pending scripts if possible. 56 // Processes the passed in script and any pending scripts if possible.
(...skipping 10 matching lines...) Expand all
65 // ResourceClient 67 // ResourceClient
66 void notifyFinished(Resource*) override; 68 void notifyFinished(Resource*) override;
67 String debugName() const override { return "HTMLScriptRunner"; } 69 String debugName() const override { return "HTMLScriptRunner"; }
68 70
69 DECLARE_TRACE(); 71 DECLARE_TRACE();
70 72
71 private: 73 private:
72 HTMLScriptRunner(Document*, HTMLScriptRunnerHost*); 74 HTMLScriptRunner(Document*, HTMLScriptRunnerHost*);
73 75
74 void executeParsingBlockingScript(); 76 void executeParsingBlockingScript();
75 void executePendingScriptAndDispatchEvent(PendingScript&, PendingScript::Typ e); 77 void executePendingScriptAndDispatchEvent(PendingScript*, ScriptStreamer::Ty pe);
76 void executeParsingBlockingScripts(); 78 void executeParsingBlockingScripts();
77 79
78 void requestParsingBlockingScript(Element*); 80 void requestParsingBlockingScript(Element*);
79 void requestDeferredScript(Element*); 81 void requestDeferredScript(Element*);
80 bool requestPendingScript(PendingScript&, Element*) const; 82 bool requestPendingScript(PendingScript*, Element*) const;
81 83
82 void runScript(Element*, const TextPosition& scriptStartPosition); 84 void runScript(Element*, const TextPosition& scriptStartPosition);
83 85
84 bool isPendingScriptReady(const PendingScript&); 86 bool isPendingScriptReady(const PendingScript*);
85 87
86 void stopWatchingResourceForLoad(Resource*); 88 void stopWatchingResourceForLoad(Resource*);
87 89
88 RawPtrWillBeMember<Document> m_document; 90 RawPtrWillBeMember<Document> m_document;
89 RawPtrWillBeMember<HTMLScriptRunnerHost> m_host; 91 RawPtrWillBeMember<HTMLScriptRunnerHost> m_host;
90 PendingScript m_parserBlockingScript; 92 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 93 // 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; 94 WillBeHeapDeque<OwnPtrWillBeMember<PendingScript>> m_scriptsToExecuteAfterPa rsing;
93 unsigned m_scriptNestingLevel; 95 unsigned m_scriptNestingLevel;
94 96
95 // We only want stylesheet loads to trigger script execution if script 97 // We only want stylesheet loads to trigger script execution if script
96 // execution is currently stopped due to stylesheet loads, otherwise we'd 98 // execution is currently stopped due to stylesheet loads, otherwise we'd
97 // cause nested script execution when parsing <style> tags since </style> 99 // cause nested script execution when parsing <style> tags since </style>
98 // tags can cause Document to call executeScriptsWaitingForResources. 100 // tags can cause Document to call executeScriptsWaitingForResources.
99 bool m_hasScriptsWaitingForResources; 101 bool m_hasScriptsWaitingForResources;
100 102
101 // For tracking the times between script load and compilation, we need to 103 // For tracking the times between script load and compilation, we need to
102 // know whether a parser blocking script was loaded previously, or whether 104 // know whether a parser blocking script was loaded previously, or whether
103 // it's really loaded when requested. 105 // it's really loaded when requested.
104 bool m_parserBlockingScriptAlreadyLoaded; 106 bool m_parserBlockingScriptAlreadyLoaded;
105 }; 107 };
106 108
107 } 109 }
108 110
109 #endif 111 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698