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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "platform/wtf/Noncopyable.h" | 12 #include "platform/wtf/Noncopyable.h" |
13 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class Resource; | 17 class Resource; |
18 class ScriptResource; | 18 class ScriptResource; |
19 | 19 |
20 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed | 20 // ScriptStreamer streams incomplete script data to V8 so that it can be parsed |
21 // while it's loaded. PendingScript holds a reference to ScriptStreamer. At the | 21 // while it's loaded. ClassicPendingScript holds a reference to ScriptStreamer. |
22 // moment, ScriptStreamer is only used for parser blocking scripts; this means | 22 // At the moment, ScriptStreamer is only used for parser blocking scripts; this |
23 // that the Document stays stable and no other scripts are executing while we're | 23 // means that the Document stays stable and no other scripts are executing |
24 // streaming. It is possible, though, that Document and the PendingScript are | 24 // while we're streaming. It is possible, though, that Document and the |
25 // destroyed while the streaming is in progress, and ScriptStreamer handles it | 25 // ClassicPendingScript are destroyed while the streaming is in progress, and |
26 // gracefully. | 26 // ScriptStreamer handles it gracefully. |
27 // | 27 // |
28 // ScriptStreamer is abstract just to implement unit tests. ScriptStreamerImpl | 28 // ScriptStreamer is abstract just to implement unit tests. ScriptStreamerImpl |
29 // is the only subclass in non-test code that implements the functionality. | 29 // is the only subclass in non-test code that implements the functionality. |
30 class CORE_EXPORT ScriptStreamer | 30 class CORE_EXPORT ScriptStreamer |
31 : public GarbageCollectedFinalized<ScriptStreamer> { | 31 : public GarbageCollectedFinalized<ScriptStreamer> { |
32 WTF_MAKE_NONCOPYABLE(ScriptStreamer); | 32 WTF_MAKE_NONCOPYABLE(ScriptStreamer); |
33 | 33 |
34 public: | 34 public: |
35 enum Type { kParsingBlocking, kDeferred, kAsync }; | 35 enum Type { kParsingBlocking, kDeferred, kAsync }; |
36 | 36 |
(...skipping 22 matching lines...) Expand all Loading... |
59 virtual bool StreamingSuppressed() const = 0; | 59 virtual bool StreamingSuppressed() const = 0; |
60 | 60 |
61 // Called by ClassicPendingScript when data arrives from the network. | 61 // Called by ClassicPendingScript when data arrives from the network. |
62 virtual void NotifyAppendData(ScriptResource*) = 0; | 62 virtual void NotifyAppendData(ScriptResource*) = 0; |
63 virtual void NotifyFinished(Resource*) = 0; | 63 virtual void NotifyFinished(Resource*) = 0; |
64 }; | 64 }; |
65 | 65 |
66 } // namespace blink | 66 } // namespace blink |
67 | 67 |
68 #endif // ScriptStreamer_h | 68 #endif // ScriptStreamer_h |
OLD | NEW |