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

Unified Diff: content/browser/loader/mojo_async_resource_handler.cc

Issue 2496193002: Implement transfer navigation with mojo (Closed)
Patch Set: fix Created 4 years, 1 month 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/browser/loader/mojo_async_resource_handler.cc
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc
index 1288fe45136fb67142fa4ca4383a058c83eb14e9..26bc87409ea51dee46f1cc2a37171f0ed0e36202 100644
--- a/content/browser/loader/mojo_async_resource_handler.cc
+++ b/content/browser/loader/mojo_async_resource_handler.cc
@@ -111,13 +111,17 @@ MojoAsyncResourceHandler::MojoAsyncResourceHandler(
: ResourceHandler(request),
rdh_(rdh),
binding_(this, std::move(mojo_request)),
- url_loader_client_(std::move(url_loader_client)) {
+ url_loader_client_(std::move(url_loader_client)),
+ weak_factory_(this) {
DCHECK(url_loader_client_);
InitializeResourceBufferConstants();
// This unretained pointer is safe, because |binding_| is owned by |this| and
// the callback will never be called after |this| is destroyed.
binding_.set_connection_error_handler(
base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this)));
+
+ GetRequestInfo()->set_on_transfer(base::Bind(
+ &MojoAsyncResourceHandler::OnTransfer, weak_factory_.GetWeakPtr()));
}
MojoAsyncResourceHandler::~MojoAsyncResourceHandler() {
@@ -438,4 +442,14 @@ void MojoAsyncResourceHandler::ReportBadMessage(const std::string& error) {
mojo::ReportBadMessage(error);
}
+void MojoAsyncResourceHandler::OnTransfer(
+ mojom::URLLoaderAssociatedRequest mojo_request,
+ mojom::URLLoaderClientAssociatedPtr url_loader_client) {
+ binding_.Unbind();
+ binding_.Bind(std::move(mojo_request));
+ binding_.set_connection_error_handler(
+ base::Bind(&MojoAsyncResourceHandler::Cancel, base::Unretained(this)));
+ url_loader_client_ = std::move(url_loader_client);
+}
+
} // namespace content
« no previous file with comments | « content/browser/loader/mojo_async_resource_handler.h ('k') | content/browser/loader/resource_dispatcher_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698