Reconsider ImageLoader lifetime |
|||
Issue descriptionCurrently, ImageLoader is forced to be alive from ImageResourceContent::Fetch() until the image load/error event is fired, using |keep_alive_| Persistent (*1). But this causes: - Code health issue: |keep_alive_| hack is not clean ( Issue 383741 ). - Memory leaks ( Issue 327574 and 726091 ): They are "working (=leaking) as intended" if we assume (*1). So to fix the leaks, we have to reconsider (*1). Basically I expect the solution will be to remove |keep_alive_| and adjust the ImageLoader lifetime.
,
May 25 2017
,
May 25 2017
Also related to cleaning up the fallback conditions in SelectSourceURL().
,
May 30 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/44f1ff3ef09322690900c00580c90b841a52d73a commit 44f1ff3ef09322690900c00580c90b841a52d73a Author: hiroshige <hiroshige@chromium.org> Date: Tue May 30 09:38:22 2017 Remove T:: from ActiveScriptWrappable<T>::DispatchHasPendingActivity() Previously, for a class T : public ActiveScriptWrappable<T>, HasPendingActivity() cannot be overridden by the subclasses of T because DispatchHasPendingActivity() calls T::HasPendingActivity(). This CL enables the override by calling HasPendingActivity() instead, as preparation for https://codereview.chromium.org/2905233002/. BUG= 383741 , 327574 , 726091 , 726414 Review-Url: https://codereview.chromium.org/2907173002 Cr-Commit-Position: refs/heads/master@{#475480} [modify] https://crrev.com/44f1ff3ef09322690900c00580c90b841a52d73a/third_party/WebKit/Source/platform/bindings/ActiveScriptWrappable.h
,
May 30 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/da1ebb6c4b424e74296c55b180055d1a98b73832 commit da1ebb6c4b424e74296c55b180055d1a98b73832 Author: hiroshige <hiroshige@chromium.org> Date: Tue May 30 12:53:30 2017 Remove the lifetime hack in ImageLoader where it keeps its assoc element alive Instead of keeping Element alive by |ImageLoader::keep_alive_|, this CL makes the Elements keep themselves alive by HasPendingActivity(). This makes ImageLoader NOT kept alive after the corresponding context is destroyed, which is the general behavior of HasPendingActivity(). Previously, ImageLoader is forced to be kept alive until load/error events are fired, because |keep_alive_| is not cleared, regardless of whether the context is still valid or not. This lifetime change fixes memory leaks in tests ( Issue 327574 and Issue 726091 ). This CL is based on kouhei@'s CL: https://codereview.chromium.org/2344563002/. In addition to that, this CL also applies HasPendingActivity() changes to Input, PlugIn/Embed/Object, and Media/Video elements because they create ImageLoader and retain references to ImageLoader. BUG= 383741 , 327574 , 726091 , 726414 Review-Url: https://codereview.chromium.org/2905233002 Cr-Commit-Position: refs/heads/master@{#475505} [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/LayoutTests/LeakExpectations [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLEmbedElement.idl [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLInputElement.cpp [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLInputElement.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLInputElement.idl [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLMediaElement.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLObjectElement.idl [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLPlugInElement.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLVideoElement.cpp [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLVideoElement.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/html/HTMLVideoElement.idl [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/loader/ImageLoader.cpp [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/loader/ImageLoader.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/svg/SVGImageElement.h [modify] https://crrev.com/da1ebb6c4b424e74296c55b180055d1a98b73832/third_party/WebKit/Source/core/svg/SVGImageElement.idl
,
Jun 13 2017
Closing as fixed. Actually the removal of |keep_alive_|, i.e. allowing ImageLoader to be garbage collected after the associated context becomes invalid, resolved the all related issues. |
|||
►
Sign in to add a comment |
|||
Comment 1 by hirosh...@chromium.org
, May 25 2017