Commit e140bdce authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Move tokenization budget to static

The query to GetFieldTrialParamByFeatureAsInt() caused a small
perf regression when repeatedly calling innerHTML. This
should fix that regression.

Fixed: 1130177
Change-Id: I9ca7bb8c8d99f65bfa435e3b8df8d83e4eee8b1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422520
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Yu Han <yuzhehan@chromium.org>
Reviewed-by: default avatarYu Han <yuzhehan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809094}
parent 69fbb966
......@@ -264,6 +264,15 @@ HTMLDocumentParser::HTMLDocumentParser(
context_element, report_errors, options_));
}
namespace {
int GetMaxTokenizationBudget() {
static int max = base::GetFieldTrialParamByFeatureAsInt(
features::kForceSynchronousHTMLParsing, "MaxTokenizationBudget",
kDefaultMaxTokenizationBudget);
return max;
}
} // namespace
HTMLDocumentParser::HTMLDocumentParser(Document& document,
ParserContentPolicy content_policy,
ParserSynchronizationPolicy sync_policy)
......@@ -319,9 +328,7 @@ HTMLDocumentParser::HTMLDocumentParser(Document& document,
document.UkmSourceID(), document.UkmRecorder());
}
max_tokenization_budget_ = base::GetFieldTrialParamByFeatureAsInt(
features::kForceSynchronousHTMLParsing, "MaxTokenizationBudget",
kDefaultMaxTokenizationBudget);
max_tokenization_budget_ = GetMaxTokenizationBudget();
// Don't create preloader for parsing clipboard content.
if (content_policy == kDisallowScriptingAndPluginContent)
......
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