Commit 7c10d9bb authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[blink] Stream scripts on preload

Start streaming ScriptResources when they are fetched, so that they
can start streaming during preload, before the script tag is seen.
This is enabled with a new ScriptStreamingOnPreload flag.

Bug: chromium:865098
Change-Id: I4a2874bce857a538f4bd35a818254ca9617f1a72
Reviewed-on: https://chromium-review.googlesource.com/c/1185185
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610370}
parent b6bfa2b7
......@@ -413,6 +413,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs(
WebRuntimeFeatures::EnableScheduledScriptStreaming(
base::FeatureList::IsEnabled(features::kScheduledScriptStreaming));
WebRuntimeFeatures::EnableScriptStreamingOnPreload(
base::FeatureList::IsEnabled(features::kScriptStreamingOnPreload));
WebRuntimeFeatures::EnableMergeBlockingNonBlockingPools(
base::FeatureList::IsEnabled(base::kMergeBlockingNonBlockingPools));
......
......@@ -620,6 +620,10 @@ const base::Feature kWorkStealingInScriptRunner{
const base::Feature kScheduledScriptStreaming{
"ScheduledScriptStreaming", base::FEATURE_DISABLED_BY_DEFAULT};
// Start streaming scripts on script preload.
const base::Feature kScriptStreamingOnPreload{
"ScriptStreamingOnPreload", base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_ANDROID)
// Autofill Accessibility in Android.
// crbug.com/627860
......
......@@ -138,6 +138,7 @@ CONTENT_EXPORT extern const base::Feature kWebXrOrientationSensorDevice;
CONTENT_EXPORT extern const base::Feature kWipeCorruptV2IDBDatabases;
CONTENT_EXPORT extern const base::Feature kWorkStealingInScriptRunner;
CONTENT_EXPORT extern const base::Feature kScheduledScriptStreaming;
CONTENT_EXPORT extern const base::Feature kScriptStreamingOnPreload;
#if defined(OS_ANDROID)
CONTENT_EXPORT extern const base::Feature kAndroidAutofillAccessibility;
......
......@@ -356,6 +356,8 @@ crbug.com/826957 fast/peerconnection/RTCPeerConnection-manyCandidates.html [ Slo
crbug.com/842995 external/wpt/html/semantics/scripting-1/the-script-element/execution-timing/078.html [ Slow ]
crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/async_007.htm [ Slow ]
crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/async_010.htm [ Slow ]
crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/async_007.htm [ Slow ]
crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/async_010.htm [ Slow ]
crbug.com/840792 [ Mac10.12 Mac10.13 ] external/wpt/pointerevents/pointerevent_touch-action-table-test_touch-manual.html [ Slow ]
......
......@@ -3312,6 +3312,8 @@ crbug.com/626703 external/wpt/websockets/Create-Secure-extensions-empty.any.html
crbug.com/626703 external/wpt/websockets/Create-Secure-extensions-empty.any.worker.html [ Timeout ]
crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-integrity-classic.sub.html [ Skip ]
crbug.com/626703 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-integrity-module.sub.html [ Skip ]
crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-integrity-classic.sub.html [ Skip ]
crbug.com/626703 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-integrity-module.sub.html [ Skip ]
crbug.com/626703 external/wpt/html/browsers/history/joint-session-history/joint-session-history-remove-iframe.html [ Timeout ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-flex-basis-content-003a.html [ Failure ]
crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-flex-basis-content-004a.html [ Failure ]
......@@ -4263,6 +4265,7 @@ crbug.com/734762 inspector-protocol/timeline/page-frames.js [ Failure Pass ]
# module script lacks XHTML support
crbug.com/717643 external/wpt/html/semantics/scripting-1/the-script-element/module/module-in-xhtml.xhtml [ Failure ]
crbug.com/717643 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/module-in-xhtml.xhtml [ Failure ]
# known bug: import() inside set{Timeout,Interval}
......@@ -4271,6 +4274,10 @@ crbug.com/796034 external/wpt/html/semantics/scripting-1/the-script-element/modu
crbug.com/796034 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-external-module.html [ Failure ]
crbug.com/796034 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-classic.html [ Failure ]
crbug.com/796034 external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-module.html [ Failure ]
crbug.com/796034 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-external-classic.html [ Failure ]
crbug.com/796034 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-external-module.html [ Failure ]
crbug.com/796034 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-classic.html [ Failure ]
crbug.com/796034 virtual/streaming-preload/external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-module.html [ Failure ]
# Geolocation tests
crbug.com/745079 external/wpt/geolocation-API/PositionOptions.https.html [ Failure ]
......
......@@ -1026,5 +1026,15 @@
"prefix": "transferable-streams",
"base": "http/tests/streams/transferable",
"args": ["--enable-blink-features=TransferableStreams"]
},
{
"prefix": "streaming-preload",
"base": "http/tests/fetch",
"args": ["--enable-features=ScriptStreamingOnPreload"]
},
{
"prefix": "streaming-preload",
"base": "external/wpt/html/semantics/scripting-1",
"args": ["--enable-features=ScriptStreamingOnPreload"]
}
]
# This suite runs the tests in external/wpt/html/semantics/scripting-1 with the
# flag --enable-feature=ScriptStreamingOnPreload
\ No newline at end of file
# This suite runs the tests in http/tests/fetch with the flag
# --enable-feature=ScriptStreamingOnPreload
\ No newline at end of file
......@@ -206,6 +206,7 @@ class WebRuntimeFeatures {
BLINK_PLATFORM_EXPORT static void EnableAutomationControlled(bool);
BLINK_PLATFORM_EXPORT static void EnableWorkStealingInScriptRunner(bool);
BLINK_PLATFORM_EXPORT static void EnableScheduledScriptStreaming(bool);
BLINK_PLATFORM_EXPORT static void EnableScriptStreamingOnPreload(bool);
BLINK_PLATFORM_EXPORT static void EnableExperimentalProductivityFeatures(
bool);
BLINK_PLATFORM_EXPORT static void EnableAutoplayIgnoresWebAudio(bool);
......
......@@ -42,6 +42,7 @@
#include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h"
#include "third_party/blink/renderer/platform/loader/subresource_integrity.h"
#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/shared_buffer.h"
namespace blink {
......@@ -80,7 +81,12 @@ ScriptResource* ScriptResource::Fetch(FetchParameters& params,
ScriptResource* resource = ToScriptResource(
fetcher->RequestResource(params, ScriptResourceFactory(), client));
if (streaming_allowed != kAllowStreaming) {
if (streaming_allowed == kAllowStreaming) {
// Start streaming the script as soon as we get it.
if (RuntimeEnabledFeatures::ScriptStreamingOnPreloadEnabled()) {
resource->StartStreaming(fetcher->Context().GetLoadingTaskRunner());
}
} else {
// Advance the |streaming_state_| to kStreamingNotAllowed by calling
// SetClientIsWaitingForFinished unless it is explicitly allowed.'
//
......
......@@ -552,6 +552,10 @@ void WebRuntimeFeatures::EnableScheduledScriptStreaming(bool enable) {
RuntimeEnabledFeatures::SetScheduledScriptStreamingEnabled(enable);
}
void WebRuntimeFeatures::EnableScriptStreamingOnPreload(bool enable) {
RuntimeEnabledFeatures::SetScriptStreamingOnPreloadEnabled(enable);
}
void WebRuntimeFeatures::EnableExperimentalProductivityFeatures(bool enable) {
RuntimeEnabledFeatures::SetExperimentalProductivityFeaturesEnabled(enable);
}
......
......@@ -1097,6 +1097,9 @@
name: "ScriptedSpeechSynthesis",
status: "stable",
},
{
name: "ScriptStreamingOnPreload",
},
// Serialize and restore scroll anchors.
{
name: "ScrollAnchorSerialization",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment