OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ScriptStreamer_h | 5 #ifndef ScriptStreamer_h |
6 #define ScriptStreamer_h | 6 #define ScriptStreamer_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "wtf/RefCounted.h" | 10 #include "wtf/Noncopyable.h" |
11 #include "wtf/text/WTFString.h" | 11 #include "wtf/text/WTFString.h" |
12 | 12 |
13 #include <v8.h> | 13 #include <v8.h> |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class PendingScript; | 17 class PendingScript; |
18 class Resource; | 18 class Resource; |
19 class ScriptResource; | 19 class ScriptResource; |
20 class ScriptState; | 20 class ScriptState; |
21 class Settings; | 21 class Settings; |
22 class SourceStream; | 22 class SourceStream; |
23 class WebTaskRunner; | 23 class WebTaskRunner; |
24 | 24 |
25 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed | 25 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed |
26 // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the | 26 // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the |
27 // moment, ScriptStreamer is only used for parser blocking scripts; this means | 27 // moment, ScriptStreamer is only used for parser blocking scripts; this means |
28 // that the Document stays stable and no other scripts are executing while we're | 28 // that the Document stays stable and no other scripts are executing while we're |
29 // streaming. It is possible, though, that Document and the PendingScript are | 29 // streaming. It is possible, though, that Document and the PendingScript are |
30 // destroyed while the streaming is in progress, and ScriptStreamer handles it | 30 // destroyed while the streaming is in progress, and ScriptStreamer handles it |
31 // gracefully. | 31 // gracefully. |
32 class CORE_EXPORT ScriptStreamer final : public RefCountedGarbageCollected<Scrip
tStreamer> { | 32 class CORE_EXPORT ScriptStreamer final : public GarbageCollectedFinalized<Script
Streamer> { |
33 WTF_MAKE_NONCOPYABLE(ScriptStreamer); | 33 WTF_MAKE_NONCOPYABLE(ScriptStreamer); |
34 public: | 34 public: |
35 enum Type { | 35 enum Type { |
36 ParsingBlocking, | 36 ParsingBlocking, |
37 Deferred, | 37 Deferred, |
38 Async | 38 Async |
39 }; | 39 }; |
40 | 40 |
41 ~ScriptStreamer(); | 41 ~ScriptStreamer(); |
42 DECLARE_TRACE(); | 42 DECLARE_TRACE(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // Encoding of the streamed script. Saved for sanity checking purposes. | 151 // Encoding of the streamed script. Saved for sanity checking purposes. |
152 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; | 152 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; |
153 | 153 |
154 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 154 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
155 }; | 155 }; |
156 | 156 |
157 } // namespace blink | 157 } // namespace blink |
158 | 158 |
159 #endif // ScriptStreamer_h | 159 #endif // ScriptStreamer_h |
OLD | NEW |