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

Unified Diff: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h

Issue 2746343002: Phase III Step 1: Make ImageResourceContent manage its own ResourceStatus (Closed)
Patch Set: Reflect comments Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h
index 78c55b1e26e90eb7f39e005f11c6bef4c2e6abd7..6351b931253d66bdb82d1dbb5af93471842d7295 100644
--- a/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResourceContent.h
@@ -93,15 +93,29 @@ class CORE_EXPORT ImageResourceContent final
DECLARE_TRACE();
- // Redirecting methods to Resource.
- const KURL& Url() const;
- bool IsAccessAllowed(SecurityOrigin*);
- const ResourceResponse& GetResponse() const;
+ // Content status and deriving predicates.
+ // https://docs.google.com/document/d/1O-fB83mrE0B_V8gzXNqHgmRLCvstTB4MMi3RnVLr8bE/edit#heading=h.6cyqmir0f30h
+ // Normal transitions:
+ // kNotStarted -> kPending -> kCached|kLoadError|kDecodeError.
+ // Additional transitions in multipart images:
+ // kCached -> kLoadError|kDecodeError.
+ // Transitions due to revalidation:
+ // kCached -> kPending.
+ // Transitions due to reload:
+ // kCached|kLoadError|kDecodeError -> kPending.
+ //
+ // ImageResourceContent::GetContentStatus() can be different from
+ // ImageResource::GetStatus(). Use ImageResourceContent::GetContentStatus().
+ ResourceStatus GetContentStatus() const;
bool IsLoaded() const;
bool IsLoading() const;
bool ErrorOccurred() const;
bool LoadFailedOrCanceled() const;
- ResourceStatus GetStatus() const;
+
+ // Redirecting methods to Resource.
+ const KURL& Url() const;
+ bool IsAccessAllowed(SecurityOrigin*);
+ const ResourceResponse& GetResponse() const;
const ResourceError& GetResourceError() const;
// For FrameSerializer.
@@ -142,9 +156,11 @@ class CORE_EXPORT ImageResourceContent final
kShouldDecodeError,
};
WARN_UNUSED_RESULT UpdateImageResult UpdateImage(PassRefPtr<SharedBuffer>,
+ ResourceStatus,
UpdateImageOption,
bool all_data_received);
+ void NotifyStartLoad();
void DestroyDecodedData();
void DoResetAnimation();
@@ -178,6 +194,7 @@ class CORE_EXPORT ImageResourceContent final
void NotifyObservers(NotifyFinishOption,
const IntRect* change_rect = nullptr);
void MarkObserverFinished(ImageResourceObserver*);
+ void UpdateToLoadedContentStatus(ResourceStatus);
class ProhibitAddRemoveObserverInScope : public AutoReset<bool> {
public:
@@ -186,6 +203,7 @@ class CORE_EXPORT ImageResourceContent final
};
Member<ImageResourceInfo> info_;
+ ResourceStatus content_status_ = ResourceStatus::kNotStarted;
RefPtr<blink::Image> image_;

Powered by Google App Engine
This is Rietveld 408576698