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

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

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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;
39 class Element; 40 class Element;
40 class ImageLoader; 41 class ImageLoader;
41 class LayoutImageResource; 42 class LayoutImageResource;
42 43
43 template<typename T> class EventSender; 44 template<typename T> class EventSender;
44 using ImageEventSender = EventSender<ImageLoader>; 45 using ImageEventSender = EventSender<ImageLoader>;
45 46
46 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ImageResourceClient { 47 class CORE_EXPORT ImageLoader : public NoBaseWillBeGarbageCollectedFinalized<Ima geLoader>, public ResourceClient, public ImageResourceObserver {
47 WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose); 48 WILL_BE_USING_PRE_FINALIZER(ImageLoader, dispose);
48 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader); 49 USING_FAST_MALLOC_WILL_BE_REMOVED(ImageLoader);
49 public: 50 public:
50 explicit ImageLoader(Element*); 51 explicit ImageLoader(Element*);
51 ~ImageLoader() override; 52 ~ImageLoader() override;
52 53
53 DECLARE_TRACE(); 54 DECLARE_TRACE();
54 55
55 enum UpdateFromElementBehavior { 56 enum UpdateFromElementBehavior {
56 // This should be the update behavior when the element is attached to a document, or when DOM mutations trigger a new load. 57 // This should be the update behavior when the element is attached to a document, or when DOM mutations trigger a new load.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool hasPendingError() const 95 bool hasPendingError() const
95 { 96 {
96 return m_hasPendingErrorEvent; 97 return m_hasPendingErrorEvent;
97 } 98 }
98 99
99 void dispatchPendingEvent(ImageEventSender*); 100 void dispatchPendingEvent(ImageEventSender*);
100 101
101 static void dispatchPendingLoadEvents(); 102 static void dispatchPendingLoadEvents();
102 static void dispatchPendingErrorEvents(); 103 static void dispatchPendingErrorEvents();
103 104
104 bool getImageAnimationPolicy(ImageResource*, ImageAnimationPolicy&) final; 105 bool getImageAnimationPolicy(ImageAnimationPolicy&) final;
105 protected: 106 protected:
106 void notifyFinished(Resource*) override; 107 void notifyFinished(Resource*) override;
107 108
108 private: 109 private:
109 class Task; 110 class Task;
110 111
111 // Called from the task or from updateFromElement to initiate the load. 112 // Called from the task or from updateFromElement to initiate the load.
112 void doUpdateFromElement(BypassMainWorldBehavior, UpdateFromElementBehavior, ReferrerPolicy = ReferrerPolicyDefault); 113 void doUpdateFromElement(BypassMainWorldBehavior, UpdateFromElementBehavior, ReferrerPolicy = ReferrerPolicyDefault);
113 114
114 virtual void dispatchLoadEvent() = 0; 115 virtual void dispatchLoadEvent() = 0;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 bool m_hasPendingErrorEvent : 1; 159 bool m_hasPendingErrorEvent : 1;
159 bool m_imageComplete : 1; 160 bool m_imageComplete : 1;
160 bool m_loadingImageDocument : 1; 161 bool m_loadingImageDocument : 1;
161 bool m_elementIsProtected : 1; 162 bool m_elementIsProtected : 1;
162 bool m_suppressErrorEvents : 1; 163 bool m_suppressErrorEvents : 1;
163 }; 164 };
164 165
165 } // namespace blink 166 } // namespace blink
166 167
167 #endif 168 #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