Bug 178567 - When destroying a resource, register "only" the clients who are losing their resource as having pending resources
Summary: When destroying a resource, register "only" the clients who are losing their ...
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
Keywords: InRadar
Depends on:
Reported: 2017-10-19 22:11 PDT by Said Abou-Hallawa
Modified: 2017-10-20 13:34 PDT (History)
5 users (show)

See Also:

Patch (6.83 KB, patch)
2017-10-19 22:31 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (14.45 KB, patch)
2017-10-20 12:02 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2017-10-19 22:11:18 PDT
In <http://trac.webkit.org/changeset/95047>, we tried to fix this issue. But instead of registering the clients of the destroyed resource, we registered all the clients in the cache as having pending resources.

In SVGResourcesCache::resourceDestroyed(), we call resourcesCacheFromRenderer() which returns a cache that maps <RenderElement, SVGResources>.
We loop through all the elements in the cache and we call SVGResources::resourceDestroyed() which will remove the reference to the destroyed resource if it's one of the resources of SVGResources
Then we call SVGDocumentExtensions::addPendingResource() with the ID of the destroyed resource and the Element of the RenderElement.

This is wrong if the SVGResources does not have a reference to the destroyed resource. It is waste of time to register the Element of the RenderElement to have a pending resources in this caae.
Comment 1 Said Abou-Hallawa 2017-10-19 22:31:34 PDT
Created attachment 324358 [details]
Comment 2 Said Abou-Hallawa 2017-10-19 22:34:05 PDT
Comment 3 Simon Fraser (smfr) 2017-10-20 11:01:40 PDT
Comment on attachment 324358 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=324358&action=review

> Source/WebCore/rendering/svg/SVGResources.cpp:391
>              m_clipperFilterMaskerData->masker = 0;

These 0 should all be nullptr, right?

> Source/WebCore/rendering/svg/SVGResources.h:70
> +    bool resourceDestroyed(RenderSVGResourceContainer&);

Please add a comment saying what the return value means, or use an enum.
Comment 4 Said Abou-Hallawa 2017-10-20 12:02:19 PDT
Created attachment 324424 [details]
Comment 5 WebKit Commit Bot 2017-10-20 13:34:31 PDT
Comment on attachment 324424 [details]

Clearing flags on attachment: 324424

Committed r223789: <https://trac.webkit.org/changeset/223789>
Comment 6 WebKit Commit Bot 2017-10-20 13:34:33 PDT
All reviewed patches have been landed.  Closing bug.