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

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

Issue 1224323003: Oilpan: simplify ImageLoaderClient handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add unregistration of weakly held clients 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 f7e004a046677578bdbe85cb203e289ccab58563..d159f698186b55006b336ee43c033139c8f96d9c 100644
--- a/Source/core/loader/ImageLoader.h
+++ b/Source/core/loader/ImageLoader.h
@@ -158,6 +158,10 @@ private:
// have already been finalized in the current lazy sweeping.
void dispose();
+#if ENABLE(OILPAN)
+ void clearWeakMembers(Visitor*);
+#endif
+
RawPtrWillBeMember<Element> m_element;
ResourcePtr<ImageResource> m_image;
// FIXME: Oilpan: We might be able to remove this Persistent hack when
@@ -165,28 +169,8 @@ private:
GC_PLUGIN_IGNORE("http://crbug.com/383741")
RefPtrWillBePersistent<Element> m_keepAlive;
-#if ENABLE(OILPAN)
- class ImageLoaderClientRemover {
- public:
- ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { }
- ~ImageLoaderClientRemover();
-
- private:
- ImageLoader& m_loader;
- 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
- // for HeapHashMap is not triggered when both of ImageLoader and
- // ImageLoaderClient are unreachable.
- GC_PLUGIN_IGNORE("http://crbug.com/383742")
- PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClientRemover>> m_clients;
-#else
+ // Oilpan: the client references are weak, and managed as such via clearWeakMembers();
HashSet<ImageLoaderClient*> m_clients;
haraken 2015/07/13 14:46:56 I'm wondering if we could just use HeapHashSet<Wea
sof 2015/07/13 14:49:44 We need to explicitly unregister (==willRemoveClie
-#endif
Timer<ImageLoader> m_derefElementTimer;
AtomicString m_failedLoadURL;
WeakPtr<Task> m_pendingTask; // owned by Microtask
« 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