Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamer.cpp

Issue 1398523004: Revalidate using the same Resource, attempt #3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 ASSERT(scriptState->contextIsValid()); 643 ASSERT(scriptState->contextIsValid());
644 ScriptResource* resource = script.resource(); 644 ScriptResource* resource = script.resource();
645 if (resource->isLoaded()) { 645 if (resource->isLoaded()) {
646 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), AlreadyLoaded, NotStreamingReasonEnd); 646 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), AlreadyLoaded, NotStreamingReasonEnd);
647 return false; 647 return false;
648 } 648 }
649 if (!resource->url().protocolIsInHTTPFamily()) { 649 if (!resource->url().protocolIsInHTTPFamily()) {
650 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), NotHTTP, NotStreamingReasonEnd); 650 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), NotHTTP, NotStreamingReasonEnd);
651 return false; 651 return false;
652 } 652 }
653 if (resource->resourceToRevalidate()) { 653 if (resource->isCacheValidator()) {
654 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), Reload, NotStreamingReasonEnd); 654 Platform::current()->histogramEnumeration(notStreamingReasonHistogramNam e(scriptType), Reload, NotStreamingReasonEnd);
655 // This happens e.g., during reloads. We're actually not going to load 655 // This happens e.g., during reloads. We're actually not going to load
656 // the current Resource of the PendingScript but switch to another 656 // the current Resource of the PendingScript but switch to another
657 // Resource -> don't stream. 657 // Resource -> don't stream.
658 return false; 658 return false;
659 } 659 }
660 // We cannot filter out short scripts, even if we wait for the HTTP headers 660 // We cannot filter out short scripts, even if we wait for the HTTP headers
661 // to arrive: the Content-Length HTTP header is not sent for chunked 661 // to arrive: the Content-Length HTTP header is not sent for chunked
662 // downloads. 662 // downloads.
663 663
664 // Decide what kind of cached data we should produce while streaming. Only 664 // Decide what kind of cached data we should produce while streaming. Only
665 // produce parser cache if the non-streaming compile takes advantage of it. 665 // produce parser cache if the non-streaming compile takes advantage of it.
666 v8::ScriptCompiler::CompileOptions compileOption = v8::ScriptCompiler::kNoCo mpileOptions; 666 v8::ScriptCompiler::CompileOptions compileOption = v8::ScriptCompiler::kNoCo mpileOptions;
667 if (settings->v8CacheOptions() == V8CacheOptionsParse) 667 if (settings->v8CacheOptions() == V8CacheOptionsParse)
668 compileOption = v8::ScriptCompiler::kProduceParserCache; 668 compileOption = v8::ScriptCompiler::kProduceParserCache;
669 669
670 // The Resource might go out of scope if the script is no longer 670 // The Resource might go out of scope if the script is no longer
671 // needed. This makes PendingScript notify the ScriptStreamer when it is 671 // needed. This makes PendingScript notify the ScriptStreamer when it is
672 // destroyed. 672 // destroyed.
673 script.setStreamer(ScriptStreamer::create(resource, scriptType, scriptState, compileOption, loadingTaskRunner)); 673 script.setStreamer(ScriptStreamer::create(resource, scriptType, scriptState, compileOption, loadingTaskRunner));
674 674
675 return true; 675 return true;
676 } 676 }
677 677
678 } // namespace blink 678 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698