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

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

Issue 2361263003: Blink: Throttle progressively loaded images. (Closed)
Patch Set: land: rebase Created 4 years, 1 month 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 11 matching lines...) Expand all
22 22
23 #ifndef ImageResource_h 23 #ifndef ImageResource_h
24 #define ImageResource_h 24 #define ImageResource_h
25 25
26 #include "core/CoreExport.h" 26 #include "core/CoreExport.h"
27 #include "core/fetch/MultipartImageResourceParser.h" 27 #include "core/fetch/MultipartImageResourceParser.h"
28 #include "core/fetch/Resource.h" 28 #include "core/fetch/Resource.h"
29 #include "platform/geometry/IntRect.h" 29 #include "platform/geometry/IntRect.h"
30 #include "platform/geometry/IntSizeHash.h" 30 #include "platform/geometry/IntSizeHash.h"
31 #include "platform/geometry/LayoutSize.h" 31 #include "platform/geometry/LayoutSize.h"
32 #include "platform/graphics/Image.h"
32 #include "platform/graphics/ImageObserver.h" 33 #include "platform/graphics/ImageObserver.h"
33 #include "platform/graphics/ImageOrientation.h" 34 #include "platform/graphics/ImageOrientation.h"
34 #include "wtf/HashMap.h" 35 #include "wtf/HashMap.h"
35 #include <memory> 36 #include <memory>
36 37
37 namespace blink { 38 namespace blink {
38 39
39 class FetchRequest; 40 class FetchRequest;
40 class ImageResourceObserver; 41 class ImageResourceObserver;
41 class MemoryCache; 42 class MemoryCache;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 void checkNotify() override; 195 void checkNotify() override;
195 void notifyObserversInternal(MarkFinishedOption); 196 void notifyObserversInternal(MarkFinishedOption);
196 void markObserverFinished(ImageResourceObserver*); 197 void markObserverFinished(ImageResourceObserver*);
197 198
198 void doResetAnimation(); 199 void doResetAnimation();
199 200
200 void destroyDecodedDataIfPossible() override; 201 void destroyDecodedDataIfPossible() override;
201 void destroyDecodedDataForFailedRevalidation() override; 202 void destroyDecodedDataForFailedRevalidation() override;
202 203
204 void flushImageIfNeeded(TimerBase*);
205
203 float m_devicePixelRatioHeaderValue; 206 float m_devicePixelRatioHeaderValue;
204 207
205 Member<MultipartImageResourceParser> m_multipartParser; 208 Member<MultipartImageResourceParser> m_multipartParser;
206 RefPtr<blink::Image> m_image; 209 RefPtr<blink::Image> m_image;
207 MultipartParsingState m_multipartParsingState = 210 MultipartParsingState m_multipartParsingState =
208 MultipartParsingState::WaitingForFirstPart; 211 MultipartParsingState::WaitingForFirstPart;
209 bool m_hasDevicePixelRatioHeaderValue; 212 bool m_hasDevicePixelRatioHeaderValue;
210 HashCountedSet<ImageResourceObserver*> m_observers; 213 HashCountedSet<ImageResourceObserver*> m_observers;
211 HashCountedSet<ImageResourceObserver*> m_finishedObservers; 214 HashCountedSet<ImageResourceObserver*> m_finishedObservers;
212 215
213 // Indicates if the ImageResource is currently scheduling a reload, e.g. 216 // Indicates if the ImageResource is currently scheduling a reload, e.g.
214 // because reloadIfLoFi() was called. 217 // because reloadIfLoFi() was called.
215 bool m_isSchedulingReload; 218 bool m_isSchedulingReload;
216 219
217 // Indicates if this ImageResource is either attempting to load a placeholder 220 // Indicates if this ImageResource is either attempting to load a placeholder
218 // image, or is a (possibly broken) placeholder image. 221 // image, or is a (possibly broken) placeholder image.
219 bool m_isPlaceholder; 222 bool m_isPlaceholder;
223
224 Timer<ImageResource> m_flushTimer;
225 double m_lastFlushTime = 0.;
226 Image::SizeAvailability m_sizeAvailable = Image::SizeUnavailable;
220 }; 227 };
221 228
222 DEFINE_RESOURCE_TYPE_CASTS(Image); 229 DEFINE_RESOURCE_TYPE_CASTS(Image);
223 230
224 } // namespace blink 231 } // namespace blink
225 232
226 #endif 233 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698