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

Unified Diff: Source/core/loader/ImageLoader.h

Issue 1226373008: Oilpan: switch ImageLoader to be prefinalized. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: compile fix Created 5 years, 5 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 | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/ImageLoader.h
diff --git a/Source/core/loader/ImageLoader.h b/Source/core/loader/ImageLoader.h
index 4c21261fe805f5db3806cf7b2321bdad6f4dd862..f7e004a046677578bdbe85cb203e289ccab58563 100644
--- a/Source/core/loader/ImageLoader.h
+++ b/Source/core/loader/ImageLoader.h
@@ -59,16 +59,11 @@ template<typename T> class EventSender;
typedef EventSender<ImageLoader> ImageEventSender;
class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<ImageLoader>, public ImageResourceClient {
+ WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose);
public:
explicit ImageLoader(Element*);
~ImageLoader() override;
- // We must run the destructor in the eager sweeping phase and call
- // m_image->removeClient(this). Otherwise, the ImageResource can invoke
- // didAddClient() for the ImageLoader that is about to die in the current
- // lazy sweeping, and the didAddClient() can access on-heap objects that
- // have already been finalized in the current lazy sweeping.
- EAGERLY_FINALIZE();
DECLARE_TRACE();
enum UpdateFromElementBehavior {
@@ -156,12 +151,20 @@ private:
void willRemoveClient(ImageLoaderClient&);
+ // For Oilpan, we must run dispose() as a prefinalizer and call
+ // m_image->removeClient(this) (and more.) Otherwise, the ImageResource can invoke
+ // didAddClient() for the ImageLoader that is about to die in the current
+ // lazy sweeping, and the didAddClient() can access on-heap objects that
+ // have already been finalized in the current lazy sweeping.
+ void dispose();
+
RawPtrWillBeMember<Element> m_element;
ResourcePtr<ImageResource> m_image;
// FIXME: Oilpan: We might be able to remove this Persistent hack when
// ImageResourceClient is traceable.
GC_PLUGIN_IGNORE("http://crbug.com/383741")
RefPtrWillBePersistent<Element> m_keepAlive;
+
#if ENABLE(OILPAN)
class ImageLoaderClientRemover {
public:
@@ -173,6 +176,7 @@ private:
ImageLoaderClient& m_client;
};
friend class ImageLoaderClientRemover;
+
// Oilpan: This ImageLoader object must outlive its clients because they
// need to call ImageLoader::willRemoveClient before they
// die. Non-Persistent HeapHashMap doesn't work well because weak processing
« no previous file with comments | « no previous file | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698