| 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 : private ScriptResourceClient { | 39 class ScriptLoader final : public NoBaseWillBeGarbageCollectedFinalized<ScriptLo
ader>, private ScriptResourceClient { |
| 40 public: | 40 public: |
| 41 static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool
isEvaluated); | 41 static PassOwnPtrWillBeRawPtr<ScriptLoader> create(Element* element, bool cr
eatedByParser, bool isEvaluated) |
| 42 { |
| 43 return adoptPtrWillBeNoop(new ScriptLoader(element, createdByParser, isE
valuated)); |
| 44 } |
| 45 |
| 42 virtual ~ScriptLoader(); | 46 virtual ~ScriptLoader(); |
| 47 virtual void trace(Visitor*); |
| 43 | 48 |
| 44 Element* element() const { return m_element; } | 49 Element* element() const { return m_element; } |
| 45 | 50 |
| 46 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; | 51 enum LegacyTypeSupport { DisallowLegacyTypeInTypeAttribute, AllowLegacyTypeI
nTypeAttribute }; |
| 47 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); | 52 bool prepareScript(const TextPosition& scriptStartPosition = TextPosition::m
inimumPosition(), LegacyTypeSupport = DisallowLegacyTypeInTypeAttribute); |
| 48 | 53 |
| 49 String scriptCharset() const { return m_characterEncoding; } | 54 String scriptCharset() const { return m_characterEncoding; } |
| 50 String scriptContent() const; | 55 String scriptContent() const; |
| 51 void executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); | 56 void executeScript(const ScriptSourceCode&, double* compilationFinishTime =
0); |
| 52 void execute(); | 57 void execute(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool ignoresLoadRequest() const; | 89 bool ignoresLoadRequest() const; |
| 85 bool isScriptForEventSupported() const; | 90 bool isScriptForEventSupported() const; |
| 86 | 91 |
| 87 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); | 92 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); |
| 88 | 93 |
| 89 ScriptLoaderClient* client() const; | 94 ScriptLoaderClient* client() const; |
| 90 | 95 |
| 91 // ResourceClient | 96 // ResourceClient |
| 92 virtual void notifyFinished(Resource*) override; | 97 virtual void notifyFinished(Resource*) override; |
| 93 | 98 |
| 94 // FIXME: Oilpan: This should become a Member once ResourceClient is moved t
o the heap. | 99 RawPtrWillBeMember<Element> m_element; |
| 95 Element* m_element; | |
| 96 ResourcePtr<ScriptResource> m_resource; | 100 ResourcePtr<ScriptResource> m_resource; |
| 97 WTF::OrdinalNumber m_startLineNumber; | 101 WTF::OrdinalNumber m_startLineNumber; |
| 102 String m_characterEncoding; |
| 103 String m_fallbackCharacterEncoding; |
| 104 |
| 105 PendingScript m_pendingScript; |
| 106 |
| 98 bool m_parserInserted : 1; | 107 bool m_parserInserted : 1; |
| 99 bool m_isExternalScript : 1; | 108 bool m_isExternalScript : 1; |
| 100 bool m_alreadyStarted : 1; | 109 bool m_alreadyStarted : 1; |
| 101 bool m_haveFiredLoad : 1; | 110 bool m_haveFiredLoad : 1; |
| 102 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." | 111 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin
g the script." |
| 103 bool m_readyToBeParserExecuted : 1; | 112 bool m_readyToBeParserExecuted : 1; |
| 104 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 113 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 105 bool m_forceAsync : 1; | 114 bool m_forceAsync : 1; |
| 106 bool m_willExecuteInOrder : 1; | 115 bool m_willExecuteInOrder : 1; |
| 107 String m_characterEncoding; | |
| 108 String m_fallbackCharacterEncoding; | |
| 109 | |
| 110 PendingScript m_pendingScript; | |
| 111 }; | 116 }; |
| 112 | 117 |
| 113 ScriptLoader* toScriptLoaderIfPossible(Element*); | 118 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 114 | 119 |
| 115 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea
tedByParser, bool isEvaluated) | 120 } // namespace blink |
| 116 { | |
| 117 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); | |
| 118 } | |
| 119 | 121 |
| 120 } | 122 #endif // ScriptLoader_h |
| 121 | |
| 122 | |
| 123 #endif | |
| OLD | NEW |