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

Unified Diff: content/child/web_url_loader_impl.cc

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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: content/child/web_url_loader_impl.cc
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index cd0104333542bb72b0e91ff585fa65486a0d2de7..b3e3b1818980fcfc165078e9c4e6a9ea9f82bd17 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -36,6 +36,7 @@
#include "content/common/resource_request_body_impl.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/common/ssl_status_serialization.h"
+#include "content/common/url_loader.mojom.h"
#include "content/public/child/fixed_received_data.h"
#include "content/public/child/request_peer.h"
#include "content/public/common/browser_side_navigation_policy.h"
@@ -307,7 +308,8 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
Context(WebURLLoaderImpl* loader,
ResourceDispatcher* resource_dispatcher,
- std::unique_ptr<blink::WebTaskRunner> task_runner);
+ std::unique_ptr<blink::WebTaskRunner> task_runner,
+ mojom::URLLoaderFactory* factory);
WebURLLoaderClient* client() const { return client_; }
void set_client(WebURLLoaderClient* client) { client_ = client; }
@@ -369,6 +371,8 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context> {
enum DeferState {NOT_DEFERRING, SHOULD_DEFER, DEFERRED_DATA};
DeferState defers_loading_;
int request_id_;
+
+ mojom::URLLoaderFactory* url_loader_factory_;
};
// A thin wrapper class for Context to ensure its lifetime while it is
@@ -403,14 +407,16 @@ class WebURLLoaderImpl::RequestPeerImpl : public RequestPeer {
WebURLLoaderImpl::Context::Context(
WebURLLoaderImpl* loader,
ResourceDispatcher* resource_dispatcher,
- std::unique_ptr<blink::WebTaskRunner> web_task_runner)
+ std::unique_ptr<blink::WebTaskRunner> web_task_runner,
+ mojom::URLLoaderFactory* url_loader_factory)
: loader_(loader),
client_(NULL),
resource_dispatcher_(resource_dispatcher),
web_task_runner_(std::move(web_task_runner)),
referrer_policy_(blink::WebReferrerPolicyDefault),
defers_loading_(NOT_DEFERRING),
- request_id_(-1) {}
+ request_id_(-1),
+ url_loader_factory_(url_loader_factory) {}
void WebURLLoaderImpl::Context::Cancel() {
TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Cancel", this,
@@ -569,7 +575,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
if (sync_load_response) {
DCHECK(defers_loading_ == NOT_DEFERRING);
resource_dispatcher_->StartSync(
- request_info, request_body.get(), sync_load_response);
+ request_info, request_body.get(), sync_load_response,
+ request.getLoadingIPCType(), url_loader_factory_);
return;
}
@@ -577,7 +584,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
TRACE_EVENT_FLAG_FLOW_OUT);
request_id_ = resource_dispatcher_->StartAsync(
request_info, request_body.get(),
- base::WrapUnique(new WebURLLoaderImpl::RequestPeerImpl(this)));
+ base::WrapUnique(new WebURLLoaderImpl::RequestPeerImpl(this)),
+ request.getLoadingIPCType(), url_loader_factory_);
if (defers_loading_ != NOT_DEFERRING)
resource_dispatcher_->SetDefersLoading(request_id_, true);
@@ -950,9 +958,12 @@ void WebURLLoaderImpl::RequestPeerImpl::OnCompletedRequest(
WebURLLoaderImpl::WebURLLoaderImpl(
ResourceDispatcher* resource_dispatcher,
- std::unique_ptr<blink::WebTaskRunner> web_task_runner)
- : context_(
- new Context(this, resource_dispatcher, std::move(web_task_runner))) {}
+ std::unique_ptr<blink::WebTaskRunner> web_task_runner,
+ mojom::URLLoaderFactory* url_loader_factory)
+ : context_(new Context(this,
+ resource_dispatcher,
+ std::move(web_task_runner),
+ url_loader_factory)) {}
WebURLLoaderImpl::~WebURLLoaderImpl() {
cancel();

Powered by Google App Engine
This is Rietveld 408576698