OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ClassicPendingScript_h | 5 #ifndef ClassicPendingScript_h |
6 #define ClassicPendingScript_h | 6 #define ClassicPendingScript_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptStreamer.h" | 8 #include "bindings/core/v8/ScriptStreamer.h" |
9 #include "core/dom/ClassicScript.h" | 9 #include "core/dom/ClassicScript.h" |
10 #include "core/dom/PendingScript.h" | 10 #include "core/dom/PendingScript.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // also register ClassicPendingScript::Dispose() as the prefinalizer of | 32 // also register ClassicPendingScript::Dispose() as the prefinalizer of |
33 // ClassicPendingScript here. https://crbug.com/711703 | 33 // ClassicPendingScript here. https://crbug.com/711703 |
34 USING_PRE_FINALIZER(ClassicPendingScript, Dispose); | 34 USING_PRE_FINALIZER(ClassicPendingScript, Dispose); |
35 | 35 |
36 public: | 36 public: |
37 // For script from an external file. | 37 // For script from an external file. |
38 static ClassicPendingScript* Create(ScriptElementBase*, ScriptResource*); | 38 static ClassicPendingScript* Create(ScriptElementBase*, ScriptResource*); |
39 // For inline script. | 39 // For inline script. |
40 static ClassicPendingScript* Create(ScriptElementBase*, const TextPosition&); | 40 static ClassicPendingScript* Create(ScriptElementBase*, const TextPosition&); |
41 | 41 |
42 static ClassicPendingScript* CreateForTesting(ScriptResource*); | |
43 | |
44 ~ClassicPendingScript() override; | 42 ~ClassicPendingScript() override; |
45 | 43 |
46 void SetStreamer(ScriptStreamer*); | 44 void SetStreamer(ScriptStreamer*); |
47 void StreamingFinished(); | 45 void StreamingFinished(); |
48 | 46 |
49 DECLARE_TRACE(); | 47 DECLARE_TRACE(); |
50 | 48 |
51 blink::ScriptType GetScriptType() const override { | 49 blink::ScriptType GetScriptType() const override { |
52 return blink::ScriptType::kClassic; | 50 return blink::ScriptType::kClassic; |
53 } | 51 } |
(...skipping 11 matching lines...) Expand all Loading... |
65 | 63 |
66 // Just used as the prefinalizer, does the same as PendingScript::Dispose(). | 64 // Just used as the prefinalizer, does the same as PendingScript::Dispose(). |
67 // We define Dispose() with NOINLINE in ClassicPendingScript just to make | 65 // We define Dispose() with NOINLINE in ClassicPendingScript just to make |
68 // the prefinalizers of PendingScript and ClassicPendingScript have | 66 // the prefinalizers of PendingScript and ClassicPendingScript have |
69 // different addresses to avoid assertion failures on Windows test bots. | 67 // different addresses to avoid assertion failures on Windows test bots. |
70 void Dispose(); | 68 void Dispose(); |
71 | 69 |
72 private: | 70 private: |
73 ClassicPendingScript(ScriptElementBase*, | 71 ClassicPendingScript(ScriptElementBase*, |
74 ScriptResource*, | 72 ScriptResource*, |
75 const TextPosition&, | 73 const TextPosition&); |
76 bool is_for_testing = false); | |
77 ClassicPendingScript() = delete; | 74 ClassicPendingScript() = delete; |
78 | 75 |
79 void CheckState() const override; | 76 void CheckState() const override; |
80 | 77 |
81 // ScriptResourceClient | 78 // ScriptResourceClient |
82 void NotifyFinished(Resource*) override; | 79 void NotifyFinished(Resource*) override; |
83 String DebugName() const override { return "PendingScript"; } | 80 String DebugName() const override { return "PendingScript"; } |
84 void NotifyAppendData(ScriptResource*) override; | 81 void NotifyAppendData(ScriptResource*) override; |
85 | 82 |
86 // MemoryCoordinatorClient | 83 // MemoryCoordinatorClient |
87 void OnPurgeMemory() override; | 84 void OnPurgeMemory() override; |
88 | 85 |
89 bool integrity_failure_; | 86 bool integrity_failure_; |
90 | 87 |
91 Member<ScriptStreamer> streamer_; | 88 Member<ScriptStreamer> streamer_; |
92 | |
93 // This flag is used to skip non-null checks of |m_element| in unit | |
94 // tests, because |m_element| can be null in unit tests. | |
95 const bool is_for_testing_; | |
96 }; | 89 }; |
97 | 90 |
98 } // namespace blink | 91 } // namespace blink |
99 | 92 |
100 #endif // PendingScript_h | 93 #endif // PendingScript_h |
OLD | NEW |