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 "platform/weborigin/KURL.h" | |
10 #include "wtf/RefCounted.h" | 11 #include "wtf/RefCounted.h" |
11 | 12 |
12 #include <v8.h> | 13 #include <v8.h> |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class PendingScript; | 17 class PendingScript; |
17 class Resource; | 18 class Resource; |
18 class ScriptResource; | 19 class ScriptResource; |
19 class ScriptState; | 20 class ScriptState; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 // Called by PendingScript when data arrives from the network. | 76 // Called by PendingScript when data arrives from the network. |
76 void notifyAppendData(ScriptResource*); | 77 void notifyAppendData(ScriptResource*); |
77 void notifyFinished(Resource*); | 78 void notifyFinished(Resource*); |
78 | 79 |
79 // Called by ScriptStreamingTask when it has streamed all data to V8 and V8 | 80 // Called by ScriptStreamingTask when it has streamed all data to V8 and V8 |
80 // has processed it. | 81 // has processed it. |
81 void streamingCompleteOnBackgroundThread(); | 82 void streamingCompleteOnBackgroundThread(); |
82 | 83 |
83 v8::ScriptCompiler::StreamedSource::Encoding encoding() const { return m_enc oding; } | 84 v8::ScriptCompiler::StreamedSource::Encoding encoding() const { return m_enc oding; } |
84 | 85 |
86 const KURL& scriptURL() const { return m_scriptURL; } | |
caseq
2016/03/18 23:36:04
We only care for the string representation of URL,
horo
2016/03/23 07:06:05
Done.
| |
87 | |
85 static void setSmallScriptThresholdForTesting(size_t threshold) | 88 static void setSmallScriptThresholdForTesting(size_t threshold) |
86 { | 89 { |
87 s_smallScriptThreshold = threshold; | 90 s_smallScriptThreshold = threshold; |
88 } | 91 } |
89 | 92 |
90 static size_t smallScriptThreshold() { return s_smallScriptThreshold; } | 93 static size_t smallScriptThreshold() { return s_smallScriptThreshold; } |
91 | 94 |
92 private: | 95 private: |
93 // Scripts whose first data chunk is smaller than this constant won't be | 96 // Scripts whose first data chunk is smaller than this constant won't be |
94 // streamed. Non-const for testing. | 97 // streamed. Non-const for testing. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 bool m_streamingSuppressed; | 132 bool m_streamingSuppressed; |
130 | 133 |
131 // What kind of cached data V8 produces during streaming. | 134 // What kind of cached data V8 produces during streaming. |
132 v8::ScriptCompiler::CompileOptions m_compileOptions; | 135 v8::ScriptCompiler::CompileOptions m_compileOptions; |
133 | 136 |
134 RefPtr<ScriptState> m_scriptState; | 137 RefPtr<ScriptState> m_scriptState; |
135 | 138 |
136 // For recording metrics for different types of scripts separately. | 139 // For recording metrics for different types of scripts separately. |
137 Type m_scriptType; | 140 Type m_scriptType; |
138 | 141 |
142 // Keep the script URL for event tracing. | |
143 KURL m_scriptURL; | |
144 | |
139 mutable Mutex m_mutex; | 145 mutable Mutex m_mutex; |
140 | 146 |
141 // Encoding of the streamed script. Saved for sanity checking purposes. | 147 // Encoding of the streamed script. Saved for sanity checking purposes. |
142 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; | 148 v8::ScriptCompiler::StreamedSource::Encoding m_encoding; |
143 | 149 |
144 OwnPtr<WebTaskRunner> m_loadingTaskRunner; | 150 OwnPtr<WebTaskRunner> m_loadingTaskRunner; |
145 }; | 151 }; |
146 | 152 |
147 } // namespace blink | 153 } // namespace blink |
148 | 154 |
149 #endif // ScriptStreamer_h | 155 #endif // ScriptStreamer_h |
OLD | NEW |