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

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: tests 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..12e15491cb533ab181cb62d1a92895e66ea610cc 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.h
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.h
@@ -71,7 +71,14 @@ 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(
+ // This method starts reloading for the corresponding ImageResourceContent
+ // (this->getContent()) by creating a new ImageResource.
+ // The ImageResourceContent is detached from |this| and attached to the new
+ // ImageResource.
+ // |this| no longer has ImageResourceContent and shouldn't be used anymore.
+ // This method returns the new ImageResource that is used for reloading
+ // if reloading is started, or nullptr otherwise.
+ ImageResource* reloadIfLoFiOrPlaceholder(
ResourceFetcher*,
ReloadCachePolicy = ReloadCachePolicy::BypassCache);
@@ -83,10 +90,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 +138,6 @@ class CORE_EXPORT ImageResource final
void updateImageAndClearBuffer();
- void checkNotify() override;
-
void destroyDecodedDataIfPossible() override;
void destroyDecodedDataForFailedRevalidation() override;
@@ -140,11 +146,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 +168,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