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