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 #include "bindings/core/v8/ScriptStreamer.h" | 5 #include "bindings/core/v8/ScriptStreamer.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptStreamerThread.h" | 7 #include "bindings/core/v8/ScriptStreamerThread.h" |
8 #include "bindings/core/v8/V8ScriptRunner.h" | 8 #include "bindings/core/v8/V8ScriptRunner.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 recordNotStreamingReasonHistogram(m_scriptType, ScriptTooSmall); | 563 recordNotStreamingReasonHistogram(m_scriptType, ScriptTooSmall); |
564 recordStartedStreamingHistogram(m_scriptType, 0); | 564 recordStartedStreamingHistogram(m_scriptType, 0); |
565 suppressStreaming(); | 565 suppressStreaming(); |
566 } | 566 } |
567 if (m_stream) | 567 if (m_stream) |
568 m_stream->didFinishLoading(); | 568 m_stream->didFinishLoading(); |
569 m_loadingFinished = true; | 569 m_loadingFinished = true; |
570 | 570 |
571 // Calling notifyFinishedToClient can result into the upper layers dropping | 571 // Calling notifyFinishedToClient can result into the upper layers dropping |
572 // references to ScriptStreamer. Keep it alive until this function ends. | 572 // references to ScriptStreamer. Keep it alive until this function ends. |
573 RefPtrWillBeRawPtr<ScriptStreamer> protect(this); | 573 RawPtr<ScriptStreamer> protect(this); |
574 | 574 |
575 notifyFinishedToClient(); | 575 notifyFinishedToClient(); |
576 } | 576 } |
577 | 577 |
578 ScriptStreamer::ScriptStreamer(PendingScript* script, Type scriptType, ScriptSta
te* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunne
r* loadingTaskRunner) | 578 ScriptStreamer::ScriptStreamer(PendingScript* script, Type scriptType, ScriptSta
te* scriptState, v8::ScriptCompiler::CompileOptions compileOptions, WebTaskRunne
r* loadingTaskRunner) |
579 : m_pendingScript(script) | 579 : m_pendingScript(script) |
580 , m_resource(script->resource()) | 580 , m_resource(script->resource()) |
581 , m_detached(false) | 581 , m_detached(false) |
582 , m_stream(0) | 582 , m_stream(0) |
583 , m_loadingFinished(false) | 583 , m_loadingFinished(false) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 678 |
679 // The Resource might go out of scope if the script is no longer | 679 // The Resource might go out of scope if the script is no longer |
680 // needed. This makes PendingScript notify the ScriptStreamer when it is | 680 // needed. This makes PendingScript notify the ScriptStreamer when it is |
681 // destroyed. | 681 // destroyed. |
682 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); | 682 script->setStreamer(ScriptStreamer::create(script, scriptType, scriptState,
compileOption, loadingTaskRunner)); |
683 | 683 |
684 return true; | 684 return true; |
685 } | 685 } |
686 | 686 |
687 } // namespace blink | 687 } // namespace blink |
OLD | NEW |