OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/dom/PendingScript.h" | 26 #include "core/dom/PendingScript.h" |
27 | 27 |
28 #include "bindings/core/v8/ScriptSourceCode.h" | 28 #include "bindings/core/v8/ScriptSourceCode.h" |
29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
30 #include "bindings/core/v8/V8Binding.h" | 30 #include "bindings/core/v8/V8Binding.h" |
| 31 #include "core/dom/ClassicScript.h" |
31 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
32 #include "core/dom/ScriptElementBase.h" | 33 #include "core/dom/ScriptElementBase.h" |
33 #include "core/dom/TaskRunnerHelper.h" | 34 #include "core/dom/TaskRunnerHelper.h" |
34 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
35 #include "core/frame/SubresourceIntegrity.h" | 36 #include "core/frame/SubresourceIntegrity.h" |
36 #include "platform/SharedBuffer.h" | 37 #include "platform/SharedBuffer.h" |
37 #include "platform/wtf/CurrentTime.h" | 38 #include "platform/wtf/CurrentTime.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 225 } |
225 | 226 |
226 DEFINE_TRACE(PendingScript) { | 227 DEFINE_TRACE(PendingScript) { |
227 visitor->Trace(element_); | 228 visitor->Trace(element_); |
228 visitor->Trace(streamer_); | 229 visitor->Trace(streamer_); |
229 visitor->Trace(client_); | 230 visitor->Trace(client_); |
230 ResourceOwner<ScriptResource>::Trace(visitor); | 231 ResourceOwner<ScriptResource>::Trace(visitor); |
231 MemoryCoordinatorClient::Trace(visitor); | 232 MemoryCoordinatorClient::Trace(visitor); |
232 } | 233 } |
233 | 234 |
234 ScriptSourceCode PendingScript::GetSource(const KURL& document_url, | 235 ClassicScript* PendingScript::GetSource(const KURL& document_url, |
235 bool& error_occurred) const { | 236 bool& error_occurred) const { |
236 CheckState(); | 237 CheckState(); |
237 | 238 |
238 error_occurred = this->ErrorOccurred(); | 239 error_occurred = this->ErrorOccurred(); |
239 if (GetResource()) { | 240 if (GetResource()) { |
240 DCHECK(GetResource()->IsLoaded()); | 241 DCHECK(GetResource()->IsLoaded()); |
241 if (streamer_ && !streamer_->StreamingSuppressed()) | 242 if (streamer_ && !streamer_->StreamingSuppressed()) |
242 return ScriptSourceCode(streamer_, GetResource()); | 243 return ClassicScript::Create(ScriptSourceCode(streamer_, GetResource())); |
243 return ScriptSourceCode(GetResource()); | 244 return ClassicScript::Create(ScriptSourceCode(GetResource())); |
244 } | 245 } |
245 | 246 |
246 return ScriptSourceCode(element_->TextContent(), document_url, | 247 return ClassicScript::Create(ScriptSourceCode( |
247 StartingPosition()); | 248 element_->TextContent(), document_url, StartingPosition())); |
248 } | 249 } |
249 | 250 |
250 void PendingScript::SetStreamer(ScriptStreamer* streamer) { | 251 void PendingScript::SetStreamer(ScriptStreamer* streamer) { |
251 DCHECK(!streamer_); | 252 DCHECK(!streamer_); |
252 DCHECK(!watching_for_load_); | 253 DCHECK(!watching_for_load_); |
253 streamer_ = streamer; | 254 streamer_ = streamer; |
254 CheckState(); | 255 CheckState(); |
255 } | 256 } |
256 | 257 |
257 bool PendingScript::IsReady() const { | 258 bool PendingScript::IsReady() const { |
(...skipping 30 matching lines...) Expand all Loading... |
288 ScriptState* script_state = ToScriptStateForMainWorld(document->GetFrame()); | 289 ScriptState* script_state = ToScriptStateForMainWorld(document->GetFrame()); |
289 if (!script_state) | 290 if (!script_state) |
290 return; | 291 return; |
291 | 292 |
292 ScriptStreamer::StartStreaming( | 293 ScriptStreamer::StartStreaming( |
293 this, streamer_type, document->GetFrame()->GetSettings(), script_state, | 294 this, streamer_type, document->GetFrame()->GetSettings(), script_state, |
294 TaskRunnerHelper::Get(TaskType::kNetworking, document)); | 295 TaskRunnerHelper::Get(TaskType::kNetworking, document)); |
295 } | 296 } |
296 | 297 |
297 } // namespace blink | 298 } // namespace blink |
OLD | NEW |