Commit 0f55a080 authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

Add KeepScriptResourceAlive feature and flag

This CL puts the KeepScriptResourceAlive base::Feature under the
blink::features namespace. It also adds a corresponding about:flags
flag, and RuntimeEnabledFeature.

ScriptLoader's behavior depends on the RuntimeEnabledFeature, which is
enabled when the base::Feature is enabled. The base::Feature is enabled
when the corresponding about:flags flag is enabled.

These are the first steps to running experiments with the
KeepScriptResourceAlive feature. A subsequent CL will add to
fieldtrial_testing_conflig.json, so we can control the base::Feature via
Finch.

R=kinuko@chromium.org

Bug: 1043679
Change-Id: Ib7cd83346c6634dad547311100a614cc43e0fce6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2112172Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752772}
parent 7bec3176
...@@ -496,5 +496,8 @@ const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{ ...@@ -496,5 +496,8 @@ const base::FeatureParam<int> kFontPreloadingDelaysRenderingParam{
const base::Feature kFlexNG{"FlexNG", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kFlexNG{"FlexNG", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features } // namespace features
} // namespace blink } // namespace blink
...@@ -164,6 +164,8 @@ BLINK_COMMON_EXPORT extern const base::FeatureParam<int> ...@@ -164,6 +164,8 @@ BLINK_COMMON_EXPORT extern const base::FeatureParam<int>
BLINK_COMMON_EXPORT extern const base::Feature kFlexNG; BLINK_COMMON_EXPORT extern const base::Feature kFlexNG;
BLINK_COMMON_EXPORT extern const base::Feature kKeepScriptResourceAlive;
} // namespace features } // namespace features
} // namespace blink } // namespace blink
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "base/feature_list.h" #include "base/feature_list.h"
#include "third_party/blink/public/common/feature_policy/feature_policy.h" #include "third_party/blink/public/common/feature_policy/feature_policy.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom-blink.h" #include "third_party/blink/public/mojom/feature_policy/feature_policy_feature.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h" #include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
...@@ -72,13 +73,6 @@ ...@@ -72,13 +73,6 @@
namespace blink { namespace blink {
namespace {
const base::Feature kKeepScriptResourceAlive{"KeepScriptResourceAlive",
base::FEATURE_DISABLED_BY_DEFAULT};
}
ScriptLoader::ScriptLoader(ScriptElementBase* element, ScriptLoader::ScriptLoader(ScriptElementBase* element,
bool parser_inserted, bool parser_inserted,
bool already_started) bool already_started)
...@@ -982,7 +976,8 @@ void ScriptLoader::PendingScriptFinished(PendingScript* pending_script) { ...@@ -982,7 +976,8 @@ void ScriptLoader::PendingScriptFinished(PendingScript* pending_script) {
// keep the resource in the memory cache. // keep the resource in the memory cache.
if (resource_keep_alive_ && if (resource_keep_alive_ &&
!resource_keep_alive_->GetResponse().IsSignedExchangeInnerResponse() && !resource_keep_alive_->GetResponse().IsSignedExchangeInnerResponse() &&
!base::FeatureList::IsEnabled(kKeepScriptResourceAlive)) { !base::FeatureList::IsEnabled(
blink::features::kKeepScriptResourceAlive)) {
resource_keep_alive_ = nullptr; resource_keep_alive_ = nullptr;
} }
......
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