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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 bool ScriptStreamer::startStreamingInternal(PendingScript& script, Settings* set
tings, ScriptState* scriptState, PendingScript::Type scriptType) | 499 bool ScriptStreamer::startStreamingInternal(PendingScript& script, Settings* set
tings, ScriptState* scriptState, PendingScript::Type scriptType) |
500 { | 500 { |
501 ASSERT(isMainThread()); | 501 ASSERT(isMainThread()); |
502 if (!settings || !settings->v8ScriptStreamingEnabled()) | 502 if (!settings || !settings->v8ScriptStreamingEnabled()) |
503 return false; | 503 return false; |
504 if (settings->v8ScriptStreamingMode() == ScriptStreamingModeOnlyAsyncAndDefe
r | 504 if (settings->v8ScriptStreamingMode() == ScriptStreamingModeOnlyAsyncAndDefe
r |
505 && scriptType == PendingScript::ParsingBlocking) | 505 && scriptType == PendingScript::ParsingBlocking) |
506 return false; | 506 return false; |
507 | 507 |
508 ScriptResource* resource = script.resource(); | 508 ScriptResource* resource = script.resource(); |
509 ASSERT(!resource->isLoaded()); | 509 if (resource->isLoaded()) |
| 510 return false; |
510 if (!resource->url().protocolIsInHTTPFamily()) | 511 if (!resource->url().protocolIsInHTTPFamily()) |
511 return false; | 512 return false; |
512 if (resource->resourceToRevalidate()) { | 513 if (resource->resourceToRevalidate()) { |
513 // This happens e.g., during reloads. We're actually not going to load | 514 // This happens e.g., during reloads. We're actually not going to load |
514 // the current Resource of the PendingScript but switch to another | 515 // the current Resource of the PendingScript but switch to another |
515 // Resource -> don't stream. | 516 // Resource -> don't stream. |
516 return false; | 517 return false; |
517 } | 518 } |
518 // We cannot filter out short scripts, even if we wait for the HTTP headers | 519 // We cannot filter out short scripts, even if we wait for the HTTP headers |
519 // to arrive. In general, the web servers don't seem to send the | 520 // to arrive. In general, the web servers don't seem to send the |
(...skipping 11 matching lines...) Expand all Loading... |
531 | 532 |
532 // The Resource might go out of scope if the script is no longer | 533 // The Resource might go out of scope if the script is no longer |
533 // needed. This makes PendingScript notify the ScriptStreamer when it is | 534 // needed. This makes PendingScript notify the ScriptStreamer when it is |
534 // destroyed. | 535 // destroyed. |
535 script.setStreamer(adoptRef(new ScriptStreamer(resource, scriptType, setting
s->v8ScriptStreamingMode(), scriptState, compileOption))); | 536 script.setStreamer(adoptRef(new ScriptStreamer(resource, scriptType, setting
s->v8ScriptStreamingMode(), scriptState, compileOption))); |
536 | 537 |
537 return true; | 538 return true; |
538 } | 539 } |
539 | 540 |
540 } // namespace blink | 541 } // namespace blink |
OLD | NEW |