Commit 72d57270 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Remove WebURLLoaderImpl::RequestPeerImpl::discard_body_

It was introduced to discard the response body for prefetch, but the
response body (including the cached metadata) is filtered in the
browser process (see content::PrefetchURLLoader) so we don't need to
do that in content/renderer.

Bug: 860403
Change-Id: I97d1feb2bc47727004484d53afcaa27f22ebf41a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2037291
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738506}
parent 1ec2087e
...@@ -438,9 +438,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> { ...@@ -438,9 +438,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
// Context and held by ResourceDispatcher. // Context and held by ResourceDispatcher.
class WebURLLoaderImpl::RequestPeerImpl : public RequestPeer { class WebURLLoaderImpl::RequestPeerImpl : public RequestPeer {
public: public:
// If |discard_body| is false this doesn't propagate the received data explicit RequestPeerImpl(Context* context);
// to the context.
explicit RequestPeerImpl(Context* context, bool discard_body = false);
// RequestPeer methods: // RequestPeer methods:
void OnUploadProgress(uint64_t position, uint64_t size) override; void OnUploadProgress(uint64_t position, uint64_t size) override;
...@@ -459,7 +457,6 @@ class WebURLLoaderImpl::RequestPeerImpl : public RequestPeer { ...@@ -459,7 +457,6 @@ class WebURLLoaderImpl::RequestPeerImpl : public RequestPeer {
private: private:
scoped_refptr<Context> context_; scoped_refptr<Context> context_;
const bool discard_body_;
DISALLOW_COPY_AND_ASSIGN(RequestPeerImpl); DISALLOW_COPY_AND_ASSIGN(RequestPeerImpl);
}; };
...@@ -684,10 +681,7 @@ void WebURLLoaderImpl::Context::Start( ...@@ -684,10 +681,7 @@ void WebURLLoaderImpl::Context::Start(
if (download_to_network_cache_only) { if (download_to_network_cache_only) {
peer = std::make_unique<SinkPeer>(this); peer = std::make_unique<SinkPeer>(this);
} else { } else {
const bool discard_body = peer = std::make_unique<WebURLLoaderImpl::RequestPeerImpl>(this);
(resource_type == blink::mojom::ResourceType::kPrefetch);
peer =
std::make_unique<WebURLLoaderImpl::RequestPeerImpl>(this, discard_body);
} }
if (resource_type == blink::mojom::ResourceType::kPrefetch) { if (resource_type == blink::mojom::ResourceType::kPrefetch) {
...@@ -853,9 +847,8 @@ void WebURLLoaderImpl::Context::CancelBodyStreaming() { ...@@ -853,9 +847,8 @@ void WebURLLoaderImpl::Context::CancelBodyStreaming() {
// WebURLLoaderImpl::RequestPeerImpl ------------------------------------------ // WebURLLoaderImpl::RequestPeerImpl ------------------------------------------
WebURLLoaderImpl::RequestPeerImpl::RequestPeerImpl(Context* context, WebURLLoaderImpl::RequestPeerImpl::RequestPeerImpl(Context* context)
bool discard_body) : context_(context) {}
: context_(context), discard_body_(discard_body) {}
void WebURLLoaderImpl::RequestPeerImpl::OnUploadProgress(uint64_t position, void WebURLLoaderImpl::RequestPeerImpl::OnUploadProgress(uint64_t position,
uint64_t size) { uint64_t size) {
...@@ -885,8 +878,6 @@ void WebURLLoaderImpl::RequestPeerImpl::OnTransferSizeUpdated( ...@@ -885,8 +878,6 @@ void WebURLLoaderImpl::RequestPeerImpl::OnTransferSizeUpdated(
void WebURLLoaderImpl::RequestPeerImpl::OnReceivedCachedMetadata( void WebURLLoaderImpl::RequestPeerImpl::OnReceivedCachedMetadata(
mojo_base::BigBuffer data) { mojo_base::BigBuffer data) {
if (discard_body_)
return;
context_->OnReceivedCachedMetadata(std::move(data)); context_->OnReceivedCachedMetadata(std::move(data));
} }
......
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