Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r180214 - [GTK] GObject DOM bindings object are cached forever
https://bugs.webkit.org/show_bug.cgi?id=141558 Reviewed by Sergio Villar Senin. Source/WebCore: Rework the DOMObjectCache to avoid having to manually clear the objects when the frame is destroyed, using a FrameDestructionObserver instead. When a new object associated to a Frame is added to the cache, a FrameDestructionObserver is created for the frame if needed, and the DOM object is tracked by the observer too. When the frame is detached from the page all its objects are cleared, and if the aren't additional references, the object is finalized and removed from the cache normally. This patch also simplifies and modernizes the code to make it easier to read an maintain. * bindings/gobject/DOMObjectCache.cpp: (WebKit::DOMObjectCacheData::DOMObjectCacheData): Add constructor to initialize its members and simplify the callers. (WebKit::DOMObjectCacheData::clearObject): Remove the references added by the cache, ensuring the GObject is not finalized until the method returns. (WebKit::DOMObjectCacheData::refObject): Adds a reference owned by the cache. (WebKit::domObjectCacheFrameObservers): Map a frame to a FrameDestructionObserver. (WebKit::getOrCreateDOMObjectCacheFrameObserver): Create a new FrameDestructionObserver for the given Frame or return the existing one. (WebKit::domObjects): Map wrapped object to wrapper object. (WebKit::DOMObjectCache::forget): Remove the wrapped object from the cache. (WebKit::DOMObjectCache::get): Return the wrapped object if it is in the cache, increasing the cache references. (WebKit::DOMObjectCache::put): Add the wrapper object to the cache for the given wrapped object. If it's a Node and has a frame add the node to the FrameDestructionObserver corresponding to the frame. (WebKit::getFrameFromHandle): Deleted. (WebKit::weakRefNotify): Deleted. (WebKit::DOMObjectCache::clearByFrame): Deleted. (WebKit::DOMObjectCache::~DOMObjectCache): Deleted. * bindings/gobject/DOMObjectCache.h: Merge r181631 - [GTK] WebKitDOM objects leaking https://bugs.webkit.org/show_bug.cgi?id=118788 Reviewed by Darin Adler and Sergio Villar Senin. Source/WebCore: Use a DOMwindowObserver class, derived from DOMWindowProperty to be notified when the window object is detached from the frame to clear the DOM objects associated to that frame in that case too. * bindings/gobject/DOMObjectCache.cpp:
- Loading branch information
1 parent
d4c3f27
commit 55c3810
Showing
5 changed files
with
219 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.