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

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

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/browser/loader/resource_dispatcher_host_impl.h
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index 3d960faa85ad57391bc7d6a6eed2b724bdf6ff52..025965c72ace0ceb41d16b6671df503944cf6503 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -33,6 +33,7 @@
#include "content/browser/loader/resource_scheduler.h"
#include "content/common/content_export.h"
#include "content/common/resource_request_body.h"
+#include "content/common/url_loader.mojom.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/download_item.h"
#include "content/public/browser/download_url_parameters.h"
@@ -80,6 +81,8 @@ struct DownloadSaveInfo;
struct NavigationRequestInfo;
struct Referrer;
struct ResourceRequest;
+struct ResourceRequestCompletionStatus;
+struct ResourceResponseHead;
// This class is responsible for notifying the IO thread (specifically, the
// ResourceDispatcherHostImpl) of frame events. It has an interace for callers
@@ -318,6 +321,24 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// or experiment status. For unit tests only.
void EnableStaleWhileRevalidateForTesting();
+ // These functions are used when loading with mojo.
+ // Stores a URLLoader and a URLLoaderClient in |this| object in order to use
+ // them in the next OnRequestResource call.
+ void SetMojoLoaderAndClientrForNextLoadRequest(
kinuko 2016/05/20 09:38:51 nit: ...AndClientrFor -> ...AndClientFor ? (extra
yhirano 2016/05/20 11:32:54 Done.
+ std::unique_ptr<mojom::URLLoader> loader,
+ mojom::URLLoaderClientPtr client);
+ // Sends |message| with mojo if it is possible and returns whether the message
+ // is sent.
+ bool SendWithMojoIfPossible(const IPC::Message& message,
+ ResourceMessageFilter* filter);
+ // Add an uninitiated (i.e., resource loading is not yet started) loader in
+ // order to keep it alive.
+ void AddUninitiatedURLLoader(int child_id,
+ std::unique_ptr<mojom::URLLoader> loader);
+ // Returns an uninitiated URL loader whose raw pointer equals to |loader|.
+ std::unique_ptr<mojom::URLLoader> TakeUninitiatedURLLoader(
+ mojom::URLLoader* loader);
kinuko 2016/05/20 09:38:51 ditto, these are mojo-only impl details, is it pos
yhirano 2016/05/20 11:32:54 Done, but I'm not sure whether the code is getting
+
private:
friend class LoaderIOThreadNotifier;
friend class ResourceDispatcherHostTest;
@@ -371,8 +392,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
void OnRenderFrameDeleted(const GlobalFrameRoutingId& global_routing_id);
// Helper function for regular and download requests.
- void BeginRequestInternal(std::unique_ptr<net::URLRequest> request,
- std::unique_ptr<ResourceHandler> handler);
+ void BeginRequestInternal(
+ std::unique_ptr<net::URLRequest> request,
+ std::unique_ptr<ResourceHandler> handler,
+ std::unique_ptr<mojom::URLLoader> url_loader = nullptr,
+ mojom::URLLoaderClientPtr client = nullptr);
void StartLoading(ResourceRequestInfoImpl* info,
std::unique_ptr<ResourceLoader> loader);
@@ -483,7 +507,9 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
void BeginRequest(int request_id,
const ResourceRequest& request_data,
IPC::Message* sync_result, // only valid for sync
- int route_id); // only valid for async
+ int route_id, // only valid for async
+ std::unique_ptr<mojom::URLLoader> url_loader = nullptr,
+ mojom::URLLoaderClientPtr client = nullptr);
// Creates a ResourceHandler to be used by BeginRequest() for normal resource
// loading.
@@ -494,7 +520,8 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
int route_id,
int process_type,
int child_id,
- ResourceContext* resource_context);
+ ResourceContext* resource_context,
+ bool using_mojo);
// Wraps |handler| in the standard resource handlers for normal resource
// loading and navigation requests. This adds MimeTypeResourceHandler and
@@ -515,6 +542,13 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
net::RequestPriority new_priority,
int intra_priority_value);
+ // These function are used to trap messages about to sent to the renderer
kinuko 2016/05/20 09:38:51 nit: function -> functions
yhirano 2016/05/20 11:32:54 Deleted
+ // and send them via mojo.
+ void OnReceivedResponseForMojo(int request_id,
+ const ResourceResponseHead& head);
+ void OnRequestCompleteForMojo(int request_id,
+ const ResourceRequestCompletionStatus& status);
+
// Creates ResourceRequestInfoImpl for a download or page save.
// |download| should be true if the request is a file download.
ResourceRequestInfoImpl* CreateRequestInfo(
@@ -663,6 +697,11 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl
// outlive this ResourceDispatcherHostImpl.
CertStore* cert_store_for_testing_;
+ std::unique_ptr<mojom::URLLoader> mojo_loader_for_next_load_request_;
+ mojom::URLLoaderClientPtr mojo_loader_client_for_next_load_request_;
+ std::map<mojom::URLLoader*, std::pair<int, std::unique_ptr<mojom::URLLoader>>>
+ uninitiated_url_loaders_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostImpl);
};

Powered by Google App Engine
This is Rietveld 408576698