Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2009 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 | 151 |
| 152 void willRemoveClient(ImageLoaderClient&); | 152 void willRemoveClient(ImageLoaderClient&); |
| 153 | 153 |
| 154 // For Oilpan, we must run dispose() as a prefinalizer and call | 154 // For Oilpan, we must run dispose() as a prefinalizer and call |
| 155 // m_image->removeClient(this) (and more.) Otherwise, the ImageResource can invoke | 155 // m_image->removeClient(this) (and more.) Otherwise, the ImageResource can invoke |
| 156 // didAddClient() for the ImageLoader that is about to die in the current | 156 // didAddClient() for the ImageLoader that is about to die in the current |
| 157 // lazy sweeping, and the didAddClient() can access on-heap objects that | 157 // lazy sweeping, and the didAddClient() can access on-heap objects that |
| 158 // have already been finalized in the current lazy sweeping. | 158 // have already been finalized in the current lazy sweeping. |
| 159 void dispose(); | 159 void dispose(); |
| 160 | 160 |
| 161 #if ENABLE(OILPAN) | |
| 162 void clearWeakMembers(Visitor*); | |
| 163 #endif | |
| 164 | |
| 161 RawPtrWillBeMember<Element> m_element; | 165 RawPtrWillBeMember<Element> m_element; |
| 162 ResourcePtr<ImageResource> m_image; | 166 ResourcePtr<ImageResource> m_image; |
| 163 // FIXME: Oilpan: We might be able to remove this Persistent hack when | 167 // FIXME: Oilpan: We might be able to remove this Persistent hack when |
| 164 // ImageResourceClient is traceable. | 168 // ImageResourceClient is traceable. |
| 165 GC_PLUGIN_IGNORE("http://crbug.com/383741") | 169 GC_PLUGIN_IGNORE("http://crbug.com/383741") |
| 166 RefPtrWillBePersistent<Element> m_keepAlive; | 170 RefPtrWillBePersistent<Element> m_keepAlive; |
| 167 | 171 |
| 168 #if ENABLE(OILPAN) | 172 // Oilpan: the client references are weak, and managed as such via clearWeak Members(); |
| 169 class ImageLoaderClientRemover { | |
| 170 public: | |
| 171 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { } | |
| 172 ~ImageLoaderClientRemover(); | |
| 173 | |
| 174 private: | |
| 175 ImageLoader& m_loader; | |
| 176 ImageLoaderClient& m_client; | |
| 177 }; | |
| 178 friend class ImageLoaderClientRemover; | |
| 179 | |
| 180 // Oilpan: This ImageLoader object must outlive its clients because they | |
| 181 // need to call ImageLoader::willRemoveClient before they | |
| 182 // die. Non-Persistent HeapHashMap doesn't work well because weak processing | |
| 183 // for HeapHashMap is not triggered when both of ImageLoader and | |
| 184 // ImageLoaderClient are unreachable. | |
| 185 GC_PLUGIN_IGNORE("http://crbug.com/383742") | |
| 186 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover>> m_clients; | |
| 187 #else | |
| 188 HashSet<ImageLoaderClient*> m_clients; | 173 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
| |
| 189 #endif | |
| 190 Timer<ImageLoader> m_derefElementTimer; | 174 Timer<ImageLoader> m_derefElementTimer; |
| 191 AtomicString m_failedLoadURL; | 175 AtomicString m_failedLoadURL; |
| 192 WeakPtr<Task> m_pendingTask; // owned by Microtask | 176 WeakPtr<Task> m_pendingTask; // owned by Microtask |
| 193 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; | 177 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; |
| 194 bool m_hasPendingLoadEvent : 1; | 178 bool m_hasPendingLoadEvent : 1; |
| 195 bool m_hasPendingErrorEvent : 1; | 179 bool m_hasPendingErrorEvent : 1; |
| 196 bool m_imageComplete : 1; | 180 bool m_imageComplete : 1; |
| 197 bool m_loadingImageDocument : 1; | 181 bool m_loadingImageDocument : 1; |
| 198 bool m_elementIsProtected : 1; | 182 bool m_elementIsProtected : 1; |
| 199 bool m_suppressErrorEvents : 1; | 183 bool m_suppressErrorEvents : 1; |
| 200 unsigned m_highPriorityClientCount; | 184 unsigned m_highPriorityClientCount; |
| 201 }; | 185 }; |
| 202 | 186 |
| 203 } | 187 } |
| 204 | 188 |
| 205 #endif | 189 #endif |
| OLD | NEW |