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

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: rebase 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
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | 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 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 {
zerny-chromium 2014/06/10 12:54:28 Nit: FINAL
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;
139 // FIXME: Oilpan: We might be able to remove this Persistent hack when
140 // ImageResourceClient is traceable.
141 GC_PLUGIN_IGNORE("http://crbug.com/353083")
Mads Ager (chromium) 2014/06/11 06:38:41 I think this persistent should use a separate bug
tkent 2014/06/11 06:58:28 ok, will file new bug.
142 RefPtrWillBePersistent<Element> m_keepAlive;
Mads Ager (chromium) 2014/06/10 12:34:33 I don't think this persistent is doing anything in
haraken 2014/06/10 12:47:59 Good point. I agree that we can remove this Persis
zerny-chromium 2014/06/10 12:54:28 Yes. But this does point at a behavior change. The
haraken 2014/06/10 12:58:11 You're right, but as far as I see, m_element is a
tkent 2014/06/10 23:56:57 Thank you for comments. If we don't have m_keepAl
Mads Ager (chromium) 2014/06/11 06:35:14 OK, I see. This is needed because the ImageLoader
haraken 2014/06/11 06:45:03 Just a drive-by comment not related to the essence
tkent 2014/06/11 06:58:28 No, Timer is not related to this issue. As the co
Mads Ager (chromium) 2014/06/11 07:09:15 Thank you Kent. I misunderstood the code. The Time
138 #if ENABLE(OILPAN) 143 #if ENABLE(OILPAN)
139 class ImageLoaderClientRemover { 144 class ImageLoaderClientRemover {
140 public: 145 public:
141 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { } 146 ImageLoaderClientRemover(ImageLoader& loader, ImageLoaderClient& client) : m_loader(loader), m_client(client) { }
142 ~ImageLoaderClientRemover(); 147 ~ImageLoaderClientRemover();
143 148
144 private: 149 private:
145 ImageLoader& m_loader; 150 ImageLoader& m_loader;
146 ImageLoaderClient& m_client; 151 ImageLoaderClient& m_client;
147 }; 152 };
148 friend class ImageLoaderClientRemover; 153 friend class ImageLoaderClientRemover;
154 // Oilpan: This ImageLoader object must outlive its clients because they
155 // need to call ImageLoader::willRemoveClient before they die.
156 GC_PLUGIN_IGNORE("http://crbug.com/353083")
Mads Ager (chromium) 2014/06/10 12:34:33 Why does not map have to be a PersistentHeapHashMa
Mads Ager (chromium) 2014/06/10 12:37:45 Sorry, that should be: why does /the/ map have to
Mads Ager (chromium) 2014/06/10 12:44:51 Oh, is that the point here? This persistent makes
haraken 2014/06/10 12:47:59 The problem is that the weak processing does not h
Mads Ager (chromium) 2014/06/10 12:54:39 The weak processing doesn't happen if it is not pe
149 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover> > m_clients; 157 PersistentHeapHashMap<WeakMember<ImageLoaderClient>, OwnPtr<ImageLoaderClien tRemover> > m_clients;
150 #else 158 #else
151 HashSet<ImageLoaderClient*> m_clients; 159 HashSet<ImageLoaderClient*> m_clients;
152 #endif 160 #endif
153 Timer<ImageLoader> m_derefElementTimer; 161 Timer<ImageLoader> m_derefElementTimer;
154 AtomicString m_failedLoadURL; 162 AtomicString m_failedLoadURL;
155 WeakPtr<Task> m_pendingTask; // owned by Microtask 163 WeakPtr<Task> m_pendingTask; // owned by Microtask
156 OwnPtr<IncrementLoadEventDelayCount> m_delayLoad; 164 OwnPtr<IncrementLoadEventDelayCount> m_delayLoad;
157 bool m_hasPendingLoadEvent : 1; 165 bool m_hasPendingLoadEvent : 1;
158 bool m_hasPendingErrorEvent : 1; 166 bool m_hasPendingErrorEvent : 1;
159 bool m_imageComplete : 1; 167 bool m_imageComplete : 1;
160 bool m_loadManually : 1; 168 bool m_loadManually : 1;
161 bool m_elementIsProtected : 1; 169 bool m_elementIsProtected : 1;
162 unsigned m_highPriorityClientCount; 170 unsigned m_highPriorityClientCount;
163 }; 171 };
164 172
165 } 173 }
166 174
167 #endif 175 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698