Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.h

Issue 1802123002: Unify Resource loading status tracking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 // Exposed for testing 59 // Exposed for testing
60 static PassRefPtrWillBeRawPtr<ImageResource> create(const ResourceRequest& r equest, blink::Image* image) 60 static PassRefPtrWillBeRawPtr<ImageResource> create(const ResourceRequest& r equest, blink::Image* image)
61 { 61 {
62 return adoptRefWillBeNoop(new ImageResource(request, image, ResourceLoad erOptions())); 62 return adoptRefWillBeNoop(new ImageResource(request, image, ResourceLoad erOptions()));
63 } 63 }
64 64
65 ~ImageResource() override; 65 ~ImageResource() override;
66 66
67 void load(ResourceFetcher*) override;
68
69 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.
70 bool hasImage() const { return m_image.get(); } 68 bool hasImage() const { return m_image.get(); }
71 69
72 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.
73 bool willPaintBrokenImage() const; 71 bool willPaintBrokenImage() const;
74 72
75 bool usesImageContainerSize() const; 73 bool usesImageContainerSize() const;
76 bool imageHasRelativeSize() const; 74 bool imageHasRelativeSize() const;
77 // The device pixel ratio we got from the server for this image, or 1.0. 75 // The device pixel ratio we got from the server for this image, or 1.0.
78 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; } 76 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; }
(...skipping 21 matching lines...) Expand all
100 98
101 void appendData(const char*, size_t) override; 99 void appendData(const char*, size_t) override;
102 void error(Resource::Status) override; 100 void error(Resource::Status) override;
103 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override; 101 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override;
104 void finish() override; 102 void finish() override;
105 103
106 // For compatibility, images keep loading even if there are HTTP errors. 104 // For compatibility, images keep loading even if there are HTTP errors.
107 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } 105 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; }
108 106
109 bool isImage() const override { return true; } 107 bool isImage() const override { return true; }
110 bool stillNeedsLoad() const override { return !errorOccurred() && getStatus( ) == Unknown && !isLoading(); }
111 108
112 // ImageObserver 109 // ImageObserver
113 void decodedSizeChanged(const blink::Image*, int delta) override; 110 void decodedSizeChanged(const blink::Image*, int delta) override;
114 void didDraw(const blink::Image*) override; 111 void didDraw(const blink::Image*) override;
115 112
116 bool shouldPauseAnimation(const blink::Image*) override; 113 bool shouldPauseAnimation(const blink::Image*) override;
117 void animationAdvanced(const blink::Image*) override; 114 void animationAdvanced(const blink::Image*) override;
118 void changedInRect(const blink::Image*, const IntRect&) override; 115 void changedInRect(const blink::Image*, const IntRect&) override;
119 116
120 // MultipartImageResourceParser::Client 117 // MultipartImageResourceParser::Client
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 RefPtr<blink::Image> m_image; 162 RefPtr<blink::Image> m_image;
166 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti ngForFirstPart; 163 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti ngForFirstPart;
167 bool m_hasDevicePixelRatioHeaderValue; 164 bool m_hasDevicePixelRatioHeaderValue;
168 }; 165 };
169 166
170 DEFINE_RESOURCE_TYPE_CASTS(Image); 167 DEFINE_RESOURCE_TYPE_CASTS(Image);
171 168
172 } // namespace blink 169 } // namespace blink
173 170
174 #endif 171 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698