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

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.h

Issue 2527353002: Phase II Step 3: Reload LoFi/placeholder images via new ImageResource
Patch Set: Rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fetch/ImageResource.h
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.h b/third_party/WebKit/Source/core/fetch/ImageResource.h
index 152777e57229f666d6fda7066f26041a661f0bf7..560c2ba4df8db16114c9ace44e84a3839aa762a1 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.h
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.h
@@ -71,7 +71,10 @@ class CORE_EXPORT ImageResource final
// If this ImageResource has the Lo-Fi response headers or is a placeholder,
// reload the full original image with the Lo-Fi state set to off and
// optionally bypassing the cache.
- void reloadIfLoFiOrPlaceholder(
+ // Returns a new ImageResource that is used for reloading if reloading is
+ // started, and the original ImageResourceContent is attached to the new
+ // ImageResource. The original ImageResource shouldn't be used anymore.
+ ImageResource* reloadIfLoFiOrPlaceholder(
ResourceFetcher*,
ReloadCachePolicy = ReloadCachePolicy::BypassCache);
@@ -83,10 +86,11 @@ class CORE_EXPORT ImageResource final
PassRefPtr<const SharedBuffer> resourceBuffer() const override;
void appendData(const char*, size_t) override;
- void error(const ResourceError&) override;
+ void error(const ResourceError&, ResourceFetcher* fetcherForReload) override;
void responseReceived(const ResourceResponse&,
std::unique_ptr<WebDataConsumerHandle>) override;
- void finish(double finishTime = 0.0) override;
+ void finish(double finishTime = 0.0,
+ ResourceFetcher* fetcherForReload = nullptr) override;
// For compatibility, images keep loading even if there are HTTP errors.
bool shouldIgnoreHTTPStatusCodeErrors() const override { return true; }
@@ -130,8 +134,6 @@ class CORE_EXPORT ImageResource final
void updateImageAndClearBuffer();
- void checkNotify() override;
-
void destroyDecodedDataIfPossible() override;
void destroyDecodedDataForFailedRevalidation() override;
@@ -140,11 +142,14 @@ class CORE_EXPORT ImageResource final
// new image creation.
void updateImage(PassRefPtr<SharedBuffer>,
ImageResourceContent::ClearImageOption,
- bool allDataReceived);
+ bool allDataReceived,
+ ResourceFetcher* fetcherForReload = nullptr);
void flushImageIfNeeded(TimerBase*);
bool willPaintBrokenImage() const;
+ void detachContent();
+
Member<ImageResourceContent> m_content;
// Indicates whether updateImage() is called for this resource, or for this
@@ -159,10 +164,6 @@ class CORE_EXPORT ImageResource final
MultipartParsingState::WaitingForFirstPart;
bool m_hasDevicePixelRatioHeaderValue;
- // Indicates if the ImageResource is currently scheduling a reload, e.g.
- // because reloadIfLoFi() was called.
- bool m_isSchedulingReload;
-
// Indicates if this ImageResource is either attempting to load a placeholder
// image, or is a (possibly broken) placeholder image.
bool m_isPlaceholder;

Powered by Google App Engine
This is Rietveld 408576698