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 "config.h" | 5 #include "config.h" |
6 #include "bindings/core/v8/ScriptStreamer.h" | 6 #include "bindings/core/v8/ScriptStreamer.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptStreamerThread.h" | 8 #include "bindings/core/v8/ScriptStreamerThread.h" |
9 #include "bindings/core/v8/V8ScriptRunner.h" | 9 #include "bindings/core/v8/V8ScriptRunner.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // to arrive. In general, the web servers don't seem to send the | 538 // to arrive. In general, the web servers don't seem to send the |
539 // Content-Length HTTP header for scripts. | 539 // Content-Length HTTP header for scripts. |
540 | 540 |
541 if (!scriptState->contextIsValid()) | 541 if (!scriptState->contextIsValid()) |
542 return false; | 542 return false; |
543 | 543 |
544 // Decide what kind of cached data we should produce while streaming. By | 544 // Decide what kind of cached data we should produce while streaming. By |
545 // default, we generate the parser cache for streamed scripts, to emulate | 545 // default, we generate the parser cache for streamed scripts, to emulate |
546 // the non-streaming behavior (see V8ScriptRunner::compileScript). | 546 // the non-streaming behavior (see V8ScriptRunner::compileScript). |
547 v8::ScriptCompiler::CompileOptions compileOption = v8::ScriptCompiler::kProd
uceParserCache; | 547 v8::ScriptCompiler::CompileOptions compileOption = v8::ScriptCompiler::kProd
uceParserCache; |
548 if (settings->v8CacheOptions() == V8CacheOptionsCode || settings->v8CacheOpt
ions() == V8CacheOptionsCodeCompressed) | 548 if (settings->v8CacheOptions() == V8CacheOptionsCode) |
549 compileOption = v8::ScriptCompiler::kProduceCodeCache; | 549 compileOption = v8::ScriptCompiler::kProduceCodeCache; |
550 | 550 |
551 // The Resource might go out of scope if the script is no longer | 551 // The Resource might go out of scope if the script is no longer |
552 // needed. This makes PendingScript notify the ScriptStreamer when it is | 552 // needed. This makes PendingScript notify the ScriptStreamer when it is |
553 // destroyed. | 553 // destroyed. |
554 script.setStreamer(adoptRef(new ScriptStreamer(resource, scriptType, setting
s->v8ScriptStreamingMode(), scriptState, compileOption))); | 554 script.setStreamer(adoptRef(new ScriptStreamer(resource, scriptType, setting
s->v8ScriptStreamingMode(), scriptState, compileOption))); |
555 | 555 |
556 return true; | 556 return true; |
557 } | 557 } |
558 | 558 |
559 } // namespace blink | 559 } // namespace blink |
OLD | NEW |