| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 using ClientType = ResourceClient; | 50 using ClientType = ResourceClient; |
| 51 | 51 |
| 52 static ImageResource* fetch(FetchRequest&, ResourceFetcher*); | 52 static ImageResource* fetch(FetchRequest&, ResourceFetcher*); |
| 53 | 53 |
| 54 static ImageResource* create(blink::Image* image) | 54 static ImageResource* create(blink::Image* image) |
| 55 { | 55 { |
| 56 return new ImageResource(image, ResourceLoaderOptions()); | 56 return new ImageResource(image, ResourceLoaderOptions()); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Exposed for testing | 59 // Exposed for testing |
| 60 static ImageResource* create(const ResourceRequest& request, blink::Image* i
mage) | 60 static ImageResource* create(const ResourceRequest& request) |
| 61 { | 61 { |
| 62 return new ImageResource(request, image, ResourceLoaderOptions()); | 62 return new ImageResource(request, ResourceLoaderOptions()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ~ImageResource() override; | 65 ~ImageResource() override; |
| 66 | 66 |
| 67 blink::Image* getImage(); // Returns the nullImage() if the image is not ava
ilable yet. | 67 blink::Image* getImage(); // Returns the nullImage() if the image is not ava
ilable yet. |
| 68 bool hasImage() const { return m_image.get(); } | 68 bool hasImage() const { return m_image.get(); } |
| 69 | 69 |
| 70 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. | 70 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. |
| 71 bool willPaintBrokenImage() const; | 71 bool willPaintBrokenImage() const; |
| 72 | 72 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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*, const ResourceLoaderOptions&); | 132 explicit ImageResource(blink::Image*, const ResourceLoaderOptions&); |
| 133 ImageResource(const ResourceRequest&, blink::Image*, const ResourceLoaderOpt
ions&); | |
| 134 | 133 |
| 135 enum class MultipartParsingState : uint8_t { | 134 enum class MultipartParsingState : uint8_t { |
| 136 WaitingForFirstPart, | 135 WaitingForFirstPart, |
| 137 ParsingFirstPart, | 136 ParsingFirstPart, |
| 138 FinishedParsingFirstPart, | 137 FinishedParsingFirstPart, |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 class ImageResourceFactory : public ResourceFactory { | 140 class ImageResourceFactory : public ResourceFactory { |
| 142 public: | 141 public: |
| 143 ImageResourceFactory() | 142 ImageResourceFactory() |
| (...skipping 25 matching lines...) Expand all Loading... |
| 169 bool m_hasDevicePixelRatioHeaderValue; | 168 bool m_hasDevicePixelRatioHeaderValue; |
| 170 HashCountedSet<ImageResourceObserver*> m_observers; | 169 HashCountedSet<ImageResourceObserver*> m_observers; |
| 171 HashCountedSet<ImageResourceObserver*> m_finishedObservers; | 170 HashCountedSet<ImageResourceObserver*> m_finishedObservers; |
| 172 }; | 171 }; |
| 173 | 172 |
| 174 DEFINE_RESOURCE_TYPE_CASTS(Image); | 173 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 175 | 174 |
| 176 } // namespace blink | 175 } // namespace blink |
| 177 | 176 |
| 178 #endif | 177 #endif |
| OLD | NEW |