Commit 556b0762 authored by Alex Keng's avatar Alex Keng Committed by Commit Bot

Fix memory leak caused by using SVG in the UA stylesheet

The leak detector (enabled by --enable-leak-detection) complains because
the SVG images created and owned by the UA style sheet are not free'ed
at the end of the tests but it's expected because the UA style sheet is
a singleton (DEFINE_STATIC_LOCAL) and the SVG images will never be
free'ed while a renderer is alive.

Since the leak detector is not interested in anything referenced from
CSSDefaultStyleSheets [1], this CL addresses the leak by re-creating
the default style sheet in CSSDefaultStyleSheets::PrepareForLeakDetection
to clean up the SVG resources before the leak detection.

This CL also sets flattenhtml=true for IDR_UASTYLE_THEME_CONTROLS_REFRESH_CSS,
which was reverted by [2] due to the memory leak. (The reverted CL [3]
will be re-landed in a separate CL)

TestExpectations is also updated to re-enable password tests which was
disabled due to the memory leak.

[1] discussion on memory-dev:
https://groups.google.com/a/chromium.org/d/topic/memory-dev/LwiD2RBqUpg/discussion
[2] https://chromium-review.googlesource.com/c/chromium/src/+/1722789
[3] https://chromium-review.googlesource.com/c/chromium/src/+/1716161

Bug: 988232
Change-Id: I2f289e90f7c16cfe23f501ddc19ea219be7c5bbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1772657
Commit-Queue: Alex Keng <shihken@microsoft.com>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690814}
parent 16e21176
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<include name="IDR_UASTYLE_THEME_INPUT_MULTIPLE_FIELDS_CSS" file="../renderer/core/html/resources/input_multiple_fields.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_INPUT_MULTIPLE_FIELDS_CSS" file="../renderer/core/html/resources/input_multiple_fields.css" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_THEME_WIN_CSS" file="../renderer/core/html/resources/win.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_WIN_CSS" file="../renderer/core/html/resources/win.css" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_THEME_WIN_QUIRKS_CSS" file="../renderer/core/html/resources/win_quirks.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_WIN_QUIRKS_CSS" file="../renderer/core/html/resources/win_quirks.css" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_THEME_CONTROLS_REFRESH_CSS" file="../renderer/core/html/resources/controls_refresh.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_CONTROLS_REFRESH_CSS" file="../renderer/core/html/resources/controls_refresh.css" flattenhtml="true" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_THEME_FORCED_COLORS_CSS" file="../renderer/core/html/resources/forced_colors.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_THEME_FORCED_COLORS_CSS" file="../renderer/core/html/resources/forced_colors.css" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_SVG_CSS" file="../renderer/core/css/svg.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_SVG_CSS" file="../renderer/core/css/svg.css" type="BINDATA" compress="gzip"/>
<include name="IDR_UASTYLE_MATHML_CSS" file="../renderer/core/css/mathml.css" type="BINDATA" compress="gzip"/> <include name="IDR_UASTYLE_MATHML_CSS" file="../renderer/core/css/mathml.css" type="BINDATA" compress="gzip"/>
......
...@@ -120,6 +120,11 @@ void CSSDefaultStyleSheets::PrepareForLeakDetection() { ...@@ -120,6 +120,11 @@ void CSSDefaultStyleSheets::PrepareForLeakDetection() {
mathml_style_sheet_.Clear(); mathml_style_sheet_.Clear();
media_controls_style_sheet_.Clear(); media_controls_style_sheet_.Clear();
fullscreen_style_sheet_.Clear(); fullscreen_style_sheet_.Clear();
// Recreate the default style sheet to clean up possible SVG resources.
String default_rules = UncompressResourceAsASCIIString(IDR_UASTYLE_HTML_CSS) +
LayoutTheme::GetTheme().ExtraDefaultStyleSheet();
default_style_sheet_ = ParseUASheet(default_rules);
// Initialize the styles that have the lazily loaded style sheets. // Initialize the styles that have the lazily loaded style sheets.
InitializeDefaultStyles(); InitializeDefaultStyles();
default_view_source_style_.Clear(); default_view_source_style_.Clear();
......
...@@ -6410,14 +6410,6 @@ crbug.com/987138 [ Linux Win ] virtual/audio-service/media/controls/doubletap-to ...@@ -6410,14 +6410,6 @@ crbug.com/987138 [ Linux Win ] virtual/audio-service/media/controls/doubletap-to
# Sheriff 2019-07-26 # Sheriff 2019-07-26
crbug.com/835943 [ Debug ] http/tests/appcache/non-html.xhtml [ Crash Pass ] crbug.com/835943 [ Debug ] http/tests/appcache/non-html.xhtml [ Crash Pass ]
crbug.com/874866 [ Linux Debug ] media/controls/doubletap-to-jump-backwards.html [ Failure ] crbug.com/874866 [ Linux Debug ] media/controls/doubletap-to-jump-backwards.html [ Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-alt-f8-twice.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-alt-f8.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-eye-icon-font-size-48px.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-eye-icon-font-size-4px.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-eye-icon-zoom-0.5x.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-eye-icon-zoom-4x.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-mismatched_glyph.html [ Pass Failure ]
crbug.com/988232 virtual/controls-refresh/fast/forms/controls-new-ui/password/password-with-reveal-button.html [ Pass Failure ]
crbug.com/988246 external/wpt/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html [ Skip ] crbug.com/988246 external/wpt/cookie-store/serviceworker_cookieStore_subscriptions_mismatch.tentative.https.html [ Skip ]
crbug.com/988252 [ Linux Debug ] virtual/threaded/transitions/composited-with-hit-testing.html [ Pass Failure ] crbug.com/988252 [ Linux Debug ] virtual/threaded/transitions/composited-with-hit-testing.html [ Pass Failure ]
crbug.com/959129 virtual/threaded/http/tests/devtools/tracing/timeline-script-parse.js [ Pass Failure ] crbug.com/959129 virtual/threaded/http/tests/devtools/tracing/timeline-script-parse.js [ Pass Failure ]
......
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