| 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 30 matching lines...) Expand all Loading... |
| 41 class Length; | 41 class Length; |
| 42 class MemoryCache; | 42 class MemoryCache; |
| 43 class SecurityOrigin; | 43 class SecurityOrigin; |
| 44 | 44 |
| 45 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver { | 45 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver { |
| 46 friend class MemoryCache; | 46 friend class MemoryCache; |
| 47 | 47 |
| 48 public: | 48 public: |
| 49 using ClientType = ImageResourceClient; | 49 using ClientType = ImageResourceClient; |
| 50 | 50 |
| 51 static PassRefPtrWillBeRawPtr<ImageResource> fetch(FetchRequest&, ResourceFe
tcher*); | 51 static RawPtr<ImageResource> fetch(FetchRequest&, ResourceFetcher*); |
| 52 | 52 |
| 53 static PassRefPtrWillBeRawPtr<ImageResource> create(blink::Image* image) | 53 static RawPtr<ImageResource> create(blink::Image* image) |
| 54 { | 54 { |
| 55 return adoptRefWillBeNoop(new ImageResource(image)); | 55 return (new ImageResource(image)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Exposed for testing | 58 // Exposed for testing |
| 59 static PassRefPtrWillBeRawPtr<ImageResource> create(const ResourceRequest& r
equest, blink::Image* image) | 59 static RawPtr<ImageResource> create(const ResourceRequest& request, blink::I
mage* image) |
| 60 { | 60 { |
| 61 return adoptRefWillBeNoop(new ImageResource(request, image)); | 61 return (new ImageResource(request, image)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 ~ImageResource() override; | 65 ~ImageResource() override; |
| 66 | 66 |
| 67 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; | 67 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; |
| 68 | 68 |
| 69 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. | 69 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. |
| 70 bool hasImage() const { return m_image.get(); } | 70 bool hasImage() const { return m_image.get(); } |
| 71 | 71 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 explicit ImageResource(blink::Image*); | 130 explicit ImageResource(blink::Image*); |
| 131 ImageResource(const ResourceRequest&, blink::Image*); | 131 ImageResource(const ResourceRequest&, blink::Image*); |
| 132 | 132 |
| 133 class ImageResourceFactory : public ResourceFactory { | 133 class ImageResourceFactory : public ResourceFactory { |
| 134 public: | 134 public: |
| 135 ImageResourceFactory() | 135 ImageResourceFactory() |
| 136 : ResourceFactory(Resource::Image) { } | 136 : ResourceFactory(Resource::Image) { } |
| 137 | 137 |
| 138 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request,
const String&) const override | 138 RawPtr<Resource> create(const ResourceRequest& request, const String&) c
onst override |
| 139 { | 139 { |
| 140 return adoptRefWillBeNoop(new ImageResource(request)); | 140 return (new ImageResource(request)); |
| 141 } | 141 } |
| 142 }; | 142 }; |
| 143 ImageResource(const ResourceRequest&); | 143 ImageResource(const ResourceRequest&); |
| 144 | 144 |
| 145 void clear(); | 145 void clear(); |
| 146 | 146 |
| 147 void setCustomAcceptHeader(); | 147 void setCustomAcceptHeader(); |
| 148 void createImage(); | 148 void createImage(); |
| 149 void updateImage(bool allDataReceived); | 149 void updateImage(bool allDataReceived); |
| 150 void clearImage(); | 150 void clearImage(); |
| 151 // If not null, changeRect is the changed part of the image. | 151 // If not null, changeRect is the changed part of the image. |
| 152 void notifyObservers(const IntRect* changeRect = nullptr); | 152 void notifyObservers(const IntRect* changeRect = nullptr); |
| 153 bool loadingMultipartContent() const; | 153 bool loadingMultipartContent() const; |
| 154 | 154 |
| 155 float m_devicePixelRatioHeaderValue; | 155 float m_devicePixelRatioHeaderValue; |
| 156 | 156 |
| 157 RefPtr<blink::Image> m_image; | 157 RefPtr<blink::Image> m_image; |
| 158 bool m_hasDevicePixelRatioHeaderValue; | 158 bool m_hasDevicePixelRatioHeaderValue; |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 DEFINE_RESOURCE_TYPE_CASTS(Image); | 161 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 162 | 162 |
| 163 } // namespace blink | 163 } // namespace blink |
| 164 | 164 |
| 165 #endif | 165 #endif |
| OLD | NEW |