Commit 33e69a7c authored by Dominic Farolino's avatar Dominic Farolino Committed by Commit Bot

Clean up Resource::MatchPreload and overrides

R=yhirano@chromium.org,yoavweiss@chromium.org

Bug: N/A
Change-Id: I2a7475dc78061f4b4205461e9c40975f781de8b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2154817Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#760201}
parent 20625fd7
......@@ -350,15 +350,9 @@ void RawResource::DidDownloadToBlob(scoped_refptr<BlobDataHandle> blob) {
c->DidDownloadToBlob(this, blob);
}
bool RawResource::MatchPreload(const FetchParameters& params,
base::SingleThreadTaskRunner* task_runner) {
if (!Resource::MatchPreload(params, task_runner))
return false;
void RawResource::MatchPreload(const FetchParameters& params) {
matched_with_non_streaming_destination_ =
!params.GetResourceRequest().UseStreamOnResponse();
return true;
}
static bool ShouldIgnoreHeaderForCacheReuse(AtomicString header_name) {
......
......@@ -128,8 +128,7 @@ class PLATFORM_EXPORT RawResource final : public Resource {
uint64_t total_bytes_to_be_sent) override;
void DidDownloadData(uint64_t) override;
void DidDownloadToBlob(scoped_refptr<BlobDataHandle>) override;
bool MatchPreload(const FetchParameters&,
base::SingleThreadTaskRunner*) override;
void MatchPreload(const FetchParameters&) override;
scoped_refptr<BlobDataHandle> downloaded_blob_;
......
......@@ -255,7 +255,7 @@ TEST_F(RawResourceTest, PreloadWithAsynchronousAddClient) {
FetchParameters params(std::move(request));
params.MutableResourceRequest().SetUseStreamOnResponse(false);
raw->MatchPreload(params, platform_->test_task_runner().get());
raw->MatchPreload(params);
raw->AddClient(dummy_client, platform_->test_task_runner().get());
raw->ResponseBodyReceived(*body_loader, platform_->test_task_runner());
......
......@@ -1017,11 +1017,9 @@ void Resource::MarkAsPreload() {
is_unused_preload_ = true;
}
bool Resource::MatchPreload(const FetchParameters& params,
base::SingleThreadTaskRunner*) {
void Resource::MatchPreload(const FetchParameters& params) {
DCHECK(is_unused_preload_);
is_unused_preload_ = false;
return true;
}
bool Resource::CanReuseRedirectChain() const {
......
......@@ -295,8 +295,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollected<Resource>,
void MarkAsPreload();
// Returns true if |this| resource is matched with the given parameters.
virtual bool MatchPreload(const FetchParameters&,
base::SingleThreadTaskRunner*);
virtual void MatchPreload(const FetchParameters&);
bool CanReuseRedirectChain() const;
bool MustRevalidateDueToCacheHeaders(bool allow_stale) const;
......
......@@ -1279,11 +1279,7 @@ Resource* ResourceFetcher::MatchPreload(const FetchParameters& params,
return nullptr;
}
if (!resource->MatchPreload(params, task_runner_.get())) {
PrintPreloadWarning(resource, Resource::MatchStatus::kUnknownFailure);
return nullptr;
}
resource->MatchPreload(params);
preloads_.erase(it);
matched_preloads_.push_back(resource);
return resource;
......
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