Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 82 bool isScriptForEventSupported() const; | 87 bool isScriptForEventSupported() const; |
| 83 | 88 |
| 84 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); | 89 bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption); |
| 85 | 90 |
| 86 ScriptLoaderClient* client() const; | 91 ScriptLoaderClient* client() const; |
| 87 | 92 |
| 88 // ResourceClient | 93 // ResourceClient |
| 89 virtual void notifyFinished(Resource*) override; | 94 virtual void notifyFinished(Resource*) override; |
| 90 | 95 |
| 91 // FIXME: Oilpan: This should become a Member once ResourceClient is moved t o the heap. | 96 // FIXME: Oilpan: This should become a Member once ResourceClient is moved t o the heap. |
| 92 Element* m_element; | 97 Element* m_element; |
|
haraken
2014/10/17 12:35:29
Can we make this a Member?
sof
2014/10/17 12:55:46
Thanks, I overlooked that -- yes, the owning scrip
| |
| 93 ResourcePtr<ScriptResource> m_resource; | 98 ResourcePtr<ScriptResource> m_resource; |
| 94 WTF::OrdinalNumber m_startLineNumber; | 99 WTF::OrdinalNumber m_startLineNumber; |
| 95 bool m_parserInserted : 1; | 100 bool m_parserInserted : 1; |
| 96 bool m_isExternalScript : 1; | 101 bool m_isExternalScript : 1; |
| 97 bool m_alreadyStarted : 1; | 102 bool m_alreadyStarted : 1; |
| 98 bool m_haveFiredLoad : 1; | 103 bool m_haveFiredLoad : 1; |
| 99 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script." | 104 bool m_willBeParserExecuted : 1; // Same as "The parser will handle executin g the script." |
| 100 bool m_readyToBeParserExecuted : 1; | 105 bool m_readyToBeParserExecuted : 1; |
| 101 bool m_willExecuteWhenDocumentFinishedParsing : 1; | 106 bool m_willExecuteWhenDocumentFinishedParsing : 1; |
| 102 bool m_forceAsync : 1; | 107 bool m_forceAsync : 1; |
| 103 bool m_willExecuteInOrder : 1; | 108 bool m_willExecuteInOrder : 1; |
| 104 String m_characterEncoding; | 109 String m_characterEncoding; |
| 105 String m_fallbackCharacterEncoding; | 110 String m_fallbackCharacterEncoding; |
| 106 | 111 |
| 107 PendingScript m_pendingScript; | 112 PendingScript m_pendingScript; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 ScriptLoader* toScriptLoaderIfPossible(Element*); | 115 ScriptLoader* toScriptLoaderIfPossible(Element*); |
| 111 | 116 |
| 112 inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool crea tedByParser, bool isEvaluated) | 117 } // namespace blink |
| 113 { | |
| 114 return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated)); | |
| 115 } | |
| 116 | 118 |
| 117 } | 119 #endif // ScriptLoader_h |
| 118 | |
| 119 | |
| 120 #endif | |
| OLD | NEW |