OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "wtf/text/TextPosition.h" | 29 #include "wtf/text/TextPosition.h" |
30 #include "wtf/text/WTFString.h" | 30 #include "wtf/text/WTFString.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 class Element; | 34 class Element; |
35 class ScriptLoaderClient; | 35 class ScriptLoaderClient; |
36 class ScriptSourceCode; | 36 class ScriptSourceCode; |
37 | 37 |
38 | 38 |
39 class ScriptLoader final : public NoBaseWillBeGarbageCollectedFinalized<ScriptLo
ader>, private ScriptResourceClient { | 39 class ScriptLoader final : private ScriptResourceClient { |
40 public: | 40 public: |
41 static PassOwnPtrWillBeRawPtr<ScriptLoader> create(Element* element, bool cr
eatedByParser, bool isEvaluated) | 41 static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool
isEvaluated); |
42 { | |
43 return adoptPtrWillBeNoop(new ScriptLoader(element, createdByParser, isE
valuated)); | |
44 } | |
45 | |
46 virtual ~ScriptLoader(); | 42 virtual ~ScriptLoader(); |
47 virtual void trace(Visitor*); | |
48 | 43 |
49 Element* element() const { return m_element; } | 44 Element* element() const { return m_element; } |
50 | 45 |
51 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; | 46 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; |
52 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); | 47 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); |
53 | 48 |
54 String scriptCharset() const { return m_characterEncoding; } | 49 String scriptCharset() const { return m_characterEncoding; } |
55 String scriptContent() const; | 50 String scriptContent() const; |
56 void executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); | 51 void executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); |
57 void execute(); | 52 void execute(); |
(...skipping 28 matching lines...) Expand all Loading... |
86 bool ignoresLoadRequest() const; | 81 bool ignoresLoadRequest() const; |
87 bool isScriptForEventSupported() const; | 82 bool isScriptForEventSupported() const; |
88 | 83 |
89 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); | 84 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); |
90 | 85 |
91 ScriptLoaderClient* client() const; | 86 ScriptLoaderClient* client() const; |
92 | 87 |
93 // ResourceClient | 88 // ResourceClient |
94 virtual void notifyFinished(Resource*) override; | 89 virtual void notifyFinished(Resource*) override; |
95 | 90 |
96 RawPtrWillBeMember<Element> m_element; | 91 // FIXME: Oilpan: This should become a Member once ResourceClient is moved t
o the heap. |
| 92 Element* m_element; |
97 ResourcePtr<ScriptResource> m_resource; | 93 ResourcePtr<ScriptResource> m_resource; |
98 WTF::OrdinalNumber m_startLineNumber; | 94 WTF::OrdinalNumber m_startLineNumber; |
99 String m_characterEncoding; | |
100 String m_fallbackCharacterEncoding; | |
101 | |
102 PendingScript m_pendingScript; | |
103 | |
104 bool m_parserInserted : 1; | 95 bool m_parserInserted : 1; |
105 bool m_isExternalScript : 1; | 96 bool m_isExternalScript : 1; |
106 bool m_alreadyStarted : 1; | 97 bool m_alreadyStarted : 1; |
107 bool m_haveFiredLoad : 1; | 98 bool m_haveFiredLoad : 1; |
108 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 99 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
109 bool m_readyToBeParserExecuted : 1; | 100 bool m_readyToBeParserExecuted : 1; |
110 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 101 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
111 bool m_forceAsync : 1; | 102 bool m_forceAsync : 1; |
112 bool m_willExecuteInOrder : 1; | 103 bool m_willExecuteInOrder : 1; |
| 104 String m_characterEncoding; |
| 105 String m_fallbackCharacterEncoding; |
| 106 |
| 107 PendingScript m_pendingScript; |
113 }; | 108 }; |
114 | 109 |
115 ScriptLoader* toScriptLoaderIfPossible(Element*); | 110 ScriptLoader* toScriptLoaderIfPossible(Element*); |
116 | 111 |
117 } // namespace blink | 112 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) |
| 113 { |
| 114 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); |
| 115 } |
118 | 116 |
119 #endif // ScriptLoader_h | 117 } |
| 118 |
| 119 |
| 120 #endif |
OLD | NEW |