| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void updateImageAnimationPolicy(); | 94 void updateImageAnimationPolicy(); |
| 96 | 95 |
| 97 // If this ImageResource has the Lo-Fi response headers, reload it with | 96 // If this ImageResource has the Lo-Fi response headers, reload it with |
| 98 // the Lo-Fi state set to off and bypassing the cache. | 97 // the Lo-Fi state set to off and bypassing the cache. |
| 99 void reloadIfLoFi(ResourceFetcher*); | 98 void reloadIfLoFi(ResourceFetcher*); |
| 100 | 99 |
| 101 bool isMultipartImage() const { return m_multipartParser; } | 100 bool isMultipartImage() const { return m_multipartParser; } |
| 102 | 101 |
| 103 void addObserver(ImageResourceObserver*); | 102 void addObserver(ImageResourceObserver*); |
| 104 void removeObserver(ImageResourceObserver*); | 103 void removeObserver(ImageResourceObserver*); |
| 105 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO
bservers() || !m_observers.isEmpty(); } | 104 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO
bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); } |
| 106 | 105 |
| 107 ResourcePriority priorityFromObservers() override; | 106 ResourcePriority priorityFromObservers() override; |
| 108 | 107 |
| 109 void allClientsAndObserversRemoved() override; | 108 void allClientsAndObserversRemoved() override; |
| 110 | 109 |
| 111 void appendData(const char*, size_t) override; | 110 void appendData(const char*, size_t) override; |
| 112 void error(Resource::Status) override; | 111 void error(Resource::Status) override; |
| 113 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; | 112 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan
dle>) override; |
| 114 void finish() override; | 113 void finish() override; |
| 115 | 114 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 }; | 153 }; |
| 155 ImageResource(const ResourceRequest&); | 154 ImageResource(const ResourceRequest&); |
| 156 | 155 |
| 157 void clear(); | 156 void clear(); |
| 158 | 157 |
| 159 void setCustomAcceptHeader(); | 158 void setCustomAcceptHeader(); |
| 160 void createImage(); | 159 void createImage(); |
| 161 void updateImage(bool allDataReceived); | 160 void updateImage(bool allDataReceived); |
| 162 void clearImage(); | 161 void clearImage(); |
| 163 // If not null, changeRect is the changed part of the image. | 162 // If not null, changeRect is the changed part of the image. |
| 164 void notifyObservers(const IntRect* changeRect = nullptr); | 163 void notifyObservers(bool isNotifyingFinish, const IntRect* changeRect = nul
lptr); |
| 164 void notifyObserver(ImageResourceObserver*, bool isNotifyingFinish, const In
tRect* changeRect = nullptr); |
| 165 | 165 |
| 166 float m_devicePixelRatioHeaderValue; | 166 float m_devicePixelRatioHeaderValue; |
| 167 | 167 |
| 168 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; | 168 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; |
| 169 RefPtr<blink::Image> m_image; | 169 RefPtr<blink::Image> m_image; |
| 170 bool m_hasDevicePixelRatioHeaderValue; | 170 bool m_hasDevicePixelRatioHeaderValue; |
| 171 HashCountedSet<ImageResourceObserver*> m_observers; | 171 HashCountedSet<ImageResourceObserver*> m_observers; |
| 172 HashCountedSet<ImageResourceObserver*> m_finishedObservers; |
| 172 }; | 173 }; |
| 173 | 174 |
| 174 DEFINE_RESOURCE_TYPE_CASTS(Image); | 175 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 175 | 176 |
| 176 } // namespace blink | 177 } // namespace blink |
| 177 | 178 |
| 178 #endif | 179 #endif |
| OLD | NEW |