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

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

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.h
diff --git a/content/browser/loader/mojo_async_resource_handler.h b/content/browser/loader/mojo_async_resource_handler.h
index ae47419a9565684db5a487f06858ed51221d318c..264516ae7655460b8422e3c98adfb603557deab5 100644
--- a/content/browser/loader/mojo_async_resource_handler.h
+++ b/content/browser/loader/mojo_async_resource_handler.h
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/timer/timer.h"
#include "content/browser/loader/resource_handler.h"
#include "content/common/content_export.h"
@@ -41,6 +42,10 @@ class CONTENT_EXPORT MojoAsyncResourceHandler
: public ResourceHandler,
public NON_EXPORTED_BASE(mojom::URLLoader) {
public:
+ using TransferCallback =
+ base::Callback<void(mojom::URLLoaderAssociatedRequest,
+ mojom::URLLoaderClientAssociatedPtr)>;
+
MojoAsyncResourceHandler(
net::URLRequest* request,
ResourceDispatcherHostImpl* rdh,
@@ -48,6 +53,8 @@ class CONTENT_EXPORT MojoAsyncResourceHandler
mojom::URLLoaderClientAssociatedPtr url_loader_client);
~MojoAsyncResourceHandler() override;
+ TransferCallback GetTransferCallback();
+
// ResourceHandler implementation:
bool OnRequestRedirected(const net::RedirectInfo& redirect_info,
ResourceResponse* response,
@@ -93,6 +100,9 @@ class CONTENT_EXPORT MojoAsyncResourceHandler
// This function can be overriden only for tests.
virtual void ReportBadMessage(const std::string& error);
+ void OnTransfer(mojom::URLLoaderAssociatedRequest mojo_request,
+ mojom::URLLoaderClientAssociatedPtr url_loader_client);
+
ResourceDispatcherHostImpl* rdh_;
mojo::AssociatedBinding<mojom::URLLoader> binding_;
@@ -112,6 +122,7 @@ class CONTENT_EXPORT MojoAsyncResourceHandler
size_t buffer_bytes_read_ = 0;
scoped_refptr<SharedWriter> shared_writer_;
+ base::WeakPtrFactory<MojoAsyncResourceHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandler);
};

Powered by Google App Engine
This is Rietveld 408576698