| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // ImageObserver | 112 // ImageObserver |
| 113 void decodedSizeChanged(const blink::Image*, int delta) override; | 113 void decodedSizeChanged(const blink::Image*, int delta) override; |
| 114 void didDraw(const blink::Image*) override; | 114 void didDraw(const blink::Image*) override; |
| 115 | 115 |
| 116 bool shouldPauseAnimation(const blink::Image*) override; | 116 bool shouldPauseAnimation(const blink::Image*) override; |
| 117 void animationAdvanced(const blink::Image*) override; | 117 void animationAdvanced(const blink::Image*) override; |
| 118 void changedInRect(const blink::Image*, const IntRect&) override; | 118 void changedInRect(const blink::Image*, const IntRect&) override; |
| 119 | 119 |
| 120 // MultipartImageResourceParser::Client | 120 // MultipartImageResourceParser::Client |
| 121 void onePartInMultipartReceived(const ResourceResponse&, bool isFirstPart) f
inal; | 121 void onePartInMultipartReceived(const ResourceResponse&) final; |
| 122 void multipartDataReceived(const char*, size_t) final; | 122 void multipartDataReceived(const char*, size_t) final; |
| 123 | 123 |
| 124 DECLARE_VIRTUAL_TRACE(); | 124 DECLARE_VIRTUAL_TRACE(); |
| 125 | 125 |
| 126 protected: | 126 protected: |
| 127 bool isSafeToUnlock() const override; | 127 bool isSafeToUnlock() const override; |
| 128 void destroyDecodedDataIfPossible() override; | 128 void destroyDecodedDataIfPossible() override; |
| 129 void destroyDecodedDataForFailedRevalidation() override; | 129 void destroyDecodedDataForFailedRevalidation() override; |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 explicit ImageResource(blink::Image*); | 132 explicit ImageResource(blink::Image*); |
| 133 ImageResource(const ResourceRequest&, blink::Image*); | 133 ImageResource(const ResourceRequest&, blink::Image*); |
| 134 | 134 |
| 135 enum class MultipartParsingState : uint8_t { |
| 136 WaitingForFirstPart, |
| 137 ParsingFirstPart, |
| 138 FinishedParsingFirstPart, |
| 139 }; |
| 140 |
| 135 class ImageResourceFactory : public ResourceFactory { | 141 class ImageResourceFactory : public ResourceFactory { |
| 136 public: | 142 public: |
| 137 ImageResourceFactory() | 143 ImageResourceFactory() |
| 138 : ResourceFactory(Resource::Image) { } | 144 : ResourceFactory(Resource::Image) { } |
| 139 | 145 |
| 140 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request,
const String&) const override | 146 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request,
const String&) const override |
| 141 { | 147 { |
| 142 return adoptRefWillBeNoop(new ImageResource(request)); | 148 return adoptRefWillBeNoop(new ImageResource(request)); |
| 143 } | 149 } |
| 144 }; | 150 }; |
| 145 ImageResource(const ResourceRequest&); | 151 ImageResource(const ResourceRequest&); |
| 146 | 152 |
| 147 void clear(); | 153 void clear(); |
| 148 | 154 |
| 149 void setCustomAcceptHeader(); | 155 void setCustomAcceptHeader(); |
| 150 void createImage(); | 156 void createImage(); |
| 151 void updateImage(bool allDataReceived); | 157 void updateImage(bool allDataReceived); |
| 152 void clearImage(); | 158 void clearImage(); |
| 153 // If not null, changeRect is the changed part of the image. | 159 // If not null, changeRect is the changed part of the image. |
| 154 void notifyObservers(const IntRect* changeRect = nullptr); | 160 void notifyObservers(const IntRect* changeRect = nullptr); |
| 155 | 161 |
| 156 float m_devicePixelRatioHeaderValue; | 162 float m_devicePixelRatioHeaderValue; |
| 157 | 163 |
| 158 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; | 164 PersistentWillBeMember<MultipartImageResourceParser> m_multipartParser; |
| 159 RefPtr<blink::Image> m_image; | 165 RefPtr<blink::Image> m_image; |
| 166 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti
ngForFirstPart; |
| 160 bool m_hasDevicePixelRatioHeaderValue; | 167 bool m_hasDevicePixelRatioHeaderValue; |
| 161 }; | 168 }; |
| 162 | 169 |
| 163 DEFINE_RESOURCE_TYPE_CASTS(Image); | 170 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 164 | 171 |
| 165 } // namespace blink | 172 } // namespace blink |
| 166 | 173 |
| 167 #endif | 174 #endif |
| OLD | NEW |