OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> | 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> |
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
6 | 6 |
7 This library is free software; you can redistribute it and/or | 7 This library is free software; you can redistribute it and/or |
8 modify it under the terms of the GNU Library General Public | 8 modify it under the terms of the GNU Library General Public |
9 License as published by the Free Software Foundation; either | 9 License as published by the Free Software Foundation; either |
10 version 2 of the License, or (at your option) any later version. | 10 version 2 of the License, or (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "platform/geometry/LayoutSize.h" | 31 #include "platform/geometry/LayoutSize.h" |
32 #include "platform/graphics/ImageObserver.h" | 32 #include "platform/graphics/ImageObserver.h" |
33 #include "platform/graphics/ImageOrientation.h" | 33 #include "platform/graphics/ImageOrientation.h" |
34 #include "wtf/HashMap.h" | 34 #include "wtf/HashMap.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class FetchRequest; | 38 class FetchRequest; |
39 class FloatSize; | 39 class FloatSize; |
40 class ImageResourceObserver; | 40 class ImageResourceObserver; |
41 class Length; | |
42 class MemoryCache; | 41 class MemoryCache; |
43 class ResourceClient; | 42 class ResourceClient; |
44 class ResourceFetcher; | 43 class ResourceFetcher; |
45 class SecurityOrigin; | 44 class SecurityOrigin; |
46 | 45 |
47 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver, p
ublic MultipartImageResourceParser::Client { | 46 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver, p
ublic MultipartImageResourceParser::Client { |
48 friend class MemoryCache; | 47 friend class MemoryCache; |
49 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageResource); | 48 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageResource); |
50 public: | 49 public: |
51 using ClientType = ResourceClient; | 50 using ClientType = ResourceClient; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool isAccessAllowed(SecurityOrigin*); | 86 bool isAccessAllowed(SecurityOrigin*); |
88 | 87 |
89 void updateImageAnimationPolicy(); | 88 void updateImageAnimationPolicy(); |
90 | 89 |
91 // If this ImageResource has the Lo-Fi response headers, reload it with | 90 // If this ImageResource has the Lo-Fi response headers, reload it with |
92 // the Lo-Fi state set to off and bypassing the cache. | 91 // the Lo-Fi state set to off and bypassing the cache. |
93 void reloadIfLoFi(ResourceFetcher*); | 92 void reloadIfLoFi(ResourceFetcher*); |
94 | 93 |
95 void addObserver(ImageResourceObserver*); | 94 void addObserver(ImageResourceObserver*); |
96 void removeObserver(ImageResourceObserver*); | 95 void removeObserver(ImageResourceObserver*); |
97 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO
bservers() || !m_observers.isEmpty(); } | 96 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO
bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); } |
98 | 97 |
99 ResourcePriority priorityFromObservers() override; | 98 ResourcePriority priorityFromObservers() override; |
100 | 99 |
101 void allClientsAndObserversRemoved() override; | 100 void allClientsAndObserversRemoved() override; |
102 | 101 |
103 void appendData(const char*, size_t) override; | 102 void appendData(const char*, size_t) override; |
104 void error(Resource::Status) override; | 103 void error(Resource::Status) override; |
105 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; | 104 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; |
106 void finish() override; | 105 void finish() override; |
107 | 106 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 }; | 150 }; |
152 ImageResource(const ResourceRequest&, const ResourceLoaderOptions&); | 151 ImageResource(const ResourceRequest&, const ResourceLoaderOptions&); |
153 | 152 |
154 void clear(); | 153 void clear(); |
155 | 154 |
156 void setCustomAcceptHeader(); | 155 void setCustomAcceptHeader(); |
157 void createImage(); | 156 void createImage(); |
158 void updateImage(bool allDataReceived); | 157 void updateImage(bool allDataReceived); |
159 void clearImage(); | 158 void clearImage(); |
160 // If not null, changeRect is the changed part of the image. | 159 // If not null, changeRect is the changed part of the image. |
161 void notifyObservers(const IntRect* changeRect = nullptr); | 160 void notifyObservers(bool isNotifyingFinish, const IntRect* changeRect = nul
lptr); |
| 161 void notifyObserver(ImageResourceObserver*, bool isNotifyingFinish, const In
tRect* changeRect = nullptr); |
162 | 162 |
163 float m_devicePixelRatioHeaderValue; | 163 float m_devicePixelRatioHeaderValue; |
164 | 164 |
165 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; | 165 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; |
166 RefPtr<blink::Image> m_image; | 166 RefPtr<blink::Image> m_image; |
167 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti
ngForFirstPart; | 167 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti
ngForFirstPart; |
168 bool m_hasDevicePixelRatioHeaderValue; | 168 bool m_hasDevicePixelRatioHeaderValue; |
169 HashCountedSet<ImageResourceObserver*> m_observers; | 169 HashCountedSet<ImageResourceObserver*> m_observers; |
| 170 HashCountedSet<ImageResourceObserver*> m_finishedObservers; |
170 }; | 171 }; |
171 | 172 |
172 DEFINE_RESOURCE_TYPE_CASTS(Image); | 173 DEFINE_RESOURCE_TYPE_CASTS(Image); |
173 | 174 |
174 } // namespace blink | 175 } // namespace blink |
175 | 176 |
176 #endif | 177 #endif |
OLD | NEW |