Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/PendingScript.h |
| diff --git a/third_party/WebKit/Source/core/dom/PendingScript.h b/third_party/WebKit/Source/core/dom/PendingScript.h |
| index 6c3dfafa60cbf828df2776f27f5a8b0f9a41ae72..f56d3c0588fc9ed1c0c9b7a6ea3a5e2971c8d8b6 100644 |
| --- a/third_party/WebKit/Source/core/dom/PendingScript.h |
| +++ b/third_party/WebKit/Source/core/dom/PendingScript.h |
| @@ -70,13 +70,16 @@ class CORE_EXPORT PendingScript final |
| WTF_MAKE_NONCOPYABLE(PendingScript); |
| public: |
| + // For script from an external file. |
| static PendingScript* create(Element*, ScriptResource*); |
| + // For inline script. |
| + static PendingScript* create(Element*, const TextPosition&); |
| + |
| + static PendingScript* createForTesting(ScriptResource*); |
| + |
| ~PendingScript() override; |
| TextPosition startingPosition() const { return m_startingPosition; } |
| - void setStartingPosition(const TextPosition& position) { |
| - m_startingPosition = position; |
| - } |
| void markParserBlockingLoadStartTime(); |
| // Returns the time the load of this script started blocking the parser, or |
| // zero if this script hasn't yet blocked the parser, in |
| @@ -88,10 +91,7 @@ class CORE_EXPORT PendingScript final |
| void watchForLoad(PendingScriptClient*); |
| void stopWatchingForLoad(); |
| - Element* element() const { return m_element.get(); } |
| - void setElement(Element*); |
| - |
| - void setScriptResource(ScriptResource*); |
| + Element* element() const; |
| DECLARE_TRACE(); |
| @@ -107,7 +107,10 @@ class CORE_EXPORT PendingScript final |
| void dispose(); |
| private: |
| - PendingScript(Element*, ScriptResource*); |
| + PendingScript(Element*, |
| + ScriptResource*, |
| + const TextPosition&, |
| + bool isForTesting = false); |
| PendingScript() = delete; |
| // ScriptResourceClient |
| @@ -119,13 +122,21 @@ class CORE_EXPORT PendingScript final |
| void onPurgeMemory() override; |
| bool m_watchingForLoad; |
| + |
| + // |m_element| must points to the corresponding ScriptLoader's element and |
| + // thus must be non-null before dispose() is called. |
| Member<Element> m_element; |
| + |
| TextPosition m_startingPosition; // Only used for inline script tags. |
| bool m_integrityFailure; |
| double m_parserBlockingLoadStartTime; |
| Member<ScriptStreamer> m_streamer; |
| Member<PendingScriptClient> m_client; |
| + |
| + // In unit tests |m_element| can be null. |
|
sof
2017/02/16 08:15:15
nit: null => false
hiroshige
2017/02/17 23:15:15
|m_element| is Member<Element> so it is |null|.
Re
|
| + // This flag is used to skip non-null checks of |m_element| in tests. |
| + const bool m_isForTesting; |
| }; |
| } // namespace blink |