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

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

Issue 1697713002: [WIP] ImageResourceClient->ImageResourceObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef ImageLoader_h 23 #ifndef ImageLoader_h
24 #define ImageLoader_h 24 #define ImageLoader_h
25 25
26 #include "core/CoreExport.h" 26 #include "core/CoreExport.h"
27 #include "core/fetch/ImageResource.h" 27 #include "core/fetch/ImageResource.h"
28 #include "core/fetch/ImageResourceClient.h" 28 #include "core/fetch/ImageResourceObserver.h"
29 #include "core/fetch/ResourceClient.h"
29 #include "platform/heap/Handle.h" 30 #include "platform/heap/Handle.h"
30 #include "wtf/HashSet.h" 31 #include "wtf/HashSet.h"
31 #include "wtf/WeakPtr.h" 32 #include "wtf/WeakPtr.h"
32 #include "wtf/text/AtomicString.h" 33 #include "wtf/text/AtomicString.h"
33 34
34 namespace blink { 35 namespace blink {
35 36
36 class IncrementLoadEventDelayCount; 37 class IncrementLoadEventDelayCount;
37 class FetchRequest; 38 class FetchRequest;
38 class Document; 39 class Document;
(...skipping 11 matching lines...) Expand all
50 ImageLoaderClient() { } 51 ImageLoaderClient() { }
51 }; 52 };
52 53
53 class Element; 54 class Element;
54 class ImageLoader; 55 class ImageLoader;
55 class LayoutImageResource; 56 class LayoutImageResource;
56 57
57 template<typename T> class EventSender; 58 template<typename T> class EventSender;
58 using ImageEventSender = EventSender<ImageLoader>; 59 using ImageEventSender = EventSender<ImageLoader>;
59 60
60 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ImageResourceClient { 61 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ResourceClient, public ImageResourceObserver {
61 WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose); 62 WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose);
62 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader); 63 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader);
63 public: 64 public:
64 explicit ImageLoader(Element*); 65 explicit ImageLoader(Element*);
65 ~ImageLoader() override; 66 ~ImageLoader() override;
66 67
67 DECLARE_TRACE(); 68 DECLARE_TRACE();
68 69
69 enum UpdateFromElementBehavior { 70 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. 71 // This should be the update behavior when the element is attached to a document, or when DOM mutations trigger a new load.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 112 }
112 113
113 void dispatchPendingEvent(ImageEventSender*); 114 void dispatchPendingEvent(ImageEventSender*);
114 115
115 static void dispatchPendingLoadEvents(); 116 static void dispatchPendingLoadEvents();
116 static void dispatchPendingErrorEvents(); 117 static void dispatchPendingErrorEvents();
117 118
118 void addClient(ImageLoaderClient*); 119 void addClient(ImageLoaderClient*);
119 void removeClient(ImageLoaderClient*); 120 void removeClient(ImageLoaderClient*);
120 121
121 bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final; 122 bool getImageAnimationPolicy(ImageAnimationPolicy&) final;
122 protected: 123 protected:
123 void notifyFinished(Resource*) override; 124 void notifyFinished(Resource*) override;
124 125
125 private: 126 private:
126 class Task; 127 class Task;
127 128
128 // Called from the task or from updateFromElement to initiate the load. 129 // Called from the task or from updateFromElement to initiate the load.
129 void doUpdateFromElement(BypassMainWorldBehavior, UpdateFromElementBehavior, ReferrerPolicy = ReferrerPolicyDefault); 130 void doUpdateFromElement(BypassMainWorldBehavior, UpdateFromElementBehavior, ReferrerPolicy = ReferrerPolicyDefault);
130 131
131 virtual void dispatchLoadEvent() = 0; 132 virtual void dispatchLoadEvent() = 0;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bool m_imageComplete : 1; 186 bool m_imageComplete : 1;
186 bool m_loadingImageDocument : 1; 187 bool m_loadingImageDocument : 1;
187 bool m_elementIsProtected : 1; 188 bool m_elementIsProtected : 1;
188 bool m_suppressErrorEvents : 1; 189 bool m_suppressErrorEvents : 1;
189 unsigned m_highPriorityClientCount; 190 unsigned m_highPriorityClientCount;
190 }; 191 };
191 192
192 } // namespace blink 193 } // namespace blink
193 194
194 #endif 195 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp ('k') | third_party/WebKit/Source/core/loader/ImageLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698