| 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 19 matching lines...) Expand all Loading... |
| 30 #include "wtf/HashSet.h" | 30 #include "wtf/HashSet.h" |
| 31 #include "wtf/WeakPtr.h" | 31 #include "wtf/WeakPtr.h" |
| 32 #include "wtf/text/AtomicString.h" | 32 #include "wtf/text/AtomicString.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class IncrementLoadEventDelayCount; | 36 class IncrementLoadEventDelayCount; |
| 37 class FetchRequest; | 37 class FetchRequest; |
| 38 class Document; | 38 class Document; |
| 39 | 39 |
| 40 class CORE_EXPORT ImageLoaderClient : public WillBeGarbageCollectedMixin { | 40 class CORE_EXPORT ImageLoaderClient : public GarbageCollectedMixin { |
| 41 public: | 41 public: |
| 42 virtual void notifyImageSourceChanged() = 0; | 42 virtual void notifyImageSourceChanged() = 0; |
| 43 | 43 |
| 44 // Determines whether the observed ImageResource should have higher priority
in the decoded resources cache. | 44 // Determines whether the observed ImageResource should have higher priority
in the decoded resources cache. |
| 45 virtual bool requestsHighLiveResourceCachePriority() { return false; } | 45 virtual bool requestsHighLiveResourceCachePriority() { return false; } |
| 46 | 46 |
| 47 DEFINE_INLINE_VIRTUAL_TRACE() { } | 47 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 ImageLoaderClient() { } | 50 ImageLoaderClient() { } |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class Element; | 53 class Element; |
| 54 class ImageLoader; | 54 class ImageLoader; |
| 55 class LayoutImageResource; | 55 class LayoutImageResource; |
| 56 | 56 |
| 57 template<typename T> class EventSender; | 57 template<typename T> class EventSender; |
| 58 using ImageEventSender = EventSender<ImageLoader>; | 58 using ImageEventSender = EventSender<ImageLoader>; |
| 59 | 59 |
| 60 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima
geLoader>, public ImageResourceClient { | 60 class CORE_EXPORT ImageLoader : public GarbageCollectedFinalized<ImageLoader>, p
ublic ImageResourceClient { |
| 61 WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose); | 61 USING_PRE_FINALIZER(ImageLoader, dispose); |
| 62 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader); | |
| 63 public: | 62 public: |
| 64 explicit ImageLoader(Element*); | 63 explicit ImageLoader(Element*); |
| 65 ~ImageLoader() override; | 64 ~ImageLoader() override; |
| 66 | 65 |
| 67 DECLARE_TRACE(); | 66 DECLARE_TRACE(); |
| 68 | 67 |
| 69 enum UpdateFromElementBehavior { | 68 enum UpdateFromElementBehavior { |
| 70 // This should be the update behavior when the element is attached to a
document, or when DOM mutations trigger a new load. | 69 // This should be the update behavior when the element is attached to a
document, or when DOM mutations trigger a new load. |
| 71 // Starts loading if a load hasn't already been started. | 70 // Starts loading if a load hasn't already been started. |
| 72 UpdateNormal, | 71 UpdateNormal, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // m_image->removeClient(this) (and more.) Otherwise, the ImageResource can
invoke | 159 // m_image->removeClient(this) (and more.) Otherwise, the ImageResource can
invoke |
| 161 // didAddClient() for the ImageLoader that is about to die in the current | 160 // didAddClient() for the ImageLoader that is about to die in the current |
| 162 // lazy sweeping, and the didAddClient() can access on-heap objects that | 161 // lazy sweeping, and the didAddClient() can access on-heap objects that |
| 163 // have already been finalized in the current lazy sweeping. | 162 // have already been finalized in the current lazy sweeping. |
| 164 void dispose(); | 163 void dispose(); |
| 165 | 164 |
| 166 #if ENABLE(OILPAN) | 165 #if ENABLE(OILPAN) |
| 167 void clearWeakMembers(Visitor*); | 166 void clearWeakMembers(Visitor*); |
| 168 #endif | 167 #endif |
| 169 | 168 |
| 170 RawPtrWillBeMember<Element> m_element; | 169 Member<Element> m_element; |
| 171 RefPtrWillBeMember<ImageResource> m_image; | 170 Member<ImageResource> m_image; |
| 172 // FIXME: Oilpan: We might be able to remove this Persistent hack when | 171 // FIXME: Oilpan: We might be able to remove this Persistent hack when |
| 173 // ImageResourceClient is traceable. | 172 // ImageResourceClient is traceable. |
| 174 GC_PLUGIN_IGNORE("http://crbug.com/383741") | 173 GC_PLUGIN_IGNORE("http://crbug.com/383741") |
| 175 RefPtrWillBePersistent<Element> m_keepAlive; | 174 Persistent<Element> m_keepAlive; |
| 176 | 175 |
| 177 // Oilpan: the client references are weak, and managed as such via clearWeak
Members(); | 176 // Oilpan: the client references are weak, and managed as such via clearWeak
Members(); |
| 178 HashSet<RawPtrWillBeUntracedMember<ImageLoaderClient>> m_clients; | 177 HashSet<UntracedMember<ImageLoaderClient>> m_clients; |
| 179 Timer<ImageLoader> m_derefElementTimer; | 178 Timer<ImageLoader> m_derefElementTimer; |
| 180 AtomicString m_failedLoadURL; | 179 AtomicString m_failedLoadURL; |
| 181 WeakPtr<Task> m_pendingTask; // owned by Microtask | 180 WeakPtr<Task> m_pendingTask; // owned by Microtask |
| 182 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; | 181 OwnPtr<IncrementLoadEventDelayCount> m_loadDelayCounter; |
| 183 bool m_hasPendingLoadEvent : 1; | 182 bool m_hasPendingLoadEvent : 1; |
| 184 bool m_hasPendingErrorEvent : 1; | 183 bool m_hasPendingErrorEvent : 1; |
| 185 bool m_imageComplete : 1; | 184 bool m_imageComplete : 1; |
| 186 bool m_loadingImageDocument : 1; | 185 bool m_loadingImageDocument : 1; |
| 187 bool m_elementIsProtected : 1; | 186 bool m_elementIsProtected : 1; |
| 188 bool m_suppressErrorEvents : 1; | 187 bool m_suppressErrorEvents : 1; |
| 189 unsigned m_highPriorityClientCount; | 188 unsigned m_highPriorityClientCount; |
| 190 }; | 189 }; |
| 191 | 190 |
| 192 } // namespace blink | 191 } // namespace blink |
| 193 | 192 |
| 194 #endif | 193 #endif |
| OLD | NEW |