Commit ecfb0648 authored by Scott Little's avatar Scott Little Committed by Commit Bot

Bypass the cache when reloading LoFi images.

This is a partial revert of
https://chromium-review.googlesource.com/c/chromium/src/+/1166600, as a
temporary workaround to the bug listed below, which is caused by a bug
in the network stack that affects partial range cache revalidations.

This CL only bypasses the cache when reloading placeholders for LoFi,
and not when reloading placeholders for lazily loaded images, because
bypassing the cache when lazily loading images can potentially waste a
lot of network data, plus lazy image loading isn't launched yet, so
keeping the behavior as-is will make it easier to debug and fix the
underlying problem.

Bug: 892461
Change-Id: I96ed023431fc4e7e346497820da1de14940aca64
Reviewed-on: https://chromium-review.googlesource.com/c/1263565Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Scott Little <sclittle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#597219}
parent adb6bf04
...@@ -590,6 +590,11 @@ void ImageResource::ReloadIfLoFiOrPlaceholderImage( ...@@ -590,6 +590,11 @@ void ImageResource::ReloadIfLoFiOrPlaceholderImage(
DCHECK(!is_scheduling_reload_); DCHECK(!is_scheduling_reload_);
is_scheduling_reload_ = true; is_scheduling_reload_ = true;
if (GetResourceRequest().GetPreviewsState() &
(WebURLRequest::kClientLoFiOn | WebURLRequest::kServerLoFiOn)) {
SetCachePolicyBypassingCache();
}
// The reloaded image should not use any previews transformations. // The reloaded image should not use any previews transformations.
WebURLRequest::PreviewsState previews_state_for_reload = WebURLRequest::PreviewsState previews_state_for_reload =
WebURLRequest::kPreviewsNoTransform; WebURLRequest::kPreviewsNoTransform;
......
...@@ -995,6 +995,10 @@ String Resource::GetMemoryDumpName() const { ...@@ -995,6 +995,10 @@ String Resource::GetMemoryDumpName() const {
identifier_); identifier_);
} }
void Resource::SetCachePolicyBypassingCache() {
resource_request_.SetCacheMode(mojom::FetchCacheMode::kBypassCache);
}
void Resource::SetPreviewsState(WebURLRequest::PreviewsState previews_state) { void Resource::SetPreviewsState(WebURLRequest::PreviewsState previews_state) {
resource_request_.SetPreviewsState(previews_state); resource_request_.SetPreviewsState(previews_state);
} }
......
...@@ -476,6 +476,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>, ...@@ -476,6 +476,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollectedFinalized<Resource>,
return clients_; return clients_;
} }
void SetCachePolicyBypassingCache();
void SetPreviewsState(WebURLRequest::PreviewsState); void SetPreviewsState(WebURLRequest::PreviewsState);
void ClearRangeRequestHeader(); void ClearRangeRequestHeader();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment