Chromium Code Reviews| 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 086f39bea06fe3005c338f26f240ae891fe760f6..28b7674ceb6ce9dd0c2f1f2c27df5429c56f7c1d 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" |
| @@ -48,6 +49,7 @@ |
| class ResourceHandler; |
| struct ResourceHostMsg_Request; |
| +struct ResourceMsg_RequestCompleteData; |
| namespace base { |
| class FilePath; |
| @@ -80,6 +82,7 @@ struct CommonNavigationParams; |
| struct DownloadSaveInfo; |
| struct NavigationRequestInfo; |
| struct Referrer; |
| +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,22 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
| // or experiment status. For unit tests only. |
| void EnableStaleWhileRevalidateForTesting(); |
| + // For mojo: |
|
jam
2016/05/13 00:55:05
nit: please document these new methods
yhirano
2016/05/17 12:38:49
Done.
|
| + void SetMojoLoaderAndClientrForNextLoadRequest( |
| + std::unique_ptr<mojom::URLLoader> loader, |
| + mojom::URLLoaderClientPtr client); |
| + void OnRequestResourceFromMojo(int routing_id, |
| + int request_id, |
| + mojom::URLLoaderClientPtr client, |
| + const ResourceHostMsg_Request& request_data, |
| + ResourceMessageFilter* filter); |
| + bool SendWithMojoIfPossible(const IPC::Message& message, |
| + ResourceMessageFilter* filter); |
| + void AddUninitiatedURLLoader(int child_id, |
| + std::unique_ptr<mojom::URLLoader> loader); |
| + std::unique_ptr<mojom::URLLoader> TakeUninitiatedURLLoader( |
| + mojom::URLLoader* loader); |
| + |
| private: |
| friend class LoaderIOThreadNotifier; |
| friend class ResourceDispatcherHostTest; |
| @@ -371,8 +390,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 +505,9 @@ class CONTENT_EXPORT ResourceDispatcherHostImpl |
| void BeginRequest(int request_id, |
| const ResourceHostMsg_Request& 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 +518,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 +540,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 |
| + // and send them via mojo. |
| + void OnReceivedResponseForMojo(int request_id, |
| + const ResourceResponseHead& head); |
| + void OnRequestCompleteForMojo(int request_id, |
| + const ResourceMsg_RequestCompleteData& data); |
| + |
| // Creates ResourceRequestInfoImpl for a download or page save. |
| // |download| should be true if the request is a file download. |
| ResourceRequestInfoImpl* CreateRequestInfo( |
| @@ -663,6 +695,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); |
| }; |