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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp

Issue 2846593008: Proactively dispose image filters for SVG filter chains (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp
index 9ab2bf4cc905c17b3c006b4cbdb1590547c39658..3cc60c5e95f82b1c1aa05d00829556766fa17cf1 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceFilter.cpp
@@ -36,6 +36,8 @@ DEFINE_TRACE(FilterData) {
void FilterData::Dispose() {
node_map = nullptr;
+ if (last_effect)
+ last_effect->DisposeImageFiltersRecursive();
last_effect = nullptr;
}
@@ -45,8 +47,8 @@ LayoutSVGResourceFilter::LayoutSVGResourceFilter(SVGFilterElement* node)
LayoutSVGResourceFilter::~LayoutSVGResourceFilter() {}
void LayoutSVGResourceFilter::DisposeFilterMap() {
- for (auto& filter : filter_)
- filter.value->Dispose();
+ for (auto& entry : filter_)
+ entry.value->Dispose();
filter_.clear();
}
@@ -76,9 +78,12 @@ void LayoutSVGResourceFilter::RemoveClientFromCache(
bool mark_for_invalidation) {
DCHECK(client);
- bool filter_cached = filter_.Contains(client);
- if (filter_cached)
- filter_.erase(client);
+ auto entry = filter_.find(client);
+ bool filter_cached = entry != filter_.end();
+ if (filter_cached) {
+ entry->value->Dispose();
+ filter_.erase(entry);
+ }
// If the filter has a cached subtree, invalidate the associated display item.
if (mark_for_invalidation && filter_cached)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698