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

Side by Side Diff: Source/core/loader/ImageLoader.h

Issue 1174463003: Oilpan: Disable lazy seeping for ImageLoaders (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 class ImageLoader; 55 class ImageLoader;
56 class LayoutImageResource; 56 class LayoutImageResource;
57 57
58 template<typename T> class EventSender; 58 template<typename T> class EventSender;
59 typedef EventSender<ImageLoader> ImageEventSender; 59 typedef EventSender<ImageLoader> ImageEventSender;
60 60
61 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ImageResourceClient { 61 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ImageResourceClient {
62 public: 62 public:
63 explicit ImageLoader(Element*); 63 explicit ImageLoader(Element*);
64 virtual ~ImageLoader(); 64 virtual ~ImageLoader();
65
66 // If we enable lazy sweeping for ImageLoader, ImageLoader::Task::run()
67 // can be scheduled for an ImageLoader that is about to die in the current
68 // lazy sweeping but has not yet swept. To avoid that from happening,
69 // disable lazy sweeping.
70 EAGERLY_FINALIZE();
65 DECLARE_TRACE(); 71 DECLARE_TRACE();
66 72
67 enum UpdateFromElementBehavior { 73 enum UpdateFromElementBehavior {
68 // This should be the update behavior when the element is attached to a document, or when DOM mutations trigger a new load. 74 // This should be the update behavior when the element is attached to a document, or when DOM mutations trigger a new load.
69 // Starts loading if a load hasn't already been started. 75 // Starts loading if a load hasn't already been started.
70 UpdateNormal, 76 UpdateNormal,
71 // This should be the update behavior when the resource was changed (via 'src', 'srcset' or 'sizes'). 77 // This should be the update behavior when the resource was changed (via 'src', 'srcset' or 'sizes').
72 // Starts a new load even if a previous load of the same resource have f ailed, to match Firefox's behavior. 78 // Starts a new load even if a previous load of the same resource have f ailed, to match Firefox's behavior.
73 // FIXME - Verify that this is the right behavior according to the spec. 79 // FIXME - Verify that this is the right behavior according to the spec.
74 UpdateIgnorePreviousError, 80 UpdateIgnorePreviousError,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 RawPtrWillBeMember<Element> m_element; 158 RawPtrWillBeMember<Element> m_element;
153 ResourcePtr<ImageResource> m_image; 159 ResourcePtr<ImageResource> m_image;
154 // FIXME: Oilpan: We might be able to remove this Persistent hack when 160 // FIXME: Oilpan: We might be able to remove this Persistent hack when
155 // ImageResourceClient is traceable. 161 // ImageResourceClient is traceable.
156 GC_PLUGIN_IGNORE("http://crbug.com/383741") 162 GC_PLUGIN_IGNORE("http://crbug.com/383741")
157 RefPtrWillBePersistent<Element> m_keepAlive; 163 RefPtrWillBePersistent<Element> m_keepAlive;
158 #if ENABLE(OILPAN) 164 #if ENABLE(OILPAN)
159 class ImageLoaderClientRemover { 165 class ImageLoaderClientRemover {
160 public: 166 public:
161 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { } 167 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { }
162 ~ImageLoaderClientRemover(); 168 ~ImageLoaderClientRemover();
haraken 2015/06/09 11:53:17 Question: Who guarantees that m_loader is still al
163 169
164 private: 170 private:
165 ImageLoader& m_loader; 171 ImageLoader& m_loader;
166 ImageLoaderClient& m_client; 172 ImageLoaderClient& m_client;
167 }; 173 };
168 friend class ImageLoaderClientRemover; 174 friend class ImageLoaderClientRemover;
169 // Oilpan: This ImageLoader object must outlive its clients because they 175 // Oilpan: This ImageLoader object must outlive its clients because they
haraken 2015/06/09 11:53:17 Now we have an eager sweep heap, but it seems not
170 // need to call ImageLoader::willRemoveClient before they 176 // need to call ImageLoader::willRemoveClient before they
171 // die. Non-Persistent HeapHashMap doesn't work well because weak processing 177 // die. Non-Persistent HeapHashMap doesn't work well because weak processing
172 // for HeapHashMap is not triggered when both of ImageLoader and 178 // for HeapHashMap is not triggered when both of ImageLoader and
173 // ImageLoaderClient are unreachable. 179 // ImageLoaderClient are unreachable.
174 GC_PLUGIN_IGNORE("http://crbug.com/383742") 180 GC_PLUGIN_IGNORE("http://crbug.com/383742")
175 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover>> m_clients; 181 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover>> m_clients;
176 #else 182 #else
177 HashSet<ImageLoaderClient*> m_clients; 183 HashSet<ImageLoaderClient*> m_clients;
178 #endif 184 #endif
179 Timer<ImageLoader> m_derefElementTimer; 185 Timer<ImageLoader> m_derefElementTimer;
180 AtomicString m_failedLoadURL; 186 AtomicString m_failedLoadURL;
181 WeakPtr<Task> m_pendingTask; // owned by Microtask 187 WeakPtr<Task> m_pendingTask; // owned by Microtask
182 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; 188 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter;
183 bool m_hasPendingLoadEvent : 1; 189 bool m_hasPendingLoadEvent : 1;
184 bool m_hasPendingErrorEvent : 1; 190 bool m_hasPendingErrorEvent : 1;
185 bool m_imageComplete : 1; 191 bool m_imageComplete : 1;
186 bool m_loadingImageDocument : 1; 192 bool m_loadingImageDocument : 1;
187 bool m_elementIsProtected : 1; 193 bool m_elementIsProtected : 1;
188 bool m_suppressErrorEvents : 1; 194 bool m_suppressErrorEvents : 1;
189 unsigned m_highPriorityClientCount; 195 unsigned m_highPriorityClientCount;
190 }; 196 };
191 197
192 } 198 }
193 199
194 #endif 200 #endif
OLDNEW
« 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