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) { ...@@ -350,15 +350,9 @@ void RawResource::DidDownloadToBlob(scoped_refptr<BlobDataHandle> blob) {
c->DidDownloadToBlob(this, blob); c->DidDownloadToBlob(this, blob);
} }
bool RawResource::MatchPreload(const FetchParameters& params, void RawResource::MatchPreload(const FetchParameters& params) {
base::SingleThreadTaskRunner* task_runner) {
if (!Resource::MatchPreload(params, task_runner))
return false;
matched_with_non_streaming_destination_ = matched_with_non_streaming_destination_ =
!params.GetResourceRequest().UseStreamOnResponse(); !params.GetResourceRequest().UseStreamOnResponse();
return true;
} }
static bool ShouldIgnoreHeaderForCacheReuse(AtomicString header_name) { static bool ShouldIgnoreHeaderForCacheReuse(AtomicString header_name) {
......
...@@ -128,8 +128,7 @@ class PLATFORM_EXPORT RawResource final : public Resource { ...@@ -128,8 +128,7 @@ class PLATFORM_EXPORT RawResource final : public Resource {
uint64_t total_bytes_to_be_sent) override; uint64_t total_bytes_to_be_sent) override;
void DidDownloadData(uint64_t) override; void DidDownloadData(uint64_t) override;
void DidDownloadToBlob(scoped_refptr<BlobDataHandle>) override; void DidDownloadToBlob(scoped_refptr<BlobDataHandle>) override;
bool MatchPreload(const FetchParameters&, void MatchPreload(const FetchParameters&) override;
base::SingleThreadTaskRunner*) override;
scoped_refptr<BlobDataHandle> downloaded_blob_; scoped_refptr<BlobDataHandle> downloaded_blob_;
......
...@@ -255,7 +255,7 @@ TEST_F(RawResourceTest, PreloadWithAsynchronousAddClient) { ...@@ -255,7 +255,7 @@ TEST_F(RawResourceTest, PreloadWithAsynchronousAddClient) {
FetchParameters params(std::move(request)); FetchParameters params(std::move(request));
params.MutableResourceRequest().SetUseStreamOnResponse(false); 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->AddClient(dummy_client, platform_->test_task_runner().get());
raw->ResponseBodyReceived(*body_loader, platform_->test_task_runner()); raw->ResponseBodyReceived(*body_loader, platform_->test_task_runner());
......
...@@ -1017,11 +1017,9 @@ void Resource::MarkAsPreload() { ...@@ -1017,11 +1017,9 @@ void Resource::MarkAsPreload() {
is_unused_preload_ = true; is_unused_preload_ = true;
} }
bool Resource::MatchPreload(const FetchParameters& params, void Resource::MatchPreload(const FetchParameters& params) {
base::SingleThreadTaskRunner*) {
DCHECK(is_unused_preload_); DCHECK(is_unused_preload_);
is_unused_preload_ = false; is_unused_preload_ = false;
return true;
} }
bool Resource::CanReuseRedirectChain() const { bool Resource::CanReuseRedirectChain() const {
......
...@@ -295,8 +295,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollected<Resource>, ...@@ -295,8 +295,7 @@ class PLATFORM_EXPORT Resource : public GarbageCollected<Resource>,
void MarkAsPreload(); void MarkAsPreload();
// Returns true if |this| resource is matched with the given parameters. // Returns true if |this| resource is matched with the given parameters.
virtual bool MatchPreload(const FetchParameters&, virtual void MatchPreload(const FetchParameters&);
base::SingleThreadTaskRunner*);
bool CanReuseRedirectChain() const; bool CanReuseRedirectChain() const;
bool MustRevalidateDueToCacheHeaders(bool allow_stale) const; bool MustRevalidateDueToCacheHeaders(bool allow_stale) const;
......
...@@ -1279,11 +1279,7 @@ Resource* ResourceFetcher::MatchPreload(const FetchParameters& params, ...@@ -1279,11 +1279,7 @@ Resource* ResourceFetcher::MatchPreload(const FetchParameters& params,
return nullptr; return nullptr;
} }
if (!resource->MatchPreload(params, task_runner_.get())) { resource->MatchPreload(params);
PrintPreloadWarning(resource, Resource::MatchStatus::kUnknownFailure);
return nullptr;
}
preloads_.erase(it); preloads_.erase(it);
matched_preloads_.push_back(resource); matched_preloads_.push_back(resource);
return 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