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

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

Issue 320253002: Oilpan: Prepare to move ImageLoader and its subclasses to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ImageLoaderClient() { } 48 ImageLoaderClient() { }
49 }; 49 };
50 50
51 class Element; 51 class Element;
52 class ImageLoader; 52 class ImageLoader;
53 class RenderImageResource; 53 class RenderImageResource;
54 54
55 template<typename T> class EventSender; 55 template<typename T> class EventSender;
56 typedef EventSender<ImageLoader> ImageEventSender; 56 typedef EventSender<ImageLoader> ImageEventSender;
57 57
58 class ImageLoader : public ImageResourceClient { 58 class ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<ImageLoader>, p ublic ImageResourceClient {
59 public: 59 public:
60 explicit ImageLoader(Element*); 60 explicit ImageLoader(Element*);
61 virtual ~ImageLoader(); 61 virtual ~ImageLoader();
62 void trace(Visitor*);
62 63
63 enum LoadType { 64 enum LoadType {
64 LoadNormally, 65 LoadNormally,
65 ForceLoadImmediately 66 ForceLoadImmediately
66 }; 67 };
67 68
68 // This function should be called when the element is attached to a document ; starts 69 // This function should be called when the element is attached to a document ; starts
69 // loading if a load hasn't already been started. 70 // loading if a load hasn't already been started.
70 void updateFromElement(LoadType = LoadNormally); 71 void updateFromElement(LoadType = LoadNormally);
71 72
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 void timerFired(Timer<ImageLoader>*); 127 void timerFired(Timer<ImageLoader>*);
127 128
128 KURL imageURL() const; 129 KURL imageURL() const;
129 130
130 // Used to determine whether to immediately initiate the load 131 // Used to determine whether to immediately initiate the load
131 // or to schedule a microtask. 132 // or to schedule a microtask.
132 bool shouldLoadImmediately(const KURL&) const; 133 bool shouldLoadImmediately(const KURL&) const;
133 134
134 void willRemoveClient(ImageLoaderClient&); 135 void willRemoveClient(ImageLoaderClient&);
135 136
136 Element* m_element; 137 RawPtrWillBeMember<Element> m_element;
137 ResourcePtr<ImageResource> m_image; 138 ResourcePtr<ImageResource> m_image;
138 #if ENABLE(OILPAN) 139 #if ENABLE(OILPAN)
140 // FIXME: Oilpan: We might be able to remove this hack when
141 // ImageResourceClient is traceable.
142 GC_PLUGIN_IGNORE("http://crbug.com/353083")
143 Persistent<ImageLoader> m_keepAlive;
144
139 class ImageLoaderClientRemover { 145 class ImageLoaderClientRemover {
140 public: 146 public:
141 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { } 147 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { }
142 ~ImageLoaderClientRemover(); 148 ~ImageLoaderClientRemover();
143 149
144 private: 150 private:
145 ImageLoader& m_loader; 151 ImageLoader& m_loader;
146 ImageLoaderClient& m_client; 152 ImageLoaderClient& m_client;
147 }; 153 };
148 friend class ImageLoaderClientRemover; 154 friend class ImageLoaderClientRemover;
155 // Oilpan: This ImageLoader object must outlive its clients because they
156 // need to call ImageLoader::willRemoveClient before they die.
157 GC_PLUGIN_IGNORE("http://crbug.com/353083")
149 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover> > m_clients; 158 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover> > m_clients;
haraken 2014/06/09 11:12:34 Why does this need to be a Persistent? It looks st
tkent 2014/06/10 01:43:09 The comment above explains it. Tracing this is my
150 #else 159 #else
151 HashSet<ImageLoaderClient*> m_clients; 160 HashSet<ImageLoaderClient*> m_clients;
152 #endif 161 #endif
153 Timer<ImageLoader> m_derefElementTimer; 162 Timer<ImageLoader> m_derefElementTimer;
154 AtomicString m_failedLoadURL; 163 AtomicString m_failedLoadURL;
155 WeakPtr<Task> m_pendingTask; // owned by Microtask 164 WeakPtr<Task> m_pendingTask; // owned by Microtask
156 OwnPtr<IncrementLoadEventDelayCount> m_delayLoad; 165 OwnPtr<IncrementLoadEventDelayCount> m_delayLoad;
157 bool m_hasPendingLoadEvent : 1; 166 bool m_hasPendingLoadEvent : 1;
158 bool m_hasPendingErrorEvent : 1; 167 bool m_hasPendingErrorEvent : 1;
159 bool m_imageComplete : 1; 168 bool m_imageComplete : 1;
160 bool m_loadManually : 1; 169 bool m_loadManually : 1;
161 bool m_elementIsProtected : 1; 170 bool m_elementIsProtected : 1;
162 unsigned m_highPriorityClientCount; 171 unsigned m_highPriorityClientCount;
163 }; 172 };
164 173
165 } 174 }
166 175
167 #endif 176 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698