Don't register excessive pending SVG resources

When an SVG resource was destroyed, it would notify the
SVGResourcesCache, which would walk the entire cache, notify the layout
object and add a "pending" entry for the id referring to the
corresponding element.
This would mean that every layout object which had any kind of resource
would get a "pending" reference from every id to itself - regardless of
if it ever referred to a resource with the given id. In the particular
test, this resulted in a fairly large (ever-growing) "pending" element
sets because there was persistent resource references in the document.

Fix by only adding "pending" entries for the current clients of the
resource that's being destroyed.
SVGResourcesCache::resourceDestroyed is removed in favor of new method
detachAllClients() in LayoutSVGResourceContainer. The part that
unregistered the resource itself as a client is removed in favor of the
pre-existing call to clientDestroyed() already existing in
LayoutSVGModelObject::willBeDestroyed (delegated to from the resource.)
SVGResources::resourceDestroyed is changed to not call
removeAllClientsFromCache() on the resource being passed - this is
instead done once after having cleared the references in all the
clients.

With this change, the "cycle time" of the test in the bug changes from
linearly increasing to constant.

BUG=521334

Review URL: https://codereview.chromium.org/1302713003

git-svn-id: svn://svn.chromium.org/blink/trunk@200840 bbb929c8-8fbe-4397-9dbb-9b2b20218538
5 files changed
tree: 6ac2ab8081592520d20427e16db589dcfdbae245
  1. third_party/