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

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

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 void addObserver(ImageResourceObserver*); 93 void addObserver(ImageResourceObserver*);
94 void removeObserver(ImageResourceObserver*); 94 void removeObserver(ImageResourceObserver*);
95 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); } 95 bool hasClientsOrObservers() const override { return Resource::hasClientsOrO bservers() || !m_observers.isEmpty() || !m_finishedObservers.isEmpty(); }
96 96
97 ResourcePriority priorityFromObservers() override; 97 ResourcePriority priorityFromObservers() override;
98 98
99 void allClientsAndObserversRemoved() override; 99 void allClientsAndObserversRemoved() override;
100 100
101 void appendData(const char*, size_t) override; 101 void appendData(const char*, size_t) override;
102 void error(Resource::Status) override; 102 void error(const ResourceError&) override;
103 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override; 103 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override;
104 void finish() override; 104 void finish(double finishTime = 0.0) override;
105 105
106 // For compatibility, images keep loading even if there are HTTP errors. 106 // For compatibility, images keep loading even if there are HTTP errors.
107 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; } 107 bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; }
108 108
109 bool isImage() const override { return true; } 109 bool isImage() const override { return true; }
110 110
111 // ImageObserver 111 // ImageObserver
112 void decodedSizeChangedTo(const blink::Image*, size_t newSize) override; 112 void decodedSizeChangedTo(const blink::Image*, size_t newSize) override;
113 void didDraw(const blink::Image*) override; 113 void didDraw(const blink::Image*) override;
114 114
(...skipping 30 matching lines...) Expand all
145 { 145 {
146 return new ImageResource(request, options); 146 return new ImageResource(request, options);
147 } 147 }
148 }; 148 };
149 ImageResource(const ResourceRequest&, const ResourceLoaderOptions&); 149 ImageResource(const ResourceRequest&, const ResourceLoaderOptions&);
150 150
151 void clear(); 151 void clear();
152 152
153 void createImage(); 153 void createImage();
154 void updateImage(bool allDataReceived); 154 void updateImage(bool allDataReceived);
155 void updateImageAndClearBuffer();
155 void clearImage(); 156 void clearImage();
156 // If not null, changeRect is the changed part of the image. 157 // If not null, changeRect is the changed part of the image.
157 void notifyObservers(const IntRect* changeRect = nullptr); 158 void notifyObservers(const IntRect* changeRect = nullptr);
158 159
159 void checkNotify() override; 160 void checkNotify() override;
160 void markClientsAndObserversFinished() override; 161 void markClientsAndObserversFinished() override;
161 162
162 float m_devicePixelRatioHeaderValue; 163 float m_devicePixelRatioHeaderValue;
163 164
164 Member<MultipartImageResourceParser> m_multipartParser; 165 Member<MultipartImageResourceParser> m_multipartParser;
165 RefPtr<blink::Image> m_image; 166 RefPtr<blink::Image> m_image;
166 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti ngForFirstPart; 167 MultipartParsingState m_multipartParsingState = MultipartParsingState::Waiti ngForFirstPart;
167 bool m_hasDevicePixelRatioHeaderValue; 168 bool m_hasDevicePixelRatioHeaderValue;
168 HashCountedSet<ImageResourceObserver*> m_observers; 169 HashCountedSet<ImageResourceObserver*> m_observers;
169 HashCountedSet<ImageResourceObserver*> m_finishedObservers; 170 HashCountedSet<ImageResourceObserver*> m_finishedObservers;
170 }; 171 };
171 172
172 DEFINE_RESOURCE_TYPE_CASTS(Image); 173 DEFINE_RESOURCE_TYPE_CASTS(Image);
173 174
174 } // namespace blink 175 } // namespace blink
175 176
176 #endif 177 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698