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/RefCounted.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void notifyFinished(Resource*); | 96 void notifyFinished(Resource*); |
97 | 97 |
98 // Called by ScriptStreamingTask when it has streamed all data to V8 and V8 | 98 // Called by ScriptStreamingTask when it has streamed all data to V8 and V8 |
99 // has processed it. | 99 // has processed it. |
100 void streamingCompleteOnBackgroundThread(); | 100 void streamingCompleteOnBackgroundThread(); |
101 | 101 |
102 v8::ScriptCompiler::StreamedSource::Encoding encoding() const { return m_enc
oding; } | 102 v8::ScriptCompiler::StreamedSource::Encoding encoding() const { return m_enc
oding; } |
103 | 103 |
104 static void setSmallScriptThresholdForTesting(size_t threshold) | 104 static void setSmallScriptThresholdForTesting(size_t threshold) |
105 { | 105 { |
106 kSmallScriptThreshold = threshold; | 106 s_smallScriptThreshold = threshold; |
107 } | 107 } |
108 | 108 |
109 static size_t smallScriptThreshold() { return kSmallScriptThreshold; } | 109 static size_t smallScriptThreshold() { return s_smallScriptThreshold; } |
110 | 110 |
111 private: | 111 private: |
112 // Scripts whose first data chunk is smaller than this constant won't be | 112 // Scripts whose first data chunk is smaller than this constant won't be |
113 // streamed. Non-const for testing. | 113 // streamed. Non-const for testing. |
114 static size_t kSmallScriptThreshold; | 114 static size_t s_smallScriptThreshold; |
115 | 115 |
116 ScriptStreamer(ScriptResource*, Type, ScriptState*, v8::ScriptCompiler::Comp
ileOptions, WebTaskRunner*); | 116 ScriptStreamer(ScriptResource*, Type, ScriptState*, v8::ScriptCompiler::Comp
ileOptions, WebTaskRunner*); |
117 | 117 |
118 void streamingComplete(); | 118 void streamingComplete(); |
119 void notifyFinishedToClient(); | 119 void notifyFinishedToClient(); |
120 | 120 |
121 static bool startStreamingInternal(PendingScript*, Type, Settings*, ScriptSt
ate*, WebTaskRunner*); | 121 static bool startStreamingInternal(PendingScript*, Type, Settings*, ScriptSt
ate*, WebTaskRunner*); |
122 | 122 |
123 // This pointer is weak. If PendingScript and its Resource are deleted | 123 // This pointer is weak. If PendingScript and its Resource are deleted |
124 // before ScriptStreamer, PendingScript will notify ScriptStreamer of its | 124 // before ScriptStreamer, PendingScript will notify ScriptStreamer of its |
(...skipping 30 matching lines...) Expand all Loading... |
155 | 155 |
156 // Encoding of the streamed script. Saved for sanity checking purposes. | 156 // Encoding of the streamed script. Saved for sanity checking purposes. |
157 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; | 157 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; |
158 | 158 |
159 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 159 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
160 }; | 160 }; |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
163 | 163 |
164 #endif // ScriptStreamer_h | 164 #endif // ScriptStreamer_h |
OLD | NEW |